@athenaintel/react 0.6.3 → 0.6.5

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/index.cjs CHANGED
@@ -16407,13 +16407,6 @@ const ThreadListItemPrimitiveRoot = React.forwardRef((props, ref) => {
16407
16407
  return jsxRuntime.jsx(Primitive$1.div, { ...isMain ? { "data-active": "true", "aria-current": "true" } : null, ...props, ref });
16408
16408
  });
16409
16409
  ThreadListItemPrimitiveRoot.displayName = "ThreadListItemPrimitive.Root";
16410
- const useThreadListItemArchive = () => {
16411
- const aui = useAui();
16412
- return React.useCallback(() => {
16413
- aui.threadListItem().archive();
16414
- }, [aui]);
16415
- };
16416
- const ThreadListItemPrimitiveArchive = createActionButton("ThreadListItemPrimitive.Archive", useThreadListItemArchive);
16417
16410
  const useThreadListItemTrigger = () => {
16418
16411
  const aui = useAui();
16419
16412
  return React.useCallback(() => {
@@ -51897,7 +51890,7 @@ const HTML_REPLACEMENTS = {
51897
51890
  function replaceUnsafeChar(ch) {
51898
51891
  return HTML_REPLACEMENTS[ch];
51899
51892
  }
51900
- function escapeHtml(str) {
51893
+ function escapeHtml$1(str) {
51901
51894
  if (HTML_ESCAPE_TEST_RE.test(str)) {
51902
51895
  return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
51903
51896
  }
@@ -51994,7 +51987,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
51994
51987
  __proto__: null,
51995
51988
  arrayReplaceAt,
51996
51989
  assign: assign$1,
51997
- escapeHtml,
51990
+ escapeHtml: escapeHtml$1,
51998
51991
  escapeRE: escapeRE$1,
51999
51992
  fromCodePoint,
52000
51993
  has,
@@ -52175,11 +52168,11 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
52175
52168
  const default_rules = {};
52176
52169
  default_rules.code_inline = function(tokens, idx, options, env, slf) {
52177
52170
  const token = tokens[idx];
52178
- return "<code" + slf.renderAttrs(token) + ">" + escapeHtml(token.content) + "</code>";
52171
+ return "<code" + slf.renderAttrs(token) + ">" + escapeHtml$1(token.content) + "</code>";
52179
52172
  };
52180
52173
  default_rules.code_block = function(tokens, idx, options, env, slf) {
52181
52174
  const token = tokens[idx];
52182
- return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml(tokens[idx].content) + "</code></pre>\n";
52175
+ return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml$1(tokens[idx].content) + "</code></pre>\n";
52183
52176
  };
52184
52177
  default_rules.fence = function(tokens, idx, options, env, slf) {
52185
52178
  const token = tokens[idx];
@@ -52193,9 +52186,9 @@ default_rules.fence = function(tokens, idx, options, env, slf) {
52193
52186
  }
52194
52187
  let highlighted;
52195
52188
  if (options.highlight) {
52196
- highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
52189
+ highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml$1(token.content);
52197
52190
  } else {
52198
- highlighted = escapeHtml(token.content);
52191
+ highlighted = escapeHtml$1(token.content);
52199
52192
  }
52200
52193
  if (highlighted.indexOf("<pre") === 0) {
52201
52194
  return highlighted + "\n";
@@ -52230,7 +52223,7 @@ default_rules.softbreak = function(tokens, idx, options) {
52230
52223
  return options.breaks ? options.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
52231
52224
  };
52232
52225
  default_rules.text = function(tokens, idx) {
52233
- return escapeHtml(tokens[idx].content);
52226
+ return escapeHtml$1(tokens[idx].content);
52234
52227
  };
52235
52228
  default_rules.html_block = function(tokens, idx) {
52236
52229
  return tokens[idx].content;
@@ -52248,7 +52241,7 @@ Renderer.prototype.renderAttrs = function renderAttrs(token) {
52248
52241
  }
52249
52242
  result = "";
52250
52243
  for (i = 0, l = token.attrs.length; i < l; i++) {
52251
- result += " " + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
52244
+ result += " " + escapeHtml$1(token.attrs[i][0]) + '="' + escapeHtml$1(token.attrs[i][1]) + '"';
52252
52245
  }
52253
52246
  return result;
52254
52247
  };
@@ -60615,11 +60608,10 @@ const createLucideIcon = (iconName, iconNode) => {
60615
60608
  * See the LICENSE file in the root directory of this source tree.
60616
60609
  */
60617
60610
  const __iconNode$J = [
60618
- ["rect", { width: "20", height: "5", x: "2", y: "3", rx: "1", key: "1wp1u1" }],
60619
- ["path", { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8", key: "1s80jp" }],
60620
- ["path", { d: "M10 12h4", key: "a56b0p" }]
60611
+ ["path", { d: "M12 5v14", key: "s699le" }],
60612
+ ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
60621
60613
  ];
60622
- const Archive = createLucideIcon("archive", __iconNode$J);
60614
+ const ArrowDown = createLucideIcon("arrow-down", __iconNode$J);
60623
60615
  /**
60624
60616
  * @license lucide-react v0.575.0 - ISC
60625
60617
  *
@@ -60627,10 +60619,10 @@ const Archive = createLucideIcon("archive", __iconNode$J);
60627
60619
  * See the LICENSE file in the root directory of this source tree.
60628
60620
  */
60629
60621
  const __iconNode$I = [
60630
- ["path", { d: "M12 5v14", key: "s699le" }],
60631
- ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
60622
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
60623
+ ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
60632
60624
  ];
60633
- const ArrowDown = createLucideIcon("arrow-down", __iconNode$I);
60625
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$I);
60634
60626
  /**
60635
60627
  * @license lucide-react v0.575.0 - ISC
60636
60628
  *
@@ -61324,6 +61316,7 @@ const TOOL_META = {
61324
61316
  execute_presentation_code: { displayName: "Generating slides", icon: Monitor },
61325
61317
  // Code & Data
61326
61318
  run_python_code: { displayName: "Running analysis", icon: Code },
61319
+ // Debug: temporarily log all tool names hitting the fallback
61327
61320
  run_sql_query_tool: { displayName: "Querying data", icon: Database },
61328
61321
  create_database: { displayName: "Setting up database", icon: Database },
61329
61322
  run_database_sql: { displayName: "Querying database", icon: Database },
@@ -62381,14 +62374,21 @@ const EmailSearchToolUIImpl = ({
62381
62374
  toolName,
62382
62375
  badge: isComplete && emails.length > 0 ? `${emails.length} emails` : void 0,
62383
62376
  error: errorMsg,
62384
- children: isComplete && emails.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-0.5 py-2", i === 0 && "pt-0"), children: [
62385
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
62386
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] font-medium text-foreground", children: email.subject || "No subject" }),
62387
- email.date && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: email.date })
62388
- ] }),
62389
- email.from && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground", children: email.from }),
62390
- email.snippet && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] leading-relaxed text-muted-foreground/80", children: truncate(email.snippet, 150) })
62391
- ] }, i)) }) })
62377
+ children: isComplete && emails.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxRuntime.jsxs(
62378
+ "div",
62379
+ {
62380
+ className: cn("flex flex-col gap-0.5 py-2", i === 0 && "pt-0"),
62381
+ children: [
62382
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
62383
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] font-medium text-foreground", children: email.subject || "No subject" }),
62384
+ email.date && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: email.date })
62385
+ ] }),
62386
+ email.from && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground", children: email.from }),
62387
+ email.snippet && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] leading-relaxed text-muted-foreground/80", children: truncate(email.snippet, 150) })
62388
+ ]
62389
+ },
62390
+ i
62391
+ )) }) })
62392
62392
  }
62393
62393
  );
62394
62394
  };
@@ -62556,7 +62556,17 @@ const CreateNotebookToolUI = React.memo(
62556
62556
  CreateNotebookToolUI.displayName = "CreateNotebookToolUI";
62557
62557
  function parsePythonResult(result) {
62558
62558
  const data = normalizeResult(result);
62559
- if (!data) return { stdout: null, stderr: null, value: null, error: null, exception: null, imagePng: null, createdAssets: [] };
62559
+ if (!data)
62560
+ return {
62561
+ stdout: null,
62562
+ stderr: null,
62563
+ value: null,
62564
+ error: null,
62565
+ exception: null,
62566
+ imagePng: null,
62567
+ plotlyJson: null,
62568
+ createdAssets: []
62569
+ };
62560
62570
  const inner = typeof data.result === "object" && data.result !== null ? data.result : data;
62561
62571
  const stdout = inner.stdout ?? null;
62562
62572
  const stderr = inner.stderr ?? null;
@@ -62572,25 +62582,243 @@ function parsePythonResult(result) {
62572
62582
  };
62573
62583
  }
62574
62584
  let imagePng = null;
62585
+ let plotlyJson = null;
62575
62586
  if (inner.data && typeof inner.data === "object") {
62576
62587
  imagePng = inner.data.png ?? null;
62577
62588
  }
62578
- if (!imagePng && Array.isArray(data.outputs)) {
62589
+ if (Array.isArray(data.outputs)) {
62579
62590
  for (const output of data.outputs) {
62580
62591
  if (output && typeof output === "object") {
62581
62592
  const mimeBundle = output.mime_bundle;
62582
62593
  if (mimeBundle && typeof mimeBundle === "object") {
62583
- const png = mimeBundle["image/png"];
62584
- if (typeof png === "string") {
62585
- imagePng = png;
62586
- break;
62594
+ const mb = mimeBundle;
62595
+ if (!plotlyJson && typeof mb["plotly+json"] === "string") {
62596
+ plotlyJson = mb["plotly+json"];
62597
+ }
62598
+ if (!imagePng && typeof mb["image/png"] === "string") {
62599
+ imagePng = mb["image/png"];
62587
62600
  }
62588
62601
  }
62589
62602
  }
62590
62603
  }
62591
62604
  }
62592
62605
  const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
62593
- return { stdout, stderr, value, error: error2, exception, imagePng, createdAssets };
62606
+ return { stdout, stderr, value, error: error2, exception, imagePng, plotlyJson, createdAssets };
62607
+ }
62608
+ let plotlyLoadPromise = null;
62609
+ function ensurePlotlyLoaded() {
62610
+ if (window.Plotly) return Promise.resolve();
62611
+ if (plotlyLoadPromise) return plotlyLoadPromise;
62612
+ plotlyLoadPromise = new Promise((resolve, reject) => {
62613
+ const script = document.createElement("script");
62614
+ script.src = "https://cdn.plot.ly/plotly-2.35.2.min.js";
62615
+ script.onload = () => resolve();
62616
+ script.onerror = () => {
62617
+ plotlyLoadPromise = null;
62618
+ reject(new Error("Failed to load Plotly"));
62619
+ };
62620
+ document.head.appendChild(script);
62621
+ });
62622
+ return plotlyLoadPromise;
62623
+ }
62624
+ const PlotlyChart = ({ json }) => {
62625
+ const chartRef = React.useRef(null);
62626
+ const [error2, setError] = React.useState(null);
62627
+ React.useEffect(() => {
62628
+ let cancelled = false;
62629
+ ensurePlotlyLoaded().then(() => {
62630
+ if (cancelled || !chartRef.current) return;
62631
+ const parsed = JSON.parse(json);
62632
+ const Plotly = window.Plotly;
62633
+ Plotly.newPlot(
62634
+ chartRef.current,
62635
+ parsed.data || [],
62636
+ { ...parsed.layout || {}, autosize: true, width: void 0, height: void 0 },
62637
+ { responsive: true, displayModeBar: true, displaylogo: false, showLink: false }
62638
+ );
62639
+ }).catch((err) => {
62640
+ if (!cancelled) setError(err.message);
62641
+ });
62642
+ return () => {
62643
+ cancelled = true;
62644
+ if (chartRef.current) {
62645
+ const Plotly = window.Plotly;
62646
+ if (Plotly == null ? void 0 : Plotly.purge) Plotly.purge(chartRef.current);
62647
+ }
62648
+ };
62649
+ }, [json]);
62650
+ if (error2) {
62651
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: error2 });
62652
+ }
62653
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: chartRef, className: "w-full overflow-hidden", style: { height: 500 } });
62654
+ };
62655
+ const SyntaxHighlightedCode = React.memo(({ code: code2 }) => {
62656
+ const highlighted = React.useMemo(() => highlightPython(code2), [code2]);
62657
+ return /* @__PURE__ */ jsxRuntime.jsx(
62658
+ "pre",
62659
+ {
62660
+ className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed font-mono",
62661
+ dangerouslySetInnerHTML: { __html: highlighted }
62662
+ }
62663
+ );
62664
+ });
62665
+ SyntaxHighlightedCode.displayName = "SyntaxHighlightedCode";
62666
+ const PY_KEYWORDS = /* @__PURE__ */ new Set([
62667
+ "False",
62668
+ "None",
62669
+ "True",
62670
+ "and",
62671
+ "as",
62672
+ "assert",
62673
+ "async",
62674
+ "await",
62675
+ "break",
62676
+ "class",
62677
+ "continue",
62678
+ "def",
62679
+ "del",
62680
+ "elif",
62681
+ "else",
62682
+ "except",
62683
+ "finally",
62684
+ "for",
62685
+ "from",
62686
+ "global",
62687
+ "if",
62688
+ "import",
62689
+ "in",
62690
+ "is",
62691
+ "lambda",
62692
+ "nonlocal",
62693
+ "not",
62694
+ "or",
62695
+ "pass",
62696
+ "raise",
62697
+ "return",
62698
+ "try",
62699
+ "while",
62700
+ "with",
62701
+ "yield"
62702
+ ]);
62703
+ const PY_BUILTINS = /* @__PURE__ */ new Set([
62704
+ "print",
62705
+ "len",
62706
+ "range",
62707
+ "int",
62708
+ "str",
62709
+ "float",
62710
+ "list",
62711
+ "dict",
62712
+ "set",
62713
+ "tuple",
62714
+ "bool",
62715
+ "type",
62716
+ "isinstance",
62717
+ "enumerate",
62718
+ "zip",
62719
+ "map",
62720
+ "filter",
62721
+ "sorted",
62722
+ "reversed",
62723
+ "sum",
62724
+ "min",
62725
+ "max",
62726
+ "abs",
62727
+ "round",
62728
+ "open",
62729
+ "super",
62730
+ "property",
62731
+ "staticmethod",
62732
+ "classmethod",
62733
+ "display",
62734
+ "input",
62735
+ "format",
62736
+ "getattr",
62737
+ "setattr",
62738
+ "hasattr",
62739
+ "vars",
62740
+ "dir"
62741
+ ]);
62742
+ function escapeHtml(s) {
62743
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
62744
+ }
62745
+ function highlightPython(code2) {
62746
+ const lines = code2.split("\n");
62747
+ return lines.map((line) => {
62748
+ const commentMatch = line.match(/^(\s*)(#.*)$/);
62749
+ if (commentMatch) {
62750
+ return `${escapeHtml(commentMatch[1])}<span style="color:var(--aui-syn-comment, #6a9955)">${escapeHtml(commentMatch[2])}</span>`;
62751
+ }
62752
+ let result = "";
62753
+ let i = 0;
62754
+ while (i < line.length) {
62755
+ if (line[i] === "#") {
62756
+ result += `<span style="color:var(--aui-syn-comment, #6a9955)">${escapeHtml(line.slice(i))}</span>`;
62757
+ break;
62758
+ }
62759
+ if (line.slice(i, i + 3) === '"""' || line.slice(i, i + 3) === "'''") {
62760
+ const quote = line.slice(i, i + 3);
62761
+ const end = line.indexOf(quote, i + 3);
62762
+ const str = end >= 0 ? line.slice(i, end + 3) : line.slice(i);
62763
+ result += `<span style="color:var(--aui-syn-string, #ce9178)">${escapeHtml(str)}</span>`;
62764
+ i += str.length;
62765
+ continue;
62766
+ }
62767
+ if (line[i] === '"' || line[i] === "'") {
62768
+ const q = line[i];
62769
+ let j = i + 1;
62770
+ while (j < line.length && line[j] !== q) {
62771
+ if (line[j] === "\\") j++;
62772
+ j++;
62773
+ }
62774
+ const str = line.slice(i, j + 1);
62775
+ result += `<span style="color:var(--aui-syn-string, #ce9178)">${escapeHtml(str)}</span>`;
62776
+ i = j + 1;
62777
+ continue;
62778
+ }
62779
+ if (/\d/.test(line[i]) && (i === 0 || /[\s(,=[\-+*/:!<>]/.test(line[i - 1]))) {
62780
+ const numMatch = line.slice(i).match(/^(\d+\.?\d*(?:[eE][+-]?\d+)?)/);
62781
+ if (numMatch) {
62782
+ result += `<span style="color:var(--aui-syn-number, #b5cea8)">${escapeHtml(numMatch[1])}</span>`;
62783
+ i += numMatch[1].length;
62784
+ continue;
62785
+ }
62786
+ }
62787
+ if (/[a-zA-Z_]/.test(line[i])) {
62788
+ const wordMatch = line.slice(i).match(/^[a-zA-Z_]\w*/);
62789
+ if (wordMatch) {
62790
+ const word = wordMatch[0];
62791
+ if (PY_KEYWORDS.has(word)) {
62792
+ result += `<span style="color:var(--aui-syn-keyword, #569cd6)">${escapeHtml(word)}</span>`;
62793
+ } else if (PY_BUILTINS.has(word)) {
62794
+ result += `<span style="color:var(--aui-syn-builtin, #dcdcaa)">${escapeHtml(word)}</span>`;
62795
+ } else if (line[i + word.length] === "(") {
62796
+ result += `<span style="color:var(--aui-syn-func, #dcdcaa)">${escapeHtml(word)}</span>`;
62797
+ } else {
62798
+ result += escapeHtml(word);
62799
+ }
62800
+ i += word.length;
62801
+ continue;
62802
+ }
62803
+ }
62804
+ if (line[i] === "@" && (i === 0 || /\s/.test(line[i - 1]))) {
62805
+ const decMatch = line.slice(i).match(/^@[\w.]+/);
62806
+ if (decMatch) {
62807
+ result += `<span style="color:var(--aui-syn-decorator, #569cd6)">${escapeHtml(decMatch[0])}</span>`;
62808
+ i += decMatch[0].length;
62809
+ continue;
62810
+ }
62811
+ }
62812
+ if (/[+\-*/%=<>!&|^~]/.test(line[i])) {
62813
+ result += `<span style="color:var(--aui-syn-op, #d4d4d4)">${escapeHtml(line[i])}</span>`;
62814
+ i++;
62815
+ continue;
62816
+ }
62817
+ result += escapeHtml(line[i]);
62818
+ i++;
62819
+ }
62820
+ return result;
62821
+ }).join("\n");
62594
62822
  }
62595
62823
  const RunPythonCodeToolUIImpl = ({
62596
62824
  toolName,
@@ -62606,11 +62834,15 @@ const RunPythonCodeToolUIImpl = ({
62606
62834
  const isRunning = (status == null ? void 0 : status.type) === "running";
62607
62835
  const isComplete = (status == null ? void 0 : status.type) === "complete";
62608
62836
  const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
62609
- const parsed = React.useMemo(() => isComplete ? parsePythonResult(result) : null, [result, isComplete]);
62837
+ const parsed = React.useMemo(
62838
+ () => isComplete ? parsePythonResult(result) : null,
62839
+ [result, isComplete]
62840
+ );
62610
62841
  const openAsset = useAssetPanelStore((s) => s.openAsset);
62611
62842
  const hasOutput = parsed && (parsed.stdout || parsed.stderr || parsed.value);
62612
62843
  const hasError = parsed && (parsed.error || parsed.exception);
62613
62844
  const hasImage = parsed == null ? void 0 : parsed.imagePng;
62845
+ const hasPlotly = parsed == null ? void 0 : parsed.plotlyJson;
62614
62846
  return /* @__PURE__ */ jsxRuntime.jsxs(
62615
62847
  ToolCard,
62616
62848
  {
@@ -62620,7 +62852,7 @@ const RunPythonCodeToolUIImpl = ({
62620
62852
  toolName,
62621
62853
  error: errorMsg,
62622
62854
  children: [
62623
- code2 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed font-mono text-foreground/80", children: code2 }) }),
62855
+ code2 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlightedCode, { code: code2 }) }),
62624
62856
  isComplete && hasOutput && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62625
62857
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
62626
62858
  /* @__PURE__ */ jsxRuntime.jsx(Terminal, { className: "size-3 text-muted-foreground" }),
@@ -62635,7 +62867,14 @@ const RunPythonCodeToolUIImpl = ({
62635
62867
  ] }),
62636
62868
  /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md bg-destructive/5 p-2 text-[11px] leading-relaxed font-mono text-destructive/80", children: ((_a2 = parsed.exception) == null ? void 0 : _a2.traceback) ?? parsed.error })
62637
62869
  ] }),
62638
- isComplete && hasImage && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62870
+ isComplete && hasPlotly && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62871
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
62872
+ /* @__PURE__ */ jsxRuntime.jsx(ChartColumn, { className: "size-3 text-muted-foreground" }),
62873
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Interactive chart" })
62874
+ ] }),
62875
+ /* @__PURE__ */ jsxRuntime.jsx(PlotlyChart, { json: parsed.plotlyJson })
62876
+ ] }),
62877
+ isComplete && hasImage && !hasPlotly && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62639
62878
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
62640
62879
  /* @__PURE__ */ jsxRuntime.jsx(Image, { className: "size-3 text-muted-foreground" }),
62641
62880
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Generated image" })
@@ -62866,13 +63105,63 @@ const TooltipIconButton = React.forwardRef(
62866
63105
  );
62867
63106
  TooltipIconButton.displayName = "TooltipIconButton";
62868
63107
  const EMPTY_MENTION_TOOLS = [];
63108
+ const DEFAULT_SUGGESTIONS = [
63109
+ {
63110
+ icon: Search,
63111
+ title: "Research a topic and draft a report",
63112
+ prompt: "Search the web for the latest developments in enterprise AI adoption, then create a document summarizing the key trends, market data, and strategic implications."
63113
+ },
63114
+ {
63115
+ icon: ChartColumn,
63116
+ title: "Analyze data and visualize insights",
63117
+ prompt: "Generate a sample quarterly sales dataset across 4 product categories, then create an interactive chart showing revenue trends and category performance over time."
63118
+ },
63119
+ {
63120
+ icon: Presentation,
63121
+ title: "Build a presentation from scratch",
63122
+ prompt: "Create a 5-slide investor update presentation covering market opportunity, product traction, key metrics, competitive positioning, and next steps."
63123
+ },
63124
+ {
63125
+ icon: FileText,
63126
+ title: "Set up a structured spreadsheet",
63127
+ prompt: "Create a project tracking spreadsheet with columns for task name, owner, priority, status, start date, due date, and completion percentage."
63128
+ }
63129
+ ];
63130
+ const SuggestionCard = ({
63131
+ suggestion,
63132
+ index: index2
63133
+ }) => {
63134
+ const aui = useAui();
63135
+ const Icon2 = suggestion.icon;
63136
+ const handleClick2 = React.useCallback(() => {
63137
+ aui.thread().append({
63138
+ role: "user",
63139
+ content: [{ type: "text", text: suggestion.prompt }]
63140
+ });
63141
+ }, [aui, suggestion.prompt]);
63142
+ return /* @__PURE__ */ jsxRuntime.jsxs(
63143
+ "button",
63144
+ {
63145
+ type: "button",
63146
+ onClick: handleClick2,
63147
+ className: `fade-in slide-in-from-bottom-2 animate-in fill-mode-both group flex items-start gap-3 rounded-xl border border-border/60 bg-background p-3.5 text-left shadow-sm transition-all duration-150 hover:border-border hover:bg-muted/40 hover:shadow-md`,
63148
+ style: { animationDelay: `${100 + index2 * 75}ms` },
63149
+ children: [
63150
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary", children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4" }) }),
63151
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-medium leading-snug text-foreground", children: suggestion.title }) }),
63152
+ /* @__PURE__ */ jsxRuntime.jsx(ArrowRight, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground/0 transition-all group-hover:text-muted-foreground" })
63153
+ ]
63154
+ }
63155
+ );
63156
+ };
62869
63157
  const AthenaChat = ({
62870
63158
  className,
62871
63159
  welcomeMessage = "Hello there!",
62872
- welcomeSubtext = "How can I help you today?",
63160
+ welcomeSubtext = "What can I help you with?",
62873
63161
  maxWidth = "44rem",
62874
63162
  toolUIs,
62875
- mentionTools
63163
+ mentionTools,
63164
+ welcomeSuggestions = DEFAULT_SUGGESTIONS
62876
63165
  }) => {
62877
63166
  const tools = mentionTools ?? EMPTY_MENTION_TOOLS;
62878
63167
  const mergedToolUIs = React.useMemo(() => ({
@@ -62885,43 +63174,52 @@ const AthenaChat = ({
62885
63174
  () => () => /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { toolUIs: mergedToolUIs }),
62886
63175
  [mergedToolUIs]
62887
63176
  );
62888
- return /* @__PURE__ */ jsxRuntime.jsx(
63177
+ return /* @__PURE__ */ jsxRuntime.jsxs(
62889
63178
  ThreadPrimitiveRoot,
62890
63179
  {
62891
63180
  className: `aui-root aui-thread-root @container flex h-full flex-col bg-background ${className ?? ""}`,
62892
63181
  style: { ["--thread-max-width"]: maxWidth, position: "relative" },
62893
- children: /* @__PURE__ */ jsxRuntime.jsxs(
62894
- ThreadPrimitiveViewport,
62895
- {
62896
- turnAnchor: "top",
62897
- className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
62898
- children: [
62899
- /* @__PURE__ */ jsxRuntime.jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
62900
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200", children: welcomeMessage }),
62901
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200", children: welcomeSubtext })
62902
- ] }) }) }) }),
62903
- /* @__PURE__ */ jsxRuntime.jsx(
62904
- ThreadPrimitiveMessages,
62905
- {
62906
- components: {
62907
- UserMessage,
62908
- AssistantMessage: AssistantMessageComponent
63182
+ children: [
63183
+ /* @__PURE__ */ jsxRuntime.jsx(ThreadLoadingOverlay, {}),
63184
+ /* @__PURE__ */ jsxRuntime.jsxs(
63185
+ ThreadPrimitiveViewport,
63186
+ {
63187
+ turnAnchor: "top",
63188
+ className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
63189
+ children: [
63190
+ /* @__PURE__ */ jsxRuntime.jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
63191
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200", children: welcomeMessage }),
63192
+ welcomeSubtext && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-lg delay-75 duration-200", children: welcomeSubtext }),
63193
+ welcomeSuggestions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2", children: welcomeSuggestions.map((s, i) => /* @__PURE__ */ jsxRuntime.jsx(SuggestionCard, { suggestion: s, index: i }, i)) })
63194
+ ] }) }) }) }),
63195
+ /* @__PURE__ */ jsxRuntime.jsx(
63196
+ ThreadPrimitiveMessages,
63197
+ {
63198
+ components: {
63199
+ UserMessage,
63200
+ AssistantMessage: AssistantMessageComponent
63201
+ }
62909
63202
  }
62910
- }
62911
- ),
62912
- /* @__PURE__ */ jsxRuntime.jsxs(ThreadPrimitiveViewportFooter, { className: "aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6", children: [
62913
- /* @__PURE__ */ jsxRuntime.jsx(ThreadScrollToBottom, {}),
62914
- /* @__PURE__ */ jsxRuntime.jsxs(ComposerPrimitiveRoot, { className: "aui-composer-root relative flex w-full flex-col rounded-2xl border border-input bg-background px-1 pt-2 outline-none transition-shadow focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20", children: [
62915
- /* @__PURE__ */ jsxRuntime.jsx(TiptapComposer, { tools }),
62916
- /* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {})
63203
+ ),
63204
+ /* @__PURE__ */ jsxRuntime.jsxs(ThreadPrimitiveViewportFooter, { className: "aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6", children: [
63205
+ /* @__PURE__ */ jsxRuntime.jsx(ThreadScrollToBottom, {}),
63206
+ /* @__PURE__ */ jsxRuntime.jsxs(ComposerPrimitiveRoot, { className: "aui-composer-root relative flex w-full flex-col rounded-2xl border border-input bg-background px-1 pt-2 outline-none transition-shadow focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20", children: [
63207
+ /* @__PURE__ */ jsxRuntime.jsx(TiptapComposer, { tools }),
63208
+ /* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {})
63209
+ ] })
62917
63210
  ] })
62918
- ] })
62919
- ]
62920
- }
62921
- )
63211
+ ]
63212
+ }
63213
+ )
63214
+ ]
62922
63215
  }
62923
63216
  );
62924
63217
  };
63218
+ const ThreadLoadingOverlay = () => {
63219
+ const remoteId = useAthenaThreadId();
63220
+ if (!remoteId) return null;
63221
+ return /* @__PURE__ */ jsxRuntime.jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent" }) }) });
63222
+ };
62925
63223
  const ThreadScrollToBottom = () => /* @__PURE__ */ jsxRuntime.jsx(ThreadPrimitiveScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
62926
63224
  TooltipIconButton,
62927
63225
  {
@@ -63358,13 +63656,10 @@ function ThreadList({ className }) {
63358
63656
  ] });
63359
63657
  }
63360
63658
  function ThreadListItem() {
63361
- return /* @__PURE__ */ jsxRuntime.jsxs(ThreadListItemPrimitiveRoot, { className: "group", children: [
63362
- /* @__PURE__ */ jsxRuntime.jsxs(ThreadListItemPrimitiveTrigger, { className: "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors cursor-pointer text-muted-foreground hover:bg-muted/30 hover:text-foreground data-[active]:bg-muted/50 data-[active]:text-foreground", children: [
63363
- /* @__PURE__ */ jsxRuntime.jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
63364
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-left", children: /* @__PURE__ */ jsxRuntime.jsx(ThreadListItemPrimitiveTitle, { fallback: "Untitled" }) })
63365
- ] }),
63366
- /* @__PURE__ */ jsxRuntime.jsx(ThreadListItemPrimitiveArchive, { className: "hidden size-5 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-muted hover:text-foreground group-hover:flex", children: /* @__PURE__ */ jsxRuntime.jsx(Archive, { className: "size-3" }) })
63367
- ] });
63659
+ return /* @__PURE__ */ jsxRuntime.jsx(ThreadListItemPrimitiveRoot, { className: "group", children: /* @__PURE__ */ jsxRuntime.jsxs(ThreadListItemPrimitiveTrigger, { className: "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors cursor-pointer text-muted-foreground hover:bg-muted/30 hover:text-foreground data-[active]:bg-muted/50 data-[active]:text-foreground", children: [
63660
+ /* @__PURE__ */ jsxRuntime.jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
63661
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-left", children: /* @__PURE__ */ jsxRuntime.jsx(ThreadListItemPrimitiveTitle, { fallback: "Untitled" }) })
63662
+ ] }) });
63368
63663
  }
63369
63664
  function useAppendToComposer() {
63370
63665
  const aui = useAui();