agentic-ui-kit 0.7.1 → 0.8.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.
@@ -0,0 +1,103 @@
1
+ import { type JsonSchema, type UiComponentSpec } from "./ui-tree";
2
+ /**
3
+ * The specs by name, so a host can pick or adjust one: `{ ...uiSpecs.Card, description: "..." }`.
4
+ * Stack, Grid, Card, Heading, Text, Metric, List, Table, Badge, Progress, Checklist, Tabs, Show, Button.
5
+ */
6
+ export declare const uiSpecs: {
7
+ Stack: {
8
+ name: string;
9
+ description: string;
10
+ children: true;
11
+ props: JsonSchema;
12
+ };
13
+ Grid: {
14
+ name: string;
15
+ description: string;
16
+ children: true;
17
+ props: JsonSchema;
18
+ };
19
+ Card: {
20
+ name: string;
21
+ description: string;
22
+ children: true;
23
+ props: JsonSchema;
24
+ };
25
+ Heading: {
26
+ name: string;
27
+ description: string;
28
+ props: JsonSchema;
29
+ };
30
+ Text: {
31
+ name: string;
32
+ description: string;
33
+ props: JsonSchema;
34
+ };
35
+ Metric: {
36
+ name: string;
37
+ description: string;
38
+ props: JsonSchema;
39
+ };
40
+ List: {
41
+ name: string;
42
+ description: string;
43
+ props: JsonSchema;
44
+ };
45
+ Table: {
46
+ name: string;
47
+ description: string;
48
+ props: JsonSchema;
49
+ };
50
+ Badge: {
51
+ name: string;
52
+ description: string;
53
+ props: JsonSchema;
54
+ };
55
+ Progress: {
56
+ name: string;
57
+ description: string;
58
+ props: JsonSchema;
59
+ };
60
+ Checklist: {
61
+ name: string;
62
+ description: string;
63
+ props: JsonSchema;
64
+ };
65
+ Tabs: {
66
+ name: string;
67
+ description: string;
68
+ props: JsonSchema;
69
+ };
70
+ Show: {
71
+ name: string;
72
+ description: string;
73
+ children: true;
74
+ props: JsonSchema;
75
+ };
76
+ Button: {
77
+ name: string;
78
+ description: string;
79
+ props: JsonSchema;
80
+ };
81
+ };
82
+ /** Which components are display only and which take input or drive state. */
83
+ export declare const uiSpecGroups: {
84
+ readonly display: readonly ["Stack", "Grid", "Card", "Heading", "Text", "Metric", "List", "Table", "Badge", "Progress"];
85
+ readonly interactive: readonly ["Checklist", "Tabs", "Show", "Button"];
86
+ };
87
+ export type UiSpecName = keyof typeof uiSpecs;
88
+ /** A component name, or a group of them: "display" or "interactive". */
89
+ export type UiSpecPick = UiSpecName | keyof typeof uiSpecGroups;
90
+ export interface UiSpecSelection {
91
+ /** Only these (names or groups). Default: all. */
92
+ include?: readonly UiSpecPick[];
93
+ /** Leave these out (names or groups), after `include`. */
94
+ exclude?: readonly UiSpecPick[];
95
+ }
96
+ /**
97
+ * The specs of the components a host registers, in a fixed order. Feed it to `renderUiTool`, `showUiTool`,
98
+ * `uiMarkupGuide` and `checkUiTree` so the model is only told about, and only checked against, those:
99
+ * `uiSpecSet({ exclude: ["interactive"] })` is display only.
100
+ */
101
+ export declare function uiSpecSet({ include, exclude }?: UiSpecSelection): UiComponentSpec[];
102
+ /** All of `uiSpecs` as a list: `uiSpecSet()`. */
103
+ export declare const uiComponentSpecs: readonly UiComponentSpec[];
@@ -10,4 +10,4 @@ export interface ActivityGroupProps {
10
10
  * row per step. Each row expands on its own; tool rows render through the registered `ToolView`.
11
11
  * A group of one step skips the rows: the heading is the step's own label and the box holds its detail.
12
12
  */
13
- export declare function ActivityGroup({ parts, defaultExpanded, className }: ActivityGroupProps): import("react").JSX.Element;
13
+ export declare function ActivityGroup({ parts: all, defaultExpanded, className }: ActivityGroupProps): import("react").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import { type ToolCallPart } from "../../../core/src/index.js";
2
+ import type { ToolPromptProps, ToolView } from "./tools";
3
+ /**
4
+ * The `ask_user` prompt: the model's questions one at a time with a pager, answered by clicking or the keyboard
5
+ * (number keys, arrows, Enter; Alt+arrows reorder a rank). Submits `{ answers }` (an `AskUserResult`) after the
6
+ * last question; Skip leaves a question out, the close button or Escape declines everything.
7
+ */
8
+ export declare function AskUserPrompt({ part, onSubmit, onDecline }: ToolPromptProps): import("react").JSX.Element | null;
9
+ /** The user's answers as a card in the message: each question with its answer, "Ranked: 1. …", or "Skipped". */
10
+ export declare function AskUserAnswers({ part }: {
11
+ part: ToolCallPart;
12
+ }): import("react").JSX.Element | null;
13
+ /**
14
+ * The view of the `ask_user` tool (`askUserTool` in `agentic-ui-kit/core`): the prompt over the composer while
15
+ * the call awaits the user, then the answers card in the message. Registered in `defaultToolViews`.
16
+ */
17
+ export declare const askUserToolView: ToolView;
@@ -21,11 +21,27 @@ export interface LinkList {
21
21
  }
22
22
  /** Draws a list whose items are all links your way, e.g. a list of job links as cards. Return undefined to keep the list. */
23
23
  export type RenderLinkList = (list: LinkList) => ReactNode | undefined;
24
- export declare function MarkdownLinksProvider({ renderLink, renderLinkList, children, }: {
24
+ /** Draws an image in message markdown your way: an `<img>`, a link, or nothing (return null). Set with `MarkdownLinksProvider`. */
25
+ export type RenderImage = (image: {
26
+ src: string;
27
+ alt: string;
28
+ }) => ReactNode;
29
+ export declare function MarkdownLinksProvider({ renderLink, renderLinkList, renderImage, imageOrigins, children, }: {
25
30
  /** Draws single links. */
26
31
  renderLink?: RenderLink;
27
32
  /** Draws a bullet or numbered list in which every item is a link (and nothing else). */
28
33
  renderLinkList?: RenderLinkList;
34
+ /**
35
+ * Draws every image in a reply (markdown or raw HTML) your way. Without it, images load only from
36
+ * `imageOrigins` and otherwise show as a link. Models can be tricked into writing an image whose URL
37
+ * carries private data, and the browser would send it on render.
38
+ */
39
+ renderImage?: RenderImage;
40
+ /**
41
+ * Origins (`"https://cdn.example.com"`) whose images load as `<img>`, or `"all"` for any (not advised for
42
+ * replies built from web pages or other untrusted text). `data:image/` URLs always load. Default: none.
43
+ */
44
+ imageOrigins?: string[] | "all";
29
45
  children: ReactNode;
30
46
  }): import("react").JSX.Element;
31
47
  export interface MarkdownProps {
@@ -0,0 +1,14 @@
1
+ import type { PendingPrompt } from "../hooks/use-chat";
2
+ export interface ToolPromptCardProps {
3
+ prompt: PendingPrompt;
4
+ /** The user's answer: the call's result. `useChat().answer`. */
5
+ onAnswer: (partId: string, result: unknown) => void;
6
+ /** The user closed the prompt. `useChat().decline`. */
7
+ onDecline: (partId: string) => void;
8
+ }
9
+ /**
10
+ * Shows the `Prompt` of a pending call's tool view, above the composer (`ChatView` does this for you). Apps
11
+ * that lay out the chat themselves render it from `useChat().prompts[0]`. Renders nothing if the tool's view
12
+ * has no `Prompt`.
13
+ */
14
+ export declare function ToolPromptCard({ prompt, onAnswer, onDecline }: ToolPromptCardProps): import("react").JSX.Element | null;
@@ -33,6 +33,13 @@ export interface ToolView {
33
33
  Block?: ComponentType<{
34
34
  part: ToolCallPart;
35
35
  }>;
36
+ /**
37
+ * Makes the call a client tool the user answers: while it is "awaiting" (a client tool no page handler
38
+ * runs) the prompt shows over the composer, and what it submits becomes the call's result, sent back like
39
+ * an approval so the run continues. `useChat` (`promptTools`) and `ChatView` (`prompts`) wire this up; apps
40
+ * without them use `ToolPromptCard` and the guide "Tools the user answers". Typing in the composer instead declines the call.
41
+ */
42
+ Prompt?: ComponentType<ToolPromptProps>;
36
43
  /**
37
44
  * A card under the activity group the call sits in, while the call keeps its row: job cards, a diff with
38
45
  * Apply/Undo. Reads the part's `data` (display data the model does not see) or its result.
@@ -41,6 +48,15 @@ export interface ToolView {
41
48
  part: ToolCallPart;
42
49
  }>;
43
50
  }
51
+ /** Props of a tool view's `Prompt`. */
52
+ export interface ToolPromptProps {
53
+ /** The awaiting call; `part.input` is complete. */
54
+ part: ToolCallPart;
55
+ /** The user's answer: becomes the call's `result`. */
56
+ onSubmit: (result: unknown) => void;
57
+ /** The user closed the prompt without answering: the call ends as an error "Declined by the user". */
58
+ onDecline: () => void;
59
+ }
44
60
  export type ToolViews = Record<string, ToolView>;
45
61
  export declare function ToolViewsProvider({ tools, children }: {
46
62
  tools: ToolViews;
@@ -0,0 +1,42 @@
1
+ import { type UiSpecName, type UiSpecSelection } from "../../../core/src/index.js";
2
+ import type { ComponentType } from "react";
3
+ import { type UiComponent } from "./ui-tree";
4
+ /** How a component is drawn: gets its props (checked, state refs resolved) and its rendered children. */
5
+ type UiRender = ComponentType<any>;
6
+ /**
7
+ * The drawing of each component, by name and apart from its spec. Take one to reuse in your own
8
+ * component: `{ ...uiSpecs.Card, render: uiRenders.Card }`.
9
+ */
10
+ export declare const uiRenders: {
11
+ Stack: import("react").FunctionComponent<any>;
12
+ Grid: import("react").FunctionComponent<any>;
13
+ Card: import("react").FunctionComponent<any>;
14
+ Heading: import("react").FunctionComponent<any>;
15
+ Text: import("react").FunctionComponent<any>;
16
+ Metric: import("react").FunctionComponent<any>;
17
+ List: import("react").FunctionComponent<any>;
18
+ Table: import("react").FunctionComponent<any>;
19
+ Badge: import("react").FunctionComponent<any>;
20
+ Progress: import("react").FunctionComponent<any>;
21
+ Checklist: import("react").FunctionComponent<any>;
22
+ Tabs: import("react").FunctionComponent<any>;
23
+ Show: import("react").FunctionComponent<any>;
24
+ Button: import("react").FunctionComponent<any>;
25
+ };
26
+ export interface UiComponentSetOptions extends UiSpecSelection {
27
+ /** Draw a component with your own render (your design system's Button, say); its spec, and so what the model is told, stays. */
28
+ renders?: {
29
+ [Name in UiSpecName]?: UiRender;
30
+ };
31
+ }
32
+ /**
33
+ * The ready components for `UiComponentsProvider`, in the order of `uiComponentSpecs`. Everything by default;
34
+ * `include` and `exclude` take component names or the groups `"display"` (Stack, Grid, Card, Heading, Text,
35
+ * Metric, List, Table, Badge, Progress) and `"interactive"` (Checklist, Tabs, Show, Button). `renders` swaps the
36
+ * drawing of single components. Build the model's tool from the same picks so it only hears of what you
37
+ * registered: `uiSpecSet({ include })` in `agentic-ui-kit/core`, or strip the renders from this list.
38
+ */
39
+ export declare function uiComponentSet({ renders, ...selection }?: UiComponentSetOptions): UiComponent[];
40
+ /** The whole set: `uiComponentSet()`. */
41
+ export declare const uiComponents: readonly UiComponent[];
42
+ export {};
@@ -30,8 +30,13 @@ export declare function useUiAction(): (action: unknown) => void;
30
30
  /** Inside a registered component: the widget's state and a setter, for inputs that write to it. */
31
31
  export declare function useUiState(): [Record<string, unknown>, (key: string, value: unknown) => void];
32
32
  export interface UiTreeProps {
33
- /** Keys the widget's state in the store, usually the tool call's id. */
33
+ /** Identifies the widget, usually the tool call's id. Keys its state in the store unless `stateKey` is set. */
34
34
  id: string;
35
+ /**
36
+ * Keys the widget's state in the `persist` store instead of `id`. Pass an id that is the same while the
37
+ * message streams and after it is saved, when the part ids differ between the two (e.g. your tool activity id).
38
+ */
39
+ stateKey?: string;
35
40
  /** The tree so far; it may be cut short while it streams. */
36
41
  root: unknown;
37
42
  /** Starting values of the state, from the tree. */
@@ -39,21 +44,26 @@ export interface UiTreeProps {
39
44
  streaming?: boolean;
40
45
  }
41
46
  /** Draws a `render_ui` tree with the registered components. Unknown components and bad props render nothing. */
42
- export declare function UiTree({ id, root, state: initial, streaming }: UiTreeProps): import("react").JSX.Element | null;
47
+ export declare function UiTree({ id, stateKey, root, state: initial, streaming }: UiTreeProps): import("react").JSX.Element | null;
43
48
  /** The fence language drawn as UI here, or undefined outside a `UiComponentsProvider`. */
44
49
  export declare function useUiMarkupLanguage(): string | undefined;
45
50
  /** A ```ui block from a reply, drawn with the registered components. Safe on a block that is still streaming. */
46
- export declare function UiMarkupBlock({ id, source, streaming }: {
51
+ export declare function UiMarkupBlock({ id, stateKey, source, streaming }: {
47
52
  id: string;
53
+ stateKey?: string;
48
54
  source: string;
49
55
  streaming?: boolean;
50
56
  }): import("react").JSX.Element;
57
+ export interface UiToolViewOptions {
58
+ /** The key for the widget's `persist` state, when the call's id differs between live and saved parts. See `UiTreeProps.stateKey`. */
59
+ stateKey?: (part: ToolCallPart) => string | undefined;
60
+ }
51
61
  /**
52
62
  * A tool view that draws a call's (streaming) JSX markup with your registered components, for whatever tool
53
63
  * your harness uses; the suggested one is core's `showUiTool`. Register it under your tool's name:
54
64
  * `{ show_ui: uiMarkupToolView() }`. `read` maps your tool's input to the markup; the default reads `markup`.
55
65
  */
56
- export declare function uiMarkupToolView(read?: (input: unknown) => string | undefined): {
66
+ export declare function uiMarkupToolView(read?: (input: unknown) => string | undefined, options?: UiToolViewOptions): {
57
67
  Block: ({ part }: {
58
68
  part: ToolCallPart;
59
69
  }) => import("react").JSX.Element | null;
@@ -72,7 +82,7 @@ export declare function readTreeInput(input: unknown): {
72
82
  export declare function uiTreeToolView(read?: (input: unknown) => {
73
83
  root?: unknown;
74
84
  state?: Record<string, unknown>;
75
- }): {
85
+ }, options?: UiToolViewOptions): {
76
86
  Block: ({ part }: {
77
87
  part: ToolCallPart;
78
88
  }) => import("react").JSX.Element | null;
@@ -47,6 +47,12 @@ export interface UseChatOptions {
47
47
  * `conversationId`. Safe in React StrictMode: the run is joined once and survives the double mount.
48
48
  */
49
49
  resume?: boolean;
50
+ /**
51
+ * Names of tools the user answers through a prompt (a tool view's `Prompt`, e.g. `ask_user`): a call to one
52
+ * that ends the run "awaiting" is listed in `prompts` instead of running. Tools registered with
53
+ * `useChatTool` whose view has a `Prompt` count too. Default `["ask_user"]`.
54
+ */
55
+ promptTools?: readonly string[];
50
56
  }
51
57
  export interface SendOptions {
52
58
  model?: string;
@@ -60,6 +66,11 @@ export interface PendingApproval {
60
66
  messageId: string;
61
67
  part: ToolCallPart;
62
68
  }
69
+ /** A tool call waiting for the user to fill in its `Prompt` (a tool view's prompt over the composer). */
70
+ export interface PendingPrompt {
71
+ messageId: string;
72
+ part: ToolCallPart;
73
+ }
63
74
  export interface UseChat {
64
75
  messages: Message[];
65
76
  /** True while a reply streams or client tools run. False while waiting on an approval. */
@@ -67,6 +78,15 @@ export interface UseChat {
67
78
  /** Tool calls waiting on the user. Sending a new message declines them. */
68
79
  approvals: PendingApproval[];
69
80
  respond(partId: string, granted: boolean): void;
81
+ /**
82
+ * Tool calls waiting for the user's input through their tool view's `Prompt` (e.g. `ask_user`); the first
83
+ * shows above the composer. Sending a new message declines them.
84
+ */
85
+ prompts: PendingPrompt[];
86
+ /** Settles a prompted call with the user's answer as its result and continues the run once nothing else waits. */
87
+ answer(partId: string, result: unknown): void;
88
+ /** Settles a prompted call as declined (an error "Declined by the user" the model sees) and continues the run. */
89
+ decline(partId: string): void;
70
90
  send(text: string, options?: SendOptions): void;
71
91
  stop(): void;
72
92
  /** Drops the assistant reply and asks again from its user message. */
@@ -78,4 +98,4 @@ export declare function userMessage(text: string, parentId: string | null, attac
78
98
  * retries. With an `AgentProvider` it also runs the agent loop: client tools run in the page, approvals
79
99
  * wait for the user, then the reply continues; every finished tool call reaches its tool's `onResult`.
80
100
  */
81
- export declare function useChat({ transport, conversationId, initialMessages, onTitle, agent, maxSteps, resume }: UseChatOptions): UseChat;
101
+ export declare function useChat({ transport, conversationId, initialMessages, onTitle, agent, maxSteps, resume, promptTools }: UseChatOptions): UseChat;
@@ -28,7 +28,7 @@ export { defaultIcons, useIcons } from "./primitives/icons";
28
28
  export type { ChatIcons } from "./primitives/icons";
29
29
  export type { CodeThemes, ChatMotion } from "./primitives/appearance";
30
30
  export { useChat, userMessage } from "./hooks/use-chat";
31
- export type { Transport, SendRequest, SendOptions, UseChat, UseChatOptions, PendingApproval } from "./hooks/use-chat";
31
+ export type { Transport, SendRequest, SendOptions, UseChat, UseChatOptions, PendingApproval, PendingPrompt } from "./hooks/use-chat";
32
32
  export { sseTransport, type SseTransportOptions, type SseRequestBody } from "./hooks/sse-transport";
33
33
  export { AgentProvider, AgentRegistry, useAgentRegistry, useAgentSnapshot, useAgentTool, useAgentContext } from "./hooks/agent";
34
34
  export type { AgentTool, ToolContext, ToolSpec, JsonSchema } from "./hooks/agent";
@@ -38,15 +38,20 @@ export type { SidebarState } from "./hooks/sidebar-state";
38
38
  export { UserMessage, AssistantMessage, formatRelativeTime, messageText } from "./components/messages";
39
39
  export type { UserMessageProps, AssistantMessageProps, Feedback, MessageActions } from "./components/messages";
40
40
  export { Markdown, MarkdownLinksProvider } from "./components/markdown";
41
- export type { LinkList, MarkdownProps, RenderLink, RenderLinkList } from "./components/markdown";
41
+ export type { LinkList, MarkdownProps, RenderImage, RenderLink, RenderLinkList } from "./components/markdown";
42
42
  export { ActivityGroup } from "./components/activity-group";
43
43
  export type { ActivityGroupProps } from "./components/activity-group";
44
44
  export { ToolViewsProvider, useToolView, useToolViews, activityLabel, activityHeading, commandTool, webSearchTool, webFetchTool, memoryTool, defaultToolViews, formatDuration, useChatTool, } from "./components/tools";
45
- export type { ToolView, ToolViews, SearchResult, ChatTool } 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";
46
49
  export { WidgetFrame, WidgetHostProvider, useWidgetHost, WidgetPartView, widgetToolView, readVisualizeInput, widgetCsp, intersectAllow, openInNewTab, WIDGET_MAX_HEIGHT } from "./components/widget-frame";
47
50
  export type { WidgetFrameProps, WidgetToolInput, WidgetHost, WidgetAllow, WidgetResource } from "./components/widget-frame";
48
51
  export { UiComponentsProvider, UiTree, UiMarkupBlock, useUiMarkupLanguage, useUiAction, useUiState, htmlComponent, uiTreeToolView, uiMarkupToolView, readTreeInput } from "./components/ui-tree";
49
- export type { UiComponent, UiStateStore, UiTreeProps } 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";
50
55
  export { ApprovalCard } from "./components/approval-card";
51
56
  export type { ApprovalCardProps } from "./components/approval-card";
52
57
  export { TokenCounter, useCountUp, formatTokens } from "./components/token-counter";
@@ -55,6 +55,14 @@ export interface ChatIcons {
55
55
  warning: ReactNode;
56
56
  /** Tool approval card. */
57
57
  approval: ReactNode;
58
+ /** Previous question in the ask_user prompt's pager. */
59
+ askPrevious: ReactNode;
60
+ /** Next question in the ask_user prompt's pager. */
61
+ askPagerNext: ReactNode;
62
+ /** Continue / send answers button in the ask_user prompt. */
63
+ askNext: ReactNode;
64
+ /** Drag handle of a rank row in the ask_user prompt. */
65
+ dragHandle: ReactNode;
58
66
  /** Web link without a favicon, in search results. */
59
67
  web: ReactNode;
60
68
  /** Pin a chat. */
@@ -91,6 +91,42 @@ export interface ChatLabels {
91
91
  replyPlaceholder: string;
92
92
  /** Composer placeholder while a tool waits for approval. */
93
93
  replyDirectly: string;
94
+ /** Accessible name of the question prompt over the composer. */
95
+ askUserPrompt: string;
96
+ /** Pager in the prompt: "1 of 3". */
97
+ askUserPager: (current: number, total: number) => string;
98
+ /** Pager button to the previous question. */
99
+ askUserPrevious: string;
100
+ /** Pager button to the next question. */
101
+ askUserNext: string;
102
+ /** Button that moves on to the next unanswered question. */
103
+ askUserContinue: string;
104
+ /** Button on the last question, which sends the answers. */
105
+ askUserSubmit: string;
106
+ /** Close button of the prompt; declines the questions like replying in the composer does. */
107
+ askUserClose: string;
108
+ /** The free-text row (and its input's name) under each choice question. */
109
+ askUserSomethingElse: string;
110
+ /** Skips the current question. */
111
+ askUserSkip: string;
112
+ /** Count under a multiple-choice question: "2 selected". */
113
+ askUserSelected: (count: number) => string;
114
+ /** Hint under a rank question. */
115
+ askUserRankHint: string;
116
+ /** Accessible name of a rank row's drag handle. */
117
+ askUserReorder: (option: string) => string;
118
+ /** Spoken description of the keyboard way to reorder a rank row. */
119
+ askUserReorderKeys: string;
120
+ /** Answers card: the options a user picked in a multiple-choice question. */
121
+ askUserPicked: (options: string[]) => string;
122
+ /** Answers card: a rank answer, e.g. "Ranked: 1. Fast 2. Cheap". */
123
+ askUserRanked: (options: string[]) => string;
124
+ /** Answers card: a question the user skipped. */
125
+ askUserSkipped: string;
126
+ /** Answers card: the user closed the prompt or replied instead. */
127
+ askUserDeclined: string;
128
+ /** Accessible name of the answers card. */
129
+ askUserAnswers: string;
94
130
  /** Accessible name of the composer text box. */
95
131
  message: string;
96
132
  /** Stop button. */
@@ -1,6 +1,6 @@
1
1
  import type { Message, Part } from "../../../core/src/index.js";
2
2
  import { type CSSProperties, type ReactNode } from "react";
3
- import type { PendingApproval } from "../hooks/use-chat";
3
+ import type { PendingApproval, PendingPrompt } from "../hooks/use-chat";
4
4
  import { type ComposerProps } from "../components/composer";
5
5
  import type { Feedback, MessageActions } from "../components/messages";
6
6
  import { type WidgetHost } from "../components/widget-frame";
@@ -19,6 +19,16 @@ export interface ChatViewProps {
19
19
  /** Tool calls waiting on the user (`useChat().approvals`); the first shows above the composer. */
20
20
  approvals?: PendingApproval[];
21
21
  onApprove?: (partId: string, granted: boolean) => void;
22
+ /**
23
+ * Tool calls waiting for the user's input through their tool view's `Prompt` (`useChat().prompts`), e.g. the
24
+ * `ask_user` questions; the first shows above the composer, whose placeholder becomes "Or reply directly…".
25
+ * Needs `onAnswer`.
26
+ */
27
+ prompts?: PendingPrompt[];
28
+ /** The prompt's submitted answer, which becomes the tool call's result (`useChat().answer`). */
29
+ onAnswer?: (partId: string, result: unknown) => void;
30
+ /** The user closed the prompt (`useChat().decline`). Replying in the composer declines it too, through `onSend`. */
31
+ onDecline?: (partId: string) => void;
22
32
  onRetry?: (assistantId: string) => void;
23
33
  onEdit?: (userId: string) => void;
24
34
  onFeedback?: (assistantId: string, feedback: Feedback) => void;
@@ -62,7 +72,7 @@ export interface ChatViewProps {
62
72
  className?: string;
63
73
  }
64
74
  /** A whole chat: header, the conversation, the docked composer. An empty chat shows `emptyState`. */
65
- export declare function ChatView({ messages, busy, onSend, onStop, approvals, onApprove, onRetry, onEdit, onFeedback, onReadAloud, messageActions, renderPart, widgets, header, composer, emptyState, disclaimer, renderComposer, density, contentWidth, contentPadding, className, }: ChatViewProps): import("react").JSX.Element;
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;
66
76
  export interface EmptyStateProps {
67
77
  /** "Good evening, Alex". */
68
78
  greeting: ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-ui-kit",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "React UI kit for LLM chat and agentic apps: streaming messages, tool calls, approvals, themable with CSS variables.",
5
5
  "license": "MIT",
6
6
  "type": "module",