@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.d.ts CHANGED
@@ -7,6 +7,7 @@ import { EmptyMessagePartComponent } from '@assistant-ui/react';
7
7
  import { FC } from 'react';
8
8
  import { ForwardRefExoticComponent } from 'react';
9
9
  import { JSX } from 'react/jsx-runtime';
10
+ import { PersistOptions } from 'zustand/middleware';
10
11
  import * as React_2 from 'react';
11
12
  import { ReactNode } from 'react';
12
13
  import { ReasoningMessagePartComponent } from '@assistant-ui/react';
@@ -580,7 +581,7 @@ export declare const parseAthenaCitationLink: ({ href, appUrl, }: {
580
581
  appUrl?: string | null;
581
582
  }) => ParsedAthenaCitationLink | null;
582
583
 
583
- declare interface ParsedAthenaCitationLink {
584
+ export declare interface ParsedAthenaCitationLink {
584
585
  url: URL;
585
586
  assetId: string;
586
587
  assetIds: string[];
@@ -1025,7 +1026,19 @@ export declare interface UseAssetEmbedResult {
1025
1026
  error: string | null;
1026
1027
  }
1027
1028
 
1028
- export declare const useAssetPanelStore: UseBoundStore<StoreApi<AssetPanelState>>;
1029
+ export declare const useAssetPanelStore: UseBoundStore<Omit<StoreApi<AssetPanelState>, "setState" | "persist"> & {
1030
+ setState(partial: AssetPanelState | Partial<AssetPanelState> | ((state: AssetPanelState) => AssetPanelState | Partial<AssetPanelState>), replace?: false | undefined): unknown;
1031
+ setState(state: AssetPanelState | ((state: AssetPanelState) => AssetPanelState), replace: true): unknown;
1032
+ persist: {
1033
+ setOptions: (options: Partial<PersistOptions<AssetPanelState, unknown, unknown>>) => void;
1034
+ clearStorage: () => void;
1035
+ rehydrate: () => Promise<void> | void;
1036
+ hasHydrated: () => boolean;
1037
+ onHydrate: (fn: (state: AssetPanelState) => void) => () => void;
1038
+ onFinishHydration: (fn: (state: AssetPanelState) => void) => () => void;
1039
+ getOptions: () => Partial<PersistOptions<AssetPanelState, unknown, unknown>>;
1040
+ };
1041
+ }>;
1029
1042
 
1030
1043
  export declare const useAthenaCitationLinkHandler: () => AthenaCitationLinkHandler;
1031
1044
 
package/dist/index.js CHANGED
@@ -16483,7 +16483,7 @@ const createUrlWithFallback = (url, fallbackUrl) => {
16483
16483
  return new URL(`${normalizeBaseUrl(fallbackUrl)}/`);
16484
16484
  }
16485
16485
  };
16486
- const getHostname = (value) => {
16486
+ const getHostname$1 = (value) => {
16487
16487
  if (!value) return null;
16488
16488
  try {
16489
16489
  return new URL(value).hostname;
@@ -16524,7 +16524,7 @@ function deriveAthenaAppUrl({
16524
16524
  sourcePort: "8000"
16525
16525
  });
16526
16526
  if (workspaceAppUrl) return workspaceAppUrl;
16527
- const backendHostname = getHostname(backendUrl);
16527
+ const backendHostname = getHostname$1(backendUrl);
16528
16528
  if (backendHostname === "api.athenaintel.com") {
16529
16529
  return ATHENA_ENVIRONMENT_URLS.production.appUrl;
16530
16530
  }
@@ -16538,7 +16538,7 @@ function deriveAthenaAppUrl({
16538
16538
  sourcePort: "8787"
16539
16539
  });
16540
16540
  if (workspaceAppUrl) return workspaceAppUrl;
16541
- const apiHostname = getHostname(apiUrl);
16541
+ const apiHostname = getHostname$1(apiUrl);
16542
16542
  if (apiHostname === "sync.athenaintel.com") {
16543
16543
  return ATHENA_ENVIRONMENT_URLS.production.appUrl;
16544
16544
  }
@@ -58643,57 +58643,276 @@ const MentionExtension = Node3.create({
58643
58643
  };
58644
58644
  }
58645
58645
  });
58646
- const useAssetPanelStore = create((set2, get2) => ({
58647
- isOpen: false,
58648
- tabs: [],
58649
- activeTabId: null,
58650
- viewMode: "tabs",
58651
- isFullscreen: false,
58652
- assetPanelHostCount: 0,
58653
- autoOpenGeneration: 0,
58654
- autoOpenedAssets: /* @__PURE__ */ new Map(),
58655
- registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
58656
- unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
58657
- openAsset: (assetId, meta) => set2((s) => {
58658
- const existing = s.tabs.find((t) => t.id === assetId);
58659
- if (existing) {
58660
- const tabs = meta ? s.tabs.map(
58661
- (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
58662
- ) : s.tabs;
58663
- return { isOpen: true, tabs, activeTabId: assetId };
58646
+ function createJSONStorage(getStorage, options) {
58647
+ let storage;
58648
+ try {
58649
+ storage = getStorage();
58650
+ } catch (e) {
58651
+ return;
58652
+ }
58653
+ const persistStorage = {
58654
+ getItem: (name) => {
58655
+ var _a2;
58656
+ const parse2 = (str2) => {
58657
+ if (str2 === null) {
58658
+ return null;
58659
+ }
58660
+ return JSON.parse(str2, void 0);
58661
+ };
58662
+ const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
58663
+ if (str instanceof Promise) {
58664
+ return str.then(parse2);
58665
+ }
58666
+ return parse2(str);
58667
+ },
58668
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
58669
+ removeItem: (name) => storage.removeItem(name)
58670
+ };
58671
+ return persistStorage;
58672
+ }
58673
+ const toThenable = (fn) => (input) => {
58674
+ try {
58675
+ const result = fn(input);
58676
+ if (result instanceof Promise) {
58677
+ return result;
58664
58678
  }
58665
- const newTab = {
58666
- id: assetId,
58667
- name: (meta == null ? void 0 : meta.name) ?? null,
58668
- type: (meta == null ? void 0 : meta.type) ?? "unknown"
58679
+ return {
58680
+ then(onFulfilled) {
58681
+ return toThenable(onFulfilled)(result);
58682
+ },
58683
+ catch(_onRejected) {
58684
+ return this;
58685
+ }
58669
58686
  };
58670
- return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
58671
- }),
58672
- closeTab: (assetId) => set2((s) => {
58673
- var _a2;
58674
- const tabs = s.tabs.filter((t) => t.id !== assetId);
58675
- if (tabs.length === 0) {
58676
- return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
58687
+ } catch (e) {
58688
+ return {
58689
+ then(_onFulfilled) {
58690
+ return this;
58691
+ },
58692
+ catch(onRejected) {
58693
+ return toThenable(onRejected)(e);
58694
+ }
58695
+ };
58696
+ }
58697
+ };
58698
+ const persistImpl = (config2, baseOptions) => (set2, get2, api) => {
58699
+ let options = {
58700
+ storage: createJSONStorage(() => window.localStorage),
58701
+ partialize: (state) => state,
58702
+ version: 0,
58703
+ merge: (persistedState, currentState) => ({
58704
+ ...currentState,
58705
+ ...persistedState
58706
+ }),
58707
+ ...baseOptions
58708
+ };
58709
+ let hasHydrated = false;
58710
+ let hydrationVersion = 0;
58711
+ const hydrationListeners = /* @__PURE__ */ new Set();
58712
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
58713
+ let storage = options.storage;
58714
+ if (!storage) {
58715
+ return config2(
58716
+ (...args) => {
58717
+ console.warn(
58718
+ `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
58719
+ );
58720
+ set2(...args);
58721
+ },
58722
+ get2,
58723
+ api
58724
+ );
58725
+ }
58726
+ const setItem = () => {
58727
+ const state = options.partialize({ ...get2() });
58728
+ return storage.setItem(options.name, {
58729
+ state,
58730
+ version: options.version
58731
+ });
58732
+ };
58733
+ const savedSetState = api.setState;
58734
+ api.setState = (state, replace2) => {
58735
+ savedSetState(state, replace2);
58736
+ return setItem();
58737
+ };
58738
+ const configResult = config2(
58739
+ (...args) => {
58740
+ set2(...args);
58741
+ return setItem();
58742
+ },
58743
+ get2,
58744
+ api
58745
+ );
58746
+ api.getInitialState = () => configResult;
58747
+ let stateFromStorage;
58748
+ const hydrate = () => {
58749
+ var _a2, _b;
58750
+ if (!storage) return;
58751
+ const currentVersion = ++hydrationVersion;
58752
+ hasHydrated = false;
58753
+ hydrationListeners.forEach((cb) => {
58754
+ var _a22;
58755
+ return cb((_a22 = get2()) != null ? _a22 : configResult);
58756
+ });
58757
+ const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get2()) != null ? _a2 : configResult)) || void 0;
58758
+ return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
58759
+ if (deserializedStorageValue) {
58760
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
58761
+ if (options.migrate) {
58762
+ const migration = options.migrate(
58763
+ deserializedStorageValue.state,
58764
+ deserializedStorageValue.version
58765
+ );
58766
+ if (migration instanceof Promise) {
58767
+ return migration.then((result) => [true, result]);
58768
+ }
58769
+ return [true, migration];
58770
+ }
58771
+ console.error(
58772
+ `State loaded from storage couldn't be migrated since no migrate function was provided`
58773
+ );
58774
+ } else {
58775
+ return [false, deserializedStorageValue.state];
58776
+ }
58777
+ }
58778
+ return [false, void 0];
58779
+ }).then((migrationResult) => {
58780
+ var _a22;
58781
+ if (currentVersion !== hydrationVersion) {
58782
+ return;
58783
+ }
58784
+ const [migrated, migratedState] = migrationResult;
58785
+ stateFromStorage = options.merge(
58786
+ migratedState,
58787
+ (_a22 = get2()) != null ? _a22 : configResult
58788
+ );
58789
+ set2(stateFromStorage, true);
58790
+ if (migrated) {
58791
+ return setItem();
58792
+ }
58793
+ }).then(() => {
58794
+ if (currentVersion !== hydrationVersion) {
58795
+ return;
58796
+ }
58797
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
58798
+ stateFromStorage = get2();
58799
+ hasHydrated = true;
58800
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
58801
+ }).catch((e) => {
58802
+ if (currentVersion !== hydrationVersion) {
58803
+ return;
58804
+ }
58805
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
58806
+ });
58807
+ };
58808
+ api.persist = {
58809
+ setOptions: (newOptions) => {
58810
+ options = {
58811
+ ...options,
58812
+ ...newOptions
58813
+ };
58814
+ if (newOptions.storage) {
58815
+ storage = newOptions.storage;
58816
+ }
58817
+ },
58818
+ clearStorage: () => {
58819
+ storage == null ? void 0 : storage.removeItem(options.name);
58820
+ },
58821
+ getOptions: () => options,
58822
+ rehydrate: () => hydrate(),
58823
+ hasHydrated: () => hasHydrated,
58824
+ onHydrate: (cb) => {
58825
+ hydrationListeners.add(cb);
58826
+ return () => {
58827
+ hydrationListeners.delete(cb);
58828
+ };
58829
+ },
58830
+ onFinishHydration: (cb) => {
58831
+ finishHydrationListeners.add(cb);
58832
+ return () => {
58833
+ finishHydrationListeners.delete(cb);
58834
+ };
58677
58835
  }
58678
- 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;
58679
- return { tabs, activeTabId };
58680
- }),
58681
- setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
58682
- setViewMode: (mode) => set2({ viewMode: mode }),
58683
- closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
58684
- toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
58685
- resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
58686
- markAutoOpened: (assetId) => {
58687
- const state = get2();
58688
- if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
58689
- return false;
58836
+ };
58837
+ if (!options.skipHydration) {
58838
+ hydrate();
58839
+ }
58840
+ return stateFromStorage || configResult;
58841
+ };
58842
+ const persist = persistImpl;
58843
+ const useAssetPanelStore = create()(
58844
+ persist(
58845
+ (set2, get2) => ({
58846
+ isOpen: false,
58847
+ tabs: [],
58848
+ activeTabId: null,
58849
+ viewMode: "tabs",
58850
+ isFullscreen: false,
58851
+ assetPanelHostCount: 0,
58852
+ autoOpenGeneration: 0,
58853
+ autoOpenedAssets: /* @__PURE__ */ new Map(),
58854
+ registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
58855
+ unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
58856
+ openAsset: (assetId, meta) => set2((s) => {
58857
+ const existing = s.tabs.find((t) => t.id === assetId);
58858
+ if (existing) {
58859
+ const tabs = meta ? s.tabs.map(
58860
+ (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
58861
+ ) : s.tabs;
58862
+ return { isOpen: true, tabs, activeTabId: assetId };
58863
+ }
58864
+ const newTab = {
58865
+ id: assetId,
58866
+ name: (meta == null ? void 0 : meta.name) ?? null,
58867
+ type: (meta == null ? void 0 : meta.type) ?? "unknown"
58868
+ };
58869
+ return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
58870
+ }),
58871
+ closeTab: (assetId) => set2((s) => {
58872
+ var _a2;
58873
+ const tabs = s.tabs.filter((t) => t.id !== assetId);
58874
+ if (tabs.length === 0) {
58875
+ return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
58876
+ }
58877
+ 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;
58878
+ return { tabs, activeTabId };
58879
+ }),
58880
+ setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
58881
+ setViewMode: (mode) => set2({ viewMode: mode }),
58882
+ closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
58883
+ toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
58884
+ resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
58885
+ markAutoOpened: (assetId) => {
58886
+ const state = get2();
58887
+ if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
58888
+ return false;
58889
+ }
58890
+ state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
58891
+ return true;
58892
+ }
58893
+ }),
58894
+ {
58895
+ name: "athena-react-asset-panel",
58896
+ partialize: ({
58897
+ isOpen,
58898
+ tabs,
58899
+ activeTabId,
58900
+ viewMode,
58901
+ isFullscreen
58902
+ }) => ({
58903
+ isOpen,
58904
+ tabs,
58905
+ activeTabId,
58906
+ viewMode,
58907
+ isFullscreen
58908
+ }),
58909
+ storage: createJSONStorage(() => sessionStorage)
58690
58910
  }
58691
- state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
58692
- return true;
58693
- }
58694
- }));
58911
+ )
58912
+ );
58695
58913
  const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
58696
58914
  const ATHENA_PREVIEW_HOSTNAME_SUFFIX = ".previews.athenaintel.com";
58915
+ const ATHENA_WORKSPACE_HOSTNAME_SUFFIXES = [".app.athenaintel.com", ".staging-app.athenaintel.com"];
58697
58916
  const ASSET_TYPE_ALIASES = {
58698
58917
  document: "document",
58699
58918
  notebook: "notebook",
@@ -58723,6 +58942,20 @@ const getOrigin = (value) => {
58723
58942
  return null;
58724
58943
  }
58725
58944
  };
58945
+ const getHostname = (value) => {
58946
+ if (!value) {
58947
+ return null;
58948
+ }
58949
+ try {
58950
+ return new URL(value).hostname.toLowerCase();
58951
+ } catch {
58952
+ return null;
58953
+ }
58954
+ };
58955
+ const matchesHostnameOrSubdomain = ({
58956
+ hostname,
58957
+ candidateHostname
58958
+ }) => hostname === candidateHostname || hostname.endsWith(`.${candidateHostname}`);
58726
58959
  const getCurrentOrigin = () => {
58727
58960
  if (typeof window === "undefined") {
58728
58961
  return null;
@@ -58745,7 +58978,11 @@ const isAthenaAppUrl = ({
58745
58978
  appUrl
58746
58979
  }) => {
58747
58980
  const hostname = url.hostname.toLowerCase();
58748
- if (ATHENA_APP_HOSTNAMES.has(hostname) || hostname.endsWith(ATHENA_PREVIEW_HOSTNAME_SUFFIX)) {
58981
+ if (ATHENA_APP_HOSTNAMES.has(hostname) || hostname.endsWith(ATHENA_PREVIEW_HOSTNAME_SUFFIX) || ATHENA_WORKSPACE_HOSTNAME_SUFFIXES.some((suffix) => hostname.endsWith(suffix))) {
58982
+ return true;
58983
+ }
58984
+ const configuredHostname = getHostname(appUrl);
58985
+ if (configuredHostname && matchesHostnameOrSubdomain({ hostname, candidateHostname: configuredHostname })) {
58749
58986
  return true;
58750
58987
  }
58751
58988
  const configuredOrigin = getOrigin(appUrl);
@@ -63428,6 +63665,7 @@ function parsePythonResult(result) {
63428
63665
  const data = normalizeResult(result);
63429
63666
  if (!data)
63430
63667
  return {
63668
+ outputs: [],
63431
63669
  stdout: null,
63432
63670
  stderr: null,
63433
63671
  value: null,
@@ -63435,7 +63673,9 @@ function parsePythonResult(result) {
63435
63673
  exception: null,
63436
63674
  imagePng: null,
63437
63675
  plotlyJson: null,
63438
- createdAssets: []
63676
+ createdAssets: [],
63677
+ assetId: null,
63678
+ deckId: null
63439
63679
  };
63440
63680
  const inner = typeof data.result === "object" && data.result !== null ? data.result : data;
63441
63681
  const stdout = inner.stdout ?? null;
@@ -63453,13 +63693,18 @@ function parsePythonResult(result) {
63453
63693
  }
63454
63694
  let imagePng = null;
63455
63695
  let plotlyJson = null;
63696
+ const outputs = [];
63456
63697
  if (inner.data && typeof inner.data === "object") {
63457
63698
  imagePng = inner.data.png ?? null;
63458
63699
  }
63459
63700
  if (Array.isArray(data.outputs)) {
63460
63701
  for (const output of data.outputs) {
63461
63702
  if (output && typeof output === "object") {
63703
+ const outputRecord = output;
63462
63704
  const mimeBundle = output.mime_bundle;
63705
+ let outputImagePng = null;
63706
+ let outputPlotlyJson = null;
63707
+ let outputTextPlain = null;
63463
63708
  if (mimeBundle && typeof mimeBundle === "object") {
63464
63709
  const mb = mimeBundle;
63465
63710
  if (!plotlyJson && typeof mb["plotly+json"] === "string") {
@@ -63468,12 +63713,52 @@ function parsePythonResult(result) {
63468
63713
  if (!imagePng && typeof mb["image/png"] === "string") {
63469
63714
  imagePng = mb["image/png"];
63470
63715
  }
63471
- }
63716
+ outputPlotlyJson = typeof mb["plotly+json"] === "string" ? mb["plotly+json"] : null;
63717
+ outputImagePng = typeof mb["image/png"] === "string" ? mb["image/png"] : null;
63718
+ outputTextPlain = typeof mb["text/plain"] === "string" ? mb["text/plain"] : null;
63719
+ }
63720
+ outputs.push({
63721
+ objectId: typeof outputRecord.object_id === "string" ? outputRecord.object_id : null,
63722
+ title: typeof outputRecord.title === "string" ? outputRecord.title : null,
63723
+ textPlain: outputTextPlain,
63724
+ imagePng: outputImagePng,
63725
+ plotlyJson: outputPlotlyJson,
63726
+ assetId: typeof outputRecord.asset_id === "string" ? outputRecord.asset_id : null
63727
+ });
63472
63728
  }
63473
63729
  }
63474
63730
  }
63475
63731
  const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
63476
- return { stdout, stderr, value, error: error2, exception, imagePng, plotlyJson, createdAssets };
63732
+ const assetId = typeof data.asset_id === "string" ? data.asset_id : null;
63733
+ const deckId = typeof data.deck_id === "string" ? data.deck_id : null;
63734
+ return {
63735
+ outputs,
63736
+ stdout,
63737
+ stderr,
63738
+ value,
63739
+ error: error2,
63740
+ exception,
63741
+ imagePng,
63742
+ plotlyJson,
63743
+ createdAssets,
63744
+ assetId,
63745
+ deckId
63746
+ };
63747
+ }
63748
+ function getExecutionTextOutput(parsed) {
63749
+ const output = [
63750
+ parsed.value,
63751
+ parsed.stdout,
63752
+ parsed.stderr,
63753
+ ...parsed.outputs.map((entry) => {
63754
+ if (!entry.textPlain) {
63755
+ return null;
63756
+ }
63757
+ return entry.title ? `${entry.title}
63758
+ ${entry.textPlain}` : entry.textPlain;
63759
+ })
63760
+ ].filter((chunk) => Boolean(chunk && chunk.trim())).join("\n\n");
63761
+ return output || null;
63477
63762
  }
63478
63763
  function getPlotly() {
63479
63764
  return window.Plotly;
@@ -63758,7 +64043,8 @@ const RunPythonCodeToolUIImpl = ({
63758
64043
  [result, isComplete]
63759
64044
  );
63760
64045
  const openAsset = useAssetPanelStore((s) => s.openAsset);
63761
- const hasOutput = parsed && (parsed.stdout || parsed.stderr || parsed.value);
64046
+ const outputText = parsed ? getExecutionTextOutput(parsed) : null;
64047
+ const hasOutput = Boolean(outputText);
63762
64048
  const hasError = parsed && (parsed.error || parsed.exception);
63763
64049
  const hasImage = parsed == null ? void 0 : parsed.imagePng;
63764
64050
  const hasPlotly = parsed == null ? void 0 : parsed.plotlyJson;
@@ -63779,7 +64065,7 @@ const RunPythonCodeToolUIImpl = ({
63779
64065
  /* @__PURE__ */ jsx(Terminal, { className: "size-3 text-muted-foreground" }),
63780
64066
  /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Output" })
63781
64067
  ] }),
63782
- /* @__PURE__ */ 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") })
64068
+ /* @__PURE__ */ 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 })
63783
64069
  ] }),
63784
64070
  isComplete && hasError && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 bg-destructive/10 px-4 py-2.5", children: [
63785
64071
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
@@ -63827,6 +64113,109 @@ const RunPythonCodeToolUI = memo(
63827
64113
  RunPythonCodeToolUIImpl
63828
64114
  );
63829
64115
  RunPythonCodeToolUI.displayName = "RunPythonCodeToolUI";
64116
+ const ExecutePresentationCodeToolUIImpl = ({
64117
+ toolName,
64118
+ args,
64119
+ result,
64120
+ status
64121
+ }) => {
64122
+ var _a2;
64123
+ const typedArgs = args;
64124
+ const code2 = (typedArgs == null ? void 0 : typedArgs.code) ?? "";
64125
+ const summary = (typedArgs == null ? void 0 : typedArgs.summary) ?? null;
64126
+ const deckIdFromArgs = typeof (typedArgs == null ? void 0 : typedArgs.deck_id) === "string" ? typedArgs.deck_id : null;
64127
+ const isRunning = (status == null ? void 0 : status.type) === "running";
64128
+ const isComplete = (status == null ? void 0 : status.type) === "complete";
64129
+ const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
64130
+ const parsed = useMemo(
64131
+ () => isComplete ? parsePythonResult(result) : null,
64132
+ [result, isComplete]
64133
+ );
64134
+ const outputText = parsed ? getExecutionTextOutput(parsed) : null;
64135
+ const assetId = (parsed == null ? void 0 : parsed.assetId) ?? null;
64136
+ const deckId = (parsed == null ? void 0 : parsed.deckId) ?? deckIdFromArgs;
64137
+ const hasError = parsed && (parsed.error || parsed.exception);
64138
+ const openAsset = useAssetPanelStore((s) => s.openAsset);
64139
+ const wasCompleteAtMount = useRef(isComplete);
64140
+ useEffect(() => {
64141
+ if (!isComplete || !assetId || wasCompleteAtMount.current) {
64142
+ return;
64143
+ }
64144
+ const store = useAssetPanelStore.getState();
64145
+ if (store.markAutoOpened(assetId)) {
64146
+ store.openAsset(assetId, { type: "presentation" });
64147
+ }
64148
+ }, [assetId, isComplete]);
64149
+ return /* @__PURE__ */ jsxs(
64150
+ ToolCard,
64151
+ {
64152
+ icon: Presentation,
64153
+ status: (status == null ? void 0 : status.type) ?? "complete",
64154
+ title: isRunning ? summary || "Executing presentation code..." : summary || "Presentation updated",
64155
+ subtitle: deckId ? `Deck ${truncate(deckId, 24)}` : assetId ? `Asset ${truncate(assetId, 24)}` : void 0,
64156
+ badge: "Deck",
64157
+ toolName,
64158
+ args: typedArgs,
64159
+ result,
64160
+ error: errorMsg,
64161
+ children: [
64162
+ assetId && isComplete && /* @__PURE__ */ jsx("div", { className: "border-t border-border/40 px-4 py-2.5", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
64163
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
64164
+ /* @__PURE__ */ jsx("div", { className: "text-[11px] font-medium text-muted-foreground", children: "Open the updated deck in the asset panel" }),
64165
+ /* @__PURE__ */ jsx("div", { className: "truncate text-[11px] text-foreground/80", children: truncate(assetId, 32) })
64166
+ ] }),
64167
+ /* @__PURE__ */ jsxs(
64168
+ "button",
64169
+ {
64170
+ type: "button",
64171
+ onClick: () => openAsset(assetId, { type: "presentation" }),
64172
+ 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",
64173
+ children: [
64174
+ /* @__PURE__ */ jsx(ExternalLink, { className: "size-3" }),
64175
+ "Open deck"
64176
+ ]
64177
+ }
64178
+ )
64179
+ ] }) }),
64180
+ code2 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsx(SyntaxHighlightedCode, { code: code2 }) }),
64181
+ isComplete && outputText && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
64182
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-1.5", children: [
64183
+ /* @__PURE__ */ jsx(Terminal, { className: "size-3 text-muted-foreground" }),
64184
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Execution log" })
64185
+ ] }),
64186
+ /* @__PURE__ */ 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 })
64187
+ ] }),
64188
+ isComplete && hasError && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 bg-destructive/10 px-4 py-2.5", children: [
64189
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-1.5", children: [
64190
+ /* @__PURE__ */ jsx(TriangleAlert, { className: "size-3 text-destructive" }),
64191
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-destructive", children: parsed.exception ? `${parsed.exception.name}: ${parsed.exception.value}` : "Execution error" })
64192
+ ] }),
64193
+ /* @__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 })
64194
+ ] }),
64195
+ isComplete && parsed && parsed.createdAssets.length > 0 && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2", children: [
64196
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Created assets" }),
64197
+ /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-1.5", children: parsed.createdAssets.map((entry) => /* @__PURE__ */ jsxs(
64198
+ "button",
64199
+ {
64200
+ type: "button",
64201
+ onClick: () => openAsset(entry.asset_id),
64202
+ 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",
64203
+ children: [
64204
+ /* @__PURE__ */ jsx(ExternalLink, { className: "size-2.5" }),
64205
+ truncate(entry.asset_id, 20)
64206
+ ]
64207
+ },
64208
+ entry.asset_id
64209
+ )) })
64210
+ ] })
64211
+ ]
64212
+ }
64213
+ );
64214
+ };
64215
+ const ExecutePresentationCodeToolUI = memo(
64216
+ ExecutePresentationCodeToolUIImpl
64217
+ );
64218
+ ExecutePresentationCodeToolUI.displayName = "ExecutePresentationCodeToolUI";
63830
64219
  const OpenAssetToolUIImpl = ({
63831
64220
  toolName,
63832
64221
  args,
@@ -63908,6 +64297,7 @@ const TOOL_UI_REGISTRY = {
63908
64297
  create_new_sheet: CreateSheetToolUI,
63909
64298
  create_powerpoint_deck: CreatePresentationToolUI,
63910
64299
  create_new_notebook: CreateNotebookToolUI,
64300
+ execute_presentation_code: ExecutePresentationCodeToolUI,
63911
64301
  run_python_code: RunPythonCodeToolUI,
63912
64302
  open_asset_in_workspace: OpenAssetToolUI
63913
64303
  };
@@ -64620,7 +65010,7 @@ const MessageError = () => /* @__PURE__ */ jsx(MessagePrimitiveError, { children
64620
65010
  }
64621
65011
  ) })
64622
65012
  ] }) });
64623
- const AthenaAssistantMessageEmpty = () => /* @__PURE__ */ jsx("span", { className: "shimmer text-muted-foreground", children: "Thinking..." });
65013
+ const AthenaAssistantMessageEmpty = () => /* @__PURE__ */ jsx("span", { className: "shimmer text-[13px] text-muted-foreground", children: "Thinking..." });
64624
65014
  const AthenaReasoningPart = ({
64625
65015
  text: text2,
64626
65016
  status,
@@ -64670,7 +65060,7 @@ const AthenaReasoningPart = ({
64670
65060
  className: "flex w-full items-center justify-between gap-3 text-left",
64671
65061
  "aria-label": isRunning ? "Toggle reasoning while streaming" : "Toggle reasoning",
64672
65062
  children: [
64673
- /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-2 text-sm font-medium text-muted-foreground", children: [
65063
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-2 text-[13px] font-medium text-muted-foreground", children: [
64674
65064
  /* @__PURE__ */ jsx(Brain, { className: "size-4 shrink-0" }),
64675
65065
  /* @__PURE__ */ jsx("span", { children: isRunning ? "Reasoning..." : "Reasoning" })
64676
65066
  ] }),
@@ -64691,7 +65081,7 @@ const AthenaReasoningPart = ({
64691
65081
  ]
64692
65082
  }
64693
65083
  ) }),
64694
- /* @__PURE__ */ jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsx("span", { className: "shimmer text-sm text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground", children: text2 }) : /* @__PURE__ */ jsx("div", { className: "aui-assistant-reasoning-body text-sm", children: /* @__PURE__ */ jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
65084
+ /* @__PURE__ */ jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsx("span", { className: "shimmer text-[13px] text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap break-words text-[13px] leading-relaxed text-foreground", children: text2 }) : /* @__PURE__ */ jsx("div", { className: "aui-assistant-reasoning-body text-[13px] leading-relaxed", children: /* @__PURE__ */ jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
64695
65085
  ]
64696
65086
  }
64697
65087
  );