@marimo-team/islands 0.23.7-dev20 → 0.23.7-dev23

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.
@@ -6,16 +6,16 @@ import { _ as Logger, c as Objects, g as cn, l as useEventListener, t as Button
6
6
  import { t as require_react } from "./react-DA-nE2FX.js";
7
7
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
8
8
  import { r as toast } from "./copy-DLf4aN7I.js";
9
- import { C as AccordionContent, D as ChatBubbleIcon, En as Trash2, Ft as jotaiJsonStorage, G as cellErrorsAtom, Ht as allTablesAtom, It as variablesAtom, Kt as getRequestClient, Lt as PluralWord, Nn as Info, Ot as moveToEndOfEditor, P as base64ToDataURL, Rn as CircleX, S as Accordion, T as AccordionTrigger, Tn as Wrench, Tt as createVariableInfoElement, Ut as dataSourceConnectionsAtom, V as renderHTML, Wt as getTableType, Xt as singleFacet, Y as notebookAtom, _ as Boosts, _n as atomWithStorage, b as AIContextProvider, c as Popover, d as PopoverTrigger, f as isOutputEmpty, h as DatasourceContextProvider, jn as LoaderCircle, n as MarkdownRenderer, on as CellOutputId, s as Spinner, t as toPng, tn as ZodLocalStorage, u as PopoverContent, v as Sections, vt as displayCellName, w as AccordionItem, x as AIContextRegistry, y as contextToXml, yn as Anchor2 } from "./html-to-image-q0T1ijn_.js";
9
+ import { C as AccordionContent, D as ChatBubbleIcon, En as Trash2, Ft as jotaiJsonStorage, G as cellErrorsAtom, Ht as allTablesAtom, In as ExternalLink, It as variablesAtom, Kt as getRequestClient, Lt as PluralWord, Nn as Info, Ot as moveToEndOfEditor, P as base64ToDataURL, Pn as FileText, S as Accordion, T as AccordionTrigger, Tn as Wrench, Tt as createVariableInfoElement, Ut as dataSourceConnectionsAtom, V as renderHTML, Wt as getTableType, Xt as singleFacet, Y as notebookAtom, _ as Boosts, _n as atomWithStorage, b as AIContextProvider, c as Popover, d as PopoverTrigger, f as isOutputEmpty, h as DatasourceContextProvider, jn as LoaderCircle, n as MarkdownRenderer, on as CellOutputId, s as Spinner, t as toPng, tn as ZodLocalStorage, u as PopoverContent, v as Sections, vt as displayCellName, w as AccordionItem, x as AIContextRegistry, y as contextToXml, yn as Anchor2, zn as CircleX } from "./html-to-image-DxWM1HVj.js";
10
10
  import "./chunk-5FQGJX7Z-BOg95xG5.js";
11
11
  import { u as createLucideIcon } from "./dist-D3ZI9nhS.js";
12
- import { F as X, S as logNever, t as Strings } from "./strings-BiIhGaI8.js";
12
+ import { F as X, L as ChevronDown, S as logNever, t as Strings } from "./strings-BiIhGaI8.js";
13
13
  import { a as NumberField, b as DropdownMenuTrigger, d as DropdownMenuContent, p as DropdownMenuItem, r as Input, u as DropdownMenu } from "./input-Cc1Vvw9A.js";
14
- import { v as CircleQuestionMark } from "./toDate-CJWlVNGD.js";
15
- import { a as MarimoIncomingMessageEvent, d as File$1, n as blobToString, t as processOutput, u as deserializeBlob } from "./process-output-DTKS9bKk.js";
14
+ import { p as isUrl, v as CircleQuestionMark } from "./toDate-CJWlVNGD.js";
15
+ import { a as MarimoIncomingMessageEvent, d as File$1, n as blobToString, t as processOutput, u as deserializeBlob } from "./process-output-DBYxXdrN.js";
16
16
  import "./react-dom-BWRJ_g_k.js";
17
17
  import { t as require_jsx_runtime } from "./jsx-runtime-COBk7ree.js";
18
- import { B as union, C as any, D as discriminatedUnion, E as custom, H as safeParseAsync, I as record, L as strictObject, M as never, N as number, O as lazy, P as object$1, R as string, S as _null, T as boolean, V as unknown, W as toJSONSchema, b as _enum, k as literal, w as array$1, x as _instanceof } from "./zod-BWkcDORu.js";
18
+ import { A as looseObject, B as union, C as any, D as discriminatedUnion, E as custom, H as safeParseAsync, I as record, L as strictObject, M as never, N as number, O as lazy, P as object$1, R as string, S as _null, T as boolean, V as unknown, W as toJSONSchema, b as _enum, k as literal, w as array$1, x as _instanceof } from "./zod-BWkcDORu.js";
19
19
  import { n as ErrorBanner } from "./error-banner-CVkfBUT3.js";
20
20
  import { t as Label } from "./label-BLqV33b1.js";
21
21
  import { t as Tooltip } from "./tooltip-DRaMBu06.js";
@@ -33,7 +33,15 @@ import "./dist-nuW5EDYT.js";
33
33
  import { n as minimalSetup, t as esm_default } from "./esm-CWp0KQeK.js";
34
34
  import "./purify.es-DT70lfR0.js";
35
35
  import { t as useAsyncData } from "./useAsyncData-C56Khv_R.js";
36
- var BotMessageSquare = createLucideIcon("bot-message-square", [
36
+ var Ban = createLucideIcon("ban", [["path", {
37
+ d: "M4.929 4.929 19.07 19.071",
38
+ key: "196cmz"
39
+ }], ["circle", {
40
+ cx: "12",
41
+ cy: "12",
42
+ r: "10",
43
+ key: "1mglay"
44
+ }]]), BotMessageSquare = createLucideIcon("bot-message-square", [
37
45
  ["path", {
38
46
  d: "M12 6V2H8",
39
47
  key: "1155em"
@@ -87,7 +95,20 @@ var BotMessageSquare = createLucideIcon("bot-message-square", [
87
95
  cy: "12",
88
96
  r: "3",
89
97
  key: "1v7zrd"
90
- }]]);
98
+ }]]), ShieldQuestionMark = createLucideIcon("shield-question-mark", [
99
+ ["path", {
100
+ d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
101
+ key: "oel41y"
102
+ }],
103
+ ["path", {
104
+ d: "M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",
105
+ key: "mhlwft"
106
+ }],
107
+ ["path", {
108
+ d: "M12 17h.01",
109
+ key: "p32p05"
110
+ }]
111
+ ]);
91
112
  require_compiler_runtime();
92
113
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1), marker$2 = "vercel.ai.error", symbol$2 = Symbol.for(marker$2), _a$2, _b$1, AISDKError = class e extends (_b$1 = Error, _a$2 = symbol$2, _b$1) {
93
114
  constructor({ name: e18, message: h, cause: g }) {
@@ -2885,42 +2906,107 @@ var ParseError = class extends Error {
2885
2906
  constructor(e18, h) {
2886
2907
  super(e18), this.name = "ParseError", this.type = h.type, this.field = h.field, this.value = h.value, this.line = h.line;
2887
2908
  }
2888
- };
2909
+ }, LF = 10, CR = 13, SPACE = 32;
2889
2910
  function noop(e18) {
2890
2911
  }
2891
2912
  function createParser(e18) {
2892
2913
  if (typeof e18 == "function") throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
2893
- let { onEvent: h = noop, onError: g = noop, onRetry: _ = noop, onComment: v } = e18, y = "", b = true, x, S = "", C = "";
2894
- function w(e19) {
2895
- let h2 = b ? e19.replace(/^\xEF\xBB\xBF/, "") : e19, [g2, _2] = splitLines(`${y}${h2}`);
2896
- for (let e20 of g2) T(e20);
2897
- y = _2, b = false;
2898
- }
2914
+ let { onEvent: h = noop, onError: g = noop, onRetry: _ = noop, onComment: v } = e18, y = [], b = true, x, S = "", C = 0, w;
2899
2915
  function T(e19) {
2900
- if (e19 === "") {
2901
- D();
2916
+ if (b && (b = false, e19.charCodeAt(0) === 239 && e19.charCodeAt(1) === 187 && e19.charCodeAt(2) === 191 && (e19 = e19.slice(3))), y.length === 0) {
2917
+ let h3 = E(e19);
2918
+ h3 !== "" && y.push(h3);
2902
2919
  return;
2903
2920
  }
2904
- if (e19.startsWith(":")) {
2905
- v && v(e19.slice(e19.startsWith(": ") ? 2 : 1));
2921
+ if (e19.indexOf("\n") === -1 && e19.indexOf("\r") === -1) {
2922
+ y.push(e19);
2906
2923
  return;
2907
2924
  }
2908
- let h2 = e19.indexOf(":");
2909
- if (h2 !== -1) {
2910
- let g2 = e19.slice(0, h2), _2 = e19[h2 + 1] === " " ? 2 : 1;
2911
- E(g2, e19.slice(h2 + _2), e19);
2925
+ y.push(e19);
2926
+ let h2 = y.join("");
2927
+ y.length = 0;
2928
+ let g2 = E(h2);
2929
+ g2 !== "" && y.push(g2);
2930
+ }
2931
+ function E(e19) {
2932
+ let g2 = 0;
2933
+ if (e19.indexOf("\r") === -1) {
2934
+ let _2 = e19.indexOf("\n", g2);
2935
+ for (; _2 !== -1; ) {
2936
+ if (g2 === _2) {
2937
+ C > 0 && h({
2938
+ id: x,
2939
+ event: w,
2940
+ data: S
2941
+ }), x = void 0, S = "", C = 0, w = void 0, g2 = _2 + 1, _2 = e19.indexOf("\n", g2);
2942
+ continue;
2943
+ }
2944
+ let v2 = e19.charCodeAt(g2);
2945
+ if (isDataPrefix(e19, g2, v2)) {
2946
+ let v3 = e19.charCodeAt(g2 + 5) === SPACE ? g2 + 6 : g2 + 5, y2 = e19.slice(v3, _2);
2947
+ if (C === 0 && e19.charCodeAt(_2 + 1) === LF) {
2948
+ h({
2949
+ id: x,
2950
+ event: w,
2951
+ data: y2
2952
+ }), x = void 0, S = "", w = void 0, g2 = _2 + 2, _2 = e19.indexOf("\n", g2);
2953
+ continue;
2954
+ }
2955
+ S = C === 0 ? y2 : `${S}
2956
+ ${y2}`, C++;
2957
+ } else isEventPrefix(e19, g2, v2) ? w = e19.slice(e19.charCodeAt(g2 + 6) === SPACE ? g2 + 7 : g2 + 6, _2) || void 0 : D(e19, g2, _2);
2958
+ g2 = _2 + 1, _2 = e19.indexOf("\n", g2);
2959
+ }
2960
+ return e19.slice(g2);
2961
+ }
2962
+ for (; g2 < e19.length; ) {
2963
+ let h2 = e19.indexOf("\r", g2), _2 = e19.indexOf("\n", g2), v2 = -1;
2964
+ if (h2 !== -1 && _2 !== -1 ? v2 = h2 < _2 ? h2 : _2 : h2 === -1 ? _2 !== -1 && (v2 = _2) : v2 = h2 === e19.length - 1 ? -1 : h2, v2 === -1) break;
2965
+ D(e19, g2, v2), g2 = v2 + 1, e19.charCodeAt(g2 - 1) === CR && e19.charCodeAt(g2) === LF && g2++;
2966
+ }
2967
+ return e19.slice(g2);
2968
+ }
2969
+ function D(e19, h2, g2) {
2970
+ if (h2 === g2) {
2971
+ k();
2912
2972
  return;
2913
2973
  }
2914
- E(e19, "", e19);
2974
+ let _2 = e19.charCodeAt(h2);
2975
+ if (isDataPrefix(e19, h2, _2)) {
2976
+ let _3 = e19.charCodeAt(h2 + 5) === SPACE ? h2 + 6 : h2 + 5, v2 = e19.slice(_3, g2);
2977
+ S = C === 0 ? v2 : `${S}
2978
+ ${v2}`, C++;
2979
+ return;
2980
+ }
2981
+ if (isEventPrefix(e19, h2, _2)) {
2982
+ w = e19.slice(e19.charCodeAt(h2 + 6) === SPACE ? h2 + 7 : h2 + 6, g2) || void 0;
2983
+ return;
2984
+ }
2985
+ if (_2 === 105 && e19.charCodeAt(h2 + 1) === 100 && e19.charCodeAt(h2 + 2) === 58) {
2986
+ let _3 = e19.slice(e19.charCodeAt(h2 + 3) === SPACE ? h2 + 4 : h2 + 3, g2);
2987
+ x = _3.includes("\0") ? void 0 : _3;
2988
+ return;
2989
+ }
2990
+ if (_2 === 58) {
2991
+ v && v(e19.slice(h2, g2).slice(e19.charCodeAt(h2 + 1) === SPACE ? 2 : 1));
2992
+ return;
2993
+ }
2994
+ let y2 = e19.slice(h2, g2), b2 = y2.indexOf(":");
2995
+ if (b2 === -1) {
2996
+ O(y2, "", y2);
2997
+ return;
2998
+ }
2999
+ let T2 = y2.slice(0, b2), E2 = y2.charCodeAt(b2 + 1) === SPACE ? 2 : 1;
3000
+ O(T2, y2.slice(b2 + E2), y2);
2915
3001
  }
2916
- function E(e19, h2, v2) {
3002
+ function O(e19, h2, v2) {
2917
3003
  switch (e19) {
2918
3004
  case "event":
2919
- C = h2;
3005
+ w = h2 || void 0;
2920
3006
  break;
2921
3007
  case "data":
2922
- S = `${S}${h2}
2923
- `;
3008
+ S = C === 0 ? h2 : `${S}
3009
+ ${h2}`, C++;
2924
3010
  break;
2925
3011
  case "id":
2926
3012
  x = h2.includes("\0") ? void 0 : h2;
@@ -2942,34 +3028,30 @@ function createParser(e18) {
2942
3028
  break;
2943
3029
  }
2944
3030
  }
2945
- function D() {
2946
- S.length > 0 && h({
3031
+ function k() {
3032
+ C > 0 && h({
2947
3033
  id: x,
2948
- event: C || void 0,
2949
- data: S.endsWith("\n") ? S.slice(0, -1) : S
2950
- }), x = void 0, S = "", C = "";
2951
- }
2952
- function O(e19 = {}) {
2953
- y && e19.consume && T(y), b = true, x = void 0, S = "", C = "", y = "";
3034
+ event: w,
3035
+ data: S
3036
+ }), x = void 0, S = "", C = 0, w = void 0;
3037
+ }
3038
+ function A(e19 = {}) {
3039
+ if (e19.consume && y.length > 0) {
3040
+ let e20 = y.join("");
3041
+ D(e20, 0, e20.length);
3042
+ }
3043
+ b = true, x = void 0, S = "", C = 0, w = void 0, y.length = 0;
2954
3044
  }
2955
3045
  return {
2956
- feed: w,
2957
- reset: O
3046
+ feed: T,
3047
+ reset: A
2958
3048
  };
2959
3049
  }
2960
- function splitLines(e18) {
2961
- let h = [], g = "", _ = 0;
2962
- for (; _ < e18.length; ) {
2963
- let v = e18.indexOf("\r", _), y = e18.indexOf("\n", _), b = -1;
2964
- if (v !== -1 && y !== -1 ? b = Math.min(v, y) : v === -1 ? y !== -1 && (b = y) : b = v === e18.length - 1 ? -1 : v, b === -1) {
2965
- g = e18.slice(_);
2966
- break;
2967
- } else {
2968
- let g2 = e18.slice(_, b);
2969
- h.push(g2), _ = b + 1, e18[_ - 1] === "\r" && e18[_] === "\n" && _++;
2970
- }
2971
- }
2972
- return [h, g];
3050
+ function isDataPrefix(e18, h, g) {
3051
+ return g === 100 && e18.charCodeAt(h + 1) === 97 && e18.charCodeAt(h + 2) === 116 && e18.charCodeAt(h + 3) === 97 && e18.charCodeAt(h + 4) === 58;
3052
+ }
3053
+ function isEventPrefix(e18, h, g) {
3054
+ return g === 101 && e18.charCodeAt(h + 1) === 118 && e18.charCodeAt(h + 2) === 101 && e18.charCodeAt(h + 3) === 110 && e18.charCodeAt(h + 4) === 116 && e18.charCodeAt(h + 5) === 58;
2973
3055
  }
2974
3056
  var EventSourceParserStream = class extends TransformStream {
2975
3057
  constructor({ onError: e18, onRetry: h, onComment: g } = {}) {
@@ -4221,7 +4303,7 @@ function mergeObjects(e18, h) {
4221
4303
  if (e18 === void 0) return h;
4222
4304
  if (h === void 0) return e18;
4223
4305
  let g = { ...e18 };
4224
- for (let _ in h) if (Object.prototype.hasOwnProperty.call(h, _)) {
4306
+ for (let _ in h) if (!(_ === "__proto__" || _ === "constructor" || _ === "prototype") && Object.prototype.hasOwnProperty.call(h, _)) {
4225
4307
  let v = h[_];
4226
4308
  if (v === void 0) continue;
4227
4309
  let y = _ in e18 ? e18[_] : void 0, b = typeof v == "object" && !!v && !Array.isArray(v) && !(v instanceof Date) && !(v instanceof RegExp), x = typeof y == "object" && !!y && !Array.isArray(y) && !(y instanceof Date) && !(y instanceof RegExp);
@@ -6334,10 +6416,10 @@ async function convertToFileUIPart(e18) {
6334
6416
  url: await blobToString(e19, "dataUrl")
6335
6417
  })));
6336
6418
  }
6337
- var import_compiler_runtime$4 = require_compiler_runtime();
6419
+ var import_compiler_runtime$9 = require_compiler_runtime();
6338
6420
  const AttachmentRenderer = (e18) => {
6339
6421
  var _a;
6340
- let h = (0, import_compiler_runtime$4.c)(6), { attachment: g } = e18;
6422
+ let h = (0, import_compiler_runtime$9.c)(6), { attachment: g } = e18;
6341
6423
  if ((_a = g.mediaType) == null ? void 0 : _a.startsWith("image/")) {
6342
6424
  let e19 = g.filename || "Attachment", _2;
6343
6425
  return h[0] !== g.url || h[1] !== e19 ? (_2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
@@ -6353,28 +6435,66 @@ const AttachmentRenderer = (e18) => {
6353
6435
  className: "flex flex-row gap-1 items-center text-xs",
6354
6436
  children: [_, v]
6355
6437
  }), h[4] = v, h[5] = y), y;
6438
+ }, SourceChip = (e18) => {
6439
+ let h = (0, import_compiler_runtime$9.c)(15), { icon: g, title: _, subtitle: v, href: y } = e18, b;
6440
+ h[0] === _ ? b = h[1] : (b = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6441
+ className: "truncate font-medium",
6442
+ children: _
6443
+ }), h[0] = _, h[1] = b);
6444
+ let x;
6445
+ h[2] === v ? x = h[3] : (x = v && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6446
+ className: "truncate opacity-70",
6447
+ children: [
6448
+ "(",
6449
+ v,
6450
+ ")"
6451
+ ]
6452
+ }), h[2] = v, h[3] = x);
6453
+ let S;
6454
+ h[4] !== g || h[5] !== b || h[6] !== x ? (S = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
6455
+ g,
6456
+ b,
6457
+ x
6458
+ ] }), h[4] = g, h[5] = b, h[6] = x, h[7] = S) : S = h[7];
6459
+ let C = S;
6460
+ if (y && isUrl(y)) {
6461
+ let e19 = v ?? _, g2;
6462
+ return h[8] !== C || h[9] !== y || h[10] !== e19 ? (g2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
6463
+ href: y,
6464
+ target: "_blank",
6465
+ rel: "noopener noreferrer",
6466
+ title: e19,
6467
+ className: "inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/50 px-2 py-1 my-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",
6468
+ children: C
6469
+ }), h[8] = C, h[9] = y, h[10] = e19, h[11] = g2) : g2 = h[11], g2;
6470
+ }
6471
+ let w = v ?? _, T;
6472
+ return h[12] !== C || h[13] !== w ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6473
+ className: "inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/50 px-2 py-1 my-1 text-xs text-muted-foreground",
6474
+ title: w,
6475
+ children: C
6476
+ }), h[12] = C, h[13] = w, h[14] = T) : T = h[14], T;
6356
6477
  };
6357
- var import_compiler_runtime$3 = require_compiler_runtime();
6478
+ var import_compiler_runtime$8 = require_compiler_runtime();
6358
6479
  const ReasoningAccordion = (e18) => {
6359
- let h = (0, import_compiler_runtime$3.c)(13), { reasoning: g, index: _, isStreaming: v } = e18, y = _ === void 0 ? 0 : _, b = v === void 0 ? false : v, x = b ? "reasoning" : void 0, S;
6360
- h[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), h[0] = S) : S = h[0];
6361
- let C = b ? "Thinking" : "View reasoning", T;
6362
- h[1] !== g.length || h[2] !== C ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6480
+ let h = (0, import_compiler_runtime$8.c)(13), { reasoning: g, index: _, isStreaming: v } = e18, y = _ === void 0 ? 0 : _, b = v === void 0 ? false : v, [x, S] = import_react.useState("");
6481
+ if (!g && !b) return null;
6482
+ let C = b ? "reasoning" : x, T;
6483
+ h[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), h[0] = T) : T = h[0];
6484
+ let E = b ? "Thinking" : "View reasoning", D = g.length > 0 && ` (${g.length} chars)`, O;
6485
+ h[1] !== E || h[2] !== D ? (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6363
6486
  className: "text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",
6364
6487
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6365
6488
  className: "flex items-center gap-2",
6366
6489
  children: [
6367
- S,
6368
- C,
6369
- " (",
6370
- g.length,
6371
- " ",
6372
- "chars)"
6490
+ T,
6491
+ E,
6492
+ D
6373
6493
  ]
6374
6494
  })
6375
- }), h[1] = g.length, h[2] = C, h[3] = T) : T = h[3];
6376
- let E;
6377
- h[4] === g ? E = h[5] : (E = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6495
+ }), h[1] = E, h[2] = D, h[3] = O) : O = h[3];
6496
+ let k;
6497
+ h[4] === g ? k = h[5] : (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6378
6498
  className: "pb-2 px-2",
6379
6499
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6380
6500
  className: "bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",
@@ -6383,31 +6503,194 @@ const ReasoningAccordion = (e18) => {
6383
6503
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownRenderer, { content: g })
6384
6504
  })
6385
6505
  })
6386
- }), h[4] = g, h[5] = E);
6387
- let D;
6388
- h[6] !== T || h[7] !== E ? (D = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6506
+ }), h[4] = g, h[5] = k);
6507
+ let A;
6508
+ h[6] !== O || h[7] !== k ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6389
6509
  value: "reasoning",
6390
6510
  className: "border-0",
6391
- children: [T, E]
6392
- }), h[6] = T, h[7] = E, h[8] = D) : D = h[8];
6393
- let O;
6394
- return h[9] !== y || h[10] !== x || h[11] !== D ? (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6511
+ children: [O, k]
6512
+ }), h[6] = O, h[7] = k, h[8] = A) : A = h[8];
6513
+ let j;
6514
+ return h[9] !== y || h[10] !== C || h[11] !== A ? (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6395
6515
  type: "single",
6396
6516
  collapsible: true,
6397
6517
  className: "w-full mb-2",
6398
- value: x,
6399
- children: D
6400
- }, y), h[9] = y, h[10] = x, h[11] = D, h[12] = O) : O = h[12], O;
6518
+ value: C,
6519
+ onValueChange: S,
6520
+ children: A
6521
+ }, y), h[9] = y, h[10] = C, h[11] = A, h[12] = j) : j = h[12], j;
6522
+ };
6523
+ function formatToolName(e18) {
6524
+ return e18.replace("tool-", "");
6525
+ }
6526
+ var import_compiler_runtime$7 = require_compiler_runtime();
6527
+ const ToolArgsRenderer = (e18) => {
6528
+ let h = (0, import_compiler_runtime$7.c)(9), { input: g, label: _ } = e18, v = _ === void 0 ? "Tool Request" : _;
6529
+ if (g == null) return null;
6530
+ let y;
6531
+ h[0] === v ? y = h[1] : (y = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
6532
+ className: "text-xs font-semibold text-muted-foreground",
6533
+ children: v
6534
+ }), h[0] = v, h[1] = y);
6535
+ let b;
6536
+ h[2] === g ? b = h[3] : (b = JSON.stringify(g, null, 2), h[2] = g, h[3] = b);
6537
+ let x;
6538
+ h[4] === b ? x = h[5] : (x = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6539
+ className: "bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",
6540
+ children: b
6541
+ }), h[4] = b, h[5] = x);
6542
+ let S;
6543
+ return h[6] !== y || h[7] !== x ? (S = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6544
+ className: "space-y-2",
6545
+ children: [y, x]
6546
+ }), h[6] = y, h[7] = x, h[8] = S) : S = h[8], S;
6547
+ };
6548
+ var import_compiler_runtime$6 = require_compiler_runtime();
6549
+ const ToolApprovalCard = (e18) => {
6550
+ let h = (0, import_compiler_runtime$6.c)(25), { toolName: g, input: _, approval: y, onApprove: x, className: S } = e18, C;
6551
+ h[0] === S ? C = h[1] : (C = cn("rounded-md border border-(--amber-6) bg-(--amber-2) p-3 space-y-3", S), h[0] = S, h[1] = C);
6552
+ let w = `Approval required for ${formatToolName(g)}`, T;
6553
+ h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldQuestionMark, { className: "h-4 w-4 text-(--amber-11) mt-0.5 shrink-0" }), h[2] = T) : T = h[2];
6554
+ let E;
6555
+ h[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6556
+ className: "font-semibold",
6557
+ children: "Approval required:"
6558
+ }), h[3] = E) : E = h[3];
6559
+ let D;
6560
+ h[4] === g ? D = h[5] : (D = formatToolName(g), h[4] = g, h[5] = D);
6561
+ let O;
6562
+ h[6] === D ? O = h[7] : (O = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6563
+ className: "flex items-start gap-2",
6564
+ children: [T, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6565
+ className: "text-xs text-(--amber-11) leading-relaxed",
6566
+ children: [
6567
+ E,
6568
+ " ",
6569
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
6570
+ className: "font-mono",
6571
+ children: D
6572
+ })
6573
+ ]
6574
+ })]
6575
+ }), h[6] = D, h[7] = O);
6576
+ let k;
6577
+ h[8] === _ ? k = h[9] : (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), h[8] = _, h[9] = k);
6578
+ let A;
6579
+ h[10] !== y.id || h[11] !== x ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
6580
+ size: "xs",
6581
+ variant: "outline",
6582
+ onClick: () => x({
6583
+ id: y.id,
6584
+ approved: false
6585
+ }),
6586
+ children: "Deny"
6587
+ }), h[10] = y.id, h[11] = x, h[12] = A) : A = h[12];
6588
+ let j;
6589
+ h[13] !== y.id || h[14] !== x ? (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
6590
+ size: "xs",
6591
+ onClick: () => x({
6592
+ id: y.id,
6593
+ approved: true
6594
+ }),
6595
+ children: "Approve"
6596
+ }), h[13] = y.id, h[14] = x, h[15] = j) : j = h[15];
6597
+ let M;
6598
+ h[16] !== A || h[17] !== j ? (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6599
+ className: "flex items-center justify-end gap-2",
6600
+ children: [A, j]
6601
+ }), h[16] = A, h[17] = j, h[18] = M) : M = h[18];
6602
+ let N;
6603
+ return h[19] !== C || h[20] !== M || h[21] !== w || h[22] !== O || h[23] !== k ? (N = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6604
+ className: C,
6605
+ role: "alertdialog",
6606
+ "aria-label": w,
6607
+ children: [
6608
+ O,
6609
+ k,
6610
+ M
6611
+ ]
6612
+ }), h[19] = C, h[20] = M, h[21] = w, h[22] = O, h[23] = k, h[24] = N) : N = h[24], N;
6401
6613
  };
6402
- var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema = object$1({
6614
+ var import_compiler_runtime$5 = require_compiler_runtime();
6615
+ const ToolErrorCard = (e18) => {
6616
+ let h = (0, import_compiler_runtime$5.c)(28), { toolName: g, input: _, errorText: y, isLive: b, className: x } = e18, [S, C] = import_react.useState(b), w = import_react.useRef(b), T, E;
6617
+ h[0] === b ? (T = h[1], E = h[2]) : (T = () => {
6618
+ w.current && !b && C(false), w.current = b;
6619
+ }, E = [b], h[0] = b, h[1] = T, h[2] = E), import_react.useEffect(T, E);
6620
+ let D;
6621
+ h[3] === x ? D = h[4] : (D = cn("rounded-md border border-(--red-6) bg-(--red-2)", x), h[3] = x, h[4] = D);
6622
+ let O;
6623
+ h[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = () => C(_temp$2), h[5] = O) : O = h[5];
6624
+ let k;
6625
+ h[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleX, { className: "h-3.5 w-3.5 shrink-0" }), h[6] = k) : k = h[6];
6626
+ let A;
6627
+ h[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6628
+ className: "font-semibold",
6629
+ children: "Failed:"
6630
+ }), h[7] = A) : A = h[7];
6631
+ let j;
6632
+ h[8] === g ? j = h[9] : (j = formatToolName(g), h[8] = g, h[9] = j);
6633
+ let M;
6634
+ h[10] === j ? M = h[11] : (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6635
+ className: "flex-1 text-left",
6636
+ children: [
6637
+ A,
6638
+ " ",
6639
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
6640
+ className: "font-mono",
6641
+ children: j
6642
+ })
6643
+ ]
6644
+ }), h[10] = j, h[11] = M);
6645
+ let N = S && "rotate-180", P;
6646
+ h[12] === N ? P = h[13] : (P = cn("h-3.5 w-3.5 shrink-0 transition-transform", N), h[12] = N, h[13] = P);
6647
+ let F;
6648
+ h[14] === P ? F = h[15] : (F = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: P }), h[14] = P, h[15] = F);
6649
+ let I;
6650
+ h[16] !== S || h[17] !== F || h[18] !== M ? (I = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
6651
+ type: "button",
6652
+ onClick: O,
6653
+ className: "w-full flex items-center gap-2 px-3 py-2 text-xs text-(--red-11) hover:bg-(--red-3) rounded-md transition-colors",
6654
+ "aria-expanded": S,
6655
+ children: [
6656
+ k,
6657
+ M,
6658
+ F
6659
+ ]
6660
+ }), h[16] = S, h[17] = F, h[18] = M, h[19] = I) : I = h[19];
6661
+ let L;
6662
+ h[20] !== y || h[21] !== _ || h[22] !== S ? (L = S && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6663
+ className: "px-3 pb-3 space-y-3 border-t border-(--red-6)/40 pt-3",
6664
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), y && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
6665
+ className: "text-xs font-semibold text-(--red-11) mb-1",
6666
+ children: "Error"
6667
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6668
+ className: "bg-(--red-2) border border-(--red-6) rounded p-2 text-xs text-(--red-11) leading-relaxed overflow-auto scrollbar-thin max-h-64 whitespace-pre-wrap",
6669
+ children: y
6670
+ })] })]
6671
+ }), h[20] = y, h[21] = _, h[22] = S, h[23] = L) : L = h[23];
6672
+ let R;
6673
+ return h[24] !== I || h[25] !== L || h[26] !== D ? (R = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6674
+ className: D,
6675
+ children: [I, L]
6676
+ }), h[24] = I, h[25] = L, h[26] = D, h[27] = R) : R = h[27], R;
6677
+ };
6678
+ function _temp$2(e18) {
6679
+ return !e18;
6680
+ }
6681
+ var import_compiler_runtime$4 = require_compiler_runtime();
6682
+ function isUninformative(e18) {
6683
+ return e18 == null ? true : typeof e18 == "object" ? isEmpty_default(e18) : false;
6684
+ }
6685
+ var SuccessResultSchema = looseObject({
6403
6686
  status: string().default("success"),
6404
6687
  auth_required: boolean().default(false),
6405
6688
  action_url: any(),
6406
6689
  next_steps: any(),
6407
6690
  meta: any(),
6408
6691
  message: string().nullish()
6409
- }).passthrough(), PrettySuccessResult = (e18) => {
6410
- let h = (0, import_compiler_runtime$2.c)(12), { data: g } = e18, _;
6692
+ }), PrettySuccessResult = (e18) => {
6693
+ let h = (0, import_compiler_runtime$4.c)(12), { data: g } = e18, _;
6411
6694
  if (h[0] !== g) {
6412
6695
  let { status: e19, auth_required: v, action_url: y, meta: b, next_steps: x, message: S, ...C } = g, w;
6413
6696
  h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
@@ -6416,12 +6699,12 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6416
6699
  }), h[2] = w) : w = h[2];
6417
6700
  let T;
6418
6701
  h[3] === e19 ? T = h[4] : (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6419
- className: "text-xs px-2 py-0.5 bg-[var(--grass-2)] text-[var(--grass-11)] rounded-full font-medium capitalize",
6702
+ className: "text-xs px-2 py-0.5 bg-(--grass-2) text-(--grass-11) rounded-full font-medium capitalize",
6420
6703
  children: e19
6421
6704
  }), h[3] = e19, h[4] = T);
6422
6705
  let E;
6423
6706
  h[5] === v ? E = h[6] : (E = v && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6424
- className: "text-xs px-2 py-0.5 bg-[var(--amber-2)] text-[var(--amber-11)] rounded-full",
6707
+ className: "text-xs px-2 py-0.5 bg-(--amber-2) text-(--amber-11) rounded-full",
6425
6708
  children: "Auth Required"
6426
6709
  }), h[5] = v, h[6] = E);
6427
6710
  let D;
@@ -6435,7 +6718,7 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6435
6718
  let O;
6436
6719
  h[10] === S ? O = h[11] : (O = S && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6437
6720
  className: "flex items-start gap-2",
6438
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "h-3 w-3 text-[var(--blue-11)] mt-0.5 flex-shrink-0" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6721
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "h-3 w-3 text-(--blue-11) mt-0.5 shrink-0" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6439
6722
  className: "text-xs text-foreground",
6440
6723
  children: S
6441
6724
  })]
@@ -6452,8 +6735,9 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6452
6735
  }), h[0] = g, h[1] = _;
6453
6736
  } else _ = h[1];
6454
6737
  return _;
6455
- }, ResultRenderer = (e18) => {
6456
- let h = (0, import_compiler_runtime$2.c)(8), { result: g } = e18, _;
6738
+ };
6739
+ const ResultRenderer = (e18) => {
6740
+ let h = (0, import_compiler_runtime$4.c)(8), { result: g } = e18, _;
6457
6741
  h[0] === g ? _ = h[1] : (_ = SuccessResultSchema.safeParse(g), h[0] = g, h[1] = _);
6458
6742
  let v = _;
6459
6743
  if (v.success) {
@@ -6467,160 +6751,262 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6467
6751
  className: "text-xs font-medium text-muted-foreground mb-1 max-h-64 overflow-y-auto scrollbar-thin",
6468
6752
  children: y
6469
6753
  }), h[6] = y, h[7] = b), b;
6470
- }, ToolArgsRenderer = (e18) => {
6471
- let h = (0, import_compiler_runtime$2.c)(9), { input: g } = e18;
6472
- if (!(g && g !== null)) return null;
6473
- let _;
6474
- h[0] === g ? _ = h[1] : (_ = isEmpty_default(g), h[0] = g, h[1] = _);
6475
- let v = _, y = typeof g == "object" && !Array.isArray(g) && Object.keys(g).length > 0, b;
6476
- h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
6477
- className: "text-xs font-semibold text-muted-foreground",
6478
- children: "Tool Request"
6479
- }), h[2] = b) : b = h[2];
6480
- let x;
6481
- h[3] !== g || h[4] !== v || h[5] !== y ? (x = v ? "{}" : y ? JSON.stringify(g, null, 2) : String(g), h[3] = g, h[4] = v, h[5] = y, h[6] = x) : x = h[6];
6482
- let S;
6483
- return h[7] === x ? S = h[8] : (S = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6484
- className: "space-y-2",
6485
- children: [b, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6486
- className: "bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64",
6487
- children: x
6488
- })]
6489
- }), h[7] = x, h[8] = S), S;
6490
6754
  };
6491
- const ToolCallAccordion = (e18) => {
6492
- let h = (0, import_compiler_runtime$2.c)(38), { toolName: g, result: _, error: y, index: b, state: x, className: S, input: C } = e18, T = b === void 0 ? 0 : b, E = x === "output-available" && (_ || y), D = y ? "error" : E ? "success" : "loading", O;
6493
- h[0] === D ? O = h[1] : (O = () => {
6494
- switch (D) {
6495
- case "loading":
6496
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-3 w-3 animate-spin" });
6497
- case "error":
6498
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleX, { className: "h-3 w-3 text-[var(--red-11)]" });
6499
- case "success":
6500
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheckBig, { className: "h-3 w-3 text-[var(--grass-11)]" });
6501
- default:
6502
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Wrench, { className: "h-3 w-3" });
6755
+ function _temp$1(e18) {
6756
+ let [h, g] = e18;
6757
+ return isUninformative(g) ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6758
+ className: "space-y-1.5",
6759
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6760
+ className: "text-xs text-muted-foreground",
6761
+ children: h
6762
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6763
+ className: "bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",
6764
+ children: JSON.stringify(g, null, 2)
6765
+ })]
6766
+ }, h);
6767
+ }
6768
+ var import_compiler_runtime$3 = require_compiler_runtime(), STATUS_LABEL = {
6769
+ "input-streaming": "Generating",
6770
+ "input-available": "Running",
6771
+ "approval-responded": "Awaiting result",
6772
+ "output-available": "Done",
6773
+ "output-denied": "Denied"
6774
+ }, StatusIcon = (e18) => {
6775
+ let h = (0, import_compiler_runtime$3.c)(4), { state: g } = e18;
6776
+ switch (g) {
6777
+ case "input-streaming":
6778
+ case "input-available":
6779
+ case "approval-responded": {
6780
+ let e19;
6781
+ return h[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-3 w-3 animate-spin" }), h[0] = e19) : e19 = h[0], e19;
6503
6782
  }
6504
- }, h[0] = D, h[1] = O);
6505
- let k = O, A;
6506
- h[2] !== y || h[3] !== E || h[4] !== D ? (A = () => D === "loading" ? "Running" : y ? "Failed" : E ? "Done" : "Tool call", h[2] = y, h[3] = E, h[4] = D, h[5] = A) : A = h[5];
6507
- let j = A, M = `tool-${T}`, N;
6508
- h[6] === S ? N = h[7] : (N = cn("w-full", S), h[6] = S, h[7] = N);
6509
- let P = D === "error" && "text-[var(--red-11)]/80", F = D === "success" && "text-[var(--grass-11)]/80", B;
6510
- h[8] !== P || h[9] !== F ? (B = cn("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline", P, F), h[8] = P, h[9] = F, h[10] = B) : B = h[10];
6511
- let V;
6512
- h[11] === k ? V = h[12] : (V = k(), h[11] = k, h[12] = V);
6513
- let H = j(), U;
6514
- h[13] === g ? U = h[14] : (U = formatToolName(g), h[13] = g, h[14] = U);
6515
- let W;
6516
- h[15] === U ? W = h[16] : (W = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
6783
+ case "output-available": {
6784
+ let e19;
6785
+ return h[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheckBig, { className: "h-3 w-3 text-(--grass-11)" }), h[1] = e19) : e19 = h[1], e19;
6786
+ }
6787
+ case "output-denied": {
6788
+ let e19;
6789
+ return h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ban, { className: "h-3 w-3 text-muted-foreground" }), h[2] = e19) : e19 = h[2], e19;
6790
+ }
6791
+ default: {
6792
+ logNever(g);
6793
+ let e19;
6794
+ return h[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Wrench, { className: "h-3 w-3" }), h[3] = e19) : e19 = h[3], e19;
6795
+ }
6796
+ }
6797
+ };
6798
+ function getTriggerToneClass(e18) {
6799
+ switch (e18) {
6800
+ case "output-available":
6801
+ return "text-(--grass-11)/80";
6802
+ case "output-denied":
6803
+ return "text-muted-foreground";
6804
+ case "input-streaming":
6805
+ case "input-available":
6806
+ case "approval-responded":
6807
+ return "";
6808
+ default:
6809
+ return logNever(e18), "";
6810
+ }
6811
+ }
6812
+ const ToolHistoryRow = (e18) => {
6813
+ let h = (0, import_compiler_runtime$3.c)(29), { toolName: g, state: _, input: y, result: b, approval: x, index: S, className: C } = e18, T = `tool-${S === void 0 ? 0 : S}`, E;
6814
+ h[0] === C ? E = h[1] : (E = cn("w-full", C), h[0] = C, h[1] = E);
6815
+ let D;
6816
+ h[2] === _ ? D = h[3] : (D = cn("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline", getTriggerToneClass(_)), h[2] = _, h[3] = D);
6817
+ let O;
6818
+ h[4] === _ ? O = h[5] : (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusIcon, { state: _ }), h[4] = _, h[5] = O);
6819
+ let k = STATUS_LABEL[_], A;
6820
+ h[6] === g ? A = h[7] : (A = formatToolName(g), h[6] = g, h[7] = A);
6821
+ let j;
6822
+ h[8] === A ? j = h[9] : (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
6517
6823
  className: "font-mono text-xs",
6518
- children: U
6519
- }), h[15] = U, h[16] = W);
6520
- let G;
6521
- h[17] !== H || h[18] !== W || h[19] !== V ? (G = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6824
+ children: A
6825
+ }), h[8] = A, h[9] = j);
6826
+ let M;
6827
+ h[10] !== O || h[11] !== k || h[12] !== j ? (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6522
6828
  className: "flex items-center gap-1",
6523
6829
  children: [
6524
- V,
6525
- H,
6830
+ O,
6831
+ k,
6526
6832
  ":",
6527
- W
6528
- ]
6529
- }), h[17] = H, h[18] = W, h[19] = V, h[20] = G) : G = h[20];
6530
- let K;
6531
- h[21] !== G || h[22] !== B ? (K = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6532
- className: B,
6533
- children: G
6534
- }), h[21] = G, h[22] = B, h[23] = K) : K = h[23];
6535
- let q;
6536
- h[24] !== y || h[25] !== E || h[26] !== C || h[27] !== _ ? (q = E && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6537
- className: "space-y-3",
6538
- children: [
6539
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: C }),
6540
- _ != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResultRenderer, { result: _ }),
6541
- y && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6542
- className: "bg-[var(--red-2)] border border-[var(--red-6)] rounded-lg p-3",
6543
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6544
- className: "text-xs font-semibold text-[var(--red-11)] mb-2 flex items-center gap-2",
6545
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-1.5 h-1.5 bg-[var(--red-9)] rounded-full" }), "Error"]
6546
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6547
- className: "text-sm text-[var(--red-11)] leading-relaxed",
6548
- children: y
6549
- })]
6550
- })
6833
+ j
6551
6834
  ]
6552
- }), h[24] = y, h[25] = E, h[26] = C, h[27] = _, h[28] = q) : q = h[28];
6553
- let J;
6554
- h[29] === q ? J = h[30] : (J = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6835
+ }), h[10] = O, h[11] = k, h[12] = j, h[13] = M) : M = h[13];
6836
+ let N;
6837
+ h[14] !== D || h[15] !== M ? (N = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6838
+ className: D,
6839
+ children: M
6840
+ }), h[14] = D, h[15] = M, h[16] = N) : N = h[16];
6841
+ let P;
6842
+ h[17] !== x || h[18] !== y || h[19] !== b || h[20] !== _ ? (P = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6555
6843
  className: "py-2 px-2",
6556
- children: q
6557
- }), h[29] = q, h[30] = J);
6558
- let Y;
6559
- h[31] !== K || h[32] !== J ? (Y = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6844
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HistoryContent, {
6845
+ state: _,
6846
+ input: y,
6847
+ result: b,
6848
+ approval: x
6849
+ })
6850
+ }), h[17] = x, h[18] = y, h[19] = b, h[20] = _, h[21] = P) : P = h[21];
6851
+ let F;
6852
+ h[22] !== N || h[23] !== P ? (F = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6560
6853
  value: "tool-call",
6561
6854
  className: "border-0",
6562
- children: [K, J]
6563
- }), h[31] = K, h[32] = J, h[33] = Y) : Y = h[33];
6564
- let Z;
6565
- return h[34] !== Y || h[35] !== M || h[36] !== N ? (Z = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6855
+ children: [N, P]
6856
+ }), h[22] = N, h[23] = P, h[24] = F) : F = h[24];
6857
+ let I;
6858
+ return h[25] !== F || h[26] !== T || h[27] !== E ? (I = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6566
6859
  type: "single",
6567
6860
  collapsible: true,
6568
- className: N,
6569
- children: Y
6570
- }, M), h[34] = Y, h[35] = M, h[36] = N, h[37] = Z) : Z = h[37], Z;
6861
+ className: E,
6862
+ children: F
6863
+ }, T), h[25] = F, h[26] = T, h[27] = E, h[28] = I) : I = h[28], I;
6571
6864
  };
6572
- function formatToolName(e18) {
6573
- return e18.replace("tool-", "");
6574
- }
6575
- function _temp$1(e18) {
6576
- let [h, g] = e18;
6577
- return isEmpty_default(g) ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6578
- className: "space-y-1.5",
6579
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6580
- className: "text-xs font-medium text-muted-foreground capitalize flex items-center gap-2",
6581
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-1.5 h-1.5 bg-[var(--blue-9)] rounded-full" }), h]
6582
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
6583
- className: "bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64",
6584
- children: JSON.stringify(g, null, 2)
6585
- })]
6586
- }, h);
6587
- }
6588
- const renderUIMessage = ({ message: e18, isStreamingReasoning: h, isLast: _ }) => {
6589
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: e18.parts.map((e19, h2) => v(e19, h2)) });
6590
- function v(v2, y) {
6591
- if (isToolPart(v2)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallAccordion, {
6592
- index: y,
6593
- toolName: v2.type,
6594
- result: v2.output,
6865
+ var HistoryContent = (e18) => {
6866
+ let h = (0, import_compiler_runtime$3.c)(16), { state: g, input: _, result: v, approval: y } = e18;
6867
+ switch (g) {
6868
+ case "input-streaming":
6869
+ case "input-available":
6870
+ case "approval-responded": {
6871
+ let e19;
6872
+ return h[0] === _ ? e19 = h[1] : (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), h[0] = _, h[1] = e19), e19;
6873
+ }
6874
+ case "output-available": {
6875
+ let e19;
6876
+ h[2] === _ ? e19 = h[3] : (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), h[2] = _, h[3] = e19);
6877
+ let g2;
6878
+ h[4] === v ? g2 = h[5] : (g2 = v != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResultRenderer, { result: v }), h[4] = v, h[5] = g2);
6879
+ let y2;
6880
+ return h[6] !== e19 || h[7] !== g2 ? (y2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6881
+ className: "space-y-3",
6882
+ children: [e19, g2]
6883
+ }), h[6] = e19, h[7] = g2, h[8] = y2) : y2 = h[8], y2;
6884
+ }
6885
+ case "output-denied": {
6886
+ let e19;
6887
+ h[9] === _ ? e19 = h[10] : (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), h[9] = _, h[10] = e19);
6888
+ let g2 = (y == null ? void 0 : y.reason) ? `: ${y.reason}` : ".", v2;
6889
+ h[11] === g2 ? v2 = h[12] : (v2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6890
+ className: "bg-muted/40 border border-border rounded-md p-3 text-xs text-muted-foreground leading-relaxed",
6891
+ children: ["Tool execution was denied", g2]
6892
+ }), h[11] = g2, h[12] = v2);
6893
+ let b;
6894
+ return h[13] !== e19 || h[14] !== v2 ? (b = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6895
+ className: "space-y-3",
6896
+ children: [e19, v2]
6897
+ }), h[13] = e19, h[14] = v2, h[15] = b) : b = h[15], b;
6898
+ }
6899
+ default:
6900
+ return logNever(g), null;
6901
+ }
6902
+ }, import_compiler_runtime$2 = require_compiler_runtime();
6903
+ const ToolCallView = (e18) => {
6904
+ let h = (0, import_compiler_runtime$2.c)(25), { toolName: g, state: _, result: v, errorText: y, input: b, approval: x, onApprove: S, index: C, className: w, isLive: T } = e18, E = T === void 0 ? true : T;
6905
+ switch (_) {
6906
+ case "approval-requested": {
6907
+ if (x != null && S != null) {
6908
+ let e20;
6909
+ return h[0] !== x || h[1] !== w || h[2] !== b || h[3] !== S || h[4] !== g ? (e20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolApprovalCard, {
6910
+ toolName: g,
6911
+ input: b,
6912
+ approval: x,
6913
+ onApprove: S,
6914
+ className: w
6915
+ }), h[0] = x, h[1] = w, h[2] = b, h[3] = S, h[4] = g, h[5] = e20) : e20 = h[5], e20;
6916
+ }
6917
+ let e19;
6918
+ return h[6] !== w || h[7] !== C || h[8] !== b || h[9] !== g ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHistoryRow, {
6919
+ toolName: g,
6920
+ state: "input-available",
6921
+ input: b,
6922
+ index: C,
6923
+ className: w
6924
+ }), h[6] = w, h[7] = C, h[8] = b, h[9] = g, h[10] = e19) : e19 = h[10], e19;
6925
+ }
6926
+ case "output-error": {
6927
+ let e19;
6928
+ return h[11] !== w || h[12] !== y || h[13] !== b || h[14] !== E || h[15] !== g ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolErrorCard, {
6929
+ toolName: g,
6930
+ input: b,
6931
+ errorText: y,
6932
+ isLive: E,
6933
+ className: w
6934
+ }), h[11] = w, h[12] = y, h[13] = b, h[14] = E, h[15] = g, h[16] = e19) : e19 = h[16], e19;
6935
+ }
6936
+ case "input-streaming":
6937
+ case "input-available":
6938
+ case "approval-responded":
6939
+ case "output-available":
6940
+ case "output-denied": {
6941
+ let e19;
6942
+ return h[17] !== x || h[18] !== w || h[19] !== C || h[20] !== b || h[21] !== v || h[22] !== _ || h[23] !== g ? (e19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHistoryRow, {
6943
+ toolName: g,
6944
+ state: _,
6945
+ input: b,
6946
+ result: v,
6947
+ approval: x,
6948
+ index: C,
6949
+ className: w
6950
+ }), h[17] = x, h[18] = w, h[19] = C, h[20] = b, h[21] = v, h[22] = _, h[23] = g, h[24] = e19) : e19 = h[24], e19;
6951
+ }
6952
+ default:
6953
+ return logNever(_), null;
6954
+ }
6955
+ }, renderUIMessage = ({ message: e18, isStreamingReasoning: h, isLast: _, addToolApprovalResponse: v }) => {
6956
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: e18.parts.map((e19, h2) => y(e19, h2)) });
6957
+ function y(y2, b) {
6958
+ if (isToolPart(y2)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallView, {
6959
+ index: b,
6960
+ toolName: y2.type,
6961
+ result: y2.output,
6962
+ errorText: y2.state === "output-error" ? y2.errorText : void 0,
6595
6963
  className: "my-2",
6596
- state: v2.state,
6597
- input: v2.input
6598
- }, y);
6599
- if (isDataPart(v2)) return Logger.debug("Found data part", v2), null;
6600
- switch (v2.type) {
6964
+ state: y2.state,
6965
+ input: y2.input,
6966
+ approval: y2.approval,
6967
+ onApprove: v,
6968
+ isLive: _
6969
+ }, b);
6970
+ if (isDataPart(y2)) return Logger.debug("Found data part", y2), null;
6971
+ switch (y2.type) {
6601
6972
  case "text":
6602
- return v2.text.includes("<marimo-") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: renderHTML({ html: v2.text }) }, y) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownRenderer, { content: v2.text }, y);
6973
+ return y2.text.includes("<marimo-") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: renderHTML({ html: y2.text }) }, b) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownRenderer, { content: y2.text }, b);
6603
6974
  case "reasoning":
6604
6975
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReasoningAccordion, {
6605
- reasoning: v2.text,
6606
- index: y,
6607
- isStreaming: h && _ && y === (e18.parts.length || 0) - 1
6608
- }, y);
6976
+ reasoning: y2.text,
6977
+ index: b,
6978
+ isStreaming: h && _ && b === (e18.parts.length || 0) - 1
6979
+ }, b);
6609
6980
  case "file":
6610
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AttachmentRenderer, { attachment: v2 }, y);
6981
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AttachmentRenderer, { attachment: y2 }, b);
6611
6982
  case "dynamic-tool":
6612
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallAccordion, {
6613
- toolName: v2.toolName,
6614
- result: v2.output,
6615
- state: v2.state,
6616
- input: v2.input
6617
- }, y);
6983
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallView, {
6984
+ toolName: y2.toolName,
6985
+ result: y2.output,
6986
+ errorText: y2.state === "output-error" ? y2.errorText : void 0,
6987
+ state: y2.state,
6988
+ input: y2.input,
6989
+ approval: y2.approval,
6990
+ onApprove: v,
6991
+ isLive: _
6992
+ }, b);
6618
6993
  case "source-document":
6994
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SourceChip, {
6995
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FileText, { className: "h-3 w-3 shrink-0" }),
6996
+ title: y2.title,
6997
+ subtitle: y2.filename
6998
+ }, b);
6619
6999
  case "source-url":
7000
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SourceChip, {
7001
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExternalLink, { className: "h-3 w-3 shrink-0" }),
7002
+ title: y2.title ?? y2.url,
7003
+ subtitle: y2.title ? y2.url : void 0,
7004
+ href: y2.url
7005
+ }, b);
6620
7006
  case "step-start":
6621
- return Logger.debug("Found non-renderable part", v2), null;
7007
+ return null;
6622
7008
  default:
6623
- return logNever(v2), null;
7009
+ return logNever(y2), null;
6624
7010
  }
6625
7011
  }
6626
7012
  };
@@ -7171,7 +7557,7 @@ const Chatbot = (e18) => {
7171
7557
  let N = (0, import_react.useRef)({
7172
7558
  backendMessageId: null,
7173
7559
  frontendMessageIndex: null
7174
- }), F = (0, import_react.useRef)(null), { data: I } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), L = e18.value.length > 0 ? e18.value : I, { messages: R, sendMessage: z, setMessages: B, status: V, stop: H, error: U, regenerate: W, clearError: G } = useChat({
7560
+ }), P = (0, import_react.useRef)(null), { data: I } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), L = e18.value.length > 0 ? e18.value : I, { messages: R, sendMessage: z, setMessages: B, status: V, stop: H, error: U, regenerate: W, clearError: G } = useChat({
7175
7561
  transport: new DefaultChatTransport({ fetch: async (h2, _2) => {
7176
7562
  var _a2;
7177
7563
  if (_2 === void 0) return fetch(h2);
@@ -7192,21 +7578,21 @@ const Chatbot = (e18) => {
7192
7578
  };
7193
7579
  }), _3 = new ReadableStream({
7194
7580
  start(e19) {
7195
- F.current = e19;
7581
+ P.current = e19;
7196
7582
  let h4 = () => {
7197
7583
  try {
7198
7584
  e19.close();
7199
7585
  } catch (e20) {
7200
7586
  Logger.debug("Controller may already be closed", { error: e20 });
7201
7587
  }
7202
- F.current = null;
7588
+ P.current = null;
7203
7589
  };
7204
7590
  return y == null ? void 0 : y.addEventListener("abort", h4), () => {
7205
7591
  y == null ? void 0 : y.removeEventListener("abort", h4);
7206
7592
  };
7207
7593
  },
7208
7594
  cancel() {
7209
- F.current = null;
7595
+ P.current = null;
7210
7596
  }
7211
7597
  });
7212
7598
  return e18.send_prompt({
@@ -7214,7 +7600,7 @@ const Chatbot = (e18) => {
7214
7600
  config: b
7215
7601
  }).catch((e19) => {
7216
7602
  var _a3;
7217
- (_a3 = F.current) == null ? void 0 : _a3.error(e19), F.current = null;
7603
+ (_a3 = P.current) == null ? void 0 : _a3.error(e19), P.current = null;
7218
7604
  }), createUIMessageStreamResponse({ stream: _3 });
7219
7605
  } catch (e19) {
7220
7606
  if (N.current = {
@@ -7242,8 +7628,8 @@ const Chatbot = (e18) => {
7242
7628
  useEventListener(e18.host, MarimoIncomingMessageEvent.TYPE, (e19) => {
7243
7629
  let h2 = ChatMessageIncomingSchema.safeParse(e19.detail.message);
7244
7630
  if (!h2.success) return;
7245
- let g = h2.data, _2 = F.current;
7246
- _2 && (g.content && _2.enqueue(g.content), g.is_final && (_2.close(), F.current = null));
7631
+ let g = h2.data, _2 = P.current;
7632
+ _2 && (g.content && _2.enqueue(g.content), g.is_final && (_2.close(), P.current = null));
7247
7633
  });
7248
7634
  let K = V === "submitted" || V === "streaming", q = (h2) => {
7249
7635
  let g = R.findIndex((e19) => e19.id === h2);