@athenaintel/react 0.6.5 → 0.6.6

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.d.ts CHANGED
@@ -107,7 +107,7 @@ export declare interface AthenaProviderProps {
107
107
  token?: string;
108
108
  /** Agent name to use. Defaults to 'athena_assist_agent'. */
109
109
  agent?: string;
110
- /** LLM model identifier. Defaults to 'claude-sonnet-4-6-low'. */
110
+ /** LLM model identifier. Defaults to 'claude-opus-4-6-thinking-max-fast'. */
111
111
  model?: string;
112
112
  /** Backend toolkit IDs to enable (e.g. 'document_toolkit', 'web_search_browse_toolkit'). */
113
113
  tools?: string[];
package/dist/index.js CHANGED
@@ -61298,7 +61298,6 @@ const TOOL_META = {
61298
61298
  execute_presentation_code: { displayName: "Generating slides", icon: Monitor },
61299
61299
  // Code & Data
61300
61300
  run_python_code: { displayName: "Running analysis", icon: Code },
61301
- // Debug: temporarily log all tool names hitting the fallback
61302
61301
  run_sql_query_tool: { displayName: "Querying data", icon: Database },
61303
61302
  create_database: { displayName: "Setting up database", icon: Database },
61304
61303
  run_database_sql: { displayName: "Querying database", icon: Database },
@@ -62587,23 +62586,28 @@ function parsePythonResult(result) {
62587
62586
  const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
62588
62587
  return { stdout, stderr, value, error: error2, exception, imagePng, plotlyJson, createdAssets };
62589
62588
  }
62589
+ function getPlotly() {
62590
+ return window.Plotly;
62591
+ }
62590
62592
  let plotlyLoadPromise = null;
62591
62593
  function ensurePlotlyLoaded() {
62592
- if (window.Plotly) return Promise.resolve();
62594
+ if (getPlotly()) return Promise.resolve();
62593
62595
  if (plotlyLoadPromise) return plotlyLoadPromise;
62594
62596
  plotlyLoadPromise = new Promise((resolve, reject) => {
62595
62597
  const script = document.createElement("script");
62596
62598
  script.src = "https://cdn.plot.ly/plotly-2.35.2.min.js";
62599
+ script.crossOrigin = "anonymous";
62597
62600
  script.onload = () => resolve();
62598
62601
  script.onerror = () => {
62599
62602
  plotlyLoadPromise = null;
62603
+ document.head.removeChild(script);
62600
62604
  reject(new Error("Failed to load Plotly"));
62601
62605
  };
62602
62606
  document.head.appendChild(script);
62603
62607
  });
62604
62608
  return plotlyLoadPromise;
62605
62609
  }
62606
- const PlotlyChart = ({ json }) => {
62610
+ const PlotlyChart = ({ json, height = 500 }) => {
62607
62611
  const chartRef = useRef(null);
62608
62612
  const [error2, setError] = useState(null);
62609
62613
  useEffect(() => {
@@ -62611,7 +62615,8 @@ const PlotlyChart = ({ json }) => {
62611
62615
  ensurePlotlyLoaded().then(() => {
62612
62616
  if (cancelled || !chartRef.current) return;
62613
62617
  const parsed = JSON.parse(json);
62614
- const Plotly = window.Plotly;
62618
+ const Plotly = getPlotly();
62619
+ if (!Plotly) return;
62615
62620
  Plotly.newPlot(
62616
62621
  chartRef.current,
62617
62622
  parsed.data || [],
@@ -62624,15 +62629,58 @@ const PlotlyChart = ({ json }) => {
62624
62629
  return () => {
62625
62630
  cancelled = true;
62626
62631
  if (chartRef.current) {
62627
- const Plotly = window.Plotly;
62628
- if (Plotly == null ? void 0 : Plotly.purge) Plotly.purge(chartRef.current);
62632
+ const Plotly = getPlotly();
62633
+ if (Plotly) Plotly.purge(chartRef.current);
62629
62634
  }
62630
62635
  };
62631
62636
  }, [json]);
62632
62637
  if (error2) {
62633
62638
  return /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: error2 });
62634
62639
  }
62635
- return /* @__PURE__ */ jsx("div", { ref: chartRef, className: "w-full overflow-hidden", style: { height: 500 } });
62640
+ return /* @__PURE__ */ jsx("div", { ref: chartRef, className: "w-full overflow-hidden", style: { height } });
62641
+ };
62642
+ const PlotlyChartSection = ({ json }) => {
62643
+ const [isFullscreen, setIsFullscreen] = useState(false);
62644
+ return /* @__PURE__ */ jsxs(Fragment$2, { children: [
62645
+ /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62646
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
62647
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
62648
+ /* @__PURE__ */ jsx(ChartColumn, { className: "size-3 text-muted-foreground" }),
62649
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Interactive chart" })
62650
+ ] }),
62651
+ /* @__PURE__ */ jsx(
62652
+ "button",
62653
+ {
62654
+ type: "button",
62655
+ onClick: () => setIsFullscreen(true),
62656
+ className: "flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
62657
+ title: "View full screen",
62658
+ children: /* @__PURE__ */ jsx(Maximize2, { className: "size-3.5" })
62659
+ }
62660
+ )
62661
+ ] }),
62662
+ /* @__PURE__ */ jsx(PlotlyChart, { json })
62663
+ ] }),
62664
+ isFullscreen && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-[9999] flex flex-col bg-background", children: [
62665
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-3 border-b border-border", children: [
62666
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
62667
+ /* @__PURE__ */ jsx(ChartColumn, { className: "size-4 text-muted-foreground" }),
62668
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Interactive chart" })
62669
+ ] }),
62670
+ /* @__PURE__ */ jsx(
62671
+ "button",
62672
+ {
62673
+ type: "button",
62674
+ onClick: () => setIsFullscreen(false),
62675
+ className: "flex items-center justify-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
62676
+ title: "Close full screen",
62677
+ children: /* @__PURE__ */ jsx(X, { className: "size-5" })
62678
+ }
62679
+ )
62680
+ ] }),
62681
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 p-4", children: /* @__PURE__ */ jsx(PlotlyChart, { json, height: "100%" }) })
62682
+ ] })
62683
+ ] });
62636
62684
  };
62637
62685
  const SyntaxHighlightedCode = memo(({ code: code2 }) => {
62638
62686
  const highlighted = useMemo(() => highlightPython(code2), [code2]);
@@ -62849,13 +62897,7 @@ const RunPythonCodeToolUIImpl = ({
62849
62897
  ] }),
62850
62898
  /* @__PURE__ */ 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 })
62851
62899
  ] }),
62852
- isComplete && hasPlotly && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62853
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
62854
- /* @__PURE__ */ jsx(ChartColumn, { className: "size-3 text-muted-foreground" }),
62855
- /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Interactive chart" })
62856
- ] }),
62857
- /* @__PURE__ */ jsx(PlotlyChart, { json: parsed.plotlyJson })
62858
- ] }),
62900
+ isComplete && hasPlotly && /* @__PURE__ */ jsx(PlotlyChartSection, { json: parsed.plotlyJson }),
62859
62901
  isComplete && hasImage && !hasPlotly && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62860
62902
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
62861
62903
  /* @__PURE__ */ jsx(Image, { className: "size-3 text-muted-foreground" }),
@@ -63172,7 +63214,7 @@ const AthenaChat = ({
63172
63214
  /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
63173
63215
  /* @__PURE__ */ 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 }),
63174
63216
  welcomeSubtext && /* @__PURE__ */ 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 }),
63175
- welcomeSuggestions.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2", children: welcomeSuggestions.map((s, i) => /* @__PURE__ */ jsx(SuggestionCard, { suggestion: s, index: i }, i)) })
63217
+ welcomeSuggestions.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2", children: welcomeSuggestions.map((s, i) => /* @__PURE__ */ jsx(SuggestionCard, { suggestion: s, index: i }, s.title)) })
63176
63218
  ] }) }) }) }),
63177
63219
  /* @__PURE__ */ jsx(
63178
63220
  ThreadPrimitiveMessages,
@@ -63199,7 +63241,14 @@ const AthenaChat = ({
63199
63241
  };
63200
63242
  const ThreadLoadingOverlay = () => {
63201
63243
  const remoteId = useAthenaThreadId();
63202
- if (!remoteId) return null;
63244
+ const [timedOut, setTimedOut] = useState(false);
63245
+ useEffect(() => {
63246
+ if (!remoteId) return;
63247
+ setTimedOut(false);
63248
+ const timer = setTimeout(() => setTimedOut(true), 15e3);
63249
+ return () => clearTimeout(timer);
63250
+ }, [remoteId]);
63251
+ if (!remoteId || timedOut) return null;
63203
63252
  return /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent" }) }) });
63204
63253
  };
63205
63254
  const ThreadScrollToBottom = () => /* @__PURE__ */ jsx(ThreadPrimitiveScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx(