@athenaintel/react 0.9.13 → 0.9.14

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
@@ -63446,6 +63446,7 @@ function parsePythonResult(result) {
63446
63446
  const data = normalizeResult(result);
63447
63447
  if (!data)
63448
63448
  return {
63449
+ outputs: [],
63449
63450
  stdout: null,
63450
63451
  stderr: null,
63451
63452
  value: null,
@@ -63453,7 +63454,9 @@ function parsePythonResult(result) {
63453
63454
  exception: null,
63454
63455
  imagePng: null,
63455
63456
  plotlyJson: null,
63456
- createdAssets: []
63457
+ createdAssets: [],
63458
+ assetId: null,
63459
+ deckId: null
63457
63460
  };
63458
63461
  const inner = typeof data.result === "object" && data.result !== null ? data.result : data;
63459
63462
  const stdout = inner.stdout ?? null;
@@ -63471,13 +63474,18 @@ function parsePythonResult(result) {
63471
63474
  }
63472
63475
  let imagePng = null;
63473
63476
  let plotlyJson = null;
63477
+ const outputs = [];
63474
63478
  if (inner.data && typeof inner.data === "object") {
63475
63479
  imagePng = inner.data.png ?? null;
63476
63480
  }
63477
63481
  if (Array.isArray(data.outputs)) {
63478
63482
  for (const output of data.outputs) {
63479
63483
  if (output && typeof output === "object") {
63484
+ const outputRecord = output;
63480
63485
  const mimeBundle = output.mime_bundle;
63486
+ let outputImagePng = null;
63487
+ let outputPlotlyJson = null;
63488
+ let outputTextPlain = null;
63481
63489
  if (mimeBundle && typeof mimeBundle === "object") {
63482
63490
  const mb = mimeBundle;
63483
63491
  if (!plotlyJson && typeof mb["plotly+json"] === "string") {
@@ -63486,12 +63494,52 @@ function parsePythonResult(result) {
63486
63494
  if (!imagePng && typeof mb["image/png"] === "string") {
63487
63495
  imagePng = mb["image/png"];
63488
63496
  }
63489
- }
63497
+ outputPlotlyJson = typeof mb["plotly+json"] === "string" ? mb["plotly+json"] : null;
63498
+ outputImagePng = typeof mb["image/png"] === "string" ? mb["image/png"] : null;
63499
+ outputTextPlain = typeof mb["text/plain"] === "string" ? mb["text/plain"] : null;
63500
+ }
63501
+ outputs.push({
63502
+ objectId: typeof outputRecord.object_id === "string" ? outputRecord.object_id : null,
63503
+ title: typeof outputRecord.title === "string" ? outputRecord.title : null,
63504
+ textPlain: outputTextPlain,
63505
+ imagePng: outputImagePng,
63506
+ plotlyJson: outputPlotlyJson,
63507
+ assetId: typeof outputRecord.asset_id === "string" ? outputRecord.asset_id : null
63508
+ });
63490
63509
  }
63491
63510
  }
63492
63511
  }
63493
63512
  const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
63494
- return { stdout, stderr, value, error: error2, exception, imagePng, plotlyJson, createdAssets };
63513
+ const assetId = typeof data.asset_id === "string" ? data.asset_id : null;
63514
+ const deckId = typeof data.deck_id === "string" ? data.deck_id : null;
63515
+ return {
63516
+ outputs,
63517
+ stdout,
63518
+ stderr,
63519
+ value,
63520
+ error: error2,
63521
+ exception,
63522
+ imagePng,
63523
+ plotlyJson,
63524
+ createdAssets,
63525
+ assetId,
63526
+ deckId
63527
+ };
63528
+ }
63529
+ function getExecutionTextOutput(parsed) {
63530
+ const output = [
63531
+ parsed.value,
63532
+ parsed.stdout,
63533
+ parsed.stderr,
63534
+ ...parsed.outputs.map((entry) => {
63535
+ if (!entry.textPlain) {
63536
+ return null;
63537
+ }
63538
+ return entry.title ? `${entry.title}
63539
+ ${entry.textPlain}` : entry.textPlain;
63540
+ })
63541
+ ].filter((chunk) => Boolean(chunk && chunk.trim())).join("\n\n");
63542
+ return output || null;
63495
63543
  }
63496
63544
  function getPlotly() {
63497
63545
  return window.Plotly;
@@ -63776,7 +63824,8 @@ const RunPythonCodeToolUIImpl = ({
63776
63824
  [result, isComplete]
63777
63825
  );
63778
63826
  const openAsset = useAssetPanelStore((s) => s.openAsset);
63779
- const hasOutput = parsed && (parsed.stdout || parsed.stderr || parsed.value);
63827
+ const outputText = parsed ? getExecutionTextOutput(parsed) : null;
63828
+ const hasOutput = Boolean(outputText);
63780
63829
  const hasError = parsed && (parsed.error || parsed.exception);
63781
63830
  const hasImage = parsed == null ? void 0 : parsed.imagePng;
63782
63831
  const hasPlotly = parsed == null ? void 0 : parsed.plotlyJson;
@@ -63797,7 +63846,7 @@ const RunPythonCodeToolUIImpl = ({
63797
63846
  /* @__PURE__ */ jsxRuntime.jsx(Terminal, { className: "size-3 text-muted-foreground" }),
63798
63847
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Output" })
63799
63848
  ] }),
63800
- /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/30 p-2 text-[11px] leading-relaxed font-mono text-foreground/80", children: [parsed.value, parsed.stdout, parsed.stderr].filter(Boolean).join("\n") })
63849
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/30 p-2 text-[11px] leading-relaxed font-mono text-foreground/80", children: outputText })
63801
63850
  ] }),
63802
63851
  isComplete && hasError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 bg-destructive/10 px-4 py-2.5", children: [
63803
63852
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
@@ -63845,6 +63894,109 @@ const RunPythonCodeToolUI = React.memo(
63845
63894
  RunPythonCodeToolUIImpl
63846
63895
  );
63847
63896
  RunPythonCodeToolUI.displayName = "RunPythonCodeToolUI";
63897
+ const ExecutePresentationCodeToolUIImpl = ({
63898
+ toolName,
63899
+ args,
63900
+ result,
63901
+ status
63902
+ }) => {
63903
+ var _a2;
63904
+ const typedArgs = args;
63905
+ const code2 = (typedArgs == null ? void 0 : typedArgs.code) ?? "";
63906
+ const summary = (typedArgs == null ? void 0 : typedArgs.summary) ?? null;
63907
+ const deckIdFromArgs = typeof (typedArgs == null ? void 0 : typedArgs.deck_id) === "string" ? typedArgs.deck_id : null;
63908
+ const isRunning = (status == null ? void 0 : status.type) === "running";
63909
+ const isComplete = (status == null ? void 0 : status.type) === "complete";
63910
+ const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
63911
+ const parsed = React.useMemo(
63912
+ () => isComplete ? parsePythonResult(result) : null,
63913
+ [result, isComplete]
63914
+ );
63915
+ const outputText = parsed ? getExecutionTextOutput(parsed) : null;
63916
+ const assetId = (parsed == null ? void 0 : parsed.assetId) ?? null;
63917
+ const deckId = (parsed == null ? void 0 : parsed.deckId) ?? deckIdFromArgs;
63918
+ const hasError = parsed && (parsed.error || parsed.exception);
63919
+ const openAsset = useAssetPanelStore((s) => s.openAsset);
63920
+ const wasCompleteAtMount = React.useRef(isComplete);
63921
+ React.useEffect(() => {
63922
+ if (!isComplete || !assetId || wasCompleteAtMount.current) {
63923
+ return;
63924
+ }
63925
+ const store = useAssetPanelStore.getState();
63926
+ if (store.markAutoOpened(assetId)) {
63927
+ store.openAsset(assetId, { type: "presentation" });
63928
+ }
63929
+ }, [assetId, isComplete]);
63930
+ return /* @__PURE__ */ jsxRuntime.jsxs(
63931
+ ToolCard,
63932
+ {
63933
+ icon: Presentation,
63934
+ status: (status == null ? void 0 : status.type) ?? "complete",
63935
+ title: isRunning ? summary || "Executing presentation code..." : summary || "Presentation updated",
63936
+ subtitle: deckId ? `Deck ${truncate(deckId, 24)}` : assetId ? `Asset ${truncate(assetId, 24)}` : void 0,
63937
+ badge: "Deck",
63938
+ toolName,
63939
+ args: typedArgs,
63940
+ result,
63941
+ error: errorMsg,
63942
+ children: [
63943
+ assetId && isComplete && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border/40 px-4 py-2.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
63944
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
63945
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[11px] font-medium text-muted-foreground", children: "Open the updated deck in the asset panel" }),
63946
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-[11px] text-foreground/80", children: truncate(assetId, 32) })
63947
+ ] }),
63948
+ /* @__PURE__ */ jsxRuntime.jsxs(
63949
+ "button",
63950
+ {
63951
+ type: "button",
63952
+ onClick: () => openAsset(assetId, { type: "presentation" }),
63953
+ className: "flex shrink-0 items-center gap-1.5 rounded-md border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
63954
+ children: [
63955
+ /* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "size-3" }),
63956
+ "Open deck"
63957
+ ]
63958
+ }
63959
+ )
63960
+ ] }) }),
63961
+ code2 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlightedCode, { code: code2 }) }),
63962
+ isComplete && outputText && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
63963
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1 flex items-center gap-1.5", children: [
63964
+ /* @__PURE__ */ jsxRuntime.jsx(Terminal, { className: "size-3 text-muted-foreground" }),
63965
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Execution log" })
63966
+ ] }),
63967
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "max-h-56 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/30 p-2 text-[11px] leading-relaxed font-mono text-foreground/80", children: outputText })
63968
+ ] }),
63969
+ isComplete && hasError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 bg-destructive/10 px-4 py-2.5", children: [
63970
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1 flex items-center gap-1.5", children: [
63971
+ /* @__PURE__ */ jsxRuntime.jsx(TriangleAlert, { className: "size-3 text-destructive" }),
63972
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-destructive", children: parsed.exception ? `${parsed.exception.name}: ${parsed.exception.value}` : "Execution error" })
63973
+ ] }),
63974
+ /* @__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 })
63975
+ ] }),
63976
+ isComplete && parsed && parsed.createdAssets.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2", children: [
63977
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Created assets" }),
63978
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 flex flex-wrap gap-1.5", children: parsed.createdAssets.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs(
63979
+ "button",
63980
+ {
63981
+ type: "button",
63982
+ onClick: () => openAsset(entry.asset_id),
63983
+ className: "flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
63984
+ children: [
63985
+ /* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "size-2.5" }),
63986
+ truncate(entry.asset_id, 20)
63987
+ ]
63988
+ },
63989
+ entry.asset_id
63990
+ )) })
63991
+ ] })
63992
+ ]
63993
+ }
63994
+ );
63995
+ };
63996
+ const ExecutePresentationCodeToolUI = React.memo(
63997
+ ExecutePresentationCodeToolUIImpl
63998
+ );
63999
+ ExecutePresentationCodeToolUI.displayName = "ExecutePresentationCodeToolUI";
63848
64000
  const OpenAssetToolUIImpl = ({
63849
64001
  toolName,
63850
64002
  args,
@@ -63926,6 +64078,7 @@ const TOOL_UI_REGISTRY = {
63926
64078
  create_new_sheet: CreateSheetToolUI,
63927
64079
  create_powerpoint_deck: CreatePresentationToolUI,
63928
64080
  create_new_notebook: CreateNotebookToolUI,
64081
+ execute_presentation_code: ExecutePresentationCodeToolUI,
63929
64082
  run_python_code: RunPythonCodeToolUI,
63930
64083
  open_asset_in_workspace: OpenAssetToolUI
63931
64084
  };
@@ -64638,7 +64791,7 @@ const MessageError = () => /* @__PURE__ */ jsxRuntime.jsx(MessagePrimitiveError,
64638
64791
  }
64639
64792
  ) })
64640
64793
  ] }) });
64641
- const AthenaAssistantMessageEmpty = () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-muted-foreground", children: "Thinking..." });
64794
+ const AthenaAssistantMessageEmpty = () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-[13px] text-muted-foreground", children: "Thinking..." });
64642
64795
  const AthenaReasoningPart = ({
64643
64796
  text: text2,
64644
64797
  status,
@@ -64688,7 +64841,7 @@ const AthenaReasoningPart = ({
64688
64841
  className: "flex w-full items-center justify-between gap-3 text-left",
64689
64842
  "aria-label": isRunning ? "Toggle reasoning while streaming" : "Toggle reasoning",
64690
64843
  children: [
64691
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-muted-foreground", children: [
64844
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2 text-[13px] font-medium text-muted-foreground", children: [
64692
64845
  /* @__PURE__ */ jsxRuntime.jsx(Brain, { className: "size-4 shrink-0" }),
64693
64846
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: isRunning ? "Reasoning..." : "Reasoning" })
64694
64847
  ] }),
@@ -64709,7 +64862,7 @@ const AthenaReasoningPart = ({
64709
64862
  ]
64710
64863
  }
64711
64864
  ) }),
64712
- /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-sm text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground", children: text2 }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-assistant-reasoning-body text-sm", children: /* @__PURE__ */ jsxRuntime.jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
64865
+ /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-[13px] text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap break-words text-[13px] leading-relaxed text-foreground", children: text2 }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-assistant-reasoning-body text-[13px] leading-relaxed", children: /* @__PURE__ */ jsxRuntime.jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
64713
64866
  ]
64714
64867
  }
64715
64868
  );