@agents24/chat-react 0.5.34 → 0.5.36

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/dist/ui/index.js CHANGED
@@ -1378,7 +1378,7 @@ function QueueRow({ message, onRemove, onEdit }) {
1378
1378
  }
1379
1379
  function AgentChatQueue({ pending, queue, onRemove, onEdit, onResume, className }) {
1380
1380
  const [resumeError, setResumeError] = React7.useState(null);
1381
- if (!pending.length && !queue?.paused) return null;
1381
+ if (!pending.length) return null;
1382
1382
  return /* @__PURE__ */ jsxs3("section", { "aria-label": "Message queue", className: cn("a24-queue relative z-0 -mb-2 overflow-visible rounded-t-xl border border-b-0 border-border/50 bg-background pb-2", className), children: [
1383
1383
  queue?.paused ? /* @__PURE__ */ jsxs3("div", { className: "flex min-h-9 items-center justify-between gap-2 px-3 text-xs text-muted-foreground", children: [
1384
1384
  /* @__PURE__ */ jsx5("span", { children: "Queue paused" }),
@@ -1625,11 +1625,11 @@ function AgentChatDefaultActions({
1625
1625
  }
1626
1626
 
1627
1627
  // src/ui/agent-chat-message.tsx
1628
- import * as React13 from "react";
1628
+ import * as React16 from "react";
1629
1629
  import { ChevronDown as ChevronDown3, ChevronUp } from "lucide-react";
1630
1630
 
1631
1631
  // src/ui/agent-response-timeline.tsx
1632
- import * as React12 from "react";
1632
+ import * as React15 from "react";
1633
1633
 
1634
1634
  // src/ui/ask-user-interaction.tsx
1635
1635
  import * as React9 from "react";
@@ -1999,7 +1999,7 @@ function AgentChatContextCompressionRow({
1999
1999
  }
2000
2000
 
2001
2001
  // src/ui/message-response.tsx
2002
- import * as React10 from "react";
2002
+ import * as React13 from "react";
2003
2003
  import { defaultRehypePlugins, Streamdown } from "streamdown";
2004
2004
 
2005
2005
  // src/active-content.ts
@@ -2023,18 +2023,494 @@ function safeChatMarkdownHref(value) {
2023
2023
  }
2024
2024
  }
2025
2025
 
2026
+ // src/ui/message-code.tsx
2027
+ import * as React12 from "react";
2028
+ import { FileCode2Icon } from "lucide-react";
2029
+
2030
+ // src/ui/code-block.tsx
2031
+ import * as React10 from "react";
2032
+ import { cva as cva2 } from "class-variance-authority";
2033
+ import { CheckIcon, CopyIcon, DownloadIcon, WrapTextIcon } from "lucide-react";
2034
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
2035
+ var codeBlockVariants = cva2(
2036
+ "a24-code-block",
2037
+ {
2038
+ variants: {
2039
+ variant: {
2040
+ default: "a24-code-block--default",
2041
+ destructive: "a24-code-block--destructive"
2042
+ }
2043
+ },
2044
+ defaultVariants: {
2045
+ variant: "default"
2046
+ }
2047
+ }
2048
+ );
2049
+ function CodeBlock({
2050
+ className,
2051
+ variant = "default",
2052
+ size = "default",
2053
+ ...props
2054
+ }) {
2055
+ return /* @__PURE__ */ jsx9(
2056
+ "div",
2057
+ {
2058
+ "data-slot": "code-block",
2059
+ "data-variant": variant,
2060
+ "data-size": size,
2061
+ className: cn(codeBlockVariants({ variant }), className),
2062
+ ...props
2063
+ }
2064
+ );
2065
+ }
2066
+ function CodeBlockHeader({ className, ...props }) {
2067
+ return /* @__PURE__ */ jsx9(
2068
+ "div",
2069
+ {
2070
+ "data-slot": "code-block-header",
2071
+ className: cn(
2072
+ "a24-code-block__header",
2073
+ className
2074
+ ),
2075
+ ...props
2076
+ }
2077
+ );
2078
+ }
2079
+ function CodeBlockTitle({ className, ...props }) {
2080
+ return /* @__PURE__ */ jsx9(
2081
+ "div",
2082
+ {
2083
+ "data-slot": "code-block-title",
2084
+ className: cn(
2085
+ "a24-code-block__title",
2086
+ className
2087
+ ),
2088
+ ...props
2089
+ }
2090
+ );
2091
+ }
2092
+ function CodeBlockActions({
2093
+ className,
2094
+ ...props
2095
+ }) {
2096
+ return /* @__PURE__ */ jsx9(
2097
+ "div",
2098
+ {
2099
+ "data-slot": "code-block-actions",
2100
+ className: cn(
2101
+ "a24-code-block__actions",
2102
+ className
2103
+ ),
2104
+ ...props
2105
+ }
2106
+ );
2107
+ }
2108
+ function CodeBlockCopyButton({
2109
+ value,
2110
+ className,
2111
+ onClick,
2112
+ ...props
2113
+ }) {
2114
+ const [copied, setCopied] = React10.useState(false);
2115
+ React10.useEffect(() => {
2116
+ if (!copied) {
2117
+ return;
2118
+ }
2119
+ const timeout = setTimeout(() => setCopied(false), 2e3);
2120
+ return () => clearTimeout(timeout);
2121
+ }, [copied]);
2122
+ return /* @__PURE__ */ jsxs6(Fragment2, { children: [
2123
+ /* @__PURE__ */ jsx9(
2124
+ "button",
2125
+ {
2126
+ type: "button",
2127
+ "data-slot": "code-block-copy-button",
2128
+ "data-copied": copied || void 0,
2129
+ "aria-label": copied ? "Copied" : "Copy",
2130
+ title: copied ? "Copied" : "Copy code",
2131
+ className: cn("a24-code-block__action", className),
2132
+ onClick: (event) => {
2133
+ onClick?.(event);
2134
+ if (event.defaultPrevented || !navigator.clipboard) return;
2135
+ navigator.clipboard.writeText(value).then(() => setCopied(true)).catch(() => {
2136
+ });
2137
+ },
2138
+ ...props,
2139
+ children: copied ? /* @__PURE__ */ jsx9(CheckIcon, { size: 12, strokeWidth: 1.5 }) : /* @__PURE__ */ jsx9(CopyIcon, { size: 12, strokeWidth: 1.5 })
2140
+ }
2141
+ ),
2142
+ /* @__PURE__ */ jsx9("span", { "aria-live": "polite", className: "a24-code-block__announcement", children: copied ? "Copied" : "" })
2143
+ ] });
2144
+ }
2145
+ function CodeBlockWrapButton({
2146
+ wrap,
2147
+ onWrapChange,
2148
+ className,
2149
+ onClick,
2150
+ ...props
2151
+ }) {
2152
+ return /* @__PURE__ */ jsx9(
2153
+ "button",
2154
+ {
2155
+ type: "button",
2156
+ "data-slot": "code-block-wrap-button",
2157
+ "aria-label": "Wrap lines",
2158
+ "aria-pressed": wrap,
2159
+ title: wrap ? "Unwrap lines" : "Wrap lines",
2160
+ className: cn("a24-code-block__action", className),
2161
+ onClick: (event) => {
2162
+ onClick?.(event);
2163
+ if (!event.defaultPrevented) onWrapChange(!wrap);
2164
+ },
2165
+ ...props,
2166
+ children: /* @__PURE__ */ jsx9(WrapTextIcon, { size: 12, strokeWidth: 1.5 })
2167
+ }
2168
+ );
2169
+ }
2170
+ function CodeBlockDownloadButton({
2171
+ value,
2172
+ filename = "code.txt",
2173
+ className,
2174
+ onClick,
2175
+ ...props
2176
+ }) {
2177
+ return /* @__PURE__ */ jsx9(
2178
+ "button",
2179
+ {
2180
+ type: "button",
2181
+ "data-slot": "code-block-download-button",
2182
+ "aria-label": "Download code",
2183
+ title: "Download code",
2184
+ className: cn("a24-code-block__action", className),
2185
+ onClick: (event) => {
2186
+ onClick?.(event);
2187
+ if (event.defaultPrevented) return;
2188
+ const url = URL.createObjectURL(new Blob([value], { type: "text/plain;charset=utf-8" }));
2189
+ const link = document.createElement("a");
2190
+ link.href = url;
2191
+ link.download = filename;
2192
+ document.body.append(link);
2193
+ link.click();
2194
+ link.remove();
2195
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
2196
+ },
2197
+ ...props,
2198
+ children: /* @__PURE__ */ jsx9(DownloadIcon, { size: 12, strokeWidth: 1.5 })
2199
+ }
2200
+ );
2201
+ }
2202
+ function CodeBlockContent({
2203
+ className,
2204
+ children,
2205
+ style,
2206
+ wrap = false,
2207
+ lineNumbers = false,
2208
+ startLine = 1,
2209
+ ...props
2210
+ }) {
2211
+ return /* @__PURE__ */ jsx9(
2212
+ "pre",
2213
+ {
2214
+ "data-slot": "code-block-content",
2215
+ "data-wrap": wrap || void 0,
2216
+ "data-numbered": lineNumbers || void 0,
2217
+ dir: "ltr",
2218
+ tabIndex: 0,
2219
+ style: { counterReset: `line ${startLine - 1}`, ...style },
2220
+ className: cn(
2221
+ "a24-code-block__content",
2222
+ className
2223
+ ),
2224
+ ...props,
2225
+ children: /* @__PURE__ */ jsx9(
2226
+ "code",
2227
+ {
2228
+ "data-slot": "code-block-code",
2229
+ className: "a24-code-block__code",
2230
+ children: lineNumbers && typeof children === "string" ? children.replace(/\n$/, "").split("\n").map((line, index) => /* @__PURE__ */ jsx9(CodeBlockLine, { children: line }, index)) : children
2231
+ }
2232
+ )
2233
+ }
2234
+ );
2235
+ }
2236
+ var codeBlockLineVariants = cva2(
2237
+ "a24-code-block__line",
2238
+ {
2239
+ variants: {
2240
+ variant: {
2241
+ default: "",
2242
+ added: "a24-code-block__line--added",
2243
+ removed: "a24-code-block__line--removed",
2244
+ highlighted: "a24-code-block__line--highlighted"
2245
+ }
2246
+ },
2247
+ defaultVariants: {
2248
+ variant: "default"
2249
+ }
2250
+ }
2251
+ );
2252
+ function CodeBlockLine({
2253
+ className,
2254
+ variant = "default",
2255
+ children,
2256
+ ...props
2257
+ }) {
2258
+ const empty = children === void 0 || children === null || children === "" || Array.isArray(children) && children.length === 0;
2259
+ return /* @__PURE__ */ jsx9(
2260
+ "span",
2261
+ {
2262
+ "data-slot": "code-block-line",
2263
+ "data-variant": variant,
2264
+ className: cn(codeBlockLineVariants({ variant }), className),
2265
+ ...props,
2266
+ children: /* @__PURE__ */ jsx9("span", { "data-slot": "code-block-line-content", className: "a24-code-block__line-content", children: empty ? "\n" : children })
2267
+ }
2268
+ );
2269
+ }
2270
+ function CodeBlockFooter({ className, ...props }) {
2271
+ return /* @__PURE__ */ jsx9(
2272
+ "div",
2273
+ {
2274
+ "data-slot": "code-block-footer",
2275
+ className: cn(
2276
+ "a24-code-block__footer",
2277
+ className
2278
+ ),
2279
+ ...props
2280
+ }
2281
+ );
2282
+ }
2283
+
2284
+ // src/ui/use-highlighted-code.ts
2285
+ import * as React11 from "react";
2286
+
2287
+ // src/ui/code-highlighter.tsx
2288
+ import {
2289
+ createHighlighterCore
2290
+ } from "shiki/core";
2291
+ import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
2292
+ import { bundledLanguages, bundledLanguagesAlias } from "shiki/langs";
2293
+ import { jsx as jsx10 } from "react/jsx-runtime";
2294
+ var languageLoaders = {
2295
+ ...bundledLanguages,
2296
+ ...bundledLanguagesAlias
2297
+ };
2298
+ var highlighter;
2299
+ function getHighlighter() {
2300
+ highlighter ?? (highlighter = createHighlighterCore({
2301
+ themes: [
2302
+ import("shiki/themes/github-light.mjs"),
2303
+ import("shiki/themes/github-dark.mjs")
2304
+ ],
2305
+ langs: [],
2306
+ engine: createJavaScriptRegexEngine({ forgiving: true })
2307
+ }));
2308
+ return highlighter;
2309
+ }
2310
+ function getLanguage(language) {
2311
+ const name = language.toLowerCase();
2312
+ if (name === "ansi") return name;
2313
+ if (Object.prototype.hasOwnProperty.call(languageLoaders, name)) return name;
2314
+ return null;
2315
+ }
2316
+ async function loadHighlighter(language) {
2317
+ const lang = getLanguage(language);
2318
+ if (!lang) {
2319
+ return null;
2320
+ }
2321
+ const shiki = await getHighlighter();
2322
+ if (lang !== "ansi" && !shiki.getLoadedLanguages().includes(lang)) {
2323
+ await shiki.loadLanguage(languageLoaders[lang]);
2324
+ }
2325
+ return {
2326
+ // Returns one React node per line, and the grammar state after the last
2327
+ // line. Pass that state back to continue where the code left off.
2328
+ highlight(code, state) {
2329
+ const tokenize = (text) => shiki.codeToTokens(text, {
2330
+ lang,
2331
+ themes: { light: "github-light", dark: "github-dark" },
2332
+ defaultColor: false,
2333
+ grammarState: state
2334
+ }).tokens;
2335
+ const tokens = lang === "ansi" ? code.split("\n").flatMap((line) => tokenize(line)) : tokenize(code);
2336
+ return {
2337
+ lines: tokens.map(
2338
+ (line) => line.map((token, index) => /* @__PURE__ */ jsx10(
2339
+ "span",
2340
+ {
2341
+ style: token.htmlStyle,
2342
+ className: "a24-code-token",
2343
+ children: token.content
2344
+ },
2345
+ index
2346
+ ))
2347
+ ),
2348
+ state: shiki.getLastGrammarState(tokens)
2349
+ };
2350
+ }
2351
+ };
2352
+ }
2353
+
2354
+ // src/ui/use-highlighted-code.ts
2355
+ function useHighlightedCode(value, language) {
2356
+ const code = value.endsWith("\n") ? value.slice(0, -1) : value;
2357
+ const [loaded, setLoaded] = React11.useState(null);
2358
+ const highlighter2 = loaded?.language === language ? loaded.highlighter : null;
2359
+ React11.useEffect(() => {
2360
+ let cancelled = false;
2361
+ loadHighlighter(language).then((next2) => {
2362
+ if (!cancelled) {
2363
+ setLoaded({ language, highlighter: next2 });
2364
+ }
2365
+ }).catch(() => {
2366
+ });
2367
+ return () => {
2368
+ cancelled = true;
2369
+ };
2370
+ }, [language]);
2371
+ const [done, setDone] = React11.useState({ highlighter: null, text: "", lines: [] });
2372
+ let next = done;
2373
+ if (next.highlighter !== highlighter2 || !code.startsWith(next.text)) {
2374
+ next = { highlighter: highlighter2, text: "", lines: [] };
2375
+ }
2376
+ const end = code.lastIndexOf("\n") + 1;
2377
+ if (highlighter2 && end > next.text.length) {
2378
+ const result = highlighter2.highlight(
2379
+ code.slice(next.text.length, end - 1),
2380
+ next.state
2381
+ );
2382
+ next = {
2383
+ highlighter: highlighter2,
2384
+ text: code.slice(0, end),
2385
+ lines: [...next.lines, ...result.lines],
2386
+ state: result.state
2387
+ };
2388
+ }
2389
+ if (next !== done) {
2390
+ setDone(next);
2391
+ }
2392
+ const tail = code.slice(end);
2393
+ return React11.useMemo(() => {
2394
+ if (!highlighter2) {
2395
+ return code.split("\n");
2396
+ }
2397
+ return [...next.lines, highlighter2.highlight(tail, next.state).lines[0]];
2398
+ }, [code, highlighter2, next, tail]);
2399
+ }
2400
+
2401
+ // src/ui/message-code.tsx
2402
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
2403
+ var CODE_EXTENSIONS = {
2404
+ bash: "sh",
2405
+ shell: "sh",
2406
+ shellscript: "sh",
2407
+ sh: "sh",
2408
+ zsh: "sh",
2409
+ javascript: "js",
2410
+ js: "js",
2411
+ jsx: "jsx",
2412
+ typescript: "ts",
2413
+ ts: "ts",
2414
+ tsx: "tsx",
2415
+ python: "py",
2416
+ py: "py",
2417
+ ruby: "rb",
2418
+ rust: "rs",
2419
+ rs: "rs",
2420
+ go: "go",
2421
+ java: "java",
2422
+ kotlin: "kt",
2423
+ swift: "swift",
2424
+ c: "c",
2425
+ cpp: "cpp",
2426
+ csharp: "cs",
2427
+ json: "json",
2428
+ jsonc: "jsonc",
2429
+ yaml: "yaml",
2430
+ yml: "yml",
2431
+ toml: "toml",
2432
+ html: "html",
2433
+ xml: "xml",
2434
+ css: "css",
2435
+ scss: "scss",
2436
+ sql: "sql",
2437
+ markdown: "md",
2438
+ md: "md",
2439
+ diff: "diff",
2440
+ text: "txt",
2441
+ plaintext: "txt"
2442
+ };
2443
+ function MessageCodeBlock({ code, language = "text" }) {
2444
+ const [wrap, setWrap] = React12.useState(false);
2445
+ const lines = useHighlightedCode(code, language);
2446
+ const extension = Object.prototype.hasOwnProperty.call(CODE_EXTENSIONS, language.toLowerCase()) ? CODE_EXTENSIONS[language.toLowerCase()] : "txt";
2447
+ return /* @__PURE__ */ jsxs7(CodeBlock, { children: [
2448
+ /* @__PURE__ */ jsxs7(CodeBlockHeader, { children: [
2449
+ /* @__PURE__ */ jsxs7(CodeBlockTitle, { children: [
2450
+ /* @__PURE__ */ jsx11(FileCode2Icon, { size: 14, strokeWidth: 1.5, "aria-hidden": "true" }),
2451
+ /* @__PURE__ */ jsx11("span", { children: language })
2452
+ ] }),
2453
+ /* @__PURE__ */ jsxs7(CodeBlockActions, { children: [
2454
+ /* @__PURE__ */ jsx11(CodeBlockWrapButton, { wrap, onWrapChange: setWrap }),
2455
+ /* @__PURE__ */ jsx11(CodeBlockDownloadButton, { value: code, filename: `code.${extension}` }),
2456
+ /* @__PURE__ */ jsx11(CodeBlockCopyButton, { value: code })
2457
+ ] })
2458
+ ] }),
2459
+ /* @__PURE__ */ jsx11(CodeBlockContent, { "aria-label": `${language} code`, lineNumbers: true, wrap, children: lines.map((line, index) => /* @__PURE__ */ jsx11(CodeBlockLine, { children: line }, index)) })
2460
+ ] });
2461
+ }
2462
+ function MessageMarkdownCode({ children, className, node, ...props }) {
2463
+ const language = className?.match(/(?:^|\s)language-([^\s]+)/)?.[1];
2464
+ const multiline = node?.position?.start?.line !== node?.position?.end?.line;
2465
+ if (props["data-block"] === void 0 && !language && !multiline) {
2466
+ return /* @__PURE__ */ jsx11("code", { ...props, className: cn("a24-inline-code", className), "data-streamdown": "inline-code", children });
2467
+ }
2468
+ const code = typeof children === "string" ? children.replace(/\n$/, "") : "";
2469
+ return /* @__PURE__ */ jsx11(MessageCodeBlock, { code, language });
2470
+ }
2471
+ function formatMessageJson(text) {
2472
+ const trimmed = text.trim();
2473
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
2474
+ try {
2475
+ JSON.parse(trimmed);
2476
+ } catch {
2477
+ return null;
2478
+ }
2479
+ const tokens = trimmed.match(/"(?:\\.|[^"\\])*"|[{}\[\],:]|[^\s{}\[\],:]+/g) || [];
2480
+ let depth = 0;
2481
+ let result = "";
2482
+ const newline = () => `
2483
+ ${" ".repeat(depth)}`;
2484
+ tokens.forEach((token, index) => {
2485
+ const previous = tokens[index - 1];
2486
+ const next = tokens[index + 1];
2487
+ if (token === "{" || token === "[") {
2488
+ result += token;
2489
+ depth += 1;
2490
+ if (next !== "}" && next !== "]") result += newline();
2491
+ } else if (token === "}" || token === "]") {
2492
+ depth -= 1;
2493
+ if (previous !== "{" && previous !== "[") result += newline();
2494
+ result += token;
2495
+ } else if (token === ",") result += `,${newline()}`;
2496
+ else if (token === ":") result += ": ";
2497
+ else result += token;
2498
+ });
2499
+ return result;
2500
+ }
2501
+
2026
2502
  // src/ui/message-response.tsx
2027
- import { Fragment as Fragment2, jsx as jsx9 } from "react/jsx-runtime";
2503
+ import { Fragment as Fragment3, jsx as jsx12 } from "react/jsx-runtime";
2028
2504
  function SafeMarkdownLink({ children, href, ...props }) {
2029
2505
  const domProps = { ...props };
2030
2506
  delete domProps.node;
2031
2507
  const safeHref = safeChatMarkdownHref(href);
2032
- if (!safeHref) return /* @__PURE__ */ jsx9("span", { children });
2033
- if (safeHref.startsWith("#")) return /* @__PURE__ */ jsx9("a", { ...domProps, href: safeHref, children });
2034
- return /* @__PURE__ */ jsx9("a", { ...domProps, href: safeHref, rel: "noopener noreferrer", target: "_blank", children });
2508
+ if (!safeHref) return /* @__PURE__ */ jsx12("span", { children });
2509
+ if (safeHref.startsWith("#")) return /* @__PURE__ */ jsx12("a", { ...domProps, href: safeHref, children });
2510
+ return /* @__PURE__ */ jsx12("a", { ...domProps, href: safeHref, rel: "noopener noreferrer", target: "_blank", children });
2035
2511
  }
2036
2512
  function BlockedMarkdownImage({ alt }) {
2037
- return alt ? /* @__PURE__ */ jsx9("span", { "aria-label": `Image blocked: ${alt}`, role: "img", children: alt }) : null;
2513
+ return alt ? /* @__PURE__ */ jsx12("span", { "aria-label": `Image blocked: ${alt}`, role: "img", children: alt }) : null;
2038
2514
  }
2039
2515
  var BLOCK_MARKDOWN_TAGS = /* @__PURE__ */ new Set([
2040
2516
  "blockquote",
@@ -2055,7 +2531,7 @@ function isMultilineCodeNode(node) {
2055
2531
  return node?.tagName === "code" && node.position?.start?.line !== void 0 && node.position?.end?.line !== void 0 && node.position.start.line !== node.position.end.line;
2056
2532
  }
2057
2533
  function hasBlockMarkdownChild(child) {
2058
- if (!React10.isValidElement(child)) {
2534
+ if (!React13.isValidElement(child)) {
2059
2535
  return false;
2060
2536
  }
2061
2537
  if (typeof child.type === "string" && BLOCK_MARKDOWN_TAGS.has(child.type)) {
@@ -2065,7 +2541,7 @@ function hasBlockMarkdownChild(child) {
2065
2541
  if (BLOCK_MARKDOWN_TAGS.has(props.node?.tagName || "") || isMultilineCodeNode(props.node)) {
2066
2542
  return true;
2067
2543
  }
2068
- return React10.Children.toArray(props.children).some(hasBlockMarkdownChild);
2544
+ return React13.Children.toArray(props.children).some(hasBlockMarkdownChild);
2069
2545
  }
2070
2546
  function MessageMarkdownParagraph({
2071
2547
  children,
@@ -2073,22 +2549,23 @@ function MessageMarkdownParagraph({
2073
2549
  }) {
2074
2550
  const domProps = { ...props };
2075
2551
  delete domProps.node;
2076
- const childArray = React10.Children.toArray(children).filter(
2552
+ const childArray = React13.Children.toArray(children).filter(
2077
2553
  (child) => child !== null && child !== ""
2078
2554
  );
2079
- const isImageOnly = childArray.length === 1 && React10.isValidElement(childArray[0]) && childArray[0].props.node?.tagName === "img";
2555
+ const isImageOnly = childArray.length === 1 && React13.isValidElement(childArray[0]) && childArray[0].props.node?.tagName === "img";
2080
2556
  if (isImageOnly) {
2081
- return /* @__PURE__ */ jsx9(Fragment2, { children });
2557
+ return /* @__PURE__ */ jsx12(Fragment3, { children });
2082
2558
  }
2083
2559
  if (childArray.some(hasBlockMarkdownChild)) {
2084
- return /* @__PURE__ */ jsx9("div", { ...domProps, children });
2560
+ return /* @__PURE__ */ jsx12("div", { ...domProps, children });
2085
2561
  }
2086
- return /* @__PURE__ */ jsx9("p", { ...domProps, children });
2562
+ return /* @__PURE__ */ jsx12("p", { ...domProps, children });
2087
2563
  }
2088
2564
  var MESSAGE_RESPONSE_COMPONENTS = {
2089
2565
  a: SafeMarkdownLink,
2090
2566
  img: BlockedMarkdownImage,
2091
- p: MessageMarkdownParagraph
2567
+ p: MessageMarkdownParagraph,
2568
+ code: MessageMarkdownCode
2092
2569
  };
2093
2570
  var streamdownDefaultRehypePlugins = defaultRehypePlugins || {};
2094
2571
  var streamdownHardenPlugin = Array.isArray(
@@ -2103,7 +2580,7 @@ var MESSAGE_RESPONSE_REHYPE_PLUGINS = [
2103
2580
  ]
2104
2581
  ] : []
2105
2582
  ];
2106
- var MessageResponse = React10.memo(
2583
+ var MessageResponse = React13.memo(
2107
2584
  ({
2108
2585
  children,
2109
2586
  className,
@@ -2121,11 +2598,21 @@ var MessageResponse = React10.memo(
2121
2598
  maxCatchupChars: 32,
2122
2599
  text
2123
2600
  });
2124
- const streamdownComponents = React10.useMemo(
2601
+ const streamdownComponents = React13.useMemo(
2125
2602
  () => ({ ...MESSAGE_RESPONSE_COMPONENTS, ...components }),
2126
2603
  [components]
2127
2604
  );
2128
- return /* @__PURE__ */ jsx9(
2605
+ const json = React13.useMemo(() => formatMessageJson(text), [text]);
2606
+ if (json !== null && !components?.code) {
2607
+ return /* @__PURE__ */ jsx12("div", { className: cn("a24-message-response", className), children: /* @__PURE__ */ jsx12(
2608
+ MessageCodeBlock,
2609
+ {
2610
+ code: streaming || streamingText.isAnimating ? streamingText.displayedText : json,
2611
+ language: "json"
2612
+ }
2613
+ ) });
2614
+ }
2615
+ return /* @__PURE__ */ jsx12(
2129
2616
  Streamdown,
2130
2617
  {
2131
2618
  className: cn("a24-message-response", className),
@@ -2177,10 +2664,10 @@ function resolvedHitlLabel(part) {
2177
2664
  }
2178
2665
 
2179
2666
  // src/ui/tool-sessions.tsx
2180
- import * as React11 from "react";
2667
+ import * as React14 from "react";
2181
2668
  import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight2 } from "lucide-react";
2182
2669
  import { ThinkingOrb } from "thinking-orbs";
2183
- import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
2670
+ import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2184
2671
  function toolSlotContext(isActive2, label, part, slots) {
2185
2672
  return {
2186
2673
  isActive: isActive2,
@@ -2198,7 +2685,7 @@ function ToolResourceAction({ context }) {
2198
2685
  const target = context.resourceTargets[0];
2199
2686
  if (!target) return null;
2200
2687
  const name = resourceTargetName(target);
2201
- return /* @__PURE__ */ jsx10(
2688
+ return /* @__PURE__ */ jsx13(
2202
2689
  "button",
2203
2690
  {
2204
2691
  "aria-label": `Open ${target.kind} ${target.path}`,
@@ -2212,8 +2699,8 @@ function ToolResourceAction({ context }) {
2212
2699
  );
2213
2700
  }
2214
2701
  function toolAccessory(context, slots) {
2215
- return /* @__PURE__ */ jsxs6(Fragment3, { children: [
2216
- slots?.onResourceAction ? /* @__PURE__ */ jsx10(ToolResourceAction, { context }) : null,
2702
+ return /* @__PURE__ */ jsxs8(Fragment4, { children: [
2703
+ slots?.onResourceAction ? /* @__PURE__ */ jsx13(ToolResourceAction, { context }) : null,
2217
2704
  slots?.renderToolAccessory?.(context)
2218
2705
  ] });
2219
2706
  }
@@ -2290,12 +2777,12 @@ function ToolActivityReel({
2290
2777
  }) {
2291
2778
  const initial = initialLabel && initialLabel !== label ? initialLabel : label;
2292
2779
  const parsedInitialShownAt = initialShownAt ? Date.parse(initialShownAt) : Number.NaN;
2293
- const [displayed, setDisplayed] = React11.useState(initial);
2294
- const [previous, setPrevious] = React11.useState(null);
2295
- const displayedRef = React11.useRef(initial);
2296
- const latestRef = React11.useRef(label);
2297
- const shownAtRef = React11.useRef(Number.isFinite(parsedInitialShownAt) ? parsedInitialShownAt : Date.now());
2298
- React11.useEffect(() => {
2780
+ const [displayed, setDisplayed] = React14.useState(initial);
2781
+ const [previous, setPrevious] = React14.useState(null);
2782
+ const displayedRef = React14.useRef(initial);
2783
+ const latestRef = React14.useRef(label);
2784
+ const shownAtRef = React14.useRef(Number.isFinite(parsedInitialShownAt) ? parsedInitialShownAt : Date.now());
2785
+ React14.useEffect(() => {
2299
2786
  latestRef.current = label;
2300
2787
  if (displayedRef.current === label) return;
2301
2788
  const showLatest = () => {
@@ -2315,18 +2802,18 @@ function ToolActivityReel({
2315
2802
  const timer = window.setTimeout(showLatest, remaining);
2316
2803
  return () => window.clearTimeout(timer);
2317
2804
  }, [label]);
2318
- React11.useEffect(() => {
2805
+ React14.useEffect(() => {
2319
2806
  if (!previous) return;
2320
2807
  const timer = window.setTimeout(() => setPrevious(null), 200);
2321
2808
  return () => window.clearTimeout(timer);
2322
2809
  }, [previous]);
2323
- return /* @__PURE__ */ jsxs6("span", { className: "a24-tool-reel", "aria-live": announce ? "polite" : "off", children: [
2324
- previous ? /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "a24-tool-reel__previous", children: previous }) : null,
2325
- /* @__PURE__ */ jsx10("span", { className: previous ? "a24-tool-reel__current" : void 0, children: displayed })
2810
+ return /* @__PURE__ */ jsxs8("span", { className: "a24-tool-reel", "aria-live": announce ? "polite" : "off", children: [
2811
+ previous ? /* @__PURE__ */ jsx13("span", { "aria-hidden": "true", className: "a24-tool-reel__previous", children: previous }) : null,
2812
+ /* @__PURE__ */ jsx13("span", { className: previous ? "a24-tool-reel__current" : void 0, children: displayed })
2326
2813
  ] });
2327
2814
  }
2328
2815
  function ToolActivityOrb({ label = "Working", kind = "tool", part, renderActivityIcon }) {
2329
- return /* @__PURE__ */ jsx10("span", { className: "a24-tool-orb", children: renderActivityIcon ? renderActivityIcon({ label, kind, part }) : /* @__PURE__ */ jsx10(ThinkingOrb, { "aria-label": label, size: 20, speed: 0.8, state: "searching" }) });
2816
+ return /* @__PURE__ */ jsx13("span", { className: "a24-tool-orb", children: renderActivityIcon ? renderActivityIcon({ label, kind, part }) : /* @__PURE__ */ jsx13(ThinkingOrb, { "aria-label": label, size: 20, speed: 0.8, state: "searching" }) });
2330
2817
  }
2331
2818
  function AgentChatActivityRow({
2332
2819
  label,
@@ -2334,22 +2821,22 @@ function AgentChatActivityRow({
2334
2821
  renderActivityIcon,
2335
2822
  onSelect
2336
2823
  }) {
2337
- const content = /* @__PURE__ */ jsxs6(Fragment3, { children: [
2338
- /* @__PURE__ */ jsx10(ToolActivityOrb, { label, kind: "planning", renderActivityIcon }),
2339
- /* @__PURE__ */ jsx10("span", { className: "a24-tool-trigger__label a24-tool-shimmer", children: /* @__PURE__ */ jsx10(ToolActivityReel, { label }) })
2824
+ const content = /* @__PURE__ */ jsxs8(Fragment4, { children: [
2825
+ /* @__PURE__ */ jsx13(ToolActivityOrb, { label, kind: "planning", renderActivityIcon }),
2826
+ /* @__PURE__ */ jsx13("span", { className: "a24-tool-trigger__label a24-tool-shimmer", children: /* @__PURE__ */ jsx13(ToolActivityReel, { label }) })
2340
2827
  ] });
2341
- return /* @__PURE__ */ jsx10("div", { className: "a24-tool-trigger-row a24-tool-trigger-row--root", "data-agents24-model-turn": modelTurnId, role: "status", children: onSelect ? /* @__PURE__ */ jsx10("button", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", onClick: onSelect, type: "button", children: content }) : /* @__PURE__ */ jsx10("div", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", children: content }) });
2828
+ return /* @__PURE__ */ jsx13("div", { className: "a24-tool-trigger-row a24-tool-trigger-row--root", "data-agents24-model-turn": modelTurnId, role: "status", children: onSelect ? /* @__PURE__ */ jsx13("button", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", onClick: onSelect, type: "button", children: content }) : /* @__PURE__ */ jsx13("div", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", children: content }) });
2342
2829
  }
2343
2830
  function AgentChatModelTurnRow({ part }) {
2344
- return /* @__PURE__ */ jsx10(AgentChatActivityRow, { label: "Planning next moves", modelTurnId: part.modelTurnId });
2831
+ return /* @__PURE__ */ jsx13(AgentChatActivityRow, { label: "Planning next moves", modelTurnId: part.modelTurnId });
2345
2832
  }
2346
2833
  function AgentChatNodeActivityRow({
2347
2834
  renderActivityIcon,
2348
2835
  onSelect,
2349
2836
  part
2350
2837
  }) {
2351
- const [open, setOpen] = React11.useState(false);
2352
- const contentId = React11.useId();
2838
+ const [open, setOpen] = React14.useState(false);
2839
+ const contentId = React14.useId();
2353
2840
  const running = part.status === "running";
2354
2841
  const failed = part.status === "failed";
2355
2842
  const failureMessage = part.failure?.message || "The node could not complete the request.";
@@ -2360,18 +2847,18 @@ function AgentChatNodeActivityRow({
2360
2847
  running && "a24-tool-trigger--active",
2361
2848
  failed && "a24-tool-trigger--error"
2362
2849
  );
2363
- const label = running ? /* @__PURE__ */ jsx10("span", { className: "a24-tool-shimmer", children: /* @__PURE__ */ jsx10(ToolActivityReel, { label: part.label }) }) : part.label;
2850
+ const label = running ? /* @__PURE__ */ jsx13("span", { className: "a24-tool-shimmer", children: /* @__PURE__ */ jsx13(ToolActivityReel, { label: part.label }) }) : part.label;
2364
2851
  if (!failed) {
2365
- return /* @__PURE__ */ jsx10("div", { className: "a24-tool-trigger-row", role: "status", children: onSelect ? /* @__PURE__ */ jsxs6("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
2366
- running ? /* @__PURE__ */ jsx10(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
2367
- /* @__PURE__ */ jsx10("span", { className: "a24-tool-trigger__label", children: label })
2368
- ] }) : /* @__PURE__ */ jsxs6("div", { className: triggerClassName, children: [
2369
- running ? /* @__PURE__ */ jsx10(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
2370
- /* @__PURE__ */ jsx10("span", { className: "a24-tool-trigger__label", children: label })
2852
+ return /* @__PURE__ */ jsx13("div", { className: "a24-tool-trigger-row", role: "status", children: onSelect ? /* @__PURE__ */ jsxs8("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
2853
+ running ? /* @__PURE__ */ jsx13(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
2854
+ /* @__PURE__ */ jsx13("span", { className: "a24-tool-trigger__label", children: label })
2855
+ ] }) : /* @__PURE__ */ jsxs8("div", { className: triggerClassName, children: [
2856
+ running ? /* @__PURE__ */ jsx13(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
2857
+ /* @__PURE__ */ jsx13("span", { className: "a24-tool-trigger__label", children: label })
2371
2858
  ] }) });
2372
2859
  }
2373
- return /* @__PURE__ */ jsxs6("div", { className: "a24-tool-disclosure", children: [
2374
- /* @__PURE__ */ jsx10("div", { className: "a24-tool-trigger-row", children: /* @__PURE__ */ jsxs6(
2860
+ return /* @__PURE__ */ jsxs8("div", { className: "a24-tool-disclosure", children: [
2861
+ /* @__PURE__ */ jsx13("div", { className: "a24-tool-trigger-row", children: /* @__PURE__ */ jsxs8(
2375
2862
  "button",
2376
2863
  {
2377
2864
  "aria-controls": contentId,
@@ -2383,12 +2870,12 @@ function AgentChatNodeActivityRow({
2383
2870
  },
2384
2871
  type: "button",
2385
2872
  children: [
2386
- /* @__PURE__ */ jsx10("span", { className: "a24-tool-trigger__label", children: label }),
2387
- open ? /* @__PURE__ */ jsx10(ChevronDown2, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ jsx10(ChevronRight2, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
2873
+ /* @__PURE__ */ jsx13("span", { className: "a24-tool-trigger__label", children: label }),
2874
+ open ? /* @__PURE__ */ jsx13(ChevronDown2, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ jsx13(ChevronRight2, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
2388
2875
  ]
2389
2876
  }
2390
2877
  ) }),
2391
- open ? /* @__PURE__ */ jsx10("div", { className: "a24-tool-detail a24-tool-detail--error", id: contentId, children: failureMessage }) : null
2878
+ open ? /* @__PURE__ */ jsx13("div", { className: "a24-tool-detail a24-tool-detail--error", id: contentId, children: failureMessage }) : null
2392
2879
  ] });
2393
2880
  }
2394
2881
  function toolRowLabel(part, separateResource = false) {
@@ -2415,25 +2902,25 @@ function ToolDisclosure({
2415
2902
  renderActivityIcon,
2416
2903
  accessory
2417
2904
  }) {
2418
- const [open, setOpen] = React11.useState(false);
2419
- const contentId = React11.useId();
2420
- const expandable = React11.Children.toArray(children).length > 0;
2905
+ const [open, setOpen] = React14.useState(false);
2906
+ const contentId = React14.useId();
2907
+ const expandable = React14.Children.toArray(children).length > 0;
2421
2908
  if (!expandable) {
2422
2909
  const triggerClassName = cn("a24-tool-trigger", root && "a24-tool-trigger--root", root && !showOrb && "a24-tool-trigger--without-orb", error && "a24-tool-trigger--error", loading && "a24-tool-trigger--active");
2423
- return /* @__PURE__ */ jsxs6("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
2424
- onSelect && part ? /* @__PURE__ */ jsxs6("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
2425
- showOrb ? /* @__PURE__ */ jsx10(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2426
- /* @__PURE__ */ jsx10("span", { className: "a24-tool-trigger__label", children: label })
2427
- ] }) : /* @__PURE__ */ jsxs6("div", { className: triggerClassName, children: [
2428
- showOrb ? /* @__PURE__ */ jsx10(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2429
- /* @__PURE__ */ jsx10("span", { className: "a24-tool-trigger__label", children: label })
2910
+ return /* @__PURE__ */ jsxs8("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
2911
+ onSelect && part ? /* @__PURE__ */ jsxs8("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
2912
+ showOrb ? /* @__PURE__ */ jsx13(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2913
+ /* @__PURE__ */ jsx13("span", { className: "a24-tool-trigger__label", children: label })
2914
+ ] }) : /* @__PURE__ */ jsxs8("div", { className: triggerClassName, children: [
2915
+ showOrb ? /* @__PURE__ */ jsx13(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2916
+ /* @__PURE__ */ jsx13("span", { className: "a24-tool-trigger__label", children: label })
2430
2917
  ] }),
2431
2918
  accessory
2432
2919
  ] });
2433
2920
  }
2434
- return /* @__PURE__ */ jsxs6("div", { className: "a24-tool-disclosure", children: [
2435
- /* @__PURE__ */ jsxs6("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
2436
- /* @__PURE__ */ jsxs6(
2921
+ return /* @__PURE__ */ jsxs8("div", { className: "a24-tool-disclosure", children: [
2922
+ /* @__PURE__ */ jsxs8("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
2923
+ /* @__PURE__ */ jsxs8(
2437
2924
  "button",
2438
2925
  {
2439
2926
  "aria-controls": contentId,
@@ -2447,25 +2934,25 @@ function ToolDisclosure({
2447
2934
  },
2448
2935
  type: "button",
2449
2936
  children: [
2450
- showOrb ? /* @__PURE__ */ jsx10(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2451
- /* @__PURE__ */ jsx10("span", { className: "a24-tool-trigger__label", children: label }),
2452
- open ? /* @__PURE__ */ jsx10(ChevronDown2, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ jsx10(ChevronRight2, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
2937
+ showOrb ? /* @__PURE__ */ jsx13(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2938
+ /* @__PURE__ */ jsx13("span", { className: "a24-tool-trigger__label", children: label }),
2939
+ open ? /* @__PURE__ */ jsx13(ChevronDown2, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ jsx13(ChevronRight2, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
2453
2940
  ]
2454
2941
  }
2455
2942
  ),
2456
2943
  accessory
2457
2944
  ] }),
2458
- open ? /* @__PURE__ */ jsx10("div", { className: "a24-tool-disclosure__content", id: contentId, children }) : null
2945
+ open ? /* @__PURE__ */ jsx13("div", { className: "a24-tool-disclosure__content", id: contentId, children }) : null
2459
2946
  ] });
2460
2947
  }
2461
2948
  function ToolLabel({ active, label, part, slots }) {
2462
2949
  const rendered = slots?.renderToolLabel?.(toolSlotContext(active, label, part, slots)) ?? label;
2463
- return active ? /* @__PURE__ */ jsx10("span", { className: "a24-tool-shimmer", children: rendered }) : /* @__PURE__ */ jsx10(Fragment3, { children: rendered });
2950
+ return active ? /* @__PURE__ */ jsx13("span", { className: "a24-tool-shimmer", children: rendered }) : /* @__PURE__ */ jsx13(Fragment4, { children: rendered });
2464
2951
  }
2465
2952
  function ToolList({ children }) {
2466
- const listRef = React11.useRef(null);
2467
- const [fades, setFades] = React11.useState({ bottom: false, top: false });
2468
- const updateFades = React11.useCallback(() => {
2953
+ const listRef = React14.useRef(null);
2954
+ const [fades, setFades] = React14.useState({ bottom: false, top: false });
2955
+ const updateFades = React14.useCallback(() => {
2469
2956
  const list = listRef.current;
2470
2957
  if (!list) return;
2471
2958
  const next = {
@@ -2474,7 +2961,7 @@ function ToolList({ children }) {
2474
2961
  };
2475
2962
  setFades((current) => current.bottom === next.bottom && current.top === next.top ? current : next);
2476
2963
  }, []);
2477
- React11.useEffect(() => {
2964
+ React14.useEffect(() => {
2478
2965
  updateFades();
2479
2966
  const list = listRef.current;
2480
2967
  if (!list || typeof ResizeObserver === "undefined") return;
@@ -2482,13 +2969,13 @@ function ToolList({ children }) {
2482
2969
  observer.observe(list);
2483
2970
  return () => observer.disconnect();
2484
2971
  }, [children, updateFades]);
2485
- return /* @__PURE__ */ jsx10(
2972
+ return /* @__PURE__ */ jsx13(
2486
2973
  "div",
2487
2974
  {
2488
2975
  className: "a24-tool-list-frame",
2489
2976
  "data-scroll-fade-bottom": fades.bottom ? "" : void 0,
2490
2977
  "data-scroll-fade-top": fades.top ? "" : void 0,
2491
- children: /* @__PURE__ */ jsx10("div", { className: "a24-tool-list", onScroll: updateFades, ref: listRef, role: "list", children })
2978
+ children: /* @__PURE__ */ jsx13("div", { className: "a24-tool-list", onScroll: updateFades, ref: listRef, role: "list", children })
2492
2979
  }
2493
2980
  );
2494
2981
  }
@@ -2505,13 +2992,13 @@ function AgentChatToolRow({
2505
2992
  const detail = failed ? failureMessage : optionalText(part.presentation.detail);
2506
2993
  const hostDetails = failed ? null : slots?.renderToolDetails?.(part);
2507
2994
  const context = toolSlotContext(active, toolRowLabel(part, Boolean(slots?.onResourceAction)), part, slots);
2508
- return /* @__PURE__ */ jsx10("div", { "data-agents24-tool-part": part.type, "data-state": part.state, children: /* @__PURE__ */ jsxs6(
2995
+ return /* @__PURE__ */ jsx13("div", { "data-agents24-tool-part": part.type, "data-state": part.state, children: /* @__PURE__ */ jsxs8(
2509
2996
  ToolDisclosure,
2510
2997
  {
2511
2998
  renderActivityIcon: slots?.renderActivityIcon,
2512
2999
  error: failed,
2513
3000
  accessory: toolAccessory(context, slots),
2514
- label: /* @__PURE__ */ jsx10(ToolLabel, { active, label: context.label, part, slots }),
3001
+ label: /* @__PURE__ */ jsx13(ToolLabel, { active, label: context.label, part, slots }),
2515
3002
  loading: active,
2516
3003
  onExpandedChange: slots?.onExpandedChange,
2517
3004
  onSelect: slots?.onToolSelect,
@@ -2520,7 +3007,7 @@ function AgentChatToolRow({
2520
3007
  showOrb: showOrb ?? active,
2521
3008
  statusLabel: active ? context.label : void 0,
2522
3009
  children: [
2523
- detail ? /* @__PURE__ */ jsx10("div", { className: cn("a24-tool-detail", failed && "a24-tool-detail--error"), children: detail }) : null,
3010
+ detail ? /* @__PURE__ */ jsx13("div", { className: cn("a24-tool-detail", failed && "a24-tool-detail--error"), children: detail }) : null,
2524
3011
  hostDetails
2525
3012
  ]
2526
3013
  }
@@ -2540,19 +3027,19 @@ function AgentChatToolSession({
2540
3027
  parts,
2541
3028
  slots
2542
3029
  }) {
2543
- const presentedLiveRef = React11.useRef(false);
3030
+ const presentedLiveRef = React14.useRef(false);
2544
3031
  if (isLive && isLatestActivity) presentedLiveRef.current = true;
2545
3032
  const activeIndex = parts.findLastIndex((part) => isActive(part, activeToolId));
2546
3033
  const running = activeIndex >= 0;
2547
- if (parts.length === 1 && !modelTurn && !leadingModelTurn) return /* @__PURE__ */ jsx10(AgentChatToolRow, { activeToolId, part: parts[0], slots });
3034
+ if (parts.length === 1 && !modelTurn && !leadingModelTurn) return /* @__PURE__ */ jsx13(AgentChatToolRow, { activeToolId, part: parts[0], slots });
2548
3035
  const visibleIndex = running ? activeIndex : parts.length - 1;
2549
3036
  const visiblePart = parts[visibleIndex];
2550
3037
  const planning = Boolean(modelTurn);
2551
3038
  const presentingActivity = isLatestActivity && (planning || running || isLive);
2552
3039
  const failed = isLatestActivity && (visiblePart.state === "output-error" || visiblePart.state === "cancelled");
2553
3040
  const label = planning ? "Planning next moves" : isLive && isLatestActivity ? toolRowLabel(visiblePart, true) : sessionLabel(parts, visiblePart, running);
2554
- const labelContent = presentedLiveRef.current ? /* @__PURE__ */ jsx10("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ jsx10(ToolActivityReel, { initialLabel: leadingModelTurn ? "Planning next moves" : void 0, initialShownAt: leadingModelTurn?.timestamp, label }) }) : label;
2555
- return /* @__PURE__ */ jsx10(
3041
+ const labelContent = presentedLiveRef.current ? /* @__PURE__ */ jsx13("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ jsx13(ToolActivityReel, { initialLabel: leadingModelTurn ? "Planning next moves" : void 0, initialShownAt: leadingModelTurn?.timestamp, label }) }) : label;
3042
+ return /* @__PURE__ */ jsx13(
2556
3043
  ToolDisclosure,
2557
3044
  {
2558
3045
  renderActivityIcon: slots?.renderActivityIcon,
@@ -2565,7 +3052,7 @@ function AgentChatToolSession({
2565
3052
  root: true,
2566
3053
  showOrb: isLive && isLatestActivity,
2567
3054
  statusLabel: planning ? "Planning next moves" : label,
2568
- children: /* @__PURE__ */ jsx10(ToolList, { children: parts.map((part) => /* @__PURE__ */ jsx10("div", { role: "listitem", children: /* @__PURE__ */ jsx10(AgentChatToolRow, { activeToolId, part, root: false, showOrb: false, slots }) }, part.id)) })
3055
+ children: /* @__PURE__ */ jsx13(ToolList, { children: parts.map((part) => /* @__PURE__ */ jsx13("div", { role: "listitem", children: /* @__PURE__ */ jsx13(AgentChatToolRow, { activeToolId, part, root: false, showOrb: false, slots }) }, part.id)) })
2569
3056
  }
2570
3057
  );
2571
3058
  }
@@ -2586,7 +3073,7 @@ function subagentLabel(part) {
2586
3073
  return { label: `Agent ${name}, ran ${children.length} ${children.length === 1 ? "tool" : "tools"}`, running: false };
2587
3074
  }
2588
3075
  function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part, slots }) {
2589
- const presentedLiveRef = React11.useRef(false);
3076
+ const presentedLiveRef = React14.useRef(false);
2590
3077
  if (isLive && isLatestActivity) presentedLiveRef.current = true;
2591
3078
  const children = part.presentation.childTools || [];
2592
3079
  const state = subagentLabel(part);
@@ -2595,9 +3082,9 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
2595
3082
  const hostDetails = failed ? null : slots?.renderToolDetails?.(part);
2596
3083
  const failureMessage = part.failure?.message || null;
2597
3084
  const presentingActivity = isLatestActivity && state.running;
2598
- const labelContent = presentedLiveRef.current ? /* @__PURE__ */ jsx10("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ jsx10(ToolActivityReel, { label: state.label }) }) : state.label;
3085
+ const labelContent = presentedLiveRef.current ? /* @__PURE__ */ jsx13("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ jsx13(ToolActivityReel, { label: state.label }) }) : state.label;
2599
3086
  const context = toolSlotContext(presentingActivity, state.label, part, slots);
2600
- return /* @__PURE__ */ jsx10(
3087
+ return /* @__PURE__ */ jsx13(
2601
3088
  ToolDisclosure,
2602
3089
  {
2603
3090
  renderActivityIcon: slots?.renderActivityIcon,
@@ -2611,12 +3098,12 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
2611
3098
  root: true,
2612
3099
  showOrb: isLive && isLatestActivity,
2613
3100
  statusLabel: state.label,
2614
- children: /* @__PURE__ */ jsxs6(ToolList, { children: [
2615
- children.map((child) => /* @__PURE__ */ jsx10("div", { className: cn("a24-child-tool", child.status === "failed" && "a24-child-tool--error"), role: "listitem", children: slots?.renderChildTool?.(child, part) ?? /* @__PURE__ */ jsxs6(Fragment3, { children: [
2616
- /* @__PURE__ */ jsx10("span", { className: cn(isLive && isLatestActivity && child.status === "running" && "a24-tool-shimmer"), children: childLabel(child) }),
2617
- child.detail ? /* @__PURE__ */ jsx10("span", { className: "a24-child-tool__detail", children: child.detail }) : null
3101
+ children: /* @__PURE__ */ jsxs8(ToolList, { children: [
3102
+ children.map((child) => /* @__PURE__ */ jsx13("div", { className: cn("a24-child-tool", child.status === "failed" && "a24-child-tool--error"), role: "listitem", children: slots?.renderChildTool?.(child, part) ?? /* @__PURE__ */ jsxs8(Fragment4, { children: [
3103
+ /* @__PURE__ */ jsx13("span", { className: cn(isLive && isLatestActivity && child.status === "running" && "a24-tool-shimmer"), children: childLabel(child) }),
3104
+ child.detail ? /* @__PURE__ */ jsx13("span", { className: "a24-child-tool__detail", children: child.detail }) : null
2618
3105
  ] }) }, child.id)),
2619
- failureMessage ? /* @__PURE__ */ jsx10("div", { className: "a24-tool-detail a24-tool-detail--error", children: failureMessage }) : null,
3106
+ failureMessage ? /* @__PURE__ */ jsx13("div", { className: "a24-tool-detail a24-tool-detail--error", children: failureMessage }) : null,
2620
3107
  hostDetails
2621
3108
  ] })
2622
3109
  }
@@ -2624,24 +3111,24 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
2624
3111
  }
2625
3112
 
2626
3113
  // src/ui/agent-response-timeline.tsx
2627
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
3114
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2628
3115
  function isInternalAskUserTool(part) {
2629
3116
  return [part.toolName, part.toolKey, part.action].some((value) => value?.trim().toLowerCase() === "runtime__ask_user");
2630
3117
  }
2631
3118
  function Shimmer({ children, className }) {
2632
- return /* @__PURE__ */ jsx11("span", { className: cn("inline-block animate-pulse", className), children });
3119
+ return /* @__PURE__ */ jsx14("span", { className: cn("inline-block animate-pulse", className), children });
2633
3120
  }
2634
3121
  function AgentChatToolPart({
2635
3122
  activeToolId,
2636
3123
  part
2637
3124
  }) {
2638
- return /* @__PURE__ */ jsx11(AgentChatToolRow, { activeToolId, part });
3125
+ return /* @__PURE__ */ jsx14(AgentChatToolRow, { activeToolId, part });
2639
3126
  }
2640
3127
  function AgentChatToolGroup({
2641
3128
  activeToolId,
2642
3129
  parts
2643
3130
  }) {
2644
- return /* @__PURE__ */ jsx11(AgentChatToolSession, { activeToolId, parts });
3131
+ return /* @__PURE__ */ jsx14(AgentChatToolSession, { activeToolId, parts });
2645
3132
  }
2646
3133
  function HitlPartRow({
2647
3134
  getHitlActionState,
@@ -2650,12 +3137,12 @@ function HitlPartRow({
2650
3137
  part
2651
3138
  }) {
2652
3139
  const state = getHitlActionState?.(part);
2653
- const [comment, setComment] = React12.useState("");
3140
+ const [comment, setComment] = React15.useState("");
2654
3141
  const presentation = part.presentation || {};
2655
3142
  const requireComment = presentation.require_comment === true;
2656
3143
  const isTerminal = part.status !== "pending";
2657
3144
  if (part.hitlKind === "user_input") {
2658
- return /* @__PURE__ */ jsx11(
3145
+ return /* @__PURE__ */ jsx14(
2659
3146
  AskUserInteraction,
2660
3147
  {
2661
3148
  error: state?.error,
@@ -2673,9 +3160,9 @@ function HitlPartRow({
2673
3160
  );
2674
3161
  }
2675
3162
  if (isTerminal) return null;
2676
- return /* @__PURE__ */ jsxs7("div", { className: "a24-hitl space-y-2.5 px-1 py-2", children: [
2677
- /* @__PURE__ */ jsx11("div", { className: "a24-hitl__title text-sm font-medium text-foreground text-pretty", children: hitlTitle(part) }),
2678
- requireComment ? /* @__PURE__ */ jsx11(
3163
+ return /* @__PURE__ */ jsxs9("div", { className: "a24-hitl space-y-2.5 px-1 py-2", children: [
3164
+ /* @__PURE__ */ jsx14("div", { className: "a24-hitl__title text-sm font-medium text-foreground text-pretty", children: hitlTitle(part) }),
3165
+ requireComment ? /* @__PURE__ */ jsx14(
2679
3166
  "textarea",
2680
3167
  {
2681
3168
  "aria-label": "Approval comment",
@@ -2687,8 +3174,8 @@ function HitlPartRow({
2687
3174
  value: comment
2688
3175
  }
2689
3176
  ) : null,
2690
- state?.error ? /* @__PURE__ */ jsx11("div", { className: "a24-hitl__error text-sm text-destructive", children: state.error }) : null,
2691
- /* @__PURE__ */ jsx11("div", { className: "a24-hitl__actions flex flex-wrap items-center gap-1.5", children: part.allowedActions.map((action) => /* @__PURE__ */ jsx11(
3177
+ state?.error ? /* @__PURE__ */ jsx14("div", { className: "a24-hitl__error text-sm text-destructive", children: state.error }) : null,
3178
+ /* @__PURE__ */ jsx14("div", { className: "a24-hitl__actions flex flex-wrap items-center gap-1.5", children: part.allowedActions.map((action) => /* @__PURE__ */ jsx14(
2692
3179
  "button",
2693
3180
  {
2694
3181
  "aria-label": hitlActionLabel(part, action),
@@ -2721,7 +3208,7 @@ function AgentChatPart({
2721
3208
  toolSlots
2722
3209
  }) {
2723
3210
  if (part.kind === "text") {
2724
- return /* @__PURE__ */ jsx11(
3211
+ return /* @__PURE__ */ jsx14(
2725
3212
  MessageResponse,
2726
3213
  {
2727
3214
  ...responseProps,
@@ -2731,23 +3218,23 @@ function AgentChatPart({
2731
3218
  }
2732
3219
  );
2733
3220
  }
2734
- if (part.kind === "tool") return isAgentChatSubagent(part) ? /* @__PURE__ */ jsx11(AgentChatSubagentGroup, { part, slots: toolSlots }) : /* @__PURE__ */ jsx11(AgentChatToolRow, { activeToolId, part, slots: toolSlots });
2735
- if (part.kind === "model-turn") return /* @__PURE__ */ jsx11(AgentChatModelTurnRow, { part });
3221
+ if (part.kind === "tool") return isAgentChatSubagent(part) ? /* @__PURE__ */ jsx14(AgentChatSubagentGroup, { part, slots: toolSlots }) : /* @__PURE__ */ jsx14(AgentChatToolRow, { activeToolId, part, slots: toolSlots });
3222
+ if (part.kind === "model-turn") return /* @__PURE__ */ jsx14(AgentChatModelTurnRow, { part });
2736
3223
  if (part.kind === "reasoning") {
2737
3224
  const label = part.text || part.label || "Thinking";
2738
- return part.status === "running" || part.status === "streaming" ? /* @__PURE__ */ jsx11(Shimmer, { className: "text-sm text-muted-foreground", children: label }) : /* @__PURE__ */ jsx11("div", { className: "text-sm text-muted-foreground", children: label });
3225
+ return part.status === "running" || part.status === "streaming" ? /* @__PURE__ */ jsx14(Shimmer, { className: "text-sm text-muted-foreground", children: label }) : /* @__PURE__ */ jsx14("div", { className: "text-sm text-muted-foreground", children: label });
2739
3226
  }
2740
3227
  if (part.kind === "context-compression") {
2741
- return /* @__PURE__ */ jsx11(AgentChatContextCompressionRow, { part });
3228
+ return /* @__PURE__ */ jsx14(AgentChatContextCompressionRow, { part });
2742
3229
  }
2743
3230
  if (part.kind === "ui-blocks") {
2744
3231
  if (part.state === "output-error") {
2745
- return /* @__PURE__ */ jsx11("div", { className: "a24-timeline-error text-sm text-destructive", children: part.errorText || "Failed to render UI content." });
3232
+ return /* @__PURE__ */ jsx14("div", { className: "a24-timeline-error text-sm text-destructive", children: part.errorText || "Failed to render UI content." });
2746
3233
  }
2747
- return part.bundle ? /* @__PURE__ */ jsx11(SafeUiBlocks, { bundle: part.bundle }) : /* @__PURE__ */ jsx11("div", { className: "text-sm text-muted-foreground", children: part.state === "input-streaming" ? /* @__PURE__ */ jsx11(Shimmer, { children: "Rendering UI block" }) : "Rendered UI block" });
3234
+ return part.bundle ? /* @__PURE__ */ jsx14(SafeUiBlocks, { bundle: part.bundle }) : /* @__PURE__ */ jsx14("div", { className: "text-sm text-muted-foreground", children: part.state === "input-streaming" ? /* @__PURE__ */ jsx14(Shimmer, { children: "Rendering UI block" }) : "Rendered UI block" });
2748
3235
  }
2749
3236
  if (part.kind === "hitl") {
2750
- return /* @__PURE__ */ jsx11(
3237
+ return /* @__PURE__ */ jsx14(
2751
3238
  HitlPartRow,
2752
3239
  {
2753
3240
  getHitlActionState,
@@ -2757,18 +3244,18 @@ function AgentChatPart({
2757
3244
  }
2758
3245
  );
2759
3246
  }
2760
- if (part.kind === "error") return /* @__PURE__ */ jsx11("div", { className: "a24-timeline-error text-sm text-destructive", role: "alert", children: part.errorText });
3247
+ if (part.kind === "error") return /* @__PURE__ */ jsx14("div", { className: "a24-timeline-error text-sm text-destructive", role: "alert", children: part.errorText });
2761
3248
  if (part.kind === "source") {
2762
3249
  const href = safeExternalUrl(part.url);
2763
- return href ? /* @__PURE__ */ jsx11("a", { className: "a24-source-link", href, rel: "noopener noreferrer", target: "_blank", children: part.title }) : /* @__PURE__ */ jsx11("span", { className: "a24-source-link", children: part.title });
3250
+ return href ? /* @__PURE__ */ jsx14("a", { className: "a24-source-link", href, rel: "noopener noreferrer", target: "_blank", children: part.title }) : /* @__PURE__ */ jsx14("span", { className: "a24-source-link", children: part.title });
2764
3251
  }
2765
3252
  if (part.kind === "citation") {
2766
3253
  const href = safeExternalUrl(part.url);
2767
3254
  const label = part.label || "Citation";
2768
- return href ? /* @__PURE__ */ jsx11("a", { className: "a24-citation", href, rel: "noopener noreferrer", target: "_blank", children: label }) : /* @__PURE__ */ jsx11("span", { className: "a24-citation", children: label });
3255
+ return href ? /* @__PURE__ */ jsx14("a", { className: "a24-citation", href, rel: "noopener noreferrer", target: "_blank", children: label }) : /* @__PURE__ */ jsx14("span", { className: "a24-citation", children: label });
2769
3256
  }
2770
- if (part.kind === "attachment") return /* @__PURE__ */ jsx11("div", { className: "a24-output-attachment", children: part.attachment.filename || "Attachment" });
2771
- if (part.kind === "data") return /* @__PURE__ */ jsx11("div", { "data-agents24-data-part": part.name, className: "hidden", children: message.id });
3257
+ if (part.kind === "attachment") return /* @__PURE__ */ jsx14("div", { className: "a24-output-attachment", children: part.attachment.filename || "Attachment" });
3258
+ if (part.kind === "data") return /* @__PURE__ */ jsx14("div", { "data-agents24-data-part": part.name, className: "hidden", children: message.id });
2772
3259
  return null;
2773
3260
  }
2774
3261
  function safeExternalUrl(value) {
@@ -2782,28 +3269,28 @@ function safeExternalUrl(value) {
2782
3269
  }
2783
3270
  function SafeUiBlocks({ bundle }) {
2784
3271
  const rows = Array.isArray(bundle.rows) ? bundle.rows : [];
2785
- return /* @__PURE__ */ jsxs7("section", { "aria-label": typeof bundle.title === "string" ? bundle.title : "Agent result", className: "a24-ui-blocks", children: [
2786
- typeof bundle.title === "string" ? /* @__PURE__ */ jsx11("h3", { children: bundle.title }) : null,
3272
+ return /* @__PURE__ */ jsxs9("section", { "aria-label": typeof bundle.title === "string" ? bundle.title : "Agent result", className: "a24-ui-blocks", children: [
3273
+ typeof bundle.title === "string" ? /* @__PURE__ */ jsx14("h3", { children: bundle.title }) : null,
2787
3274
  rows.map((rawRow, rowIndex) => {
2788
3275
  const row = rawRow && typeof rawRow === "object" && !Array.isArray(rawRow) ? rawRow : {};
2789
3276
  const blocks = Array.isArray(row.blocks) ? row.blocks : [];
2790
- return /* @__PURE__ */ jsx11("div", { className: "a24-ui-blocks__row", children: blocks.map((rawBlock, blockIndex) => {
3277
+ return /* @__PURE__ */ jsx14("div", { className: "a24-ui-blocks__row", children: blocks.map((rawBlock, blockIndex) => {
2791
3278
  const block = rawBlock && typeof rawBlock === "object" && !Array.isArray(rawBlock) ? rawBlock : {};
2792
3279
  const title = typeof block.title === "string" ? block.title : "Result";
2793
3280
  const kind = String(block.kind || "note");
2794
3281
  if (kind === "table" && Array.isArray(block.columns) && Array.isArray(block.rows)) {
2795
- return /* @__PURE__ */ jsxs7("div", { className: "a24-ui-block", children: [
2796
- /* @__PURE__ */ jsx11("h4", { children: title }),
2797
- /* @__PURE__ */ jsx11("div", { className: "a24-ui-table-scroll", children: /* @__PURE__ */ jsxs7("table", { children: [
2798
- /* @__PURE__ */ jsx11("thead", { children: /* @__PURE__ */ jsx11("tr", { children: block.columns.map((column, index) => /* @__PURE__ */ jsx11("th", { children: String(column) }, index)) }) }),
2799
- /* @__PURE__ */ jsx11("tbody", { children: block.rows.map((rawCells, index) => /* @__PURE__ */ jsx11("tr", { children: (Array.isArray(rawCells) ? rawCells : []).map((cell, cellIndex) => /* @__PURE__ */ jsx11("td", { children: String(cell) }, cellIndex)) }, index)) })
3282
+ return /* @__PURE__ */ jsxs9("div", { className: "a24-ui-block", children: [
3283
+ /* @__PURE__ */ jsx14("h4", { children: title }),
3284
+ /* @__PURE__ */ jsx14("div", { className: "a24-ui-table-scroll", children: /* @__PURE__ */ jsxs9("table", { children: [
3285
+ /* @__PURE__ */ jsx14("thead", { children: /* @__PURE__ */ jsx14("tr", { children: block.columns.map((column, index) => /* @__PURE__ */ jsx14("th", { children: String(column) }, index)) }) }),
3286
+ /* @__PURE__ */ jsx14("tbody", { children: block.rows.map((rawCells, index) => /* @__PURE__ */ jsx14("tr", { children: (Array.isArray(rawCells) ? rawCells : []).map((cell, cellIndex) => /* @__PURE__ */ jsx14("td", { children: String(cell) }, cellIndex)) }, index)) })
2800
3287
  ] }) })
2801
3288
  ] }, String(block.id || blockIndex));
2802
3289
  }
2803
3290
  const value = block.value ?? block.text ?? "";
2804
- return /* @__PURE__ */ jsxs7("div", { className: "a24-ui-block", children: [
2805
- /* @__PURE__ */ jsx11("h4", { children: title }),
2806
- /* @__PURE__ */ jsx11("p", { children: String(value) })
3291
+ return /* @__PURE__ */ jsxs9("div", { className: "a24-ui-block", children: [
3292
+ /* @__PURE__ */ jsx14("h4", { children: title }),
3293
+ /* @__PURE__ */ jsx14("p", { children: String(value) })
2807
3294
  ] }, String(block.id || blockIndex));
2808
3295
  }) }, `row-${rowIndex}`);
2809
3296
  })
@@ -2837,38 +3324,38 @@ function AgentResponseTimeline({
2837
3324
  if (segment.kind === "tool") {
2838
3325
  const isLatestActivity = segmentIndex === segments.length - 1;
2839
3326
  const showOrb = toolViewMode === "closed" ? isLoading && isLatestActivity : Boolean(activeToolId && (segment.part.id === activeToolId || segment.part.toolCallId === activeToolId));
2840
- rendered.push(/* @__PURE__ */ jsx11(AgentChatToolRow, { activeToolId, part: segment.part, showOrb, slots: toolSlots }, segment.part.id));
3327
+ rendered.push(/* @__PURE__ */ jsx14(AgentChatToolRow, { activeToolId, part: segment.part, showOrb, slots: toolSlots }, segment.part.id));
2841
3328
  continue;
2842
3329
  }
2843
3330
  if (segment.kind === "tool-session") {
2844
- rendered.push(/* @__PURE__ */ jsx11(AgentChatToolSession, { activeToolId, isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, leadingModelTurn: segment.leadingModelTurn, modelTurn: segment.modelTurn, parts: segment.parts, slots: toolSlots }, `tool-session-${segment.parts[0].id}`));
3331
+ rendered.push(/* @__PURE__ */ jsx14(AgentChatToolSession, { activeToolId, isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, leadingModelTurn: segment.leadingModelTurn, modelTurn: segment.modelTurn, parts: segment.parts, slots: toolSlots }, `tool-session-${segment.parts[0].id}`));
2845
3332
  continue;
2846
3333
  }
2847
3334
  if (segment.kind === "subagent") {
2848
- rendered.push(/* @__PURE__ */ jsx11(AgentChatSubagentGroup, { isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, part: segment.part, slots: toolSlots }, segment.part.id));
3335
+ rendered.push(/* @__PURE__ */ jsx14(AgentChatSubagentGroup, { isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, part: segment.part, slots: toolSlots }, segment.part.id));
2849
3336
  continue;
2850
3337
  }
2851
3338
  const part = segment.part;
2852
3339
  if (part.kind === "model-turn") {
2853
3340
  const key = activeActivityClaimed ? part.id : `${message.id}-active-activity`;
2854
3341
  activeActivityClaimed = true;
2855
- rendered.push(/* @__PURE__ */ jsx11(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Planning next moves", modelTurnId: part.modelTurnId }, key));
3342
+ rendered.push(/* @__PURE__ */ jsx14(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Planning next moves", modelTurnId: part.modelTurnId }, key));
2856
3343
  continue;
2857
3344
  }
2858
3345
  if (part.kind === "node-activity") {
2859
3346
  const key = activeActivityClaimed ? part.id : `${message.id}-active-activity`;
2860
3347
  if (part.status === "running") activeActivityClaimed = true;
2861
3348
  rendered.push(
2862
- part.status === "running" ? /* @__PURE__ */ jsx11(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: part.label, onSelect: onNodeSelect ? () => onNodeSelect(part) : void 0 }, key) : /* @__PURE__ */ jsx11(AgentChatNodeActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, onSelect: onNodeSelect, part }, part.id)
3349
+ part.status === "running" ? /* @__PURE__ */ jsx14(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: part.label, onSelect: onNodeSelect ? () => onNodeSelect(part) : void 0 }, key) : /* @__PURE__ */ jsx14(AgentChatNodeActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, onSelect: onNodeSelect, part }, part.id)
2863
3350
  );
2864
3351
  continue;
2865
3352
  }
2866
3353
  if (part.kind === "ui-blocks" && renderUiBlocks) {
2867
- rendered.push(/* @__PURE__ */ jsx11(React12.Fragment, { children: renderUiBlocks(part) }, part.id));
3354
+ rendered.push(/* @__PURE__ */ jsx14(React15.Fragment, { children: renderUiBlocks(part) }, part.id));
2868
3355
  continue;
2869
3356
  }
2870
3357
  rendered.push(
2871
- /* @__PURE__ */ jsx11(React12.Fragment, { children: /* @__PURE__ */ jsx11(
3358
+ /* @__PURE__ */ jsx14(React15.Fragment, { children: /* @__PURE__ */ jsx14(
2872
3359
  AgentChatPart,
2873
3360
  {
2874
3361
  activeToolId,
@@ -2885,16 +3372,16 @@ function AgentResponseTimeline({
2885
3372
  );
2886
3373
  }
2887
3374
  if (rendered.length === 0 && message.content) {
2888
- rendered.push(/* @__PURE__ */ jsx11(MessageResponse, { children: message.content }, `${message.id}-fallback`));
3375
+ rendered.push(/* @__PURE__ */ jsx14(MessageResponse, { children: message.content }, `${message.id}-fallback`));
2889
3376
  }
2890
3377
  if (rendered.length === 0 && isLoading) {
2891
- rendered.push(/* @__PURE__ */ jsx11(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Thinking" }, `${message.id}-active-activity`));
3378
+ rendered.push(/* @__PURE__ */ jsx14(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Thinking" }, `${message.id}-active-activity`));
2892
3379
  }
2893
- return /* @__PURE__ */ jsx11("div", { className: "space-y-3", children: rendered });
3380
+ return /* @__PURE__ */ jsx14("div", { className: "space-y-3", children: rendered });
2894
3381
  }
2895
3382
 
2896
3383
  // src/ui/agent-chat-message.tsx
2897
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
3384
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2898
3385
  var DEFAULT_USER_MESSAGE_COLLAPSE_THRESHOLD = 360;
2899
3386
  var DEFAULT_USER_MESSAGE_COLLAPSED_LINES = 4;
2900
3387
  function shouldCollapseUserMessage(content, threshold = DEFAULT_USER_MESSAGE_COLLAPSE_THRESHOLD) {
@@ -2907,8 +3394,8 @@ function AgentChatUserMessageContent({
2907
3394
  showLessLabel = "Show less",
2908
3395
  showMoreLabel = "Show more"
2909
3396
  }) {
2910
- const [isExpanded, setIsExpanded] = React13.useState(false);
2911
- const contentId = React13.useId();
3397
+ const [isExpanded, setIsExpanded] = React16.useState(false);
3398
+ const contentId = React16.useId();
2912
3399
  const shouldCollapse = shouldCollapseUserMessage(content, collapseThreshold);
2913
3400
  const Icon = isExpanded ? ChevronUp : ChevronDown3;
2914
3401
  const clampedStyle = shouldCollapse && !isExpanded ? {
@@ -2917,9 +3404,9 @@ function AgentChatUserMessageContent({
2917
3404
  display: "-webkit-box",
2918
3405
  overflow: "hidden"
2919
3406
  } : void 0;
2920
- return /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-col gap-3", children: [
2921
- /* @__PURE__ */ jsx12("div", { id: contentId, className: "min-w-0", style: clampedStyle, children: content }),
2922
- shouldCollapse ? /* @__PURE__ */ jsxs8(
3407
+ return /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-col gap-3", children: [
3408
+ /* @__PURE__ */ jsx15("div", { id: contentId, className: "min-w-0", style: clampedStyle, children: content }),
3409
+ shouldCollapse ? /* @__PURE__ */ jsxs10(
2923
3410
  "button",
2924
3411
  {
2925
3412
  "aria-controls": contentId,
@@ -2932,7 +3419,7 @@ function AgentChatUserMessageContent({
2932
3419
  type: "button",
2933
3420
  children: [
2934
3421
  isExpanded ? showLessLabel : showMoreLabel,
2935
- /* @__PURE__ */ jsx12(Icon, { "aria-hidden": "true", className: "size-4", strokeWidth: 2 })
3422
+ /* @__PURE__ */ jsx15(Icon, { "aria-hidden": "true", className: "size-4", strokeWidth: 2 })
2936
3423
  ]
2937
3424
  }
2938
3425
  ) : null
@@ -2942,9 +3429,9 @@ function AgentChatUserMessageActionRow({
2942
3429
  children,
2943
3430
  className
2944
3431
  }) {
2945
- const rowRef = React13.useRef(null);
2946
- const [visible, setVisible] = React13.useState(false);
2947
- React13.useEffect(() => {
3432
+ const rowRef = React16.useRef(null);
3433
+ const [visible, setVisible] = React16.useState(false);
3434
+ React16.useEffect(() => {
2948
3435
  const message = rowRef.current?.closest('[data-slot="message"]');
2949
3436
  if (!message) return;
2950
3437
  const show = () => setVisible(true);
@@ -2963,7 +3450,7 @@ function AgentChatUserMessageActionRow({
2963
3450
  message.removeEventListener("focusout", hideWhenFocusLeaves);
2964
3451
  };
2965
3452
  }, []);
2966
- return /* @__PURE__ */ jsx12(
3453
+ return /* @__PURE__ */ jsx15(
2967
3454
  "div",
2968
3455
  {
2969
3456
  ref: rowRef,
@@ -3002,7 +3489,7 @@ function AgentChatMessage({
3002
3489
  const resolvedUserContent = userMessageContent ?? message.content;
3003
3490
  const shouldRenderContent = isAssistant || Boolean(renderUserContent || resolvedUserContent);
3004
3491
  const showAttachments = Boolean(message.attachments?.length) && (message.role === "user" || showAssistantAttachments);
3005
- const renderedActions = actions ?? (actionHandlers ? /* @__PURE__ */ jsx12(
3492
+ const renderedActions = actions ?? (actionHandlers ? /* @__PURE__ */ jsx15(
3006
3493
  AgentChatDefaultActions,
3007
3494
  {
3008
3495
  additionalActions,
@@ -3012,14 +3499,14 @@ function AgentChatMessage({
3012
3499
  }
3013
3500
  ) : null);
3014
3501
  const defaultUserActions = !actions && Boolean(actionHandlers) && !isAssistant;
3015
- return /* @__PURE__ */ jsxs8(
3502
+ return /* @__PURE__ */ jsxs10(
3016
3503
  ChatMessage,
3017
3504
  {
3018
3505
  className,
3019
3506
  dir,
3020
3507
  from: message.role,
3021
3508
  children: [
3022
- showAttachments ? /* @__PURE__ */ jsx12(
3509
+ showAttachments ? /* @__PURE__ */ jsx15(
3023
3510
  ChatAttachmentRows,
3024
3511
  {
3025
3512
  attachments: message.attachments || [],
@@ -3028,14 +3515,14 @@ function AgentChatMessage({
3028
3515
  resolveContent: attachmentContentResolver
3029
3516
  }
3030
3517
  ) : null,
3031
- shouldRenderContent ? /* @__PURE__ */ jsxs8(
3518
+ shouldRenderContent ? /* @__PURE__ */ jsxs10(
3032
3519
  ChatMessageContent,
3033
3520
  {
3034
3521
  className: cn(isAssistant ? "bg-transparent p-0" : void 0, contentClassName),
3035
3522
  dir,
3036
3523
  from: message.role,
3037
3524
  children: [
3038
- isAssistant ? renderAssistantContent ? renderAssistantContent({ isStreaming, message }) : /* @__PURE__ */ jsx12(
3525
+ isAssistant ? renderAssistantContent ? renderAssistantContent({ isStreaming, message }) : /* @__PURE__ */ jsx15(
3039
3526
  Timeline,
3040
3527
  {
3041
3528
  getHitlActionState,
@@ -3046,7 +3533,7 @@ function AgentChatMessage({
3046
3533
  parts: message.parts
3047
3534
  }
3048
3535
  ) : null,
3049
- !isAssistant ? renderUserContent ? renderUserContent({ message }) : resolvedUserContent ? /* @__PURE__ */ jsx12(
3536
+ !isAssistant ? renderUserContent ? renderUserContent({ message }) : resolvedUserContent ? /* @__PURE__ */ jsx15(
3050
3537
  AgentChatUserMessageContent,
3051
3538
  {
3052
3539
  collapsedLines: userMessageCollapsedLines,
@@ -3059,18 +3546,18 @@ function AgentChatMessage({
3059
3546
  ]
3060
3547
  }
3061
3548
  ) : null,
3062
- renderedActions ? defaultUserActions ? /* @__PURE__ */ jsx12(AgentChatUserMessageActionRow, { className: actionsClassName, children: renderedActions }) : /* @__PURE__ */ jsx12("div", { className: cn(dir === "rtl" ? "mt-1 h-9 w-full" : "mt-1 h-9 w-full -translate-x-2", actionsClassName), children: renderedActions }) : null
3549
+ renderedActions ? defaultUserActions ? /* @__PURE__ */ jsx15(AgentChatUserMessageActionRow, { className: actionsClassName, children: renderedActions }) : /* @__PURE__ */ jsx15("div", { className: cn(dir === "rtl" ? "mt-1 h-9 w-full" : "mt-1 h-9 w-full -translate-x-2", actionsClassName), children: renderedActions }) : null
3063
3550
  ]
3064
3551
  }
3065
3552
  );
3066
3553
  }
3067
3554
 
3068
3555
  // src/ui/bubble.tsx
3069
- import { cva as cva2 } from "class-variance-authority";
3556
+ import { cva as cva3 } from "class-variance-authority";
3070
3557
  import { Slot as Slot2 } from "@radix-ui/react-slot";
3071
- import { jsx as jsx13 } from "react/jsx-runtime";
3558
+ import { jsx as jsx16 } from "react/jsx-runtime";
3072
3559
  function BubbleGroup({ className, ...props }) {
3073
- return /* @__PURE__ */ jsx13(
3560
+ return /* @__PURE__ */ jsx16(
3074
3561
  "div",
3075
3562
  {
3076
3563
  "data-slot": "bubble-group",
@@ -3079,7 +3566,7 @@ function BubbleGroup({ className, ...props }) {
3079
3566
  }
3080
3567
  );
3081
3568
  }
3082
- var bubbleVariants = cva2(
3569
+ var bubbleVariants = cva3(
3083
3570
  "group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",
3084
3571
  {
3085
3572
  variants: {
@@ -3104,7 +3591,7 @@ function Bubble({
3104
3591
  className,
3105
3592
  ...props
3106
3593
  }) {
3107
- return /* @__PURE__ */ jsx13(
3594
+ return /* @__PURE__ */ jsx16(
3108
3595
  "div",
3109
3596
  {
3110
3597
  "data-slot": "bubble",
@@ -3121,7 +3608,7 @@ function BubbleContent({
3121
3608
  ...props
3122
3609
  }) {
3123
3610
  const Comp = asChild ? Slot2 : "div";
3124
- return /* @__PURE__ */ jsx13(
3611
+ return /* @__PURE__ */ jsx16(
3125
3612
  Comp,
3126
3613
  {
3127
3614
  "data-slot": "bubble-content",
@@ -3133,7 +3620,7 @@ function BubbleContent({
3133
3620
  }
3134
3621
  );
3135
3622
  }
3136
- var bubbleReactionsVariants = cva2(
3623
+ var bubbleReactionsVariants = cva3(
3137
3624
  "absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",
3138
3625
  {
3139
3626
  variants: {
@@ -3158,7 +3645,7 @@ function BubbleReactions({
3158
3645
  className,
3159
3646
  ...props
3160
3647
  }) {
3161
- return /* @__PURE__ */ jsx13(
3648
+ return /* @__PURE__ */ jsx16(
3162
3649
  "div",
3163
3650
  {
3164
3651
  "data-slot": "bubble-reactions",
@@ -3171,10 +3658,10 @@ function BubbleReactions({
3171
3658
  }
3172
3659
 
3173
3660
  // src/ui/marker.tsx
3174
- import { cva as cva3 } from "class-variance-authority";
3661
+ import { cva as cva4 } from "class-variance-authority";
3175
3662
  import { Slot as Slot3 } from "@radix-ui/react-slot";
3176
- import { jsx as jsx14 } from "react/jsx-runtime";
3177
- var markerVariants = cva3(
3663
+ import { jsx as jsx17 } from "react/jsx-runtime";
3664
+ var markerVariants = cva4(
3178
3665
  "group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground",
3179
3666
  {
3180
3667
  variants: {
@@ -3193,7 +3680,7 @@ function Marker({
3193
3680
  ...props
3194
3681
  }) {
3195
3682
  const Comp = asChild ? Slot3 : "div";
3196
- return /* @__PURE__ */ jsx14(
3683
+ return /* @__PURE__ */ jsx17(
3197
3684
  Comp,
3198
3685
  {
3199
3686
  "data-slot": "marker",
@@ -3204,7 +3691,7 @@ function Marker({
3204
3691
  );
3205
3692
  }
3206
3693
  function MarkerIcon({ className, ...props }) {
3207
- return /* @__PURE__ */ jsx14(
3694
+ return /* @__PURE__ */ jsx17(
3208
3695
  "span",
3209
3696
  {
3210
3697
  "data-slot": "marker-icon",
@@ -3218,7 +3705,7 @@ function MarkerIcon({ className, ...props }) {
3218
3705
  );
3219
3706
  }
3220
3707
  function MarkerContent({ className, ...props }) {
3221
- return /* @__PURE__ */ jsx14(
3708
+ return /* @__PURE__ */ jsx17(
3222
3709
  "span",
3223
3710
  {
3224
3711
  "data-slot": "marker-content",
@@ -3232,7 +3719,7 @@ function MarkerContent({ className, ...props }) {
3232
3719
  }
3233
3720
 
3234
3721
  // src/ui/mcp-connect-required-card.tsx
3235
- import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
3722
+ import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
3236
3723
  var STATUS_LABELS = {
3237
3724
  pending: "Connect",
3238
3725
  connecting: "Connecting",
@@ -3256,7 +3743,7 @@ function McpConnectRequiredCard({
3256
3743
  const isBusy = loading || status === "connecting" || status === "resuming";
3257
3744
  const isConnected = status === "connected";
3258
3745
  const buttonDisabled = disabled || isBusy || isConnected || !onConnect;
3259
- return /* @__PURE__ */ jsx15(
3746
+ return /* @__PURE__ */ jsx18(
3260
3747
  "div",
3261
3748
  {
3262
3749
  "data-agents24-mcp-connect-card": true,
@@ -3266,13 +3753,13 @@ function McpConnectRequiredCard({
3266
3753
  className
3267
3754
  ),
3268
3755
  ...props,
3269
- children: /* @__PURE__ */ jsxs9("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [
3270
- /* @__PURE__ */ jsxs9("div", { className: "min-w-0", children: [
3271
- /* @__PURE__ */ jsx15("div", { className: "truncate text-sm font-medium", children: label }),
3272
- /* @__PURE__ */ jsx15("div", { className: "mt-1 text-sm text-muted-foreground", children: message || "Connect your account to continue." }),
3273
- status === "error" && error ? /* @__PURE__ */ jsx15("div", { className: "mt-2 text-sm text-destructive", children: error }) : null
3756
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [
3757
+ /* @__PURE__ */ jsxs11("div", { className: "min-w-0", children: [
3758
+ /* @__PURE__ */ jsx18("div", { className: "truncate text-sm font-medium", children: label }),
3759
+ /* @__PURE__ */ jsx18("div", { className: "mt-1 text-sm text-muted-foreground", children: message || "Connect your account to continue." }),
3760
+ status === "error" && error ? /* @__PURE__ */ jsx18("div", { className: "mt-2 text-sm text-destructive", children: error }) : null
3274
3761
  ] }),
3275
- /* @__PURE__ */ jsx15(
3762
+ /* @__PURE__ */ jsx18(
3276
3763
  "button",
3277
3764
  {
3278
3765
  type: "button",
@@ -3329,6 +3816,16 @@ export {
3329
3816
  ChatMessageAction,
3330
3817
  ChatMessageActions,
3331
3818
  ChatMessageContent,
3819
+ CodeBlock,
3820
+ CodeBlockActions,
3821
+ CodeBlockContent,
3822
+ CodeBlockCopyButton,
3823
+ CodeBlockDownloadButton,
3824
+ CodeBlockFooter,
3825
+ CodeBlockHeader,
3826
+ CodeBlockLine,
3827
+ CodeBlockTitle,
3828
+ CodeBlockWrapButton,
3332
3829
  Marker,
3333
3830
  MarkerContent,
3334
3831
  MarkerIcon,
@@ -3370,6 +3867,7 @@ export {
3370
3867
  useAudioRecorder,
3371
3868
  useChatComposerFocus,
3372
3869
  useCompletionActionEntrance,
3870
+ useHighlightedCode,
3373
3871
  useLiveCompletionRuns
3374
3872
  };
3375
3873
  //# sourceMappingURL=index.js.map