@braedonsaunders/appkit-ai 1.0.1 → 1.0.2

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 CHANGED
@@ -11,6 +11,11 @@ functions already enforce its `RequestContext` and RBAC policy.
11
11
  `@braedonsaunders/appkit-ai/react` supplies the streaming assistant thread, UI-message decoder,
12
12
  markdown renderer, generic tool-use cards, abort control, composer, welcome and
13
13
  disabled states. Conversation persistence and the HTTP transport stay app-owned.
14
+ Hosts can place contextual controls in the panel's fixed header with the optional
15
+ `headerActions` prop and replace the stock first-message card with a full-height
16
+ application stage through `emptyContent`. Consecutive tool calls collapse into
17
+ one quiet activity line showing the newest action and total step count; operators can expand it to
18
+ inspect every input and result without letting a long run overwhelm the thread.
14
19
 
15
20
  ```ts
16
21
  import { runAgentTurn } from '@braedonsaunders/appkit-ai'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braedonsaunders/appkit-ai",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "App-agnostic bounded agent loop and streaming assistant interface, with provider policy supplied by the host app.",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
package/react.d.ts CHANGED
@@ -16,12 +16,18 @@ export type AgentPanelLabels = {
16
16
  failed: string;
17
17
  input: string;
18
18
  result: string;
19
+ working: string;
20
+ step: string;
21
+ steps: string;
19
22
  };
20
23
  export type AgentPanelProps = {
21
24
  enabled: boolean;
22
25
  initialMessages?: AgentMessage[];
23
26
  suggestions?: string[];
24
27
  labels?: Partial<AgentPanelLabels>;
28
+ headerActions?: React.ReactNode;
29
+ /** Replaces the stock empty-state card while preserving the panel header and composer. */
30
+ emptyContent?: React.ReactNode;
25
31
  send?: (prompt: string, signal: AbortSignal) => Promise<Response>;
26
32
  maxPromptCharacters?: number;
27
33
  toolLabels?: Record<string, string>;
@@ -31,7 +37,7 @@ export type AgentPanelProps = {
31
37
  * owns persistence and the HTTP transport; appkit owns UI-message decoding,
32
38
  * cancellation, ordered part rendering, and tool cards.
33
39
  */
34
- export declare function AgentPanel({ enabled, initialMessages, suggestions, labels: labelOverrides, send, maxPromptCharacters, toolLabels, }: AgentPanelProps): React.JSX.Element;
40
+ export declare function AgentPanel({ enabled, initialMessages, suggestions, labels: labelOverrides, headerActions, emptyContent, send, maxPromptCharacters, toolLabels, }: AgentPanelProps): React.JSX.Element;
35
41
  export declare function ChatMarkdown({ children }: {
36
42
  children: string;
37
43
  }): React.JSX.Element;
package/react.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAqB9B,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;IACrC,KAAK,EAAE,OAAO,EAAE,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAgBD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,eAAe,CAAC,EAAE,YAAY,EAAE,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAClC,IAAI,CAAC,EAAE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AE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAoB,EAAE,WAAsB,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,qBAK/O"}
package/react.js CHANGED
@@ -18,23 +18,36 @@ const DEFAULT_LABELS = {
18
18
  failed: 'The assistant could not complete that turn. Please try again.',
19
19
  input: 'Input',
20
20
  result: 'Result',
21
+ working: 'Working',
22
+ step: 'step',
23
+ steps: 'steps',
21
24
  };
22
25
  /**
23
26
  * The streaming thread/composer extracted from the sibling assistant. The app
24
27
  * owns persistence and the HTTP transport; appkit owns UI-message decoding,
25
28
  * cancellation, ordered part rendering, and tool cards.
26
29
  */
27
- export function AgentPanel({ enabled, initialMessages = [], suggestions = [], labels: labelOverrides, send, maxPromptCharacters = 32_000, toolLabels, }) {
30
+ export function AgentPanel({ enabled, initialMessages = [], suggestions = [], labels: labelOverrides, headerActions, emptyContent, send, maxPromptCharacters = 32_000, toolLabels, }) {
28
31
  const labels = { ...DEFAULT_LABELS, ...labelOverrides };
29
32
  const [messages, setMessages] = React.useState(initialMessages);
30
33
  const [input, setInput] = React.useState('');
31
34
  const [streaming, setStreaming] = React.useState(false);
32
35
  const [error, setError] = React.useState(null);
33
36
  const abortRef = React.useRef(null);
34
- const bottomRef = React.useRef(null);
37
+ const messageViewportRef = React.useRef(null);
35
38
  const scrollToBottom = React.useCallback(() => {
36
- window.requestAnimationFrame(() => bottomRef.current?.scrollIntoView({ block: 'end' }));
39
+ window.requestAnimationFrame(() => {
40
+ const viewport = messageViewportRef.current;
41
+ if (viewport)
42
+ viewport.scrollTop = viewport.scrollHeight;
43
+ });
37
44
  }, []);
45
+ // An existing conversation opens where work most recently happened. Keep
46
+ // this scoped to the panel's own viewport: scrollIntoView also moves every
47
+ // scrolling ancestor and can make an otherwise app-height page jump.
48
+ React.useLayoutEffect(() => {
49
+ scrollToBottom();
50
+ }, [scrollToBottom]);
38
51
  const submit = React.useCallback(async (raw) => {
39
52
  const prompt = raw.trim();
40
53
  if (!enabled || !send || !prompt || prompt.length > maxPromptCharacters || abortRef.current)
@@ -77,7 +90,7 @@ export function AgentPanel({ enabled, initialMessages = [], suggestions = [], la
77
90
  abortRef.current = null;
78
91
  }
79
92
  }, [enabled, labels.failed, maxPromptCharacters, scrollToBottom, send]);
80
- return (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col bg-bg-subtle", children: [_jsxs("header", { className: "flex h-12 shrink-0 items-center gap-2 border-b border-border bg-surface px-4", children: [_jsx(Sparkles, { size: 16, className: "text-primary" }), _jsx("span", { className: "text-sm font-medium text-fg", children: labels.title })] }), _jsx("div", { className: "app-scroll min-h-0 flex-1 overflow-y-auto", children: _jsxs("div", { className: "mx-auto w-full max-w-3xl px-4 py-6", children: [messages.length === 0 ? _jsx(AgentWelcome, { enabled: enabled, title: enabled ? labels.welcomeTitle : labels.disabledTitle, description: enabled ? labels.welcomeDescription : labels.disabledDescription, suggestions: suggestions, onPick: (value) => void submit(value) }) : _jsx("div", { className: "space-y-6", children: messages.map((message) => message.role === 'system' ? null : _jsx(AgentMessageRow, { message: message, streaming: streaming, labels: labels, toolLabels: toolLabels }, message.id)) }), error ? _jsx("div", { role: "alert", className: "mt-5 rounded-lg border border-danger/25 bg-danger-subtle px-3 py-2 text-sm text-danger", children: error }) : null, _jsx("div", { ref: bottomRef })] }) }), enabled ? _jsx("div", { className: "shrink-0 border-t border-border bg-surface px-4 py-3", children: _jsx("div", { className: "mx-auto w-full max-w-3xl", children: _jsxs("div", { className: "flex items-end gap-2 rounded-2xl border border-border-strong bg-surface p-2 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-ring/20", children: [_jsx("textarea", { value: input, onChange: (event) => setInput(event.target.value), onKeyDown: (event) => { if (event.key === 'Enter' && !event.shiftKey) {
93
+ return (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col bg-bg-subtle", children: [_jsxs("header", { className: "flex h-12 shrink-0 items-center gap-2 border-b border-border bg-surface px-4", children: [_jsx(Sparkles, { size: 16, className: "text-primary" }), _jsx("span", { className: "text-sm font-medium text-fg", children: labels.title }), headerActions != null ? _jsx("div", { className: "ml-auto flex items-center gap-2", children: headerActions }) : null] }), _jsxs("div", { ref: messageViewportRef, className: "app-scroll min-h-0 flex-1 overflow-y-auto", children: [messages.length === 0 && emptyContent != null ? (_jsx("div", { className: "flex min-h-full flex-col", children: emptyContent })) : (_jsx("div", { className: "mx-auto w-full max-w-3xl px-4 py-6", children: messages.length === 0 ? _jsx(AgentWelcome, { enabled: enabled, title: enabled ? labels.welcomeTitle : labels.disabledTitle, description: enabled ? labels.welcomeDescription : labels.disabledDescription, suggestions: suggestions, onPick: (value) => void submit(value) }) : _jsx("div", { className: "space-y-6", children: messages.map((message) => message.role === 'system' ? null : _jsx(AgentMessageRow, { message: message, streaming: streaming, labels: labels, toolLabels: toolLabels }, message.id)) }) })), error ? _jsx("div", { role: "alert", className: "mx-auto mb-5 w-[calc(100%-2rem)] max-w-3xl rounded-lg border border-danger/25 bg-danger-subtle px-3 py-2 text-sm text-danger", children: error }) : null] }), enabled ? _jsx("div", { className: "shrink-0 border-t border-border bg-surface px-4 py-3", children: _jsx("div", { className: "mx-auto w-full max-w-3xl", children: _jsxs("div", { className: "flex items-end gap-2 rounded-2xl border border-border-strong bg-surface p-2 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-ring/20", children: [_jsx("textarea", { value: input, onChange: (event) => setInput(event.target.value), onKeyDown: (event) => { if (event.key === 'Enter' && !event.shiftKey) {
81
94
  event.preventDefault();
82
95
  void submit(input);
83
96
  } }, maxLength: maxPromptCharacters, rows: 1, placeholder: labels.placeholder, className: "max-h-40 flex-1 resize-none overflow-y-auto border-0 bg-transparent px-2 py-1.5 text-base text-fg outline-none placeholder:text-fg-subtle sm:text-sm" }), streaming ? _jsx(Button, { type: "button", variant: "outline", size: "icon", onClick: () => abortRef.current?.abort(), "aria-label": labels.stop, children: _jsx(Square, { size: 16 }) }) : _jsx(Button, { type: "button", size: "icon", onClick: () => void submit(input), disabled: !input.trim() || !send, "aria-label": labels.send, children: _jsx(Send, { size: 16 }) })] }) }) }) : null] }));
@@ -103,17 +116,59 @@ function AgentMessageRow({ message, streaming, labels, toolLabels }) {
103
116
  return _jsxs("div", { className: "flex gap-3", children: [_jsx("span", { className: "mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-primary text-primary-fg shadow-sm", children: _jsx(Sparkles, { size: 16 }) }), _jsx("div", { className: "min-w-0 flex-1 pt-0.5", children: message.parts.length === 0 && streaming ? _jsx("div", { className: "flex items-center gap-1 py-1.5", children: [0, 1, 2].map((index) => _jsx("span", { className: "size-1.5 animate-bounce rounded-full bg-fg-subtle", style: { animationDelay: `${index * 0.15}s` } }, index)) }) : _jsx(AgentMessageParts, { parts: message.parts, labels: labels, toolLabels: toolLabels }) })] });
104
117
  }
105
118
  function AgentMessageParts({ parts, labels, toolLabels }) {
106
- return _jsx("div", { className: "space-y-2.5", children: parts.map((part, index) => {
107
- if (part.type === 'text')
108
- return typeof part.text === 'string' && part.text.trim() ? _jsx(ChatMarkdown, { children: part.text }, index) : null;
109
- if (part.type === 'step-start' || part.type === 'reasoning')
110
- return null;
111
- if (part.type === 'dynamic-tool' || part.type.startsWith('tool-')) {
112
- const name = part.type === 'dynamic-tool' ? String(part.toolName ?? 'tool') : part.type.slice(5);
113
- return _jsx(AgentToolCard, { name: name, label: toolLabels?.[name], state: String(part.state ?? 'output-available'), input: part.input, output: part.output, inputLabel: labels.input, resultLabel: labels.result }, index);
114
- }
115
- return null;
116
- }) });
119
+ const rendered = [];
120
+ let tools = [];
121
+ let toolGroupStart = 0;
122
+ const flushTools = () => {
123
+ if (tools.length === 0)
124
+ return;
125
+ rendered.push(_jsx(AgentToolActivity, { parts: tools, labels: labels, toolLabels: toolLabels }, `tools-${toolGroupStart}`));
126
+ tools = [];
127
+ };
128
+ parts.forEach((part, index) => {
129
+ if (isAgentToolPart(part)) {
130
+ if (tools.length === 0)
131
+ toolGroupStart = index;
132
+ tools.push(part);
133
+ return;
134
+ }
135
+ if (part.type === 'step-start' || part.type === 'reasoning')
136
+ return;
137
+ flushTools();
138
+ if (part.type === 'text' && typeof part.text === 'string' && part.text.trim()) {
139
+ rendered.push(_jsx(ChatMarkdown, { children: part.text }, `text-${index}`));
140
+ }
141
+ });
142
+ flushTools();
143
+ return _jsx("div", { className: "space-y-2.5", children: rendered });
144
+ }
145
+ function isAgentToolPart(part) {
146
+ return part.type === 'dynamic-tool' || part.type.startsWith('tool-');
147
+ }
148
+ function agentToolName(part) {
149
+ return part.type === 'dynamic-tool' ? String(part.toolName ?? 'tool') : part.type.slice(5);
150
+ }
151
+ function agentToolRunning(part) {
152
+ const state = String(part.state ?? 'output-available');
153
+ return state === 'input-streaming' || state === 'input-available';
154
+ }
155
+ function agentToolErrored(part) {
156
+ return String(part.state) === 'output-error' || part.output?.ok === false;
157
+ }
158
+ /**
159
+ * A multi-step run stays quiet in the transcript: the newest action and total
160
+ * step count occupy one line, while the complete inputs/results remain one
161
+ * click away. Applications keep their full durable audit trail separately.
162
+ */
163
+ function AgentToolActivity({ parts, labels, toolLabels }) {
164
+ const [open, setOpen] = React.useState(false);
165
+ const latest = parts.at(-1);
166
+ const latestName = agentToolName(latest);
167
+ const running = parts.some(agentToolRunning);
168
+ const errored = parts.some(agentToolErrored);
169
+ const count = parts.length;
170
+ const status = running ? labels.working : `${count} ${count === 1 ? labels.step : labels.steps}`;
171
+ return _jsxs("div", { className: "text-sm", children: [_jsxs("button", { type: "button", onClick: () => setOpen((value) => !value), "aria-expanded": open, className: "flex h-7 max-w-full items-center gap-1.5 rounded-md px-1.5 text-left text-xs text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg", children: [_jsx("span", { className: cn('size-1.5 shrink-0 rounded-full', running ? 'animate-pulse bg-primary' : errored ? 'bg-danger' : 'bg-success') }), _jsx("span", { className: "shrink-0 font-medium", children: status }), _jsx("span", { "aria-hidden": true, className: "text-fg-subtle", children: "\u00B7" }), _jsx("span", { className: "min-w-0 truncate", children: toolLabels?.[latestName] ?? latestName.replaceAll('_', ' ') }), _jsx(ChevronRight, { size: 12, className: cn('shrink-0 text-fg-subtle transition-transform', open && 'rotate-90') })] }), open ? _jsx("div", { className: "mt-1.5 space-y-1.5 border-l border-border pl-2", children: parts.map((part, index) => { const name = agentToolName(part); return _jsx(AgentToolCard, { name: name, label: toolLabels?.[name], state: String(part.state ?? 'output-available'), input: part.input, output: part.output, inputLabel: labels.input, resultLabel: labels.result }, `${name}-${index}`); }) }) : null] });
117
172
  }
118
173
  export function ChatMarkdown({ children }) {
119
174
  return _jsx("div", { className: "space-y-2 text-sm leading-relaxed text-fg", children: _jsx(Markdown, { remarkPlugins: [remarkGfm], components: { p: ({ children: content }) => _jsx("p", { className: "whitespace-pre-wrap", children: content }), h1: ({ children: content }) => _jsx("h1", { className: "text-lg font-semibold", children: content }), h2: ({ children: content }) => _jsx("h2", { className: "text-base font-semibold", children: content }), ul: ({ children: content }) => _jsx("ul", { className: "list-disc space-y-1 pl-5", children: content }), ol: ({ children: content }) => _jsx("ol", { className: "list-decimal space-y-1 pl-5", children: content }), code: ({ children: content }) => _jsx("code", { className: "rounded bg-bg-subtle px-1 py-0.5 font-mono text-[0.85em] text-primary", children: content }), pre: ({ children: content }) => _jsx("pre", { className: "overflow-auto rounded-lg bg-overlay p-3 text-sm whitespace-pre-wrap text-white", children: content }), table: ({ children: content }) => _jsx("div", { className: "overflow-x-auto", children: _jsx("table", { className: "w-full border-collapse text-sm", children: content }) }), th: ({ children: content }) => _jsx("th", { className: "border-b border-border px-2 py-1 text-left", children: content }), td: ({ children: content }) => _jsx("td", { className: "border-b border-border-subtle px-2 py-1", children: content }), a: ({ href, children: content }) => href?.startsWith('/') ? _jsx(UiLink, { href: href, className: "font-medium text-primary underline-offset-2 hover:underline", children: content }) : _jsx("a", { href: href, target: "_blank", rel: "noreferrer", className: "font-medium text-primary underline-offset-2 hover:underline", children: content }) }, children: children }) });
package/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,IAAI,CAAA;AACX,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,MAAM,GACP,MAAM,cAAc,CAAA;AACrB,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAA;AAsB3E,MAAM,cAAc,GAAqB;IACvC,KAAK,EAAE,WAAW;IAClB,YAAY,EAAE,iBAAiB;IAC/B,kBAAkB,EAAE,qEAAqE;IACzF,aAAa,EAAE,wBAAwB;IACvC,mBAAmB,EAAE,yGAAyG;IAC9H,WAAW,EAAE,oBAAoB;IACjC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,iBAAiB;IACvB,MAAM,EAAE,+DAA+D;IACvE,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACjB,CAAA;AAYD;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,OAAO,EACP,eAAe,GAAG,EAAE,EACpB,WAAW,GAAG,EAAE,EAChB,MAAM,EAAE,cAAc,EACtB,IAAI,EACJ,mBAAmB,GAAG,MAAM,EAC5B,UAAU,GACM;I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AE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAC,eAAe,IAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAC,eAAe,IAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,IAAO,CAAC,CAAC,CAAC,IAAI,IAAO,CAAA;AAC7lC,CAAC;AAED,SAAS,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAqC;IAC1E,IAAI,IAAY,CAAA;IAChB,IAAI,CAAC;QAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAAC,CAAC;IAC5E,OAAO,0BAAK,cAAK,SAAS,EAAC,uEAAuE,YAAE,KAAK,GAAO,EAAA,cAAK,SAAS,EAAC,qGAAqG,YAAE,IAAI,GAAO,IAAM,CAAA;AACzP,CAAC","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport {\n parseJsonEventStream,\n readUIMessageStream,\n uiMessageChunkSchema,\n type UIMessageChunk,\n} from 'ai'\nimport {\n AlertCircle,\n CheckCircle2,\n ChevronRight,\n Database,\n Loader2,\n Send,\n Sparkles,\n Square,\n} from 'lucide-react'\nimport Markdown from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport { Button, EmptyState, UiLink, cn } from '@braedonsaunders/appkit-ui'\n\nexport type AgentMessage = {\n id: string\n role: 'user' | 'assistant' | 'system'\n parts: unknown[]\n}\n\nexport type AgentPanelLabels = {\n title: string\n welcomeTitle: string\n welcomeDescription: string\n disabledTitle: string\n disabledDescription: string\n placeholder: string\n send: string\n stop: string\n failed: string\n input: string\n result: string\n}\n\nconst DEFAULT_LABELS: AgentPanelLabels = {\n title: 'Assistant',\n welcomeTitle: 'How can I help?',\n welcomeDescription: 'Ask about your workspace or let the assistant use an approved tool.',\n disabledTitle: 'Connect an AI provider',\n disabledDescription: 'Connect an AI provider to enable agent conversations. No provider credentials are included in the demo.',\n placeholder: 'Ask the assistant…',\n send: 'Send',\n stop: 'Stop generating',\n failed: 'The assistant could not complete that turn. Please try again.',\n input: 'Input',\n result: 'Result',\n}\n\nexport type AgentPanelProps = {\n enabled: boolean\n initialMessages?: AgentMessage[]\n suggestions?: string[]\n labels?: Partial<AgentPanelLabels>\n send?: (prompt: string, signal: AbortSignal) => Promise<Response>\n maxPromptCharacters?: number\n toolLabels?: Record<string, string>\n}\n\n/**\n * The streaming thread/composer extracted from the sibling assistant. The app\n * owns persistence and the HTTP transport; appkit owns UI-message decoding,\n * cancellation, ordered part rendering, and tool cards.\n */\nexport function AgentPanel({\n enabled,\n initialMessages = [],\n suggestions = [],\n labels: labelOverrides,\n send,\n maxPromptCharacters = 32_000,\n toolLabels,\n}: AgentPanelProps) {\n const labels = { ...DEFAULT_LABELS, ...labelOverrides }\n const [messages, setMessages] = React.useState(initialMessages)\n const [input, setInput] = React.useState('')\n const [streaming, setStreaming] = React.useState(false)\n const [error, setError] = React.useState<string | null>(null)\n const abortRef = React.useRef<AbortController | null>(null)\n const bottomRef = React.useRef<HTMLDivElement>(null)\n\n const scrollToBottom = React.useCallback(() => {\n window.requestAnimationFrame(() => bottomRef.current?.scrollIntoView({ block: 'end' }))\n }, [])\n\n const submit = React.useCallback(async (raw: string) => {\n const prompt = raw.trim()\n if (!enabled || !send || !prompt || prompt.length > maxPromptCharacters || abortRef.current) return\n const controller = new AbortController()\n abortRef.current = controller\n const stamp = Date.now()\n setInput('')\n setError(null)\n setMessages((current) => [...current, { id: `user-${stamp}`, role: 'user', parts: [{ type: 'text', text: prompt }] }, { id: `assistant-${stamp}`, role: 'assistant', parts: [] }])\n setStreaming(true)\n scrollToBottom()\n let producedParts = false\n try {\n const response = await send(prompt, controller.signal)\n if (!response.ok || !response.body) throw new Error('agent request failed')\n const chunks = parseJsonEventStream({ stream: response.body, schema: uiMessageChunkSchema }).pipeThrough(new TransformStream<{ success: boolean; value?: UIMessageChunk }, UIMessageChunk>({ transform(part, stream) { if (part.success && part.value) stream.enqueue(part.value) } }))\n let lastParts: unknown[] = []\n for await (const message of readUIMessageStream({ stream: chunks })) {\n lastParts = message.parts as unknown[]\n producedParts = lastParts.length > 0\n setMessages((current) => replaceLastAssistantParts(current, lastParts))\n scrollToBottom()\n }\n if (lastParts.length === 0 && !controller.signal.aborted) setError(labels.failed)\n } catch (reason) {\n if ((reason as Error).name !== 'AbortError') setError(labels.failed)\n } finally {\n if (!producedParts) {\n setMessages((current) => current.filter((message) => message.id !== `assistant-${stamp}`))\n }\n setStreaming(false)\n if (abortRef.current === controller) abortRef.current = null\n }\n }, [enabled, labels.failed, maxPromptCharacters, scrollToBottom, send])\n\n return (\n <div className=\"flex min-h-0 flex-1 flex-col bg-bg-subtle\">\n <header className=\"flex h-12 shrink-0 items-center gap-2 border-b border-border bg-surface px-4\"><Sparkles size={16} className=\"text-primary\" /><span className=\"text-sm font-medium text-fg\">{labels.title}</span></header>\n <div className=\"app-scroll min-h-0 flex-1 overflow-y-auto\"><div className=\"mx-auto w-full max-w-3xl px-4 py-6\">\n {messages.length === 0 ? <AgentWelcome enabled={enabled} title={enabled ? labels.welcomeTitle : labels.disabledTitle} description={enabled ? labels.welcomeDescription : labels.disabledDescription} suggestions={suggestions} onPick={(value) => void submit(value)} /> : <div className=\"space-y-6\">{messages.map((message) => message.role === 'system' ? null : <AgentMessageRow key={message.id} message={message} streaming={streaming} labels={labels} toolLabels={toolLabels} />)}</div>}\n {error ? <div role=\"alert\" className=\"mt-5 rounded-lg border border-danger/25 bg-danger-subtle px-3 py-2 text-sm text-danger\">{error}</div> : null}<div ref={bottomRef} />\n </div></div>\n {enabled ? <div className=\"shrink-0 border-t border-border bg-surface px-4 py-3\"><div className=\"mx-auto w-full max-w-3xl\"><div className=\"flex items-end gap-2 rounded-2xl border border-border-strong bg-surface p-2 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-ring/20\"><textarea value={input} onChange={(event) => setInput(event.target.value)} onKeyDown={(event) => { if (event.key === 'Enter' && !event.shiftKey) { event.preventDefault(); void submit(input) } }} maxLength={maxPromptCharacters} rows={1} placeholder={labels.placeholder} className=\"max-h-40 flex-1 resize-none overflow-y-auto border-0 bg-transparent px-2 py-1.5 text-base text-fg outline-none placeholder:text-fg-subtle sm:text-sm\" />{streaming ? <Button type=\"button\" variant=\"outline\" size=\"icon\" onClick={() => abortRef.current?.abort()} aria-label={labels.stop}><Square size={16} /></Button> : <Button type=\"button\" size=\"icon\" onClick={() => void submit(input)} disabled={!input.trim() || !send} aria-label={labels.send}><Send size={16} /></Button>}</div></div></div> : null}\n </div>\n )\n}\n\nfunction replaceLastAssistantParts(messages: AgentMessage[], parts: unknown[]): AgentMessage[] {\n const copy = messages.slice()\n for (let index = copy.length - 1; index >= 0; index -= 1) {\n if (copy[index]?.role === 'assistant') { copy[index] = { ...copy[index]!, parts }; break }\n }\n return copy\n}\n\nfunction AgentWelcome({ enabled, title, description, suggestions, onPick }: { enabled: boolean; title: string; description: string; suggestions: string[]; onPick: (value: string) => void }) {\n return <div className=\"pt-10\"><EmptyState icon={<Sparkles />} title={title} description={description} />{enabled && suggestions.length ? <div className=\"mx-auto mt-6 grid max-w-2xl gap-2 sm:grid-cols-2\">{suggestions.map((suggestion) => <button key={suggestion} type=\"button\" onClick={() => onPick(suggestion)} className=\"rounded-xl border border-border bg-surface px-4 py-3 text-left text-sm text-fg-muted shadow-sm transition-colors hover:border-primary/40 hover:bg-primary-subtle hover:text-fg\">{suggestion}</button>)}</div> : null}</div>\n}\n\nfunction AgentMessageRow({ message, streaming, labels, toolLabels }: { message: AgentMessage; streaming: boolean; labels: AgentPanelLabels; toolLabels?: Record<string, string> }) {\n if (message.role === 'user') {\n const text = (message.parts.find((part) => (part as { type?: string }).type === 'text') as { text?: string } | undefined)?.text\n return <div className=\"flex justify-end\"><div className=\"max-w-[85%] rounded-2xl rounded-br-md bg-primary px-4 py-2 text-sm whitespace-pre-wrap text-primary-fg\">{text}</div></div>\n }\n return <div className=\"flex gap-3\"><span className=\"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-primary text-primary-fg shadow-sm\"><Sparkles size={16} /></span><div className=\"min-w-0 flex-1 pt-0.5\">{message.parts.length === 0 && streaming ? <div className=\"flex items-center gap-1 py-1.5\">{[0,1,2].map((index) => <span key={index} className=\"size-1.5 animate-bounce rounded-full bg-fg-subtle\" style={{ animationDelay: `${index * 0.15}s` }} />)}</div> : <AgentMessageParts parts={message.parts} labels={labels} toolLabels={toolLabels} />}</div></div>\n}\n\nfunction AgentMessageParts({ parts, labels, toolLabels }: { parts: unknown[]; labels: AgentPanelLabels; toolLabels?: Record<string, string> }) {\n return <div className=\"space-y-2.5\">{(parts as { type: string; [key: string]: unknown }[]).map((part, index) => {\n if (part.type === 'text') return typeof part.text === 'string' && part.text.trim() ? <ChatMarkdown key={index}>{part.text}</ChatMarkdown> : null\n if (part.type === 'step-start' || part.type === 'reasoning') return null\n if (part.type === 'dynamic-tool' || part.type.startsWith('tool-')) { const name = part.type === 'dynamic-tool' ? String(part.toolName ?? 'tool') : part.type.slice(5); return <AgentToolCard key={index} name={name} label={toolLabels?.[name]} state={String(part.state ?? 'output-available')} input={part.input} output={part.output} inputLabel={labels.input} resultLabel={labels.result} /> }\n return null\n })}</div>\n}\n\nexport function ChatMarkdown({ children }: { children: string }) {\n return <div className=\"space-y-2 text-sm leading-relaxed text-fg\"><Markdown remarkPlugins={[remarkGfm]} components={{ p: ({ children: content }) => <p className=\"whitespace-pre-wrap\">{content}</p>, h1: ({ children: content }) => <h1 className=\"text-lg font-semibold\">{content}</h1>, h2: ({ children: content }) => <h2 className=\"text-base font-semibold\">{content}</h2>, ul: ({ children: content }) => <ul className=\"list-disc space-y-1 pl-5\">{content}</ul>, ol: ({ children: content }) => <ol className=\"list-decimal space-y-1 pl-5\">{content}</ol>, code: ({ children: content }) => <code className=\"rounded bg-bg-subtle px-1 py-0.5 font-mono text-[0.85em] text-primary\">{content}</code>, pre: ({ children: content }) => <pre className=\"overflow-auto rounded-lg bg-overlay p-3 text-sm whitespace-pre-wrap text-white\">{content}</pre>, table: ({ children: content }) => <div className=\"overflow-x-auto\"><table className=\"w-full border-collapse text-sm\">{content}</table></div>, th: ({ children: content }) => <th className=\"border-b border-border px-2 py-1 text-left\">{content}</th>, td: ({ children: content }) => <td className=\"border-b border-border-subtle px-2 py-1\">{content}</td>, a: ({ href, children: content }) => href?.startsWith('/') ? <UiLink href={href} className=\"font-medium text-primary underline-offset-2 hover:underline\">{content}</UiLink> : <a href={href} target=\"_blank\" rel=\"noreferrer\" className=\"font-medium text-primary underline-offset-2 hover:underline\">{content}</a> }}>{children}</Markdown></div>\n}\n\nexport function AgentToolCard({ name, label, state, input, output, inputLabel = 'Input', resultLabel = 'Result' }: { name: string; label?: string; state: string; input?: unknown; output?: unknown; inputLabel?: string; resultLabel?: string }) {\n const [open, setOpen] = React.useState(false)\n const running = state === 'input-streaming' || state === 'input-available'\n const errored = state === 'output-error' || (output as { ok?: boolean } | undefined)?.ok === false\n return <div className=\"overflow-hidden rounded-lg border border-border bg-bg-subtle text-sm\"><button type=\"button\" onClick={() => setOpen((value) => !value)} className=\"flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors hover:bg-surface-hover\"><span className={cn('flex size-6 shrink-0 items-center justify-center rounded-md', errored ? 'bg-danger-subtle text-danger' : 'bg-primary-subtle text-primary')}><Database size={14} /></span><span className=\"min-w-0 flex-1 truncate font-medium text-fg\">{label ?? name.replaceAll('_', ' ')}</span>{running ? <Loader2 size={14} className=\"animate-spin text-fg-subtle\" /> : errored ? <AlertCircle size={14} className=\"text-danger\" /> : <CheckCircle2 size={14} className=\"text-success\" />}<ChevronRight size={14} className={cn('text-fg-subtle transition-transform', open && 'rotate-90')} /></button>{open ? <div className=\"space-y-2 border-t border-border px-3 py-2\">{input !== undefined ? <AgentToolDetail label={inputLabel} value={input} /> : null}{output !== undefined ? <AgentToolDetail label={resultLabel} value={output} /> : null}</div> : null}</div>\n}\n\nfunction AgentToolDetail({ label, value }: { label: string; value: unknown }) {\n let text: string\n try { text = JSON.stringify(value, null, 2) } catch { text = String(value) }\n return <div><div className=\"mb-1 text-[11px] font-semibold tracking-wide text-fg-subtle uppercase\">{label}</div><pre className=\"max-h-60 overflow-auto rounded-md bg-surface p-2 text-xs leading-relaxed text-fg ring-1 ring-border\">{text}</pre></div>\n}\n"]}
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,IAAI,CAAA;AACX,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,MAAM,GACP,MAAM,cAAc,CAAA;AACrB,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAA;AAyB3E,MAAM,cAAc,GAAqB;IACvC,KAAK,EAAE,WAAW;IAClB,YAAY,EAAE,iBAAiB;IAC/B,kBAAkB,EAAE,qEAAqE;IACzF,aAAa,EAAE,wBAAwB;IACvC,mBAAmB,EAAE,yGAAyG;IAC9H,WAAW,EAAE,oBAAoB;IACjC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,iBAAiB;IACvB,MAAM,EAAE,+DAA+D;IACvE,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,IAAI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,IAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,IAAO,CAAC,CAAC,CAAC,IAAI,IAAO,CAAA;AAC7lC,CAAC;AAED,SAAS,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAqC;IAC1E,IAAI,IAAY,CAAA;IAChB,IAAI,CAAC;QAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAAC,CAAC;IAC5E,OAAO,0BAAK,cAAK,SAAS,EAAC,uEAAuE,YAAE,KAAK,GAAO,EAAA,cAAK,SAAS,EAAC,qGAAqG,YAAE,IAAI,GAAO,IAAM,CAAA;AACzP,CAAC","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport {\n parseJsonEventStream,\n readUIMessageStream,\n uiMessageChunkSchema,\n type UIMessageChunk,\n} from 'ai'\nimport {\n AlertCircle,\n CheckCircle2,\n ChevronRight,\n Database,\n Loader2,\n Send,\n Sparkles,\n Square,\n} from 'lucide-react'\nimport Markdown from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport { Button, EmptyState, UiLink, cn } from '@braedonsaunders/appkit-ui'\n\nexport type AgentMessage = {\n id: string\n role: 'user' | 'assistant' | 'system'\n parts: unknown[]\n}\n\nexport type AgentPanelLabels = {\n title: string\n welcomeTitle: string\n welcomeDescription: string\n disabledTitle: string\n disabledDescription: string\n placeholder: string\n send: string\n stop: string\n failed: string\n input: string\n result: string\n working: string\n step: string\n steps: string\n}\n\nconst DEFAULT_LABELS: AgentPanelLabels = {\n title: 'Assistant',\n welcomeTitle: 'How can I help?',\n welcomeDescription: 'Ask about your workspace or let the assistant use an approved tool.',\n disabledTitle: 'Connect an AI provider',\n disabledDescription: 'Connect an AI provider to enable agent conversations. No provider credentials are included in the demo.',\n placeholder: 'Ask the assistant…',\n send: 'Send',\n stop: 'Stop generating',\n failed: 'The assistant could not complete that turn. Please try again.',\n input: 'Input',\n result: 'Result',\n working: 'Working',\n step: 'step',\n steps: 'steps',\n}\n\nexport type AgentPanelProps = {\n enabled: boolean\n initialMessages?: AgentMessage[]\n suggestions?: string[]\n labels?: Partial<AgentPanelLabels>\n headerActions?: React.ReactNode\n /** Replaces the stock empty-state card while preserving the panel header and composer. */\n emptyContent?: React.ReactNode\n send?: (prompt: string, signal: AbortSignal) => Promise<Response>\n maxPromptCharacters?: number\n toolLabels?: Record<string, string>\n}\n\n/**\n * The streaming thread/composer extracted from the sibling assistant. The app\n * owns persistence and the HTTP transport; appkit owns UI-message decoding,\n * cancellation, ordered part rendering, and tool cards.\n */\nexport function AgentPanel({\n enabled,\n initialMessages = [],\n suggestions = [],\n labels: labelOverrides,\n headerActions,\n emptyContent,\n send,\n maxPromptCharacters = 32_000,\n toolLabels,\n}: AgentPanelProps) {\n const labels = { ...DEFAULT_LABELS, ...labelOverrides }\n const [messages, setMessages] = React.useState(initialMessages)\n const [input, setInput] = React.useState('')\n const [streaming, setStreaming] = React.useState(false)\n const [error, setError] = React.useState<string | null>(null)\n const abortRef = React.useRef<AbortController | null>(null)\n const messageViewportRef = React.useRef<HTMLDivElement>(null)\n\n const scrollToBottom = React.useCallback(() => {\n window.requestAnimationFrame(() => {\n const viewport = messageViewportRef.current\n if (viewport) viewport.scrollTop = viewport.scrollHeight\n })\n }, [])\n\n // An existing conversation opens where work most recently happened. Keep\n // this scoped to the panel's own viewport: scrollIntoView also moves every\n // scrolling ancestor and can make an otherwise app-height page jump.\n React.useLayoutEffect(() => {\n scrollToBottom()\n }, [scrollToBottom])\n\n const submit = React.useCallback(async (raw: string) => {\n const prompt = raw.trim()\n if (!enabled || !send || !prompt || prompt.length > maxPromptCharacters || abortRef.current) return\n const controller = new AbortController()\n abortRef.current = controller\n const stamp = Date.now()\n setInput('')\n setError(null)\n setMessages((current) => [...current, { id: `user-${stamp}`, role: 'user', parts: [{ type: 'text', text: prompt }] }, { id: `assistant-${stamp}`, role: 'assistant', parts: [] }])\n setStreaming(true)\n scrollToBottom()\n let producedParts = false\n try {\n const response = await send(prompt, controller.signal)\n if (!response.ok || !response.body) throw new Error('agent request failed')\n const chunks = parseJsonEventStream({ stream: response.body, schema: uiMessageChunkSchema }).pipeThrough(new TransformStream<{ success: boolean; value?: UIMessageChunk }, UIMessageChunk>({ transform(part, stream) { if (part.success && part.value) stream.enqueue(part.value) } }))\n let lastParts: unknown[] = []\n for await (const message of readUIMessageStream({ stream: chunks })) {\n lastParts = message.parts as unknown[]\n producedParts = lastParts.length > 0\n setMessages((current) => replaceLastAssistantParts(current, lastParts))\n scrollToBottom()\n }\n if (lastParts.length === 0 && !controller.signal.aborted) setError(labels.failed)\n } catch (reason) {\n if ((reason as Error).name !== 'AbortError') setError(labels.failed)\n } finally {\n if (!producedParts) {\n setMessages((current) => current.filter((message) => message.id !== `assistant-${stamp}`))\n }\n setStreaming(false)\n if (abortRef.current === controller) abortRef.current = null\n }\n }, [enabled, labels.failed, maxPromptCharacters, scrollToBottom, send])\n\n return (\n <div className=\"flex min-h-0 flex-1 flex-col bg-bg-subtle\">\n <header className=\"flex h-12 shrink-0 items-center gap-2 border-b border-border bg-surface px-4\"><Sparkles size={16} className=\"text-primary\" /><span className=\"text-sm font-medium text-fg\">{labels.title}</span>{headerActions != null ? <div className=\"ml-auto flex items-center gap-2\">{headerActions}</div> : null}</header>\n <div ref={messageViewportRef} className=\"app-scroll min-h-0 flex-1 overflow-y-auto\">\n {messages.length === 0 && emptyContent != null ? (\n <div className=\"flex min-h-full flex-col\">{emptyContent}</div>\n ) : (\n <div className=\"mx-auto w-full max-w-3xl px-4 py-6\">\n {messages.length === 0 ? <AgentWelcome enabled={enabled} title={enabled ? labels.welcomeTitle : labels.disabledTitle} description={enabled ? labels.welcomeDescription : labels.disabledDescription} suggestions={suggestions} onPick={(value) => void submit(value)} /> : <div className=\"space-y-6\">{messages.map((message) => message.role === 'system' ? null : <AgentMessageRow key={message.id} message={message} streaming={streaming} labels={labels} toolLabels={toolLabels} />)}</div>}\n </div>\n )}\n {error ? <div role=\"alert\" className=\"mx-auto mb-5 w-[calc(100%-2rem)] max-w-3xl rounded-lg border border-danger/25 bg-danger-subtle px-3 py-2 text-sm text-danger\">{error}</div> : null}\n </div>\n {enabled ? <div className=\"shrink-0 border-t border-border bg-surface px-4 py-3\"><div className=\"mx-auto w-full max-w-3xl\"><div className=\"flex items-end gap-2 rounded-2xl border border-border-strong bg-surface p-2 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-ring/20\"><textarea value={input} onChange={(event) => setInput(event.target.value)} onKeyDown={(event) => { if (event.key === 'Enter' && !event.shiftKey) { event.preventDefault(); void submit(input) } }} maxLength={maxPromptCharacters} rows={1} placeholder={labels.placeholder} className=\"max-h-40 flex-1 resize-none overflow-y-auto border-0 bg-transparent px-2 py-1.5 text-base text-fg outline-none placeholder:text-fg-subtle sm:text-sm\" />{streaming ? <Button type=\"button\" variant=\"outline\" size=\"icon\" onClick={() => abortRef.current?.abort()} aria-label={labels.stop}><Square size={16} /></Button> : <Button type=\"button\" size=\"icon\" onClick={() => void submit(input)} disabled={!input.trim() || !send} aria-label={labels.send}><Send size={16} /></Button>}</div></div></div> : null}\n </div>\n )\n}\n\nfunction replaceLastAssistantParts(messages: AgentMessage[], parts: unknown[]): AgentMessage[] {\n const copy = messages.slice()\n for (let index = copy.length - 1; index >= 0; index -= 1) {\n if (copy[index]?.role === 'assistant') { copy[index] = { ...copy[index]!, parts }; break }\n }\n return copy\n}\n\nfunction AgentWelcome({ enabled, title, description, suggestions, onPick }: { enabled: boolean; title: string; description: string; suggestions: string[]; onPick: (value: string) => void }) {\n return <div className=\"pt-10\"><EmptyState icon={<Sparkles />} title={title} description={description} />{enabled && suggestions.length ? <div className=\"mx-auto mt-6 grid max-w-2xl gap-2 sm:grid-cols-2\">{suggestions.map((suggestion) => <button key={suggestion} type=\"button\" onClick={() => onPick(suggestion)} className=\"rounded-xl border border-border bg-surface px-4 py-3 text-left text-sm text-fg-muted shadow-sm transition-colors hover:border-primary/40 hover:bg-primary-subtle hover:text-fg\">{suggestion}</button>)}</div> : null}</div>\n}\n\nfunction AgentMessageRow({ message, streaming, labels, toolLabels }: { message: AgentMessage; streaming: boolean; labels: AgentPanelLabels; toolLabels?: Record<string, string> }) {\n if (message.role === 'user') {\n const text = (message.parts.find((part) => (part as { type?: string }).type === 'text') as { text?: string } | undefined)?.text\n return <div className=\"flex justify-end\"><div className=\"max-w-[85%] rounded-2xl rounded-br-md bg-primary px-4 py-2 text-sm whitespace-pre-wrap text-primary-fg\">{text}</div></div>\n }\n return <div className=\"flex gap-3\"><span className=\"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-primary text-primary-fg shadow-sm\"><Sparkles size={16} /></span><div className=\"min-w-0 flex-1 pt-0.5\">{message.parts.length === 0 && streaming ? <div className=\"flex items-center gap-1 py-1.5\">{[0,1,2].map((index) => <span key={index} className=\"size-1.5 animate-bounce rounded-full bg-fg-subtle\" style={{ animationDelay: `${index * 0.15}s` }} />)}</div> : <AgentMessageParts parts={message.parts} labels={labels} toolLabels={toolLabels} />}</div></div>\n}\n\nfunction AgentMessageParts({ parts, labels, toolLabels }: { parts: unknown[]; labels: AgentPanelLabels; toolLabels?: Record<string, string> }) {\n const rendered: React.ReactNode[] = []\n let tools: AgentToolPart[] = []\n let toolGroupStart = 0\n const flushTools = () => {\n if (tools.length === 0) return\n rendered.push(<AgentToolActivity key={`tools-${toolGroupStart}`} parts={tools} labels={labels} toolLabels={toolLabels} />)\n tools = []\n }\n ;(parts as { type: string; [key: string]: unknown }[]).forEach((part, index) => {\n if (isAgentToolPart(part)) {\n if (tools.length === 0) toolGroupStart = index\n tools.push(part)\n return\n }\n if (part.type === 'step-start' || part.type === 'reasoning') return\n flushTools()\n if (part.type === 'text' && typeof part.text === 'string' && part.text.trim()) {\n rendered.push(<ChatMarkdown key={`text-${index}`}>{part.text}</ChatMarkdown>)\n }\n })\n flushTools()\n return <div className=\"space-y-2.5\">{rendered}</div>\n}\n\ntype AgentToolPart = { type: string; toolName?: unknown; state?: unknown; input?: unknown; output?: unknown }\n\nfunction isAgentToolPart(part: { type: string }): part is AgentToolPart {\n return part.type === 'dynamic-tool' || part.type.startsWith('tool-')\n}\n\nfunction agentToolName(part: AgentToolPart): string {\n return part.type === 'dynamic-tool' ? String(part.toolName ?? 'tool') : part.type.slice(5)\n}\n\nfunction agentToolRunning(part: AgentToolPart): boolean {\n const state = String(part.state ?? 'output-available')\n return state === 'input-streaming' || state === 'input-available'\n}\n\nfunction agentToolErrored(part: AgentToolPart): boolean {\n return String(part.state) === 'output-error' || (part.output as { ok?: boolean } | undefined)?.ok === false\n}\n\n/**\n * A multi-step run stays quiet in the transcript: the newest action and total\n * step count occupy one line, while the complete inputs/results remain one\n * click away. Applications keep their full durable audit trail separately.\n */\nfunction AgentToolActivity({ parts, labels, toolLabels }: { parts: AgentToolPart[]; labels: AgentPanelLabels; toolLabels?: Record<string, string> }) {\n const [open, setOpen] = React.useState(false)\n const latest = parts.at(-1)!\n const latestName = agentToolName(latest)\n const running = parts.some(agentToolRunning)\n const errored = parts.some(agentToolErrored)\n const count = parts.length\n const status = running ? labels.working : `${count} ${count === 1 ? labels.step : labels.steps}`\n return <div className=\"text-sm\"><button type=\"button\" onClick={() => setOpen((value) => !value)} aria-expanded={open} className=\"flex h-7 max-w-full items-center gap-1.5 rounded-md px-1.5 text-left text-xs text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg\"><span className={cn('size-1.5 shrink-0 rounded-full', running ? 'animate-pulse bg-primary' : errored ? 'bg-danger' : 'bg-success')} /><span className=\"shrink-0 font-medium\">{status}</span><span aria-hidden className=\"text-fg-subtle\">·</span><span className=\"min-w-0 truncate\">{toolLabels?.[latestName] ?? latestName.replaceAll('_', ' ')}</span><ChevronRight size={12} className={cn('shrink-0 text-fg-subtle transition-transform', open && 'rotate-90')} /></button>{open ? <div className=\"mt-1.5 space-y-1.5 border-l border-border pl-2\">{parts.map((part, index) => { const name = agentToolName(part); return <AgentToolCard key={`${name}-${index}`} name={name} label={toolLabels?.[name]} state={String(part.state ?? 'output-available')} input={part.input} output={part.output} inputLabel={labels.input} resultLabel={labels.result} /> })}</div> : null}</div>\n}\n\nexport function ChatMarkdown({ children }: { children: string }) {\n return <div className=\"space-y-2 text-sm leading-relaxed text-fg\"><Markdown remarkPlugins={[remarkGfm]} components={{ p: ({ children: content }) => <p className=\"whitespace-pre-wrap\">{content}</p>, h1: ({ children: content }) => <h1 className=\"text-lg font-semibold\">{content}</h1>, h2: ({ children: content }) => <h2 className=\"text-base font-semibold\">{content}</h2>, ul: ({ children: content }) => <ul className=\"list-disc space-y-1 pl-5\">{content}</ul>, ol: ({ children: content }) => <ol className=\"list-decimal space-y-1 pl-5\">{content}</ol>, code: ({ children: content }) => <code className=\"rounded bg-bg-subtle px-1 py-0.5 font-mono text-[0.85em] text-primary\">{content}</code>, pre: ({ children: content }) => <pre className=\"overflow-auto rounded-lg bg-overlay p-3 text-sm whitespace-pre-wrap text-white\">{content}</pre>, table: ({ children: content }) => <div className=\"overflow-x-auto\"><table className=\"w-full border-collapse text-sm\">{content}</table></div>, th: ({ children: content }) => <th className=\"border-b border-border px-2 py-1 text-left\">{content}</th>, td: ({ children: content }) => <td className=\"border-b border-border-subtle px-2 py-1\">{content}</td>, a: ({ href, children: content }) => href?.startsWith('/') ? <UiLink href={href} className=\"font-medium text-primary underline-offset-2 hover:underline\">{content}</UiLink> : <a href={href} target=\"_blank\" rel=\"noreferrer\" className=\"font-medium text-primary underline-offset-2 hover:underline\">{content}</a> }}>{children}</Markdown></div>\n}\n\nexport function AgentToolCard({ name, label, state, input, output, inputLabel = 'Input', resultLabel = 'Result' }: { name: string; label?: string; state: string; input?: unknown; output?: unknown; inputLabel?: string; resultLabel?: string }) {\n const [open, setOpen] = React.useState(false)\n const running = state === 'input-streaming' || state === 'input-available'\n const errored = state === 'output-error' || (output as { ok?: boolean } | undefined)?.ok === false\n return <div className=\"overflow-hidden rounded-lg border border-border bg-bg-subtle text-sm\"><button type=\"button\" onClick={() => setOpen((value) => !value)} className=\"flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors hover:bg-surface-hover\"><span className={cn('flex size-6 shrink-0 items-center justify-center rounded-md', errored ? 'bg-danger-subtle text-danger' : 'bg-primary-subtle text-primary')}><Database size={14} /></span><span className=\"min-w-0 flex-1 truncate font-medium text-fg\">{label ?? name.replaceAll('_', ' ')}</span>{running ? <Loader2 size={14} className=\"animate-spin text-fg-subtle\" /> : errored ? <AlertCircle size={14} className=\"text-danger\" /> : <CheckCircle2 size={14} className=\"text-success\" />}<ChevronRight size={14} className={cn('text-fg-subtle transition-transform', open && 'rotate-90')} /></button>{open ? <div className=\"space-y-2 border-t border-border px-3 py-2\">{input !== undefined ? <AgentToolDetail label={inputLabel} value={input} /> : null}{output !== undefined ? <AgentToolDetail label={resultLabel} value={output} /> : null}</div> : null}</div>\n}\n\nfunction AgentToolDetail({ label, value }: { label: string; value: unknown }) {\n let text: string\n try { text = JSON.stringify(value, null, 2) } catch { text = String(value) }\n return <div><div className=\"mb-1 text-[11px] font-semibold tracking-wide text-fg-subtle uppercase\">{label}</div><pre className=\"max-h-60 overflow-auto rounded-md bg-surface p-2 text-xs leading-relaxed text-fg ring-1 ring-border\">{text}</pre></div>\n}\n"]}