@agents24/chat-react 0.5.35 → 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.cjs CHANGED
@@ -69,6 +69,16 @@ __export(ui_exports, {
69
69
  ChatMessageAction: () => ChatMessageAction,
70
70
  ChatMessageActions: () => ChatMessageActions,
71
71
  ChatMessageContent: () => ChatMessageContent,
72
+ CodeBlock: () => CodeBlock,
73
+ CodeBlockActions: () => CodeBlockActions,
74
+ CodeBlockContent: () => CodeBlockContent,
75
+ CodeBlockCopyButton: () => CodeBlockCopyButton,
76
+ CodeBlockDownloadButton: () => CodeBlockDownloadButton,
77
+ CodeBlockFooter: () => CodeBlockFooter,
78
+ CodeBlockHeader: () => CodeBlockHeader,
79
+ CodeBlockLine: () => CodeBlockLine,
80
+ CodeBlockTitle: () => CodeBlockTitle,
81
+ CodeBlockWrapButton: () => CodeBlockWrapButton,
72
82
  Marker: () => Marker,
73
83
  MarkerContent: () => MarkerContent,
74
84
  MarkerIcon: () => MarkerIcon,
@@ -110,6 +120,7 @@ __export(ui_exports, {
110
120
  useAudioRecorder: () => useAudioRecorder,
111
121
  useChatComposerFocus: () => useChatComposerFocus,
112
122
  useCompletionActionEntrance: () => useCompletionActionEntrance,
123
+ useHighlightedCode: () => useHighlightedCode,
113
124
  useLiveCompletionRuns: () => useLiveCompletionRuns
114
125
  });
115
126
  module.exports = __toCommonJS(ui_exports);
@@ -1524,7 +1535,7 @@ function QueueRow({ message, onRemove, onEdit }) {
1524
1535
  }
1525
1536
  function AgentChatQueue({ pending, queue, onRemove, onEdit, onResume, className }) {
1526
1537
  const [resumeError, setResumeError] = React7.useState(null);
1527
- if (!pending.length && !queue?.paused) return null;
1538
+ if (!pending.length) return null;
1528
1539
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("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: [
1529
1540
  queue?.paused ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex min-h-9 items-center justify-between gap-2 px-3 text-xs text-muted-foreground", children: [
1530
1541
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Queue paused" }),
@@ -1771,11 +1782,11 @@ function AgentChatDefaultActions({
1771
1782
  }
1772
1783
 
1773
1784
  // src/ui/agent-chat-message.tsx
1774
- var React13 = __toESM(require("react"), 1);
1775
- var import_lucide_react7 = require("lucide-react");
1785
+ var React16 = __toESM(require("react"), 1);
1786
+ var import_lucide_react9 = require("lucide-react");
1776
1787
 
1777
1788
  // src/ui/agent-response-timeline.tsx
1778
- var React12 = __toESM(require("react"), 1);
1789
+ var React15 = __toESM(require("react"), 1);
1779
1790
 
1780
1791
  // src/streaming-text.ts
1781
1792
  var import_react = require("react");
@@ -2322,7 +2333,7 @@ function AgentChatContextCompressionRow({
2322
2333
  }
2323
2334
 
2324
2335
  // src/ui/message-response.tsx
2325
- var React10 = __toESM(require("react"), 1);
2336
+ var React13 = __toESM(require("react"), 1);
2326
2337
  var import_streamdown = require("streamdown");
2327
2338
 
2328
2339
  // src/active-content.ts
@@ -2346,18 +2357,492 @@ function safeChatMarkdownHref(value) {
2346
2357
  }
2347
2358
  }
2348
2359
 
2349
- // src/ui/message-response.tsx
2360
+ // src/ui/message-code.tsx
2361
+ var React12 = __toESM(require("react"), 1);
2362
+ var import_lucide_react7 = require("lucide-react");
2363
+
2364
+ // src/ui/code-block.tsx
2365
+ var React10 = __toESM(require("react"), 1);
2366
+ var import_class_variance_authority2 = require("class-variance-authority");
2367
+ var import_lucide_react6 = require("lucide-react");
2350
2368
  var import_jsx_runtime9 = require("react/jsx-runtime");
2369
+ var codeBlockVariants = (0, import_class_variance_authority2.cva)(
2370
+ "a24-code-block",
2371
+ {
2372
+ variants: {
2373
+ variant: {
2374
+ default: "a24-code-block--default",
2375
+ destructive: "a24-code-block--destructive"
2376
+ }
2377
+ },
2378
+ defaultVariants: {
2379
+ variant: "default"
2380
+ }
2381
+ }
2382
+ );
2383
+ function CodeBlock({
2384
+ className,
2385
+ variant = "default",
2386
+ size = "default",
2387
+ ...props
2388
+ }) {
2389
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2390
+ "div",
2391
+ {
2392
+ "data-slot": "code-block",
2393
+ "data-variant": variant,
2394
+ "data-size": size,
2395
+ className: cn(codeBlockVariants({ variant }), className),
2396
+ ...props
2397
+ }
2398
+ );
2399
+ }
2400
+ function CodeBlockHeader({ className, ...props }) {
2401
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2402
+ "div",
2403
+ {
2404
+ "data-slot": "code-block-header",
2405
+ className: cn(
2406
+ "a24-code-block__header",
2407
+ className
2408
+ ),
2409
+ ...props
2410
+ }
2411
+ );
2412
+ }
2413
+ function CodeBlockTitle({ className, ...props }) {
2414
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2415
+ "div",
2416
+ {
2417
+ "data-slot": "code-block-title",
2418
+ className: cn(
2419
+ "a24-code-block__title",
2420
+ className
2421
+ ),
2422
+ ...props
2423
+ }
2424
+ );
2425
+ }
2426
+ function CodeBlockActions({
2427
+ className,
2428
+ ...props
2429
+ }) {
2430
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2431
+ "div",
2432
+ {
2433
+ "data-slot": "code-block-actions",
2434
+ className: cn(
2435
+ "a24-code-block__actions",
2436
+ className
2437
+ ),
2438
+ ...props
2439
+ }
2440
+ );
2441
+ }
2442
+ function CodeBlockCopyButton({
2443
+ value,
2444
+ className,
2445
+ onClick,
2446
+ ...props
2447
+ }) {
2448
+ const [copied, setCopied] = React10.useState(false);
2449
+ React10.useEffect(() => {
2450
+ if (!copied) {
2451
+ return;
2452
+ }
2453
+ const timeout = setTimeout(() => setCopied(false), 2e3);
2454
+ return () => clearTimeout(timeout);
2455
+ }, [copied]);
2456
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2457
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2458
+ "button",
2459
+ {
2460
+ type: "button",
2461
+ "data-slot": "code-block-copy-button",
2462
+ "data-copied": copied || void 0,
2463
+ "aria-label": copied ? "Copied" : "Copy",
2464
+ title: copied ? "Copied" : "Copy code",
2465
+ className: cn("a24-code-block__action", className),
2466
+ onClick: (event) => {
2467
+ onClick?.(event);
2468
+ if (event.defaultPrevented || !navigator.clipboard) return;
2469
+ navigator.clipboard.writeText(value).then(() => setCopied(true)).catch(() => {
2470
+ });
2471
+ },
2472
+ ...props,
2473
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.CheckIcon, { size: 12, strokeWidth: 1.5 }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.CopyIcon, { size: 12, strokeWidth: 1.5 })
2474
+ }
2475
+ ),
2476
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-live": "polite", className: "a24-code-block__announcement", children: copied ? "Copied" : "" })
2477
+ ] });
2478
+ }
2479
+ function CodeBlockWrapButton({
2480
+ wrap,
2481
+ onWrapChange,
2482
+ className,
2483
+ onClick,
2484
+ ...props
2485
+ }) {
2486
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2487
+ "button",
2488
+ {
2489
+ type: "button",
2490
+ "data-slot": "code-block-wrap-button",
2491
+ "aria-label": "Wrap lines",
2492
+ "aria-pressed": wrap,
2493
+ title: wrap ? "Unwrap lines" : "Wrap lines",
2494
+ className: cn("a24-code-block__action", className),
2495
+ onClick: (event) => {
2496
+ onClick?.(event);
2497
+ if (!event.defaultPrevented) onWrapChange(!wrap);
2498
+ },
2499
+ ...props,
2500
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.WrapTextIcon, { size: 12, strokeWidth: 1.5 })
2501
+ }
2502
+ );
2503
+ }
2504
+ function CodeBlockDownloadButton({
2505
+ value,
2506
+ filename = "code.txt",
2507
+ className,
2508
+ onClick,
2509
+ ...props
2510
+ }) {
2511
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2512
+ "button",
2513
+ {
2514
+ type: "button",
2515
+ "data-slot": "code-block-download-button",
2516
+ "aria-label": "Download code",
2517
+ title: "Download code",
2518
+ className: cn("a24-code-block__action", className),
2519
+ onClick: (event) => {
2520
+ onClick?.(event);
2521
+ if (event.defaultPrevented) return;
2522
+ const url = URL.createObjectURL(new Blob([value], { type: "text/plain;charset=utf-8" }));
2523
+ const link = document.createElement("a");
2524
+ link.href = url;
2525
+ link.download = filename;
2526
+ document.body.append(link);
2527
+ link.click();
2528
+ link.remove();
2529
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
2530
+ },
2531
+ ...props,
2532
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.DownloadIcon, { size: 12, strokeWidth: 1.5 })
2533
+ }
2534
+ );
2535
+ }
2536
+ function CodeBlockContent({
2537
+ className,
2538
+ children,
2539
+ style,
2540
+ wrap = false,
2541
+ lineNumbers = false,
2542
+ startLine = 1,
2543
+ ...props
2544
+ }) {
2545
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2546
+ "pre",
2547
+ {
2548
+ "data-slot": "code-block-content",
2549
+ "data-wrap": wrap || void 0,
2550
+ "data-numbered": lineNumbers || void 0,
2551
+ dir: "ltr",
2552
+ tabIndex: 0,
2553
+ style: { counterReset: `line ${startLine - 1}`, ...style },
2554
+ className: cn(
2555
+ "a24-code-block__content",
2556
+ className
2557
+ ),
2558
+ ...props,
2559
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2560
+ "code",
2561
+ {
2562
+ "data-slot": "code-block-code",
2563
+ className: "a24-code-block__code",
2564
+ children: lineNumbers && typeof children === "string" ? children.replace(/\n$/, "").split("\n").map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CodeBlockLine, { children: line }, index)) : children
2565
+ }
2566
+ )
2567
+ }
2568
+ );
2569
+ }
2570
+ var codeBlockLineVariants = (0, import_class_variance_authority2.cva)(
2571
+ "a24-code-block__line",
2572
+ {
2573
+ variants: {
2574
+ variant: {
2575
+ default: "",
2576
+ added: "a24-code-block__line--added",
2577
+ removed: "a24-code-block__line--removed",
2578
+ highlighted: "a24-code-block__line--highlighted"
2579
+ }
2580
+ },
2581
+ defaultVariants: {
2582
+ variant: "default"
2583
+ }
2584
+ }
2585
+ );
2586
+ function CodeBlockLine({
2587
+ className,
2588
+ variant = "default",
2589
+ children,
2590
+ ...props
2591
+ }) {
2592
+ const empty = children === void 0 || children === null || children === "" || Array.isArray(children) && children.length === 0;
2593
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2594
+ "span",
2595
+ {
2596
+ "data-slot": "code-block-line",
2597
+ "data-variant": variant,
2598
+ className: cn(codeBlockLineVariants({ variant }), className),
2599
+ ...props,
2600
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "data-slot": "code-block-line-content", className: "a24-code-block__line-content", children: empty ? "\n" : children })
2601
+ }
2602
+ );
2603
+ }
2604
+ function CodeBlockFooter({ className, ...props }) {
2605
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2606
+ "div",
2607
+ {
2608
+ "data-slot": "code-block-footer",
2609
+ className: cn(
2610
+ "a24-code-block__footer",
2611
+ className
2612
+ ),
2613
+ ...props
2614
+ }
2615
+ );
2616
+ }
2617
+
2618
+ // src/ui/use-highlighted-code.ts
2619
+ var React11 = __toESM(require("react"), 1);
2620
+
2621
+ // src/ui/code-highlighter.tsx
2622
+ var import_core = require("shiki/core");
2623
+ var import_javascript = require("shiki/engine/javascript");
2624
+ var import_langs = require("shiki/langs");
2625
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2626
+ var languageLoaders = {
2627
+ ...import_langs.bundledLanguages,
2628
+ ...import_langs.bundledLanguagesAlias
2629
+ };
2630
+ var highlighter;
2631
+ function getHighlighter() {
2632
+ highlighter ?? (highlighter = (0, import_core.createHighlighterCore)({
2633
+ themes: [
2634
+ import("shiki/themes/github-light.mjs"),
2635
+ import("shiki/themes/github-dark.mjs")
2636
+ ],
2637
+ langs: [],
2638
+ engine: (0, import_javascript.createJavaScriptRegexEngine)({ forgiving: true })
2639
+ }));
2640
+ return highlighter;
2641
+ }
2642
+ function getLanguage(language) {
2643
+ const name = language.toLowerCase();
2644
+ if (name === "ansi") return name;
2645
+ if (Object.prototype.hasOwnProperty.call(languageLoaders, name)) return name;
2646
+ return null;
2647
+ }
2648
+ async function loadHighlighter(language) {
2649
+ const lang = getLanguage(language);
2650
+ if (!lang) {
2651
+ return null;
2652
+ }
2653
+ const shiki = await getHighlighter();
2654
+ if (lang !== "ansi" && !shiki.getLoadedLanguages().includes(lang)) {
2655
+ await shiki.loadLanguage(languageLoaders[lang]);
2656
+ }
2657
+ return {
2658
+ // Returns one React node per line, and the grammar state after the last
2659
+ // line. Pass that state back to continue where the code left off.
2660
+ highlight(code, state) {
2661
+ const tokenize = (text) => shiki.codeToTokens(text, {
2662
+ lang,
2663
+ themes: { light: "github-light", dark: "github-dark" },
2664
+ defaultColor: false,
2665
+ grammarState: state
2666
+ }).tokens;
2667
+ const tokens = lang === "ansi" ? code.split("\n").flatMap((line) => tokenize(line)) : tokenize(code);
2668
+ return {
2669
+ lines: tokens.map(
2670
+ (line) => line.map((token, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2671
+ "span",
2672
+ {
2673
+ style: token.htmlStyle,
2674
+ className: "a24-code-token",
2675
+ children: token.content
2676
+ },
2677
+ index
2678
+ ))
2679
+ ),
2680
+ state: shiki.getLastGrammarState(tokens)
2681
+ };
2682
+ }
2683
+ };
2684
+ }
2685
+
2686
+ // src/ui/use-highlighted-code.ts
2687
+ function useHighlightedCode(value, language) {
2688
+ const code = value.endsWith("\n") ? value.slice(0, -1) : value;
2689
+ const [loaded, setLoaded] = React11.useState(null);
2690
+ const highlighter2 = loaded?.language === language ? loaded.highlighter : null;
2691
+ React11.useEffect(() => {
2692
+ let cancelled = false;
2693
+ loadHighlighter(language).then((next2) => {
2694
+ if (!cancelled) {
2695
+ setLoaded({ language, highlighter: next2 });
2696
+ }
2697
+ }).catch(() => {
2698
+ });
2699
+ return () => {
2700
+ cancelled = true;
2701
+ };
2702
+ }, [language]);
2703
+ const [done, setDone] = React11.useState({ highlighter: null, text: "", lines: [] });
2704
+ let next = done;
2705
+ if (next.highlighter !== highlighter2 || !code.startsWith(next.text)) {
2706
+ next = { highlighter: highlighter2, text: "", lines: [] };
2707
+ }
2708
+ const end = code.lastIndexOf("\n") + 1;
2709
+ if (highlighter2 && end > next.text.length) {
2710
+ const result = highlighter2.highlight(
2711
+ code.slice(next.text.length, end - 1),
2712
+ next.state
2713
+ );
2714
+ next = {
2715
+ highlighter: highlighter2,
2716
+ text: code.slice(0, end),
2717
+ lines: [...next.lines, ...result.lines],
2718
+ state: result.state
2719
+ };
2720
+ }
2721
+ if (next !== done) {
2722
+ setDone(next);
2723
+ }
2724
+ const tail = code.slice(end);
2725
+ return React11.useMemo(() => {
2726
+ if (!highlighter2) {
2727
+ return code.split("\n");
2728
+ }
2729
+ return [...next.lines, highlighter2.highlight(tail, next.state).lines[0]];
2730
+ }, [code, highlighter2, next, tail]);
2731
+ }
2732
+
2733
+ // src/ui/message-code.tsx
2734
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2735
+ var CODE_EXTENSIONS = {
2736
+ bash: "sh",
2737
+ shell: "sh",
2738
+ shellscript: "sh",
2739
+ sh: "sh",
2740
+ zsh: "sh",
2741
+ javascript: "js",
2742
+ js: "js",
2743
+ jsx: "jsx",
2744
+ typescript: "ts",
2745
+ ts: "ts",
2746
+ tsx: "tsx",
2747
+ python: "py",
2748
+ py: "py",
2749
+ ruby: "rb",
2750
+ rust: "rs",
2751
+ rs: "rs",
2752
+ go: "go",
2753
+ java: "java",
2754
+ kotlin: "kt",
2755
+ swift: "swift",
2756
+ c: "c",
2757
+ cpp: "cpp",
2758
+ csharp: "cs",
2759
+ json: "json",
2760
+ jsonc: "jsonc",
2761
+ yaml: "yaml",
2762
+ yml: "yml",
2763
+ toml: "toml",
2764
+ html: "html",
2765
+ xml: "xml",
2766
+ css: "css",
2767
+ scss: "scss",
2768
+ sql: "sql",
2769
+ markdown: "md",
2770
+ md: "md",
2771
+ diff: "diff",
2772
+ text: "txt",
2773
+ plaintext: "txt"
2774
+ };
2775
+ function MessageCodeBlock({ code, language = "text" }) {
2776
+ const [wrap, setWrap] = React12.useState(false);
2777
+ const lines = useHighlightedCode(code, language);
2778
+ const extension = Object.prototype.hasOwnProperty.call(CODE_EXTENSIONS, language.toLowerCase()) ? CODE_EXTENSIONS[language.toLowerCase()] : "txt";
2779
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CodeBlock, { children: [
2780
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CodeBlockHeader, { children: [
2781
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CodeBlockTitle, { children: [
2782
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.FileCode2Icon, { size: 14, strokeWidth: 1.5, "aria-hidden": "true" }),
2783
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: language })
2784
+ ] }),
2785
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CodeBlockActions, { children: [
2786
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockWrapButton, { wrap, onWrapChange: setWrap }),
2787
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockDownloadButton, { value: code, filename: `code.${extension}` }),
2788
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockCopyButton, { value: code })
2789
+ ] })
2790
+ ] }),
2791
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockContent, { "aria-label": `${language} code`, lineNumbers: true, wrap, children: lines.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockLine, { children: line }, index)) })
2792
+ ] });
2793
+ }
2794
+ function MessageMarkdownCode({ children, className, node, ...props }) {
2795
+ const language = className?.match(/(?:^|\s)language-([^\s]+)/)?.[1];
2796
+ const multiline = node?.position?.start?.line !== node?.position?.end?.line;
2797
+ if (props["data-block"] === void 0 && !language && !multiline) {
2798
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("code", { ...props, className: cn("a24-inline-code", className), "data-streamdown": "inline-code", children });
2799
+ }
2800
+ const code = typeof children === "string" ? children.replace(/\n$/, "") : "";
2801
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MessageCodeBlock, { code, language });
2802
+ }
2803
+ function formatMessageJson(text) {
2804
+ const trimmed = text.trim();
2805
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
2806
+ try {
2807
+ JSON.parse(trimmed);
2808
+ } catch {
2809
+ return null;
2810
+ }
2811
+ const tokens = trimmed.match(/"(?:\\.|[^"\\])*"|[{}\[\],:]|[^\s{}\[\],:]+/g) || [];
2812
+ let depth = 0;
2813
+ let result = "";
2814
+ const newline = () => `
2815
+ ${" ".repeat(depth)}`;
2816
+ tokens.forEach((token, index) => {
2817
+ const previous = tokens[index - 1];
2818
+ const next = tokens[index + 1];
2819
+ if (token === "{" || token === "[") {
2820
+ result += token;
2821
+ depth += 1;
2822
+ if (next !== "}" && next !== "]") result += newline();
2823
+ } else if (token === "}" || token === "]") {
2824
+ depth -= 1;
2825
+ if (previous !== "{" && previous !== "[") result += newline();
2826
+ result += token;
2827
+ } else if (token === ",") result += `,${newline()}`;
2828
+ else if (token === ":") result += ": ";
2829
+ else result += token;
2830
+ });
2831
+ return result;
2832
+ }
2833
+
2834
+ // src/ui/message-response.tsx
2835
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2351
2836
  function SafeMarkdownLink({ children, href, ...props }) {
2352
2837
  const domProps = { ...props };
2353
2838
  delete domProps.node;
2354
2839
  const safeHref = safeChatMarkdownHref(href);
2355
- if (!safeHref) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children });
2356
- if (safeHref.startsWith("#")) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("a", { ...domProps, href: safeHref, children });
2357
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("a", { ...domProps, href: safeHref, rel: "noopener noreferrer", target: "_blank", children });
2840
+ if (!safeHref) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children });
2841
+ if (safeHref.startsWith("#")) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", { ...domProps, href: safeHref, children });
2842
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", { ...domProps, href: safeHref, rel: "noopener noreferrer", target: "_blank", children });
2358
2843
  }
2359
2844
  function BlockedMarkdownImage({ alt }) {
2360
- return alt ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-label": `Image blocked: ${alt}`, role: "img", children: alt }) : null;
2845
+ return alt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-label": `Image blocked: ${alt}`, role: "img", children: alt }) : null;
2361
2846
  }
2362
2847
  var BLOCK_MARKDOWN_TAGS = /* @__PURE__ */ new Set([
2363
2848
  "blockquote",
@@ -2378,7 +2863,7 @@ function isMultilineCodeNode(node) {
2378
2863
  return node?.tagName === "code" && node.position?.start?.line !== void 0 && node.position?.end?.line !== void 0 && node.position.start.line !== node.position.end.line;
2379
2864
  }
2380
2865
  function hasBlockMarkdownChild(child) {
2381
- if (!React10.isValidElement(child)) {
2866
+ if (!React13.isValidElement(child)) {
2382
2867
  return false;
2383
2868
  }
2384
2869
  if (typeof child.type === "string" && BLOCK_MARKDOWN_TAGS.has(child.type)) {
@@ -2388,7 +2873,7 @@ function hasBlockMarkdownChild(child) {
2388
2873
  if (BLOCK_MARKDOWN_TAGS.has(props.node?.tagName || "") || isMultilineCodeNode(props.node)) {
2389
2874
  return true;
2390
2875
  }
2391
- return React10.Children.toArray(props.children).some(hasBlockMarkdownChild);
2876
+ return React13.Children.toArray(props.children).some(hasBlockMarkdownChild);
2392
2877
  }
2393
2878
  function MessageMarkdownParagraph({
2394
2879
  children,
@@ -2396,22 +2881,23 @@ function MessageMarkdownParagraph({
2396
2881
  }) {
2397
2882
  const domProps = { ...props };
2398
2883
  delete domProps.node;
2399
- const childArray = React10.Children.toArray(children).filter(
2884
+ const childArray = React13.Children.toArray(children).filter(
2400
2885
  (child) => child !== null && child !== ""
2401
2886
  );
2402
- const isImageOnly = childArray.length === 1 && React10.isValidElement(childArray[0]) && childArray[0].props.node?.tagName === "img";
2887
+ const isImageOnly = childArray.length === 1 && React13.isValidElement(childArray[0]) && childArray[0].props.node?.tagName === "img";
2403
2888
  if (isImageOnly) {
2404
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children });
2889
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children });
2405
2890
  }
2406
2891
  if (childArray.some(hasBlockMarkdownChild)) {
2407
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ...domProps, children });
2892
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ...domProps, children });
2408
2893
  }
2409
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { ...domProps, children });
2894
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { ...domProps, children });
2410
2895
  }
2411
2896
  var MESSAGE_RESPONSE_COMPONENTS = {
2412
2897
  a: SafeMarkdownLink,
2413
2898
  img: BlockedMarkdownImage,
2414
- p: MessageMarkdownParagraph
2899
+ p: MessageMarkdownParagraph,
2900
+ code: MessageMarkdownCode
2415
2901
  };
2416
2902
  var streamdownDefaultRehypePlugins = import_streamdown.defaultRehypePlugins || {};
2417
2903
  var streamdownHardenPlugin = Array.isArray(
@@ -2426,7 +2912,7 @@ var MESSAGE_RESPONSE_REHYPE_PLUGINS = [
2426
2912
  ]
2427
2913
  ] : []
2428
2914
  ];
2429
- var MessageResponse = React10.memo(
2915
+ var MessageResponse = React13.memo(
2430
2916
  ({
2431
2917
  children,
2432
2918
  className,
@@ -2444,11 +2930,21 @@ var MessageResponse = React10.memo(
2444
2930
  maxCatchupChars: 32,
2445
2931
  text
2446
2932
  });
2447
- const streamdownComponents = React10.useMemo(
2933
+ const streamdownComponents = React13.useMemo(
2448
2934
  () => ({ ...MESSAGE_RESPONSE_COMPONENTS, ...components }),
2449
2935
  [components]
2450
2936
  );
2451
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2937
+ const json = React13.useMemo(() => formatMessageJson(text), [text]);
2938
+ if (json !== null && !components?.code) {
2939
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("a24-message-response", className), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2940
+ MessageCodeBlock,
2941
+ {
2942
+ code: streaming || streamingText.isAnimating ? streamingText.displayedText : json,
2943
+ language: "json"
2944
+ }
2945
+ ) });
2946
+ }
2947
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2452
2948
  import_streamdown.Streamdown,
2453
2949
  {
2454
2950
  className: cn("a24-message-response", className),
@@ -2500,10 +2996,10 @@ function resolvedHitlLabel(part) {
2500
2996
  }
2501
2997
 
2502
2998
  // src/ui/tool-sessions.tsx
2503
- var React11 = __toESM(require("react"), 1);
2504
- var import_lucide_react6 = require("lucide-react");
2999
+ var React14 = __toESM(require("react"), 1);
3000
+ var import_lucide_react8 = require("lucide-react");
2505
3001
  var import_thinking_orbs = require("thinking-orbs");
2506
- var import_jsx_runtime10 = require("react/jsx-runtime");
3002
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2507
3003
  function toolSlotContext(isActive2, label, part, slots) {
2508
3004
  return {
2509
3005
  isActive: isActive2,
@@ -2521,7 +3017,7 @@ function ToolResourceAction({ context }) {
2521
3017
  const target = context.resourceTargets[0];
2522
3018
  if (!target) return null;
2523
3019
  const name = resourceTargetName(target);
2524
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3020
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2525
3021
  "button",
2526
3022
  {
2527
3023
  "aria-label": `Open ${target.kind} ${target.path}`,
@@ -2535,8 +3031,8 @@ function ToolResourceAction({ context }) {
2535
3031
  );
2536
3032
  }
2537
3033
  function toolAccessory(context, slots) {
2538
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2539
- slots?.onResourceAction ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolResourceAction, { context }) : null,
3034
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3035
+ slots?.onResourceAction ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolResourceAction, { context }) : null,
2540
3036
  slots?.renderToolAccessory?.(context)
2541
3037
  ] });
2542
3038
  }
@@ -2613,12 +3109,12 @@ function ToolActivityReel({
2613
3109
  }) {
2614
3110
  const initial = initialLabel && initialLabel !== label ? initialLabel : label;
2615
3111
  const parsedInitialShownAt = initialShownAt ? Date.parse(initialShownAt) : Number.NaN;
2616
- const [displayed, setDisplayed] = React11.useState(initial);
2617
- const [previous, setPrevious] = React11.useState(null);
2618
- const displayedRef = React11.useRef(initial);
2619
- const latestRef = React11.useRef(label);
2620
- const shownAtRef = React11.useRef(Number.isFinite(parsedInitialShownAt) ? parsedInitialShownAt : Date.now());
2621
- React11.useEffect(() => {
3112
+ const [displayed, setDisplayed] = React14.useState(initial);
3113
+ const [previous, setPrevious] = React14.useState(null);
3114
+ const displayedRef = React14.useRef(initial);
3115
+ const latestRef = React14.useRef(label);
3116
+ const shownAtRef = React14.useRef(Number.isFinite(parsedInitialShownAt) ? parsedInitialShownAt : Date.now());
3117
+ React14.useEffect(() => {
2622
3118
  latestRef.current = label;
2623
3119
  if (displayedRef.current === label) return;
2624
3120
  const showLatest = () => {
@@ -2638,18 +3134,18 @@ function ToolActivityReel({
2638
3134
  const timer = window.setTimeout(showLatest, remaining);
2639
3135
  return () => window.clearTimeout(timer);
2640
3136
  }, [label]);
2641
- React11.useEffect(() => {
3137
+ React14.useEffect(() => {
2642
3138
  if (!previous) return;
2643
3139
  const timer = window.setTimeout(() => setPrevious(null), 200);
2644
3140
  return () => window.clearTimeout(timer);
2645
3141
  }, [previous]);
2646
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "a24-tool-reel", "aria-live": announce ? "polite" : "off", children: [
2647
- previous ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", className: "a24-tool-reel__previous", children: previous }) : null,
2648
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: previous ? "a24-tool-reel__current" : void 0, children: displayed })
3142
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "a24-tool-reel", "aria-live": announce ? "polite" : "off", children: [
3143
+ previous ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", className: "a24-tool-reel__previous", children: previous }) : null,
3144
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: previous ? "a24-tool-reel__current" : void 0, children: displayed })
2649
3145
  ] });
2650
3146
  }
2651
3147
  function ToolActivityOrb({ label = "Working", kind = "tool", part, renderActivityIcon }) {
2652
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-orb", children: renderActivityIcon ? renderActivityIcon({ label, kind, part }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_thinking_orbs.ThinkingOrb, { "aria-label": label, size: 20, speed: 0.8, state: "searching" }) });
3148
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-orb", children: renderActivityIcon ? renderActivityIcon({ label, kind, part }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_thinking_orbs.ThinkingOrb, { "aria-label": label, size: 20, speed: 0.8, state: "searching" }) });
2653
3149
  }
2654
3150
  function AgentChatActivityRow({
2655
3151
  label,
@@ -2657,22 +3153,22 @@ function AgentChatActivityRow({
2657
3153
  renderActivityIcon,
2658
3154
  onSelect
2659
3155
  }) {
2660
- const content = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2661
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityOrb, { label, kind: "planning", renderActivityIcon }),
2662
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-trigger__label a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityReel, { label }) })
3156
+ const content = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3157
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label, kind: "planning", renderActivityIcon }),
3158
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityReel, { label }) })
2663
3159
  ] });
2664
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "a24-tool-trigger-row a24-tool-trigger-row--root", "data-agents24-model-turn": modelTurnId, role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", onClick: onSelect, type: "button", children: content }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", children: content }) });
3160
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-trigger-row a24-tool-trigger-row--root", "data-agents24-model-turn": modelTurnId, role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", onClick: onSelect, type: "button", children: content }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", children: content }) });
2665
3161
  }
2666
3162
  function AgentChatModelTurnRow({ part }) {
2667
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AgentChatActivityRow, { label: "Planning next moves", modelTurnId: part.modelTurnId });
3163
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AgentChatActivityRow, { label: "Planning next moves", modelTurnId: part.modelTurnId });
2668
3164
  }
2669
3165
  function AgentChatNodeActivityRow({
2670
3166
  renderActivityIcon,
2671
3167
  onSelect,
2672
3168
  part
2673
3169
  }) {
2674
- const [open, setOpen] = React11.useState(false);
2675
- const contentId = React11.useId();
3170
+ const [open, setOpen] = React14.useState(false);
3171
+ const contentId = React14.useId();
2676
3172
  const running = part.status === "running";
2677
3173
  const failed = part.status === "failed";
2678
3174
  const failureMessage = part.failure?.message || "The node could not complete the request.";
@@ -2683,18 +3179,18 @@ function AgentChatNodeActivityRow({
2683
3179
  running && "a24-tool-trigger--active",
2684
3180
  failed && "a24-tool-trigger--error"
2685
3181
  );
2686
- const label = running ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityReel, { label: part.label }) }) : part.label;
3182
+ const label = running ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityReel, { label: part.label }) }) : part.label;
2687
3183
  if (!failed) {
2688
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "a24-tool-trigger-row", role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
2689
- running ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
2690
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-trigger__label", children: label })
2691
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: triggerClassName, children: [
2692
- running ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
2693
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3184
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-trigger-row", role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
3185
+ running ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
3186
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3187
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: triggerClassName, children: [
3188
+ running ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
3189
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label })
2694
3190
  ] }) });
2695
3191
  }
2696
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "a24-tool-disclosure", children: [
2697
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "a24-tool-trigger-row", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3192
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "a24-tool-disclosure", children: [
3193
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-trigger-row", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2698
3194
  "button",
2699
3195
  {
2700
3196
  "aria-controls": contentId,
@@ -2706,12 +3202,12 @@ function AgentChatNodeActivityRow({
2706
3202
  },
2707
3203
  type: "button",
2708
3204
  children: [
2709
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-trigger__label", children: label }),
2710
- open ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.ChevronDown, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.ChevronRight, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
3205
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label }),
3206
+ open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ChevronDown, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ChevronRight, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
2711
3207
  ]
2712
3208
  }
2713
3209
  ) }),
2714
- open ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "a24-tool-detail a24-tool-detail--error", id: contentId, children: failureMessage }) : null
3210
+ open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-detail a24-tool-detail--error", id: contentId, children: failureMessage }) : null
2715
3211
  ] });
2716
3212
  }
2717
3213
  function toolRowLabel(part, separateResource = false) {
@@ -2738,25 +3234,25 @@ function ToolDisclosure({
2738
3234
  renderActivityIcon,
2739
3235
  accessory
2740
3236
  }) {
2741
- const [open, setOpen] = React11.useState(false);
2742
- const contentId = React11.useId();
2743
- const expandable = React11.Children.toArray(children).length > 0;
3237
+ const [open, setOpen] = React14.useState(false);
3238
+ const contentId = React14.useId();
3239
+ const expandable = React14.Children.toArray(children).length > 0;
2744
3240
  if (!expandable) {
2745
3241
  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");
2746
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
2747
- onSelect && part ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
2748
- showOrb ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2749
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-trigger__label", children: label })
2750
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: triggerClassName, children: [
2751
- showOrb ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2752
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3242
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
3243
+ onSelect && part ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
3244
+ showOrb ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3245
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3246
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: triggerClassName, children: [
3247
+ showOrb ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3248
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label })
2753
3249
  ] }),
2754
3250
  accessory
2755
3251
  ] });
2756
3252
  }
2757
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "a24-tool-disclosure", children: [
2758
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
2759
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3253
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "a24-tool-disclosure", children: [
3254
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
3255
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2760
3256
  "button",
2761
3257
  {
2762
3258
  "aria-controls": contentId,
@@ -2770,25 +3266,25 @@ function ToolDisclosure({
2770
3266
  },
2771
3267
  type: "button",
2772
3268
  children: [
2773
- showOrb ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
2774
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-trigger__label", children: label }),
2775
- open ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.ChevronDown, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.ChevronRight, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
3269
+ showOrb ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3270
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label }),
3271
+ open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ChevronDown, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ChevronRight, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
2776
3272
  ]
2777
3273
  }
2778
3274
  ),
2779
3275
  accessory
2780
3276
  ] }),
2781
- open ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "a24-tool-disclosure__content", id: contentId, children }) : null
3277
+ open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-disclosure__content", id: contentId, children }) : null
2782
3278
  ] });
2783
3279
  }
2784
3280
  function ToolLabel({ active, label, part, slots }) {
2785
3281
  const rendered = slots?.renderToolLabel?.(toolSlotContext(active, label, part, slots)) ?? label;
2786
- return active ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-tool-shimmer", children: rendered }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: rendered });
3282
+ return active ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-shimmer", children: rendered }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: rendered });
2787
3283
  }
2788
3284
  function ToolList({ children }) {
2789
- const listRef = React11.useRef(null);
2790
- const [fades, setFades] = React11.useState({ bottom: false, top: false });
2791
- const updateFades = React11.useCallback(() => {
3285
+ const listRef = React14.useRef(null);
3286
+ const [fades, setFades] = React14.useState({ bottom: false, top: false });
3287
+ const updateFades = React14.useCallback(() => {
2792
3288
  const list = listRef.current;
2793
3289
  if (!list) return;
2794
3290
  const next = {
@@ -2797,7 +3293,7 @@ function ToolList({ children }) {
2797
3293
  };
2798
3294
  setFades((current) => current.bottom === next.bottom && current.top === next.top ? current : next);
2799
3295
  }, []);
2800
- React11.useEffect(() => {
3296
+ React14.useEffect(() => {
2801
3297
  updateFades();
2802
3298
  const list = listRef.current;
2803
3299
  if (!list || typeof ResizeObserver === "undefined") return;
@@ -2805,13 +3301,13 @@ function ToolList({ children }) {
2805
3301
  observer.observe(list);
2806
3302
  return () => observer.disconnect();
2807
3303
  }, [children, updateFades]);
2808
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3304
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2809
3305
  "div",
2810
3306
  {
2811
3307
  className: "a24-tool-list-frame",
2812
3308
  "data-scroll-fade-bottom": fades.bottom ? "" : void 0,
2813
3309
  "data-scroll-fade-top": fades.top ? "" : void 0,
2814
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "a24-tool-list", onScroll: updateFades, ref: listRef, role: "list", children })
3310
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-list", onScroll: updateFades, ref: listRef, role: "list", children })
2815
3311
  }
2816
3312
  );
2817
3313
  }
@@ -2828,13 +3324,13 @@ function AgentChatToolRow({
2828
3324
  const detail = failed ? failureMessage : optionalText(part.presentation.detail);
2829
3325
  const hostDetails = failed ? null : slots?.renderToolDetails?.(part);
2830
3326
  const context = toolSlotContext(active, toolRowLabel(part, Boolean(slots?.onResourceAction)), part, slots);
2831
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { "data-agents24-tool-part": part.type, "data-state": part.state, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3327
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-agents24-tool-part": part.type, "data-state": part.state, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2832
3328
  ToolDisclosure,
2833
3329
  {
2834
3330
  renderActivityIcon: slots?.renderActivityIcon,
2835
3331
  error: failed,
2836
3332
  accessory: toolAccessory(context, slots),
2837
- label: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolLabel, { active, label: context.label, part, slots }),
3333
+ label: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolLabel, { active, label: context.label, part, slots }),
2838
3334
  loading: active,
2839
3335
  onExpandedChange: slots?.onExpandedChange,
2840
3336
  onSelect: slots?.onToolSelect,
@@ -2843,7 +3339,7 @@ function AgentChatToolRow({
2843
3339
  showOrb: showOrb ?? active,
2844
3340
  statusLabel: active ? context.label : void 0,
2845
3341
  children: [
2846
- detail ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("a24-tool-detail", failed && "a24-tool-detail--error"), children: detail }) : null,
3342
+ detail ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("a24-tool-detail", failed && "a24-tool-detail--error"), children: detail }) : null,
2847
3343
  hostDetails
2848
3344
  ]
2849
3345
  }
@@ -2863,19 +3359,19 @@ function AgentChatToolSession({
2863
3359
  parts,
2864
3360
  slots
2865
3361
  }) {
2866
- const presentedLiveRef = React11.useRef(false);
3362
+ const presentedLiveRef = React14.useRef(false);
2867
3363
  if (isLive && isLatestActivity) presentedLiveRef.current = true;
2868
3364
  const activeIndex = parts.findLastIndex((part) => isActive(part, activeToolId));
2869
3365
  const running = activeIndex >= 0;
2870
- if (parts.length === 1 && !modelTurn && !leadingModelTurn) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AgentChatToolRow, { activeToolId, part: parts[0], slots });
3366
+ if (parts.length === 1 && !modelTurn && !leadingModelTurn) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AgentChatToolRow, { activeToolId, part: parts[0], slots });
2871
3367
  const visibleIndex = running ? activeIndex : parts.length - 1;
2872
3368
  const visiblePart = parts[visibleIndex];
2873
3369
  const planning = Boolean(modelTurn);
2874
3370
  const presentingActivity = isLatestActivity && (planning || running || isLive);
2875
3371
  const failed = isLatestActivity && (visiblePart.state === "output-error" || visiblePart.state === "cancelled");
2876
3372
  const label = planning ? "Planning next moves" : isLive && isLatestActivity ? toolRowLabel(visiblePart, true) : sessionLabel(parts, visiblePart, running);
2877
- const labelContent = presentedLiveRef.current ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityReel, { initialLabel: leadingModelTurn ? "Planning next moves" : void 0, initialShownAt: leadingModelTurn?.timestamp, label }) }) : label;
2878
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3373
+ const labelContent = presentedLiveRef.current ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityReel, { initialLabel: leadingModelTurn ? "Planning next moves" : void 0, initialShownAt: leadingModelTurn?.timestamp, label }) }) : label;
3374
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2879
3375
  ToolDisclosure,
2880
3376
  {
2881
3377
  renderActivityIcon: slots?.renderActivityIcon,
@@ -2888,7 +3384,7 @@ function AgentChatToolSession({
2888
3384
  root: true,
2889
3385
  showOrb: isLive && isLatestActivity,
2890
3386
  statusLabel: planning ? "Planning next moves" : label,
2891
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolList, { children: parts.map((part) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { role: "listitem", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AgentChatToolRow, { activeToolId, part, root: false, showOrb: false, slots }) }, part.id)) })
3387
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolList, { children: parts.map((part) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { role: "listitem", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AgentChatToolRow, { activeToolId, part, root: false, showOrb: false, slots }) }, part.id)) })
2892
3388
  }
2893
3389
  );
2894
3390
  }
@@ -2909,7 +3405,7 @@ function subagentLabel(part) {
2909
3405
  return { label: `Agent ${name}, ran ${children.length} ${children.length === 1 ? "tool" : "tools"}`, running: false };
2910
3406
  }
2911
3407
  function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part, slots }) {
2912
- const presentedLiveRef = React11.useRef(false);
3408
+ const presentedLiveRef = React14.useRef(false);
2913
3409
  if (isLive && isLatestActivity) presentedLiveRef.current = true;
2914
3410
  const children = part.presentation.childTools || [];
2915
3411
  const state = subagentLabel(part);
@@ -2918,9 +3414,9 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
2918
3414
  const hostDetails = failed ? null : slots?.renderToolDetails?.(part);
2919
3415
  const failureMessage = part.failure?.message || null;
2920
3416
  const presentingActivity = isLatestActivity && state.running;
2921
- const labelContent = presentedLiveRef.current ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolActivityReel, { label: state.label }) }) : state.label;
3417
+ const labelContent = presentedLiveRef.current ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityReel, { label: state.label }) }) : state.label;
2922
3418
  const context = toolSlotContext(presentingActivity, state.label, part, slots);
2923
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3419
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2924
3420
  ToolDisclosure,
2925
3421
  {
2926
3422
  renderActivityIcon: slots?.renderActivityIcon,
@@ -2934,12 +3430,12 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
2934
3430
  root: true,
2935
3431
  showOrb: isLive && isLatestActivity,
2936
3432
  statusLabel: state.label,
2937
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(ToolList, { children: [
2938
- children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("a24-child-tool", child.status === "failed" && "a24-child-tool--error"), role: "listitem", children: slots?.renderChildTool?.(child, part) ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2939
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn(isLive && isLatestActivity && child.status === "running" && "a24-tool-shimmer"), children: childLabel(child) }),
2940
- child.detail ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "a24-child-tool__detail", children: child.detail }) : null
3433
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(ToolList, { children: [
3434
+ children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("a24-child-tool", child.status === "failed" && "a24-child-tool--error"), role: "listitem", children: slots?.renderChildTool?.(child, part) ?? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3435
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: cn(isLive && isLatestActivity && child.status === "running" && "a24-tool-shimmer"), children: childLabel(child) }),
3436
+ child.detail ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-child-tool__detail", children: child.detail }) : null
2941
3437
  ] }) }, child.id)),
2942
- failureMessage ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "a24-tool-detail a24-tool-detail--error", children: failureMessage }) : null,
3438
+ failureMessage ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-detail a24-tool-detail--error", children: failureMessage }) : null,
2943
3439
  hostDetails
2944
3440
  ] })
2945
3441
  }
@@ -2947,24 +3443,24 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
2947
3443
  }
2948
3444
 
2949
3445
  // src/ui/agent-response-timeline.tsx
2950
- var import_jsx_runtime11 = require("react/jsx-runtime");
3446
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2951
3447
  function isInternalAskUserTool(part) {
2952
3448
  return [part.toolName, part.toolKey, part.action].some((value) => value?.trim().toLowerCase() === "runtime__ask_user");
2953
3449
  }
2954
3450
  function Shimmer({ children, className }) {
2955
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: cn("inline-block animate-pulse", className), children });
3451
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: cn("inline-block animate-pulse", className), children });
2956
3452
  }
2957
3453
  function AgentChatToolPart({
2958
3454
  activeToolId,
2959
3455
  part
2960
3456
  }) {
2961
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatToolRow, { activeToolId, part });
3457
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolRow, { activeToolId, part });
2962
3458
  }
2963
3459
  function AgentChatToolGroup({
2964
3460
  activeToolId,
2965
3461
  parts
2966
3462
  }) {
2967
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatToolSession, { activeToolId, parts });
3463
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolSession, { activeToolId, parts });
2968
3464
  }
2969
3465
  function HitlPartRow({
2970
3466
  getHitlActionState,
@@ -2973,12 +3469,12 @@ function HitlPartRow({
2973
3469
  part
2974
3470
  }) {
2975
3471
  const state = getHitlActionState?.(part);
2976
- const [comment, setComment] = React12.useState("");
3472
+ const [comment, setComment] = React15.useState("");
2977
3473
  const presentation = part.presentation || {};
2978
3474
  const requireComment = presentation.require_comment === true;
2979
3475
  const isTerminal = part.status !== "pending";
2980
3476
  if (part.hitlKind === "user_input") {
2981
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3477
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2982
3478
  AskUserInteraction,
2983
3479
  {
2984
3480
  error: state?.error,
@@ -2996,9 +3492,9 @@ function HitlPartRow({
2996
3492
  );
2997
3493
  }
2998
3494
  if (isTerminal) return null;
2999
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "a24-hitl space-y-2.5 px-1 py-2", children: [
3000
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "a24-hitl__title text-sm font-medium text-foreground text-pretty", children: hitlTitle(part) }),
3001
- requireComment ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3495
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "a24-hitl space-y-2.5 px-1 py-2", children: [
3496
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-hitl__title text-sm font-medium text-foreground text-pretty", children: hitlTitle(part) }),
3497
+ requireComment ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3002
3498
  "textarea",
3003
3499
  {
3004
3500
  "aria-label": "Approval comment",
@@ -3010,8 +3506,8 @@ function HitlPartRow({
3010
3506
  value: comment
3011
3507
  }
3012
3508
  ) : null,
3013
- state?.error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "a24-hitl__error text-sm text-destructive", children: state.error }) : null,
3014
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "a24-hitl__actions flex flex-wrap items-center gap-1.5", children: part.allowedActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3509
+ state?.error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-hitl__error text-sm text-destructive", children: state.error }) : null,
3510
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-hitl__actions flex flex-wrap items-center gap-1.5", children: part.allowedActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3015
3511
  "button",
3016
3512
  {
3017
3513
  "aria-label": hitlActionLabel(part, action),
@@ -3044,7 +3540,7 @@ function AgentChatPart({
3044
3540
  toolSlots
3045
3541
  }) {
3046
3542
  if (part.kind === "text") {
3047
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3543
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3048
3544
  MessageResponse,
3049
3545
  {
3050
3546
  ...responseProps,
@@ -3054,23 +3550,23 @@ function AgentChatPart({
3054
3550
  }
3055
3551
  );
3056
3552
  }
3057
- if (part.kind === "tool") return isAgentChatSubagent(part) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatSubagentGroup, { part, slots: toolSlots }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatToolRow, { activeToolId, part, slots: toolSlots });
3058
- if (part.kind === "model-turn") return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatModelTurnRow, { part });
3553
+ if (part.kind === "tool") return isAgentChatSubagent(part) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatSubagentGroup, { part, slots: toolSlots }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolRow, { activeToolId, part, slots: toolSlots });
3554
+ if (part.kind === "model-turn") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatModelTurnRow, { part });
3059
3555
  if (part.kind === "reasoning") {
3060
3556
  const label = part.text || part.label || "Thinking";
3061
- return part.status === "running" || part.status === "streaming" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Shimmer, { className: "text-sm text-muted-foreground", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "text-sm text-muted-foreground", children: label });
3557
+ return part.status === "running" || part.status === "streaming" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Shimmer, { className: "text-sm text-muted-foreground", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-sm text-muted-foreground", children: label });
3062
3558
  }
3063
3559
  if (part.kind === "context-compression") {
3064
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatContextCompressionRow, { part });
3560
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatContextCompressionRow, { part });
3065
3561
  }
3066
3562
  if (part.kind === "ui-blocks") {
3067
3563
  if (part.state === "output-error") {
3068
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", children: part.errorText || "Failed to render UI content." });
3564
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", children: part.errorText || "Failed to render UI content." });
3069
3565
  }
3070
- return part.bundle ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SafeUiBlocks, { bundle: part.bundle }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "text-sm text-muted-foreground", children: part.state === "input-streaming" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Shimmer, { children: "Rendering UI block" }) : "Rendered UI block" });
3566
+ return part.bundle ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SafeUiBlocks, { bundle: part.bundle }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-sm text-muted-foreground", children: part.state === "input-streaming" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Shimmer, { children: "Rendering UI block" }) : "Rendered UI block" });
3071
3567
  }
3072
3568
  if (part.kind === "hitl") {
3073
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3569
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3074
3570
  HitlPartRow,
3075
3571
  {
3076
3572
  getHitlActionState,
@@ -3080,18 +3576,18 @@ function AgentChatPart({
3080
3576
  }
3081
3577
  );
3082
3578
  }
3083
- if (part.kind === "error") return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", role: "alert", children: part.errorText });
3579
+ if (part.kind === "error") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", role: "alert", children: part.errorText });
3084
3580
  if (part.kind === "source") {
3085
3581
  const href = safeExternalUrl(part.url);
3086
- return href ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { className: "a24-source-link", href, rel: "noopener noreferrer", target: "_blank", children: part.title }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "a24-source-link", children: part.title });
3582
+ return href ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { className: "a24-source-link", href, rel: "noopener noreferrer", target: "_blank", children: part.title }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-source-link", children: part.title });
3087
3583
  }
3088
3584
  if (part.kind === "citation") {
3089
3585
  const href = safeExternalUrl(part.url);
3090
3586
  const label = part.label || "Citation";
3091
- return href ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { className: "a24-citation", href, rel: "noopener noreferrer", target: "_blank", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "a24-citation", children: label });
3587
+ return href ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { className: "a24-citation", href, rel: "noopener noreferrer", target: "_blank", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-citation", children: label });
3092
3588
  }
3093
- if (part.kind === "attachment") return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "a24-output-attachment", children: part.attachment.filename || "Attachment" });
3094
- if (part.kind === "data") return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { "data-agents24-data-part": part.name, className: "hidden", children: message.id });
3589
+ if (part.kind === "attachment") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-output-attachment", children: part.attachment.filename || "Attachment" });
3590
+ if (part.kind === "data") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-agents24-data-part": part.name, className: "hidden", children: message.id });
3095
3591
  return null;
3096
3592
  }
3097
3593
  function safeExternalUrl(value) {
@@ -3105,28 +3601,28 @@ function safeExternalUrl(value) {
3105
3601
  }
3106
3602
  function SafeUiBlocks({ bundle }) {
3107
3603
  const rows = Array.isArray(bundle.rows) ? bundle.rows : [];
3108
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { "aria-label": typeof bundle.title === "string" ? bundle.title : "Agent result", className: "a24-ui-blocks", children: [
3109
- typeof bundle.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { children: bundle.title }) : null,
3604
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { "aria-label": typeof bundle.title === "string" ? bundle.title : "Agent result", className: "a24-ui-blocks", children: [
3605
+ typeof bundle.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { children: bundle.title }) : null,
3110
3606
  rows.map((rawRow, rowIndex) => {
3111
3607
  const row = rawRow && typeof rawRow === "object" && !Array.isArray(rawRow) ? rawRow : {};
3112
3608
  const blocks = Array.isArray(row.blocks) ? row.blocks : [];
3113
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "a24-ui-blocks__row", children: blocks.map((rawBlock, blockIndex) => {
3609
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-ui-blocks__row", children: blocks.map((rawBlock, blockIndex) => {
3114
3610
  const block = rawBlock && typeof rawBlock === "object" && !Array.isArray(rawBlock) ? rawBlock : {};
3115
3611
  const title = typeof block.title === "string" ? block.title : "Result";
3116
3612
  const kind = String(block.kind || "note");
3117
3613
  if (kind === "table" && Array.isArray(block.columns) && Array.isArray(block.rows)) {
3118
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "a24-ui-block", children: [
3119
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h4", { children: title }),
3120
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "a24-ui-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { children: [
3121
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: block.columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { children: String(column) }, index)) }) }),
3122
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tbody", { children: block.rows.map((rawCells, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: (Array.isArray(rawCells) ? rawCells : []).map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { children: String(cell) }, cellIndex)) }, index)) })
3614
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "a24-ui-block", children: [
3615
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { children: title }),
3616
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-ui-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { children: [
3617
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: block.columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { children: String(column) }, index)) }) }),
3618
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: block.rows.map((rawCells, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: (Array.isArray(rawCells) ? rawCells : []).map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { children: String(cell) }, cellIndex)) }, index)) })
3123
3619
  ] }) })
3124
3620
  ] }, String(block.id || blockIndex));
3125
3621
  }
3126
3622
  const value = block.value ?? block.text ?? "";
3127
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "a24-ui-block", children: [
3128
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h4", { children: title }),
3129
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: String(value) })
3623
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "a24-ui-block", children: [
3624
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { children: title }),
3625
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: String(value) })
3130
3626
  ] }, String(block.id || blockIndex));
3131
3627
  }) }, `row-${rowIndex}`);
3132
3628
  })
@@ -3160,38 +3656,38 @@ function AgentResponseTimeline({
3160
3656
  if (segment.kind === "tool") {
3161
3657
  const isLatestActivity = segmentIndex === segments.length - 1;
3162
3658
  const showOrb = toolViewMode === "closed" ? isLoading && isLatestActivity : Boolean(activeToolId && (segment.part.id === activeToolId || segment.part.toolCallId === activeToolId));
3163
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatToolRow, { activeToolId, part: segment.part, showOrb, slots: toolSlots }, segment.part.id));
3659
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolRow, { activeToolId, part: segment.part, showOrb, slots: toolSlots }, segment.part.id));
3164
3660
  continue;
3165
3661
  }
3166
3662
  if (segment.kind === "tool-session") {
3167
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(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}`));
3663
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(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}`));
3168
3664
  continue;
3169
3665
  }
3170
3666
  if (segment.kind === "subagent") {
3171
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatSubagentGroup, { isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, part: segment.part, slots: toolSlots }, segment.part.id));
3667
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatSubagentGroup, { isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, part: segment.part, slots: toolSlots }, segment.part.id));
3172
3668
  continue;
3173
3669
  }
3174
3670
  const part = segment.part;
3175
3671
  if (part.kind === "model-turn") {
3176
3672
  const key = activeActivityClaimed ? part.id : `${message.id}-active-activity`;
3177
3673
  activeActivityClaimed = true;
3178
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Planning next moves", modelTurnId: part.modelTurnId }, key));
3674
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Planning next moves", modelTurnId: part.modelTurnId }, key));
3179
3675
  continue;
3180
3676
  }
3181
3677
  if (part.kind === "node-activity") {
3182
3678
  const key = activeActivityClaimed ? part.id : `${message.id}-active-activity`;
3183
3679
  if (part.status === "running") activeActivityClaimed = true;
3184
3680
  rendered.push(
3185
- part.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: part.label, onSelect: onNodeSelect ? () => onNodeSelect(part) : void 0 }, key) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatNodeActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, onSelect: onNodeSelect, part }, part.id)
3681
+ part.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: part.label, onSelect: onNodeSelect ? () => onNodeSelect(part) : void 0 }, key) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatNodeActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, onSelect: onNodeSelect, part }, part.id)
3186
3682
  );
3187
3683
  continue;
3188
3684
  }
3189
3685
  if (part.kind === "ui-blocks" && renderUiBlocks) {
3190
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(React12.Fragment, { children: renderUiBlocks(part) }, part.id));
3686
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(React15.Fragment, { children: renderUiBlocks(part) }, part.id));
3191
3687
  continue;
3192
3688
  }
3193
3689
  rendered.push(
3194
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(React12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3690
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(React15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3195
3691
  AgentChatPart,
3196
3692
  {
3197
3693
  activeToolId,
@@ -3208,16 +3704,16 @@ function AgentResponseTimeline({
3208
3704
  );
3209
3705
  }
3210
3706
  if (rendered.length === 0 && message.content) {
3211
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MessageResponse, { children: message.content }, `${message.id}-fallback`));
3707
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageResponse, { children: message.content }, `${message.id}-fallback`));
3212
3708
  }
3213
3709
  if (rendered.length === 0 && isLoading) {
3214
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Thinking" }, `${message.id}-active-activity`));
3710
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Thinking" }, `${message.id}-active-activity`));
3215
3711
  }
3216
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "space-y-3", children: rendered });
3712
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "space-y-3", children: rendered });
3217
3713
  }
3218
3714
 
3219
3715
  // src/ui/agent-chat-message.tsx
3220
- var import_jsx_runtime12 = require("react/jsx-runtime");
3716
+ var import_jsx_runtime15 = require("react/jsx-runtime");
3221
3717
  var DEFAULT_USER_MESSAGE_COLLAPSE_THRESHOLD = 360;
3222
3718
  var DEFAULT_USER_MESSAGE_COLLAPSED_LINES = 4;
3223
3719
  function shouldCollapseUserMessage(content, threshold = DEFAULT_USER_MESSAGE_COLLAPSE_THRESHOLD) {
@@ -3230,19 +3726,19 @@ function AgentChatUserMessageContent({
3230
3726
  showLessLabel = "Show less",
3231
3727
  showMoreLabel = "Show more"
3232
3728
  }) {
3233
- const [isExpanded, setIsExpanded] = React13.useState(false);
3234
- const contentId = React13.useId();
3729
+ const [isExpanded, setIsExpanded] = React16.useState(false);
3730
+ const contentId = React16.useId();
3235
3731
  const shouldCollapse = shouldCollapseUserMessage(content, collapseThreshold);
3236
- const Icon = isExpanded ? import_lucide_react7.ChevronUp : import_lucide_react7.ChevronDown;
3732
+ const Icon = isExpanded ? import_lucide_react9.ChevronUp : import_lucide_react9.ChevronDown;
3237
3733
  const clampedStyle = shouldCollapse && !isExpanded ? {
3238
3734
  WebkitBoxOrient: "vertical",
3239
3735
  WebkitLineClamp: Math.max(1, collapsedLines),
3240
3736
  display: "-webkit-box",
3241
3737
  overflow: "hidden"
3242
3738
  } : void 0;
3243
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3244
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { id: contentId, className: "min-w-0", style: clampedStyle, children: content }),
3245
- shouldCollapse ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3739
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3740
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { id: contentId, className: "min-w-0", style: clampedStyle, children: content }),
3741
+ shouldCollapse ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3246
3742
  "button",
3247
3743
  {
3248
3744
  "aria-controls": contentId,
@@ -3255,7 +3751,7 @@ function AgentChatUserMessageContent({
3255
3751
  type: "button",
3256
3752
  children: [
3257
3753
  isExpanded ? showLessLabel : showMoreLabel,
3258
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { "aria-hidden": "true", className: "size-4", strokeWidth: 2 })
3754
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { "aria-hidden": "true", className: "size-4", strokeWidth: 2 })
3259
3755
  ]
3260
3756
  }
3261
3757
  ) : null
@@ -3265,9 +3761,9 @@ function AgentChatUserMessageActionRow({
3265
3761
  children,
3266
3762
  className
3267
3763
  }) {
3268
- const rowRef = React13.useRef(null);
3269
- const [visible, setVisible] = React13.useState(false);
3270
- React13.useEffect(() => {
3764
+ const rowRef = React16.useRef(null);
3765
+ const [visible, setVisible] = React16.useState(false);
3766
+ React16.useEffect(() => {
3271
3767
  const message = rowRef.current?.closest('[data-slot="message"]');
3272
3768
  if (!message) return;
3273
3769
  const show = () => setVisible(true);
@@ -3286,7 +3782,7 @@ function AgentChatUserMessageActionRow({
3286
3782
  message.removeEventListener("focusout", hideWhenFocusLeaves);
3287
3783
  };
3288
3784
  }, []);
3289
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3785
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3290
3786
  "div",
3291
3787
  {
3292
3788
  ref: rowRef,
@@ -3325,7 +3821,7 @@ function AgentChatMessage({
3325
3821
  const resolvedUserContent = userMessageContent ?? message.content;
3326
3822
  const shouldRenderContent = isAssistant || Boolean(renderUserContent || resolvedUserContent);
3327
3823
  const showAttachments = Boolean(message.attachments?.length) && (message.role === "user" || showAssistantAttachments);
3328
- const renderedActions = actions ?? (actionHandlers ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3824
+ const renderedActions = actions ?? (actionHandlers ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3329
3825
  AgentChatDefaultActions,
3330
3826
  {
3331
3827
  additionalActions,
@@ -3335,14 +3831,14 @@ function AgentChatMessage({
3335
3831
  }
3336
3832
  ) : null);
3337
3833
  const defaultUserActions = !actions && Boolean(actionHandlers) && !isAssistant;
3338
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3834
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3339
3835
  ChatMessage,
3340
3836
  {
3341
3837
  className,
3342
3838
  dir,
3343
3839
  from: message.role,
3344
3840
  children: [
3345
- showAttachments ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3841
+ showAttachments ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3346
3842
  ChatAttachmentRows,
3347
3843
  {
3348
3844
  attachments: message.attachments || [],
@@ -3351,14 +3847,14 @@ function AgentChatMessage({
3351
3847
  resolveContent: attachmentContentResolver
3352
3848
  }
3353
3849
  ) : null,
3354
- shouldRenderContent ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3850
+ shouldRenderContent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3355
3851
  ChatMessageContent,
3356
3852
  {
3357
3853
  className: cn(isAssistant ? "bg-transparent p-0" : void 0, contentClassName),
3358
3854
  dir,
3359
3855
  from: message.role,
3360
3856
  children: [
3361
- isAssistant ? renderAssistantContent ? renderAssistantContent({ isStreaming, message }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3857
+ isAssistant ? renderAssistantContent ? renderAssistantContent({ isStreaming, message }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3362
3858
  Timeline,
3363
3859
  {
3364
3860
  getHitlActionState,
@@ -3369,7 +3865,7 @@ function AgentChatMessage({
3369
3865
  parts: message.parts
3370
3866
  }
3371
3867
  ) : null,
3372
- !isAssistant ? renderUserContent ? renderUserContent({ message }) : resolvedUserContent ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3868
+ !isAssistant ? renderUserContent ? renderUserContent({ message }) : resolvedUserContent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3373
3869
  AgentChatUserMessageContent,
3374
3870
  {
3375
3871
  collapsedLines: userMessageCollapsedLines,
@@ -3382,18 +3878,18 @@ function AgentChatMessage({
3382
3878
  ]
3383
3879
  }
3384
3880
  ) : null,
3385
- renderedActions ? defaultUserActions ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AgentChatUserMessageActionRow, { className: actionsClassName, children: renderedActions }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn(dir === "rtl" ? "mt-1 h-9 w-full" : "mt-1 h-9 w-full -translate-x-2", actionsClassName), children: renderedActions }) : null
3881
+ renderedActions ? defaultUserActions ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatUserMessageActionRow, { className: actionsClassName, children: renderedActions }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn(dir === "rtl" ? "mt-1 h-9 w-full" : "mt-1 h-9 w-full -translate-x-2", actionsClassName), children: renderedActions }) : null
3386
3882
  ]
3387
3883
  }
3388
3884
  );
3389
3885
  }
3390
3886
 
3391
3887
  // src/ui/bubble.tsx
3392
- var import_class_variance_authority2 = require("class-variance-authority");
3888
+ var import_class_variance_authority3 = require("class-variance-authority");
3393
3889
  var import_react_slot2 = require("@radix-ui/react-slot");
3394
- var import_jsx_runtime13 = require("react/jsx-runtime");
3890
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3395
3891
  function BubbleGroup({ className, ...props }) {
3396
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3892
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3397
3893
  "div",
3398
3894
  {
3399
3895
  "data-slot": "bubble-group",
@@ -3402,7 +3898,7 @@ function BubbleGroup({ className, ...props }) {
3402
3898
  }
3403
3899
  );
3404
3900
  }
3405
- var bubbleVariants = (0, import_class_variance_authority2.cva)(
3901
+ var bubbleVariants = (0, import_class_variance_authority3.cva)(
3406
3902
  "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",
3407
3903
  {
3408
3904
  variants: {
@@ -3427,7 +3923,7 @@ function Bubble({
3427
3923
  className,
3428
3924
  ...props
3429
3925
  }) {
3430
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3926
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3431
3927
  "div",
3432
3928
  {
3433
3929
  "data-slot": "bubble",
@@ -3444,7 +3940,7 @@ function BubbleContent({
3444
3940
  ...props
3445
3941
  }) {
3446
3942
  const Comp = asChild ? import_react_slot2.Slot : "div";
3447
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3943
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3448
3944
  Comp,
3449
3945
  {
3450
3946
  "data-slot": "bubble-content",
@@ -3456,7 +3952,7 @@ function BubbleContent({
3456
3952
  }
3457
3953
  );
3458
3954
  }
3459
- var bubbleReactionsVariants = (0, import_class_variance_authority2.cva)(
3955
+ var bubbleReactionsVariants = (0, import_class_variance_authority3.cva)(
3460
3956
  "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",
3461
3957
  {
3462
3958
  variants: {
@@ -3481,7 +3977,7 @@ function BubbleReactions({
3481
3977
  className,
3482
3978
  ...props
3483
3979
  }) {
3484
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3980
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3485
3981
  "div",
3486
3982
  {
3487
3983
  "data-slot": "bubble-reactions",
@@ -3494,10 +3990,10 @@ function BubbleReactions({
3494
3990
  }
3495
3991
 
3496
3992
  // src/ui/marker.tsx
3497
- var import_class_variance_authority3 = require("class-variance-authority");
3993
+ var import_class_variance_authority4 = require("class-variance-authority");
3498
3994
  var import_react_slot3 = require("@radix-ui/react-slot");
3499
- var import_jsx_runtime14 = require("react/jsx-runtime");
3500
- var markerVariants = (0, import_class_variance_authority3.cva)(
3995
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3996
+ var markerVariants = (0, import_class_variance_authority4.cva)(
3501
3997
  "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",
3502
3998
  {
3503
3999
  variants: {
@@ -3516,7 +4012,7 @@ function Marker({
3516
4012
  ...props
3517
4013
  }) {
3518
4014
  const Comp = asChild ? import_react_slot3.Slot : "div";
3519
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4015
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3520
4016
  Comp,
3521
4017
  {
3522
4018
  "data-slot": "marker",
@@ -3527,7 +4023,7 @@ function Marker({
3527
4023
  );
3528
4024
  }
3529
4025
  function MarkerIcon({ className, ...props }) {
3530
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4026
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3531
4027
  "span",
3532
4028
  {
3533
4029
  "data-slot": "marker-icon",
@@ -3541,7 +4037,7 @@ function MarkerIcon({ className, ...props }) {
3541
4037
  );
3542
4038
  }
3543
4039
  function MarkerContent({ className, ...props }) {
3544
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4040
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3545
4041
  "span",
3546
4042
  {
3547
4043
  "data-slot": "marker-content",
@@ -3555,7 +4051,7 @@ function MarkerContent({ className, ...props }) {
3555
4051
  }
3556
4052
 
3557
4053
  // src/ui/mcp-connect-required-card.tsx
3558
- var import_jsx_runtime15 = require("react/jsx-runtime");
4054
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3559
4055
  var STATUS_LABELS = {
3560
4056
  pending: "Connect",
3561
4057
  connecting: "Connecting",
@@ -3579,7 +4075,7 @@ function McpConnectRequiredCard({
3579
4075
  const isBusy = loading || status === "connecting" || status === "resuming";
3580
4076
  const isConnected = status === "connected";
3581
4077
  const buttonDisabled = disabled || isBusy || isConnected || !onConnect;
3582
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4078
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3583
4079
  "div",
3584
4080
  {
3585
4081
  "data-agents24-mcp-connect-card": true,
@@ -3589,13 +4085,13 @@ function McpConnectRequiredCard({
3589
4085
  className
3590
4086
  ),
3591
4087
  ...props,
3592
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [
3593
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "min-w-0", children: [
3594
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "truncate text-sm font-medium", children: label }),
3595
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mt-1 text-sm text-muted-foreground", children: message || "Connect your account to continue." }),
3596
- status === "error" && error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mt-2 text-sm text-destructive", children: error }) : null
4088
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [
4089
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "min-w-0", children: [
4090
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "truncate text-sm font-medium", children: label }),
4091
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mt-1 text-sm text-muted-foreground", children: message || "Connect your account to continue." }),
4092
+ status === "error" && error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mt-2 text-sm text-destructive", children: error }) : null
3597
4093
  ] }),
3598
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4094
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3599
4095
  "button",
3600
4096
  {
3601
4097
  type: "button",
@@ -3653,6 +4149,16 @@ function McpConnectRequiredCard({
3653
4149
  ChatMessageAction,
3654
4150
  ChatMessageActions,
3655
4151
  ChatMessageContent,
4152
+ CodeBlock,
4153
+ CodeBlockActions,
4154
+ CodeBlockContent,
4155
+ CodeBlockCopyButton,
4156
+ CodeBlockDownloadButton,
4157
+ CodeBlockFooter,
4158
+ CodeBlockHeader,
4159
+ CodeBlockLine,
4160
+ CodeBlockTitle,
4161
+ CodeBlockWrapButton,
3656
4162
  Marker,
3657
4163
  MarkerContent,
3658
4164
  MarkerIcon,
@@ -3694,6 +4200,7 @@ function McpConnectRequiredCard({
3694
4200
  useAudioRecorder,
3695
4201
  useChatComposerFocus,
3696
4202
  useCompletionActionEntrance,
4203
+ useHighlightedCode,
3697
4204
  useLiveCompletionRuns
3698
4205
  });
3699
4206
  //# sourceMappingURL=index.cjs.map