@marimo-team/islands 0.24.1-dev32 → 0.24.1-dev36

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,13 +6,13 @@ import { c as useEventListener, g as Logger, h as cn, t as Button } from "./butt
6
6
  import { t as require_react } from "./react-DhGsCS90.js";
7
7
  import { t as require_compiler_runtime } from "./compiler-runtime-DsR6imPN.js";
8
8
  import { r as toast } from "./copy-C7ZKMKox.js";
9
- import { Bt as PluralWord, C as Accordion, Dn as Anchor2, E as AccordionTrigger, Ft as variablesAtom, H as renderHTML, Hn as FileText, Jt as getTableType, Kt as allTablesAtom, Nn as Wrench, O as ChatBubbleIcon, Pn as Trash2, Pt as jotaiJsonStorage, Q as notebookAtom, S as AIContextRegistry, T as AccordionItem, Tn as atomWithStorage, Vn as Info, Wn as ExternalLink, Xt as getRequestClient, an as singleFacet, b as contextToXml, c as Popover, d as PopoverTrigger, f as isOutputEmpty, g as formatDatasourceContextForCell, h as DatasourceContextProvider, hn as CellOutputId, ht as displayCellName, in as isTracebackMime, jt as generateUUID, kt as moveToEndOfEditor, n as Spinner, nn as isErrorMime, qn as CircleX, qt as dataSourceConnectionsAtom, r as MarkdownRenderer, rn as isMarimoErrorsMime, st as parseHtmlContent, t as toPng, u as PopoverContent, un as ZodLocalStorage, v as Boosts, w as AccordionContent, wt as createVariableInfoElement, x as AIContextProvider, y as Sections, zn as LoaderCircle } from "./html-to-image-BzT-fb14.js";
9
+ import { Bn as LoaderCircle, Bt as PluralWord, C as Accordion, E as AccordionTrigger, En as atomWithStorage, Fn as Trash2, Ft as variablesAtom, Gn as ExternalLink, H as renderHTML, Hn as Info, Jn as CircleX, Jt as getTableType, Kt as allTablesAtom, O as ChatBubbleIcon, On as Anchor2, Pn as Wrench, Pt as jotaiJsonStorage, Q as notebookAtom, S as AIContextRegistry, T as AccordionItem, Un as FileText, Xt as getRequestClient, an as singleFacet, b as contextToXml, c as Popover, d as PopoverTrigger, f as isOutputEmpty, g as formatDatasourceContextForCell, h as DatasourceContextProvider, hn as CellOutputId, ht as displayCellName, in as isTracebackMime, jt as generateUUID, kt as moveToEndOfEditor, n as Spinner, nn as isErrorMime, qt as dataSourceConnectionsAtom, r as MarkdownRenderer, rn as isMarimoErrorsMime, st as parseHtmlContent, t as toPng, u as PopoverContent, un as ZodLocalStorage, v as Boosts, w as AccordionContent, wt as createVariableInfoElement, x as AIContextProvider, y as Sections } from "./html-to-image-RKitVHn8.js";
10
10
  import "./chunk-5FQGJX7Z-BRZ_XYUw.js";
11
11
  import { u as createLucideIcon } from "./dist-j30bBjjN.js";
12
12
  import { C as logNever, I as X, R as ChevronDown, t as Strings } from "./strings-DMLVGXRo.js";
13
13
  import { C as DropdownMenuTrigger, a as NumberField, f as DropdownMenu, h as DropdownMenuItem, p as DropdownMenuContent, r as Input } from "./input-CqV2ZPgL.js";
14
14
  import { p as isUrl, w as CircleQuestionMark } from "./toDate-CjUYDkFI.js";
15
- import { a as MarimoIncomingMessageEvent, d as fileDetailsToBlob, f as Square, n as blobToString, p as File$1, t as processOutput } from "./process-output-C8Q8G6-g.js";
15
+ import { a as MarimoIncomingMessageEvent, d as fileDetailsToBlob, f as Square, n as blobToString, p as File$1, t as processOutput } from "./process-output-BEMkC1sa.js";
16
16
  import "./react-dom-CmENFV8Q.js";
17
17
  import { t as require_jsx_runtime } from "./jsx-runtime-Dp_oQwaf.js";
18
18
  import { A as looseObject, B as unknown, C as any, D as discriminatedUnion, E as custom, I as record, L as string, M as never, N as number, O as lazy, P as object$1, S as _null, T as boolean, U as toJSONSchema, V as safeParseAsync, b as _enum, k as literal, w as array$1, x as _instanceof, z as union } from "./zod-BFY2SnzC.js";
@@ -6814,15 +6814,15 @@ var import_compiler_runtime$8 = require_compiler_runtime();
6814
6814
  const ReasoningAccordion = (t18) => {
6815
6815
  let d = (0, import_compiler_runtime$8.c)(13), { reasoning: f, index: p, isStreaming: m } = t18, h = p === void 0 ? 0 : p, g = m === void 0 ? false : m, [_, v] = import_react.useState("");
6816
6816
  if (!f && !g) return null;
6817
- let y = g ? "reasoning" : _, x;
6818
- d[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), d[0] = x) : x = d[0];
6817
+ let y = g ? "reasoning" : _, b;
6818
+ d[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), d[0] = b) : b = d[0];
6819
6819
  let C = g ? "Thinking" : "View reasoning", w = f.length > 0 && ` (${f.length} chars)`, T;
6820
6820
  d[1] !== C || d[2] !== w ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6821
6821
  className: "text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",
6822
6822
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6823
6823
  className: "flex items-center gap-2",
6824
6824
  children: [
6825
- x,
6825
+ b,
6826
6826
  C,
6827
6827
  w
6828
6828
  ]
@@ -6977,12 +6977,12 @@ const ToolErrorCard = (t18) => {
6977
6977
  })
6978
6978
  ]
6979
6979
  }), d[10] = D, d[11] = O);
6980
- let k = v && "rotate-180", A;
6981
- d[12] === k ? A = d[13] : (A = cn("h-3.5 w-3.5 shrink-0 transition-transform", k), d[12] = k, d[13] = A);
6982
- let j;
6983
- d[14] === A ? j = d[15] : (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: A }), d[14] = A, d[15] = j);
6980
+ let A = v && "rotate-180", j;
6981
+ d[12] === A ? j = d[13] : (j = cn("h-3.5 w-3.5 shrink-0 transition-transform", A), d[12] = A, d[13] = j);
6984
6982
  let M;
6985
- d[16] !== v || d[17] !== j || d[18] !== O ? (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
6983
+ d[14] === j ? M = d[15] : (M = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: j }), d[14] = j, d[15] = M);
6984
+ let N;
6985
+ d[16] !== v || d[17] !== M || d[18] !== O ? (N = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
6986
6986
  type: "button",
6987
6987
  onClick: w,
6988
6988
  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",
@@ -6990,11 +6990,11 @@ const ToolErrorCard = (t18) => {
6990
6990
  children: [
6991
6991
  T,
6992
6992
  O,
6993
- j
6993
+ M
6994
6994
  ]
6995
- }), d[16] = v, d[17] = j, d[18] = O, d[19] = M) : M = d[19];
6996
- let N;
6997
- d[20] !== h || d[21] !== p || d[22] !== v ? (N = v && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6995
+ }), d[16] = v, d[17] = M, d[18] = O, d[19] = N) : N = d[19];
6996
+ let P;
6997
+ d[20] !== h || d[21] !== p || d[22] !== v ? (P = v && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6998
6998
  className: "px-3 pb-3 space-y-3 border-t border-(--red-6)/40 pt-3",
6999
6999
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: p }), h && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
7000
7000
  className: "text-xs font-semibold text-(--red-11) mb-1",
@@ -7003,12 +7003,12 @@ const ToolErrorCard = (t18) => {
7003
7003
  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",
7004
7004
  children: h
7005
7005
  })] })]
7006
- }), d[20] = h, d[21] = p, d[22] = v, d[23] = N) : N = d[23];
7007
- let P;
7008
- return d[24] !== M || d[25] !== N || d[26] !== C ? (P = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7006
+ }), d[20] = h, d[21] = p, d[22] = v, d[23] = P) : P = d[23];
7007
+ let F;
7008
+ return d[24] !== N || d[25] !== P || d[26] !== C ? (F = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7009
7009
  className: C,
7010
- children: [M, N]
7011
- }), d[24] = M, d[25] = N, d[26] = C, d[27] = P) : P = d[27], P;
7010
+ children: [N, P]
7011
+ }), d[24] = N, d[25] = P, d[26] = C, d[27] = F) : F = d[27], F;
7012
7012
  };
7013
7013
  function _temp$3(t18) {
7014
7014
  return !t18;
@@ -7153,7 +7153,7 @@ function getTriggerToneClass(t18) {
7153
7153
  }
7154
7154
  }
7155
7155
  const ToolHistoryRow = (t18) => {
7156
- let d = (0, import_compiler_runtime$3.c)(34), { toolName: f, state: p, input: h, result: g, approval: _, index: v, className: y, isActive: x } = t18, C = v === void 0 ? 0 : v, w = x === void 0 ? true : x, T;
7156
+ let d = (0, import_compiler_runtime$3.c)(34), { toolName: f, state: p, input: h, result: g, approval: _, index: v, className: y, isActive: b } = t18, C = v === void 0 ? 0 : v, w = b === void 0 ? true : b, T;
7157
7157
  d[0] !== w || d[1] !== p ? (T = !w && PENDING_STATES.has(p), d[0] = w, d[1] = p, d[2] = T) : T = d[2];
7158
7158
  let E = T, D = `tool-${C}`, O;
7159
7159
  d[3] === y ? O = d[4] : (O = cn("w-full", y), d[3] = y, d[4] = O);
@@ -7171,8 +7171,8 @@ const ToolHistoryRow = (t18) => {
7171
7171
  className: "font-mono text-xs",
7172
7172
  children: M
7173
7173
  }), d[13] = M, d[14] = N);
7174
- let F;
7175
- d[15] !== N || d[16] !== A || d[17] !== j ? (F = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
7174
+ let P;
7175
+ d[15] !== N || d[16] !== A || d[17] !== j ? (P = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
7176
7176
  className: "flex items-center gap-1",
7177
7177
  children: [
7178
7178
  A,
@@ -7180,14 +7180,14 @@ const ToolHistoryRow = (t18) => {
7180
7180
  ":",
7181
7181
  N
7182
7182
  ]
7183
- }), d[15] = N, d[16] = A, d[17] = j, d[18] = F) : F = d[18];
7184
- let I;
7185
- d[19] !== F || d[20] !== k ? (I = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
7183
+ }), d[15] = N, d[16] = A, d[17] = j, d[18] = P) : P = d[18];
7184
+ let F;
7185
+ d[19] !== P || d[20] !== k ? (F = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
7186
7186
  className: k,
7187
- children: F
7188
- }), d[19] = F, d[20] = k, d[21] = I) : I = d[21];
7189
- let L;
7190
- d[22] !== _ || d[23] !== h || d[24] !== g || d[25] !== p ? (L = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
7187
+ children: P
7188
+ }), d[19] = P, d[20] = k, d[21] = F) : F = d[21];
7189
+ let I;
7190
+ d[22] !== _ || d[23] !== h || d[24] !== g || d[25] !== p ? (I = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
7191
7191
  className: "py-2 px-2",
7192
7192
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HistoryContent, {
7193
7193
  state: p,
@@ -7195,20 +7195,20 @@ const ToolHistoryRow = (t18) => {
7195
7195
  result: g,
7196
7196
  approval: _
7197
7197
  })
7198
- }), d[22] = _, d[23] = h, d[24] = g, d[25] = p, d[26] = L) : L = d[26];
7199
- let R;
7200
- d[27] !== I || d[28] !== L ? (R = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
7198
+ }), d[22] = _, d[23] = h, d[24] = g, d[25] = p, d[26] = I) : I = d[26];
7199
+ let L;
7200
+ d[27] !== F || d[28] !== I ? (L = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
7201
7201
  value: "tool-call",
7202
7202
  className: "border-0",
7203
- children: [I, L]
7204
- }), d[27] = I, d[28] = L, d[29] = R) : R = d[29];
7203
+ children: [F, I]
7204
+ }), d[27] = F, d[28] = I, d[29] = L) : L = d[29];
7205
7205
  let z;
7206
- return d[30] !== R || d[31] !== D || d[32] !== O ? (z = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
7206
+ return d[30] !== L || d[31] !== D || d[32] !== O ? (z = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
7207
7207
  type: "single",
7208
7208
  collapsible: true,
7209
7209
  className: O,
7210
- children: R
7211
- }, D), d[30] = R, d[31] = D, d[32] = O, d[33] = z) : z = d[33], z;
7210
+ children: L
7211
+ }, D), d[30] = L, d[31] = D, d[32] = O, d[33] = z) : z = d[33], z;
7212
7212
  };
7213
7213
  var HistoryContent = (t18) => {
7214
7214
  let d = (0, import_compiler_runtime$3.c)(16), { state: f, input: p, result: m, approval: h } = t18;
@@ -8036,11 +8036,11 @@ function routeIncomingChatChunk(t18, d) {
8036
8036
  }
8037
8037
  const Chatbot = (t18) => {
8038
8038
  var _a;
8039
- let [d, g] = (0, import_react.useState)(""), [_, v] = (0, import_react.useState)(t18.config), [y, b] = (0, import_react.useState)(t18.config), [x, S] = (0, import_react.useState)(void 0), C = (0, import_react.useRef)(null), w = (0, import_react.useRef)(null), T = (0, import_react.useRef)(null), E = (0, import_react.useRef)(null);
8039
+ let [d, g] = (0, import_react.useState)(""), [_, v] = (0, import_react.useState)(t18.config), [y, b] = (0, import_react.useState)(t18.config), [x, S] = (0, import_react.useState)(void 0), C = (0, import_react.useRef)(null), T = (0, import_react.useRef)(null), E = (0, import_react.useRef)(null), D = (0, import_react.useRef)(null);
8040
8040
  Object.keys(t18.config).some((d2) => t18.config[d2] !== y[d2]) && (v(t18.config), b(t18.config));
8041
- let D = (0, import_react.useRef)(_);
8042
- D.current = _;
8043
- let O = (0, import_react.useRef)(null), k = (0, import_react.useRef)(null), j = (0, import_react.useRef)(null), [M, N] = (0, import_react.useState)(null), P = () => {
8041
+ let O = (0, import_react.useRef)(_);
8042
+ O.current = _;
8043
+ let k = (0, import_react.useRef)(null), A = (0, import_react.useRef)(null), j = (0, import_react.useRef)(null), [M, N] = (0, import_react.useState)(null), P = () => {
8044
8044
  j.current = null, N(null);
8045
8045
  }, { data: F } = useAsyncData(async () => (await t18.get_chat_history({})).messages, []), I = t18.value.length > 0 ? t18.value : F, { messages: L, sendMessage: R, setMessages: z, status: B, stop: V, error: H, regenerate: U, clearError: W, addToolApprovalResponse: G } = useChat({
8046
8046
  sendAutomaticallyWhen: ({ messages: t19 }) => hasPendingToolCalls(t19),
@@ -8048,12 +8048,12 @@ const Chatbot = (t18) => {
8048
8048
  var _a2;
8049
8049
  if (f === void 0) return fetch(d2);
8050
8050
  let m = JSON.parse(f.body), h = f.signal, g2 = {
8051
- max_tokens: D.current.max_tokens,
8052
- temperature: D.current.temperature,
8053
- top_p: D.current.top_p,
8054
- top_k: D.current.top_k,
8055
- frequency_penalty: D.current.frequency_penalty,
8056
- presence_penalty: D.current.presence_penalty
8051
+ max_tokens: O.current.max_tokens,
8052
+ temperature: O.current.temperature,
8053
+ top_p: O.current.top_p,
8054
+ top_k: O.current.top_k,
8055
+ frequency_penalty: O.current.frequency_penalty,
8056
+ presence_penalty: O.current.presence_penalty
8057
8057
  };
8058
8058
  try {
8059
8059
  let d3 = m.messages.map((t19) => {
@@ -8066,14 +8066,14 @@ const Chatbot = (t18) => {
8066
8066
  P();
8067
8067
  let _2 = new ReadableStream({
8068
8068
  start(d4) {
8069
- O.current = d4, k.current = f2;
8069
+ k.current = d4, A.current = f2;
8070
8070
  let m2 = () => {
8071
8071
  try {
8072
8072
  d4.close();
8073
8073
  } catch (t19) {
8074
8074
  Logger.debug("Controller may already be closed", { error: t19 });
8075
8075
  }
8076
- O.current = null, k.current = null, t18.cancel_prompt({ request_id: f2 }).catch((t19) => {
8076
+ k.current = null, A.current = null, t18.cancel_prompt({ request_id: f2 }).catch((t19) => {
8077
8077
  Logger.debug("cancel_prompt failed", { error: t19 });
8078
8078
  });
8079
8079
  };
@@ -8082,7 +8082,7 @@ const Chatbot = (t18) => {
8082
8082
  };
8083
8083
  },
8084
8084
  cancel() {
8085
- O.current = null, k.current = null;
8085
+ k.current = null, A.current = null;
8086
8086
  }
8087
8087
  });
8088
8088
  return t18.send_prompt({
@@ -8091,7 +8091,7 @@ const Chatbot = (t18) => {
8091
8091
  config: g2
8092
8092
  }).catch((t19) => {
8093
8093
  var _a3;
8094
- (_a3 = O.current) == null ? void 0 : _a3.error(t19), O.current = null, k.current = null;
8094
+ (_a3 = k.current) == null ? void 0 : _a3.error(t19), k.current = null, A.current = null;
8095
8095
  }), createUIMessageStreamResponse({ stream: _2 });
8096
8096
  } catch (t19) {
8097
8097
  if (t19 instanceof Error && t19.name === "AbortError") return new Response("Aborted", { status: 499 });
@@ -8126,13 +8126,13 @@ const Chatbot = (t18) => {
8126
8126
  useEventListener(t18.host, MarimoIncomingMessageEvent.TYPE, (t19) => {
8127
8127
  let d2 = ChatMessageIncomingSchema.safeParse(t19.detail.message);
8128
8128
  if (d2.success) {
8129
- if (d2.data.content && d2.data.message_id === k.current) {
8129
+ if (d2.data.content && d2.data.message_id === A.current) {
8130
8130
  let t20 = getAbortReasonFromChunk(d2.data.content);
8131
8131
  t20 !== void 0 && (j.current = t20);
8132
8132
  }
8133
8133
  routeIncomingChatChunk(d2.data, {
8134
- controllerRef: O,
8135
- activeRequestIdRef: k
8134
+ controllerRef: k,
8135
+ activeRequestIdRef: A
8136
8136
  });
8137
8137
  }
8138
8138
  });
@@ -8152,12 +8152,12 @@ const Chatbot = (t18) => {
8152
8152
  }, Z = t18.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
8153
8153
  (0, import_react.useEffect)(() => {
8154
8154
  var _a2;
8155
- (_a2 = E.current) == null ? void 0 : _a2.scrollTo({
8156
- top: E.current.scrollHeight,
8155
+ (_a2 = D.current) == null ? void 0 : _a2.scrollTo({
8156
+ top: D.current.scrollHeight,
8157
8157
  behavior: "smooth"
8158
8158
  });
8159
- }, [L.length, E]);
8160
- let Q = (_a = T.current) == null ? void 0 : _a.view, $ = () => {
8159
+ }, [L.length, D]);
8160
+ let Q = (_a = E.current) == null ? void 0 : _a.view, $ = () => {
8161
8161
  if (Q) {
8162
8162
  let t19 = Q.state.doc.length;
8163
8163
  Q.dispatch({ changes: {
@@ -8186,7 +8186,7 @@ const Chatbot = (t18) => {
8186
8186
  }),
8187
8187
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8188
8188
  className: "grow overflow-y-auto gap-4 pt-8 pb-4 px-2 flex flex-col",
8189
- ref: E,
8189
+ ref: D,
8190
8190
  children: [
8191
8191
  L.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8192
8192
  className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
@@ -8265,7 +8265,7 @@ const Chatbot = (t18) => {
8265
8265
  }, ...p ?? []]
8266
8266
  }), $();
8267
8267
  },
8268
- ref: w,
8268
+ ref: T,
8269
8269
  inert: t18.disabled || void 0,
8270
8270
  className: cn("flex w-full border-t border-(--slate-6) px-2 py-1 items-center", t18.disabled && "opacity-50 cursor-not-allowed"),
8271
8271
  children: [
@@ -8285,12 +8285,12 @@ const Chatbot = (t18) => {
8285
8285
  className: "rounded-sm mr-2",
8286
8286
  placeholder: Z,
8287
8287
  value: d,
8288
- inputRef: T,
8288
+ inputRef: E,
8289
8289
  maxHeight: t18.maxHeight ? `${t18.maxHeight / 2}px` : void 0,
8290
8290
  onChange: g,
8291
8291
  onSubmit: (t19, d2) => {
8292
8292
  var _a2;
8293
- d2.trim() && ((_a2 = w.current) == null ? void 0 : _a2.requestSubmit());
8293
+ d2.trim() && ((_a2 = T.current) == null ? void 0 : _a2.requestSubmit());
8294
8294
  },
8295
8295
  onClose: () => {
8296
8296
  },