@athenaintel/react 0.9.13 → 0.9.15

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
@@ -16501,7 +16501,7 @@ const createUrlWithFallback = (url, fallbackUrl) => {
16501
16501
  return new URL(`${normalizeBaseUrl(fallbackUrl)}/`);
16502
16502
  }
16503
16503
  };
16504
- const getHostname = (value) => {
16504
+ const getHostname$1 = (value) => {
16505
16505
  if (!value) return null;
16506
16506
  try {
16507
16507
  return new URL(value).hostname;
@@ -16542,7 +16542,7 @@ function deriveAthenaAppUrl({
16542
16542
  sourcePort: "8000"
16543
16543
  });
16544
16544
  if (workspaceAppUrl) return workspaceAppUrl;
16545
- const backendHostname = getHostname(backendUrl);
16545
+ const backendHostname = getHostname$1(backendUrl);
16546
16546
  if (backendHostname === "api.athenaintel.com") {
16547
16547
  return ATHENA_ENVIRONMENT_URLS.production.appUrl;
16548
16548
  }
@@ -16556,7 +16556,7 @@ function deriveAthenaAppUrl({
16556
16556
  sourcePort: "8787"
16557
16557
  });
16558
16558
  if (workspaceAppUrl) return workspaceAppUrl;
16559
- const apiHostname = getHostname(apiUrl);
16559
+ const apiHostname = getHostname$1(apiUrl);
16560
16560
  if (apiHostname === "sync.athenaintel.com") {
16561
16561
  return ATHENA_ENVIRONMENT_URLS.production.appUrl;
16562
16562
  }
@@ -58661,57 +58661,276 @@ const MentionExtension = Node3.create({
58661
58661
  };
58662
58662
  }
58663
58663
  });
58664
- const useAssetPanelStore = create((set2, get2) => ({
58665
- isOpen: false,
58666
- tabs: [],
58667
- activeTabId: null,
58668
- viewMode: "tabs",
58669
- isFullscreen: false,
58670
- assetPanelHostCount: 0,
58671
- autoOpenGeneration: 0,
58672
- autoOpenedAssets: /* @__PURE__ */ new Map(),
58673
- registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
58674
- unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
58675
- openAsset: (assetId, meta) => set2((s) => {
58676
- const existing = s.tabs.find((t) => t.id === assetId);
58677
- if (existing) {
58678
- const tabs = meta ? s.tabs.map(
58679
- (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
58680
- ) : s.tabs;
58681
- return { isOpen: true, tabs, activeTabId: assetId };
58664
+ function createJSONStorage(getStorage, options) {
58665
+ let storage;
58666
+ try {
58667
+ storage = getStorage();
58668
+ } catch (e) {
58669
+ return;
58670
+ }
58671
+ const persistStorage = {
58672
+ getItem: (name) => {
58673
+ var _a2;
58674
+ const parse2 = (str2) => {
58675
+ if (str2 === null) {
58676
+ return null;
58677
+ }
58678
+ return JSON.parse(str2, void 0);
58679
+ };
58680
+ const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
58681
+ if (str instanceof Promise) {
58682
+ return str.then(parse2);
58683
+ }
58684
+ return parse2(str);
58685
+ },
58686
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
58687
+ removeItem: (name) => storage.removeItem(name)
58688
+ };
58689
+ return persistStorage;
58690
+ }
58691
+ const toThenable = (fn) => (input) => {
58692
+ try {
58693
+ const result = fn(input);
58694
+ if (result instanceof Promise) {
58695
+ return result;
58682
58696
  }
58683
- const newTab = {
58684
- id: assetId,
58685
- name: (meta == null ? void 0 : meta.name) ?? null,
58686
- type: (meta == null ? void 0 : meta.type) ?? "unknown"
58697
+ return {
58698
+ then(onFulfilled) {
58699
+ return toThenable(onFulfilled)(result);
58700
+ },
58701
+ catch(_onRejected) {
58702
+ return this;
58703
+ }
58687
58704
  };
58688
- return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
58689
- }),
58690
- closeTab: (assetId) => set2((s) => {
58691
- var _a2;
58692
- const tabs = s.tabs.filter((t) => t.id !== assetId);
58693
- if (tabs.length === 0) {
58694
- return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
58705
+ } catch (e) {
58706
+ return {
58707
+ then(_onFulfilled) {
58708
+ return this;
58709
+ },
58710
+ catch(onRejected) {
58711
+ return toThenable(onRejected)(e);
58712
+ }
58713
+ };
58714
+ }
58715
+ };
58716
+ const persistImpl = (config2, baseOptions) => (set2, get2, api) => {
58717
+ let options = {
58718
+ storage: createJSONStorage(() => window.localStorage),
58719
+ partialize: (state) => state,
58720
+ version: 0,
58721
+ merge: (persistedState, currentState) => ({
58722
+ ...currentState,
58723
+ ...persistedState
58724
+ }),
58725
+ ...baseOptions
58726
+ };
58727
+ let hasHydrated = false;
58728
+ let hydrationVersion = 0;
58729
+ const hydrationListeners = /* @__PURE__ */ new Set();
58730
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
58731
+ let storage = options.storage;
58732
+ if (!storage) {
58733
+ return config2(
58734
+ (...args) => {
58735
+ console.warn(
58736
+ `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
58737
+ );
58738
+ set2(...args);
58739
+ },
58740
+ get2,
58741
+ api
58742
+ );
58743
+ }
58744
+ const setItem = () => {
58745
+ const state = options.partialize({ ...get2() });
58746
+ return storage.setItem(options.name, {
58747
+ state,
58748
+ version: options.version
58749
+ });
58750
+ };
58751
+ const savedSetState = api.setState;
58752
+ api.setState = (state, replace2) => {
58753
+ savedSetState(state, replace2);
58754
+ return setItem();
58755
+ };
58756
+ const configResult = config2(
58757
+ (...args) => {
58758
+ set2(...args);
58759
+ return setItem();
58760
+ },
58761
+ get2,
58762
+ api
58763
+ );
58764
+ api.getInitialState = () => configResult;
58765
+ let stateFromStorage;
58766
+ const hydrate = () => {
58767
+ var _a2, _b;
58768
+ if (!storage) return;
58769
+ const currentVersion = ++hydrationVersion;
58770
+ hasHydrated = false;
58771
+ hydrationListeners.forEach((cb) => {
58772
+ var _a22;
58773
+ return cb((_a22 = get2()) != null ? _a22 : configResult);
58774
+ });
58775
+ const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get2()) != null ? _a2 : configResult)) || void 0;
58776
+ return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
58777
+ if (deserializedStorageValue) {
58778
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
58779
+ if (options.migrate) {
58780
+ const migration = options.migrate(
58781
+ deserializedStorageValue.state,
58782
+ deserializedStorageValue.version
58783
+ );
58784
+ if (migration instanceof Promise) {
58785
+ return migration.then((result) => [true, result]);
58786
+ }
58787
+ return [true, migration];
58788
+ }
58789
+ console.error(
58790
+ `State loaded from storage couldn't be migrated since no migrate function was provided`
58791
+ );
58792
+ } else {
58793
+ return [false, deserializedStorageValue.state];
58794
+ }
58795
+ }
58796
+ return [false, void 0];
58797
+ }).then((migrationResult) => {
58798
+ var _a22;
58799
+ if (currentVersion !== hydrationVersion) {
58800
+ return;
58801
+ }
58802
+ const [migrated, migratedState] = migrationResult;
58803
+ stateFromStorage = options.merge(
58804
+ migratedState,
58805
+ (_a22 = get2()) != null ? _a22 : configResult
58806
+ );
58807
+ set2(stateFromStorage, true);
58808
+ if (migrated) {
58809
+ return setItem();
58810
+ }
58811
+ }).then(() => {
58812
+ if (currentVersion !== hydrationVersion) {
58813
+ return;
58814
+ }
58815
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
58816
+ stateFromStorage = get2();
58817
+ hasHydrated = true;
58818
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
58819
+ }).catch((e) => {
58820
+ if (currentVersion !== hydrationVersion) {
58821
+ return;
58822
+ }
58823
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
58824
+ });
58825
+ };
58826
+ api.persist = {
58827
+ setOptions: (newOptions) => {
58828
+ options = {
58829
+ ...options,
58830
+ ...newOptions
58831
+ };
58832
+ if (newOptions.storage) {
58833
+ storage = newOptions.storage;
58834
+ }
58835
+ },
58836
+ clearStorage: () => {
58837
+ storage == null ? void 0 : storage.removeItem(options.name);
58838
+ },
58839
+ getOptions: () => options,
58840
+ rehydrate: () => hydrate(),
58841
+ hasHydrated: () => hasHydrated,
58842
+ onHydrate: (cb) => {
58843
+ hydrationListeners.add(cb);
58844
+ return () => {
58845
+ hydrationListeners.delete(cb);
58846
+ };
58847
+ },
58848
+ onFinishHydration: (cb) => {
58849
+ finishHydrationListeners.add(cb);
58850
+ return () => {
58851
+ finishHydrationListeners.delete(cb);
58852
+ };
58695
58853
  }
58696
- const activeTabId = s.activeTabId === assetId ? ((_a2 = tabs[Math.min(s.tabs.findIndex((t) => t.id === assetId), tabs.length - 1)]) == null ? void 0 : _a2.id) ?? null : s.activeTabId;
58697
- return { tabs, activeTabId };
58698
- }),
58699
- setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
58700
- setViewMode: (mode) => set2({ viewMode: mode }),
58701
- closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
58702
- toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
58703
- resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
58704
- markAutoOpened: (assetId) => {
58705
- const state = get2();
58706
- if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
58707
- return false;
58854
+ };
58855
+ if (!options.skipHydration) {
58856
+ hydrate();
58857
+ }
58858
+ return stateFromStorage || configResult;
58859
+ };
58860
+ const persist = persistImpl;
58861
+ const useAssetPanelStore = create()(
58862
+ persist(
58863
+ (set2, get2) => ({
58864
+ isOpen: false,
58865
+ tabs: [],
58866
+ activeTabId: null,
58867
+ viewMode: "tabs",
58868
+ isFullscreen: false,
58869
+ assetPanelHostCount: 0,
58870
+ autoOpenGeneration: 0,
58871
+ autoOpenedAssets: /* @__PURE__ */ new Map(),
58872
+ registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
58873
+ unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
58874
+ openAsset: (assetId, meta) => set2((s) => {
58875
+ const existing = s.tabs.find((t) => t.id === assetId);
58876
+ if (existing) {
58877
+ const tabs = meta ? s.tabs.map(
58878
+ (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
58879
+ ) : s.tabs;
58880
+ return { isOpen: true, tabs, activeTabId: assetId };
58881
+ }
58882
+ const newTab = {
58883
+ id: assetId,
58884
+ name: (meta == null ? void 0 : meta.name) ?? null,
58885
+ type: (meta == null ? void 0 : meta.type) ?? "unknown"
58886
+ };
58887
+ return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
58888
+ }),
58889
+ closeTab: (assetId) => set2((s) => {
58890
+ var _a2;
58891
+ const tabs = s.tabs.filter((t) => t.id !== assetId);
58892
+ if (tabs.length === 0) {
58893
+ return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
58894
+ }
58895
+ const activeTabId = s.activeTabId === assetId ? ((_a2 = tabs[Math.min(s.tabs.findIndex((t) => t.id === assetId), tabs.length - 1)]) == null ? void 0 : _a2.id) ?? null : s.activeTabId;
58896
+ return { tabs, activeTabId };
58897
+ }),
58898
+ setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
58899
+ setViewMode: (mode) => set2({ viewMode: mode }),
58900
+ closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
58901
+ toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
58902
+ resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
58903
+ markAutoOpened: (assetId) => {
58904
+ const state = get2();
58905
+ if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
58906
+ return false;
58907
+ }
58908
+ state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
58909
+ return true;
58910
+ }
58911
+ }),
58912
+ {
58913
+ name: "athena-react-asset-panel",
58914
+ partialize: ({
58915
+ isOpen,
58916
+ tabs,
58917
+ activeTabId,
58918
+ viewMode,
58919
+ isFullscreen
58920
+ }) => ({
58921
+ isOpen,
58922
+ tabs,
58923
+ activeTabId,
58924
+ viewMode,
58925
+ isFullscreen
58926
+ }),
58927
+ storage: createJSONStorage(() => sessionStorage)
58708
58928
  }
58709
- state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
58710
- return true;
58711
- }
58712
- }));
58929
+ )
58930
+ );
58713
58931
  const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
58714
58932
  const ATHENA_PREVIEW_HOSTNAME_SUFFIX = ".previews.athenaintel.com";
58933
+ const ATHENA_WORKSPACE_HOSTNAME_SUFFIXES = [".app.athenaintel.com", ".staging-app.athenaintel.com"];
58715
58934
  const ASSET_TYPE_ALIASES = {
58716
58935
  document: "document",
58717
58936
  notebook: "notebook",
@@ -58741,6 +58960,20 @@ const getOrigin = (value) => {
58741
58960
  return null;
58742
58961
  }
58743
58962
  };
58963
+ const getHostname = (value) => {
58964
+ if (!value) {
58965
+ return null;
58966
+ }
58967
+ try {
58968
+ return new URL(value).hostname.toLowerCase();
58969
+ } catch {
58970
+ return null;
58971
+ }
58972
+ };
58973
+ const matchesHostnameOrSubdomain = ({
58974
+ hostname,
58975
+ candidateHostname
58976
+ }) => hostname === candidateHostname || hostname.endsWith(`.${candidateHostname}`);
58744
58977
  const getCurrentOrigin = () => {
58745
58978
  if (typeof window === "undefined") {
58746
58979
  return null;
@@ -58763,7 +58996,11 @@ const isAthenaAppUrl = ({
58763
58996
  appUrl
58764
58997
  }) => {
58765
58998
  const hostname = url.hostname.toLowerCase();
58766
- if (ATHENA_APP_HOSTNAMES.has(hostname) || hostname.endsWith(ATHENA_PREVIEW_HOSTNAME_SUFFIX)) {
58999
+ if (ATHENA_APP_HOSTNAMES.has(hostname) || hostname.endsWith(ATHENA_PREVIEW_HOSTNAME_SUFFIX) || ATHENA_WORKSPACE_HOSTNAME_SUFFIXES.some((suffix) => hostname.endsWith(suffix))) {
59000
+ return true;
59001
+ }
59002
+ const configuredHostname = getHostname(appUrl);
59003
+ if (configuredHostname && matchesHostnameOrSubdomain({ hostname, candidateHostname: configuredHostname })) {
58767
59004
  return true;
58768
59005
  }
58769
59006
  const configuredOrigin = getOrigin(appUrl);
@@ -63446,6 +63683,7 @@ function parsePythonResult(result) {
63446
63683
  const data = normalizeResult(result);
63447
63684
  if (!data)
63448
63685
  return {
63686
+ outputs: [],
63449
63687
  stdout: null,
63450
63688
  stderr: null,
63451
63689
  value: null,
@@ -63453,7 +63691,9 @@ function parsePythonResult(result) {
63453
63691
  exception: null,
63454
63692
  imagePng: null,
63455
63693
  plotlyJson: null,
63456
- createdAssets: []
63694
+ createdAssets: [],
63695
+ assetId: null,
63696
+ deckId: null
63457
63697
  };
63458
63698
  const inner = typeof data.result === "object" && data.result !== null ? data.result : data;
63459
63699
  const stdout = inner.stdout ?? null;
@@ -63471,13 +63711,18 @@ function parsePythonResult(result) {
63471
63711
  }
63472
63712
  let imagePng = null;
63473
63713
  let plotlyJson = null;
63714
+ const outputs = [];
63474
63715
  if (inner.data && typeof inner.data === "object") {
63475
63716
  imagePng = inner.data.png ?? null;
63476
63717
  }
63477
63718
  if (Array.isArray(data.outputs)) {
63478
63719
  for (const output of data.outputs) {
63479
63720
  if (output && typeof output === "object") {
63721
+ const outputRecord = output;
63480
63722
  const mimeBundle = output.mime_bundle;
63723
+ let outputImagePng = null;
63724
+ let outputPlotlyJson = null;
63725
+ let outputTextPlain = null;
63481
63726
  if (mimeBundle && typeof mimeBundle === "object") {
63482
63727
  const mb = mimeBundle;
63483
63728
  if (!plotlyJson && typeof mb["plotly+json"] === "string") {
@@ -63486,12 +63731,52 @@ function parsePythonResult(result) {
63486
63731
  if (!imagePng && typeof mb["image/png"] === "string") {
63487
63732
  imagePng = mb["image/png"];
63488
63733
  }
63489
- }
63734
+ outputPlotlyJson = typeof mb["plotly+json"] === "string" ? mb["plotly+json"] : null;
63735
+ outputImagePng = typeof mb["image/png"] === "string" ? mb["image/png"] : null;
63736
+ outputTextPlain = typeof mb["text/plain"] === "string" ? mb["text/plain"] : null;
63737
+ }
63738
+ outputs.push({
63739
+ objectId: typeof outputRecord.object_id === "string" ? outputRecord.object_id : null,
63740
+ title: typeof outputRecord.title === "string" ? outputRecord.title : null,
63741
+ textPlain: outputTextPlain,
63742
+ imagePng: outputImagePng,
63743
+ plotlyJson: outputPlotlyJson,
63744
+ assetId: typeof outputRecord.asset_id === "string" ? outputRecord.asset_id : null
63745
+ });
63490
63746
  }
63491
63747
  }
63492
63748
  }
63493
63749
  const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
63494
- return { stdout, stderr, value, error: error2, exception, imagePng, plotlyJson, createdAssets };
63750
+ const assetId = typeof data.asset_id === "string" ? data.asset_id : null;
63751
+ const deckId = typeof data.deck_id === "string" ? data.deck_id : null;
63752
+ return {
63753
+ outputs,
63754
+ stdout,
63755
+ stderr,
63756
+ value,
63757
+ error: error2,
63758
+ exception,
63759
+ imagePng,
63760
+ plotlyJson,
63761
+ createdAssets,
63762
+ assetId,
63763
+ deckId
63764
+ };
63765
+ }
63766
+ function getExecutionTextOutput(parsed) {
63767
+ const output = [
63768
+ parsed.value,
63769
+ parsed.stdout,
63770
+ parsed.stderr,
63771
+ ...parsed.outputs.map((entry) => {
63772
+ if (!entry.textPlain) {
63773
+ return null;
63774
+ }
63775
+ return entry.title ? `${entry.title}
63776
+ ${entry.textPlain}` : entry.textPlain;
63777
+ })
63778
+ ].filter((chunk) => Boolean(chunk && chunk.trim())).join("\n\n");
63779
+ return output || null;
63495
63780
  }
63496
63781
  function getPlotly() {
63497
63782
  return window.Plotly;
@@ -63776,7 +64061,8 @@ const RunPythonCodeToolUIImpl = ({
63776
64061
  [result, isComplete]
63777
64062
  );
63778
64063
  const openAsset = useAssetPanelStore((s) => s.openAsset);
63779
- const hasOutput = parsed && (parsed.stdout || parsed.stderr || parsed.value);
64064
+ const outputText = parsed ? getExecutionTextOutput(parsed) : null;
64065
+ const hasOutput = Boolean(outputText);
63780
64066
  const hasError = parsed && (parsed.error || parsed.exception);
63781
64067
  const hasImage = parsed == null ? void 0 : parsed.imagePng;
63782
64068
  const hasPlotly = parsed == null ? void 0 : parsed.plotlyJson;
@@ -63797,7 +64083,7 @@ const RunPythonCodeToolUIImpl = ({
63797
64083
  /* @__PURE__ */ jsxRuntime.jsx(Terminal, { className: "size-3 text-muted-foreground" }),
63798
64084
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Output" })
63799
64085
  ] }),
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") })
64086
+ /* @__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
64087
  ] }),
63802
64088
  isComplete && hasError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 bg-destructive/10 px-4 py-2.5", children: [
63803
64089
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
@@ -63845,6 +64131,109 @@ const RunPythonCodeToolUI = React.memo(
63845
64131
  RunPythonCodeToolUIImpl
63846
64132
  );
63847
64133
  RunPythonCodeToolUI.displayName = "RunPythonCodeToolUI";
64134
+ const ExecutePresentationCodeToolUIImpl = ({
64135
+ toolName,
64136
+ args,
64137
+ result,
64138
+ status
64139
+ }) => {
64140
+ var _a2;
64141
+ const typedArgs = args;
64142
+ const code2 = (typedArgs == null ? void 0 : typedArgs.code) ?? "";
64143
+ const summary = (typedArgs == null ? void 0 : typedArgs.summary) ?? null;
64144
+ const deckIdFromArgs = typeof (typedArgs == null ? void 0 : typedArgs.deck_id) === "string" ? typedArgs.deck_id : null;
64145
+ const isRunning = (status == null ? void 0 : status.type) === "running";
64146
+ const isComplete = (status == null ? void 0 : status.type) === "complete";
64147
+ const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
64148
+ const parsed = React.useMemo(
64149
+ () => isComplete ? parsePythonResult(result) : null,
64150
+ [result, isComplete]
64151
+ );
64152
+ const outputText = parsed ? getExecutionTextOutput(parsed) : null;
64153
+ const assetId = (parsed == null ? void 0 : parsed.assetId) ?? null;
64154
+ const deckId = (parsed == null ? void 0 : parsed.deckId) ?? deckIdFromArgs;
64155
+ const hasError = parsed && (parsed.error || parsed.exception);
64156
+ const openAsset = useAssetPanelStore((s) => s.openAsset);
64157
+ const wasCompleteAtMount = React.useRef(isComplete);
64158
+ React.useEffect(() => {
64159
+ if (!isComplete || !assetId || wasCompleteAtMount.current) {
64160
+ return;
64161
+ }
64162
+ const store = useAssetPanelStore.getState();
64163
+ if (store.markAutoOpened(assetId)) {
64164
+ store.openAsset(assetId, { type: "presentation" });
64165
+ }
64166
+ }, [assetId, isComplete]);
64167
+ return /* @__PURE__ */ jsxRuntime.jsxs(
64168
+ ToolCard,
64169
+ {
64170
+ icon: Presentation,
64171
+ status: (status == null ? void 0 : status.type) ?? "complete",
64172
+ title: isRunning ? summary || "Executing presentation code..." : summary || "Presentation updated",
64173
+ subtitle: deckId ? `Deck ${truncate(deckId, 24)}` : assetId ? `Asset ${truncate(assetId, 24)}` : void 0,
64174
+ badge: "Deck",
64175
+ toolName,
64176
+ args: typedArgs,
64177
+ result,
64178
+ error: errorMsg,
64179
+ children: [
64180
+ 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: [
64181
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
64182
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[11px] font-medium text-muted-foreground", children: "Open the updated deck in the asset panel" }),
64183
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-[11px] text-foreground/80", children: truncate(assetId, 32) })
64184
+ ] }),
64185
+ /* @__PURE__ */ jsxRuntime.jsxs(
64186
+ "button",
64187
+ {
64188
+ type: "button",
64189
+ onClick: () => openAsset(assetId, { type: "presentation" }),
64190
+ 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",
64191
+ children: [
64192
+ /* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "size-3" }),
64193
+ "Open deck"
64194
+ ]
64195
+ }
64196
+ )
64197
+ ] }) }),
64198
+ code2 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlightedCode, { code: code2 }) }),
64199
+ isComplete && outputText && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
64200
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1 flex items-center gap-1.5", children: [
64201
+ /* @__PURE__ */ jsxRuntime.jsx(Terminal, { className: "size-3 text-muted-foreground" }),
64202
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Execution log" })
64203
+ ] }),
64204
+ /* @__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 })
64205
+ ] }),
64206
+ isComplete && hasError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 bg-destructive/10 px-4 py-2.5", children: [
64207
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1 flex items-center gap-1.5", children: [
64208
+ /* @__PURE__ */ jsxRuntime.jsx(TriangleAlert, { className: "size-3 text-destructive" }),
64209
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-destructive", children: parsed.exception ? `${parsed.exception.name}: ${parsed.exception.value}` : "Execution error" })
64210
+ ] }),
64211
+ /* @__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 })
64212
+ ] }),
64213
+ isComplete && parsed && parsed.createdAssets.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2", children: [
64214
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Created assets" }),
64215
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 flex flex-wrap gap-1.5", children: parsed.createdAssets.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs(
64216
+ "button",
64217
+ {
64218
+ type: "button",
64219
+ onClick: () => openAsset(entry.asset_id),
64220
+ 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",
64221
+ children: [
64222
+ /* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "size-2.5" }),
64223
+ truncate(entry.asset_id, 20)
64224
+ ]
64225
+ },
64226
+ entry.asset_id
64227
+ )) })
64228
+ ] })
64229
+ ]
64230
+ }
64231
+ );
64232
+ };
64233
+ const ExecutePresentationCodeToolUI = React.memo(
64234
+ ExecutePresentationCodeToolUIImpl
64235
+ );
64236
+ ExecutePresentationCodeToolUI.displayName = "ExecutePresentationCodeToolUI";
63848
64237
  const OpenAssetToolUIImpl = ({
63849
64238
  toolName,
63850
64239
  args,
@@ -63926,6 +64315,7 @@ const TOOL_UI_REGISTRY = {
63926
64315
  create_new_sheet: CreateSheetToolUI,
63927
64316
  create_powerpoint_deck: CreatePresentationToolUI,
63928
64317
  create_new_notebook: CreateNotebookToolUI,
64318
+ execute_presentation_code: ExecutePresentationCodeToolUI,
63929
64319
  run_python_code: RunPythonCodeToolUI,
63930
64320
  open_asset_in_workspace: OpenAssetToolUI
63931
64321
  };
@@ -64638,7 +65028,7 @@ const MessageError = () => /* @__PURE__ */ jsxRuntime.jsx(MessagePrimitiveError,
64638
65028
  }
64639
65029
  ) })
64640
65030
  ] }) });
64641
- const AthenaAssistantMessageEmpty = () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-muted-foreground", children: "Thinking..." });
65031
+ const AthenaAssistantMessageEmpty = () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-[13px] text-muted-foreground", children: "Thinking..." });
64642
65032
  const AthenaReasoningPart = ({
64643
65033
  text: text2,
64644
65034
  status,
@@ -64688,7 +65078,7 @@ const AthenaReasoningPart = ({
64688
65078
  className: "flex w-full items-center justify-between gap-3 text-left",
64689
65079
  "aria-label": isRunning ? "Toggle reasoning while streaming" : "Toggle reasoning",
64690
65080
  children: [
64691
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-muted-foreground", children: [
65081
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2 text-[13px] font-medium text-muted-foreground", children: [
64692
65082
  /* @__PURE__ */ jsxRuntime.jsx(Brain, { className: "size-4 shrink-0" }),
64693
65083
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: isRunning ? "Reasoning..." : "Reasoning" })
64694
65084
  ] }),
@@ -64709,7 +65099,7 @@ const AthenaReasoningPart = ({
64709
65099
  ]
64710
65100
  }
64711
65101
  ) }),
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 }) }) })
65102
+ /* @__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
65103
  ]
64714
65104
  }
64715
65105
  );