@athenaintel/react 0.9.24 → 0.10.0

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
@@ -24353,6 +24353,7 @@ const useAthenaRuntime = (config2) => {
24353
24353
  workbench = [],
24354
24354
  knowledgeBase = [],
24355
24355
  systemPrompt,
24356
+ customToolConfigs,
24356
24357
  threadId: threadIdProp
24357
24358
  } = config2;
24358
24359
  const resolvedResumeApiUrl = resumeApiUrl ?? apiUrl.replace(/\/api\/chat$/, "/api/resume");
@@ -24377,7 +24378,8 @@ const useAthenaRuntime = (config2) => {
24377
24378
  model,
24378
24379
  workbench,
24379
24380
  knowledgeBase,
24380
- systemPrompt
24381
+ systemPrompt,
24382
+ customToolConfigs
24381
24383
  });
24382
24384
  runConfigRef.current = {
24383
24385
  enabledTools,
@@ -24385,7 +24387,8 @@ const useAthenaRuntime = (config2) => {
24385
24387
  model,
24386
24388
  workbench,
24387
24389
  knowledgeBase,
24388
- systemPrompt
24390
+ systemPrompt,
24391
+ customToolConfigs
24389
24392
  };
24390
24393
  const isExistingThread = !!threadIdProp;
24391
24394
  const runtime = useAssistantTransportRuntime({
@@ -24495,7 +24498,8 @@ const useAthenaRuntime = (config2) => {
24495
24498
  plan_mode_enabled: false,
24496
24499
  workbench: currentRunConfig.workbench,
24497
24500
  knowledge_base: currentRunConfig.knowledgeBase,
24498
- ...currentRunConfig.systemPrompt ? { system_prompt: currentRunConfig.systemPrompt } : {}
24501
+ ...currentRunConfig.systemPrompt ? { system_prompt: currentRunConfig.systemPrompt } : {},
24502
+ ...currentRunConfig.customToolConfigs ? { custom_tool_configs: currentRunConfig.customToolConfigs } : {}
24499
24503
  },
24500
24504
  persistToolInvocationLogs: true
24501
24505
  };
@@ -24535,424 +24539,6 @@ const useAthenaRuntime = (config2) => {
24535
24539
  }, [isExistingThread, runtime, threadId, backendUrl]);
24536
24540
  return runtime;
24537
24541
  };
24538
- function createJSONStorage(getStorage, options) {
24539
- let storage;
24540
- try {
24541
- storage = getStorage();
24542
- } catch (e) {
24543
- return;
24544
- }
24545
- const persistStorage = {
24546
- getItem: (name) => {
24547
- var _a2;
24548
- const parse2 = (str2) => {
24549
- if (str2 === null) {
24550
- return null;
24551
- }
24552
- return JSON.parse(str2, void 0);
24553
- };
24554
- const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
24555
- if (str instanceof Promise) {
24556
- return str.then(parse2);
24557
- }
24558
- return parse2(str);
24559
- },
24560
- setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
24561
- removeItem: (name) => storage.removeItem(name)
24562
- };
24563
- return persistStorage;
24564
- }
24565
- const toThenable = (fn) => (input) => {
24566
- try {
24567
- const result = fn(input);
24568
- if (result instanceof Promise) {
24569
- return result;
24570
- }
24571
- return {
24572
- then(onFulfilled) {
24573
- return toThenable(onFulfilled)(result);
24574
- },
24575
- catch(_onRejected) {
24576
- return this;
24577
- }
24578
- };
24579
- } catch (e) {
24580
- return {
24581
- then(_onFulfilled) {
24582
- return this;
24583
- },
24584
- catch(onRejected) {
24585
- return toThenable(onRejected)(e);
24586
- }
24587
- };
24588
- }
24589
- };
24590
- const persistImpl = (config2, baseOptions) => (set2, get2, api) => {
24591
- let options = {
24592
- storage: createJSONStorage(() => window.localStorage),
24593
- partialize: (state) => state,
24594
- version: 0,
24595
- merge: (persistedState, currentState) => ({
24596
- ...currentState,
24597
- ...persistedState
24598
- }),
24599
- ...baseOptions
24600
- };
24601
- let hasHydrated = false;
24602
- let hydrationVersion = 0;
24603
- const hydrationListeners = /* @__PURE__ */ new Set();
24604
- const finishHydrationListeners = /* @__PURE__ */ new Set();
24605
- let storage = options.storage;
24606
- if (!storage) {
24607
- return config2(
24608
- (...args) => {
24609
- console.warn(
24610
- `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
24611
- );
24612
- set2(...args);
24613
- },
24614
- get2,
24615
- api
24616
- );
24617
- }
24618
- const setItem = () => {
24619
- const state = options.partialize({ ...get2() });
24620
- return storage.setItem(options.name, {
24621
- state,
24622
- version: options.version
24623
- });
24624
- };
24625
- const savedSetState = api.setState;
24626
- api.setState = (state, replace2) => {
24627
- savedSetState(state, replace2);
24628
- return setItem();
24629
- };
24630
- const configResult = config2(
24631
- (...args) => {
24632
- set2(...args);
24633
- return setItem();
24634
- },
24635
- get2,
24636
- api
24637
- );
24638
- api.getInitialState = () => configResult;
24639
- let stateFromStorage;
24640
- const hydrate = () => {
24641
- var _a2, _b;
24642
- if (!storage) return;
24643
- const currentVersion = ++hydrationVersion;
24644
- hasHydrated = false;
24645
- hydrationListeners.forEach((cb) => {
24646
- var _a22;
24647
- return cb((_a22 = get2()) != null ? _a22 : configResult);
24648
- });
24649
- const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get2()) != null ? _a2 : configResult)) || void 0;
24650
- return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
24651
- if (deserializedStorageValue) {
24652
- if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
24653
- if (options.migrate) {
24654
- const migration = options.migrate(
24655
- deserializedStorageValue.state,
24656
- deserializedStorageValue.version
24657
- );
24658
- if (migration instanceof Promise) {
24659
- return migration.then((result) => [true, result]);
24660
- }
24661
- return [true, migration];
24662
- }
24663
- console.error(
24664
- `State loaded from storage couldn't be migrated since no migrate function was provided`
24665
- );
24666
- } else {
24667
- return [false, deserializedStorageValue.state];
24668
- }
24669
- }
24670
- return [false, void 0];
24671
- }).then((migrationResult) => {
24672
- var _a22;
24673
- if (currentVersion !== hydrationVersion) {
24674
- return;
24675
- }
24676
- const [migrated, migratedState] = migrationResult;
24677
- stateFromStorage = options.merge(
24678
- migratedState,
24679
- (_a22 = get2()) != null ? _a22 : configResult
24680
- );
24681
- set2(stateFromStorage, true);
24682
- if (migrated) {
24683
- return setItem();
24684
- }
24685
- }).then(() => {
24686
- if (currentVersion !== hydrationVersion) {
24687
- return;
24688
- }
24689
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
24690
- stateFromStorage = get2();
24691
- hasHydrated = true;
24692
- finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
24693
- }).catch((e) => {
24694
- if (currentVersion !== hydrationVersion) {
24695
- return;
24696
- }
24697
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
24698
- });
24699
- };
24700
- api.persist = {
24701
- setOptions: (newOptions) => {
24702
- options = {
24703
- ...options,
24704
- ...newOptions
24705
- };
24706
- if (newOptions.storage) {
24707
- storage = newOptions.storage;
24708
- }
24709
- },
24710
- clearStorage: () => {
24711
- storage == null ? void 0 : storage.removeItem(options.name);
24712
- },
24713
- getOptions: () => options,
24714
- rehydrate: () => hydrate(),
24715
- hasHydrated: () => hasHydrated,
24716
- onHydrate: (cb) => {
24717
- hydrationListeners.add(cb);
24718
- return () => {
24719
- hydrationListeners.delete(cb);
24720
- };
24721
- },
24722
- onFinishHydration: (cb) => {
24723
- finishHydrationListeners.add(cb);
24724
- return () => {
24725
- finishHydrationListeners.delete(cb);
24726
- };
24727
- }
24728
- };
24729
- if (!options.skipHydration) {
24730
- hydrate();
24731
- }
24732
- return stateFromStorage || configResult;
24733
- };
24734
- const persist = persistImpl;
24735
- const useAssetPanelStore = create()(
24736
- persist(
24737
- (set2, get2) => ({
24738
- isOpen: false,
24739
- tabs: [],
24740
- activeTabId: null,
24741
- viewMode: "tabs",
24742
- isFullscreen: false,
24743
- assetPanelHostCount: 0,
24744
- autoOpenGeneration: 0,
24745
- autoOpenedAssets: /* @__PURE__ */ new Map(),
24746
- registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
24747
- unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
24748
- openAsset: (assetId, meta) => set2((s) => {
24749
- const existing = s.tabs.find((t) => t.id === assetId);
24750
- if (existing) {
24751
- const tabs = meta ? s.tabs.map(
24752
- (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
24753
- ) : s.tabs;
24754
- return { isOpen: true, tabs, activeTabId: assetId };
24755
- }
24756
- const newTab = {
24757
- id: assetId,
24758
- name: (meta == null ? void 0 : meta.name) ?? null,
24759
- type: (meta == null ? void 0 : meta.type) ?? "unknown"
24760
- };
24761
- return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
24762
- }),
24763
- closeTab: (assetId) => set2((s) => {
24764
- var _a2;
24765
- const tabs = s.tabs.filter((t) => t.id !== assetId);
24766
- if (tabs.length === 0) {
24767
- return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
24768
- }
24769
- 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;
24770
- return { tabs, activeTabId };
24771
- }),
24772
- setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
24773
- setViewMode: (mode) => set2({ viewMode: mode }),
24774
- closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
24775
- toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
24776
- resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
24777
- markAutoOpened: (assetId) => {
24778
- const state = get2();
24779
- if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
24780
- return false;
24781
- }
24782
- state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
24783
- return true;
24784
- }
24785
- }),
24786
- {
24787
- name: "athena-react-asset-panel",
24788
- partialize: ({
24789
- isOpen,
24790
- tabs,
24791
- activeTabId,
24792
- viewMode,
24793
- isFullscreen
24794
- }) => ({
24795
- isOpen,
24796
- tabs,
24797
- activeTabId,
24798
- viewMode,
24799
- isFullscreen
24800
- }),
24801
- storage: createJSONStorage(() => sessionStorage)
24802
- }
24803
- )
24804
- );
24805
- const THREAD_SNAPSHOT_STORAGE_KEY = "athena-react-asset-panel-thread-snapshots";
24806
- const DEFAULT_ASSET_PANEL_SNAPSHOT = {
24807
- isOpen: false,
24808
- tabs: [],
24809
- activeTabId: null,
24810
- viewMode: "tabs",
24811
- isFullscreen: false
24812
- };
24813
- const useBrowserLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
24814
- const selectAssetPanelSnapshot = (state) => ({
24815
- isOpen: state.isOpen,
24816
- tabs: state.tabs,
24817
- activeTabId: state.activeTabId,
24818
- viewMode: state.viewMode,
24819
- isFullscreen: state.isFullscreen
24820
- });
24821
- const areSnapshotsEqual = (left, right) => {
24822
- if (left.isOpen !== right.isOpen || left.activeTabId !== right.activeTabId || left.viewMode !== right.viewMode || left.isFullscreen !== right.isFullscreen || left.tabs.length !== right.tabs.length) {
24823
- return false;
24824
- }
24825
- return left.tabs.every((tab, index2) => {
24826
- const otherTab = right.tabs[index2];
24827
- return otherTab !== void 0 && tab.id === otherTab.id && tab.name === otherTab.name && tab.type === otherTab.type;
24828
- });
24829
- };
24830
- const getSessionStorage = () => {
24831
- if (typeof window === "undefined") {
24832
- return null;
24833
- }
24834
- try {
24835
- return sessionStorage;
24836
- } catch {
24837
- return null;
24838
- }
24839
- };
24840
- const readAllThreadSnapshots = () => {
24841
- const storage = getSessionStorage();
24842
- if (!storage) {
24843
- return {};
24844
- }
24845
- try {
24846
- const raw = storage.getItem(THREAD_SNAPSHOT_STORAGE_KEY);
24847
- if (!raw) {
24848
- return {};
24849
- }
24850
- const parsed = JSON.parse(raw);
24851
- if (!parsed || typeof parsed !== "object") {
24852
- return {};
24853
- }
24854
- return parsed;
24855
- } catch {
24856
- return {};
24857
- }
24858
- };
24859
- const writeAllThreadSnapshots = (snapshots) => {
24860
- const storage = getSessionStorage();
24861
- if (!storage) {
24862
- return;
24863
- }
24864
- try {
24865
- storage.setItem(THREAD_SNAPSHOT_STORAGE_KEY, JSON.stringify(snapshots));
24866
- } catch {
24867
- }
24868
- };
24869
- const readThreadSnapshot = (threadInfo) => {
24870
- const snapshots = readAllThreadSnapshots();
24871
- if (threadInfo.remoteId && snapshots[threadInfo.remoteId]) {
24872
- return snapshots[threadInfo.remoteId];
24873
- }
24874
- return snapshots[threadInfo.threadId] ?? DEFAULT_ASSET_PANEL_SNAPSHOT;
24875
- };
24876
- const writeThreadSnapshot = (threadInfo, snapshot) => {
24877
- const keys2 = [threadInfo.threadId, threadInfo.remoteId].filter(
24878
- (value) => Boolean(value)
24879
- );
24880
- if (keys2.length === 0) {
24881
- return;
24882
- }
24883
- const snapshots = readAllThreadSnapshots();
24884
- let didChange = false;
24885
- for (const key of keys2) {
24886
- if (areSnapshotsEqual(snapshots[key] ?? DEFAULT_ASSET_PANEL_SNAPSHOT, snapshot)) {
24887
- continue;
24888
- }
24889
- snapshots[key] = snapshot;
24890
- didChange = true;
24891
- }
24892
- if (didChange) {
24893
- writeAllThreadSnapshots(snapshots);
24894
- }
24895
- };
24896
- function AssetPanelThreadPersistence() {
24897
- const mainThreadId = useAuiState((state) => state.threads.mainThreadId);
24898
- const activeRemoteId = useAuiState((state) => {
24899
- const activeThread = state.threads.threadItems.find(
24900
- (thread) => thread.id === state.threads.mainThreadId
24901
- );
24902
- return (activeThread == null ? void 0 : activeThread.remoteId) ?? null;
24903
- });
24904
- const panelSnapshot = useAssetPanelStore(selectAssetPanelSnapshot);
24905
- const previousThreadRef = React.useRef(null);
24906
- const pendingPersistSkipKeyRef = React.useRef(null);
24907
- useBrowserLayoutEffect(() => {
24908
- if (!mainThreadId) {
24909
- return;
24910
- }
24911
- const activeThread = {
24912
- threadId: mainThreadId,
24913
- remoteId: activeRemoteId
24914
- };
24915
- const previousThread = previousThreadRef.current;
24916
- const didThreadChange = !previousThread || previousThread.threadId !== activeThread.threadId || previousThread.remoteId !== activeThread.remoteId;
24917
- if (!didThreadChange) {
24918
- return;
24919
- }
24920
- if (previousThread) {
24921
- writeThreadSnapshot(
24922
- previousThread,
24923
- selectAssetPanelSnapshot(useAssetPanelStore.getState())
24924
- );
24925
- }
24926
- previousThreadRef.current = activeThread;
24927
- pendingPersistSkipKeyRef.current = activeThread.remoteId ?? activeThread.threadId;
24928
- const snapshotToRestore = readThreadSnapshot(activeThread);
24929
- const currentSnapshot = selectAssetPanelSnapshot(useAssetPanelStore.getState());
24930
- if (!areSnapshotsEqual(currentSnapshot, snapshotToRestore)) {
24931
- useAssetPanelStore.setState((state) => ({
24932
- ...state,
24933
- ...snapshotToRestore
24934
- }));
24935
- }
24936
- }, [mainThreadId, activeRemoteId]);
24937
- React.useEffect(() => {
24938
- if (!mainThreadId) {
24939
- return;
24940
- }
24941
- const activeThreadKey = activeRemoteId ?? mainThreadId;
24942
- if (pendingPersistSkipKeyRef.current === activeThreadKey) {
24943
- pendingPersistSkipKeyRef.current = null;
24944
- return;
24945
- }
24946
- writeThreadSnapshot(
24947
- {
24948
- threadId: mainThreadId,
24949
- remoteId: activeRemoteId
24950
- },
24951
- panelSnapshot
24952
- );
24953
- }, [mainThreadId, activeRemoteId, panelSnapshot]);
24954
- return null;
24955
- }
24956
24542
  function TooltipProvider({
24957
24543
  delayDuration = 0,
24958
24544
  ...props
@@ -25341,6 +24927,7 @@ function AthenaStandalone({
25341
24927
  workbench,
25342
24928
  knowledgeBase,
25343
24929
  systemPrompt,
24930
+ customToolConfigs,
25344
24931
  threadId,
25345
24932
  linkClicks,
25346
24933
  citationLinks
@@ -25359,6 +24946,7 @@ function AthenaStandalone({
25359
24946
  workbench,
25360
24947
  knowledgeBase,
25361
24948
  systemPrompt,
24949
+ customToolConfigs,
25362
24950
  threadId
25363
24951
  });
25364
24952
  const athenaConfig = useAthenaConfigValue({
@@ -25385,6 +24973,7 @@ function useAthenaRuntimeHook(config2) {
25385
24973
  workbench: config2.workbench,
25386
24974
  knowledgeBase: config2.knowledgeBase,
25387
24975
  systemPrompt: config2.systemPrompt,
24976
+ customToolConfigs: config2.customToolConfigs,
25388
24977
  threadId: remoteId
25389
24978
  });
25390
24979
  }
@@ -25403,6 +24992,7 @@ function AthenaWithThreadList({
25403
24992
  workbench,
25404
24993
  knowledgeBase,
25405
24994
  systemPrompt,
24995
+ customToolConfigs,
25406
24996
  linkClicks,
25407
24997
  citationLinks
25408
24998
  }) {
@@ -25422,7 +25012,8 @@ function AthenaWithThreadList({
25422
25012
  frontendToolIds,
25423
25013
  workbench,
25424
25014
  knowledgeBase,
25425
- systemPrompt
25015
+ systemPrompt,
25016
+ customToolConfigs
25426
25017
  });
25427
25018
  runtimeConfigRef.current = {
25428
25019
  apiUrl,
@@ -25435,7 +25026,8 @@ function AthenaWithThreadList({
25435
25026
  frontendToolIds,
25436
25027
  workbench,
25437
25028
  knowledgeBase,
25438
- systemPrompt
25029
+ systemPrompt,
25030
+ customToolConfigs
25439
25031
  };
25440
25032
  const runtimeHook = React.useCallback(
25441
25033
  () => useAthenaRuntimeHook(runtimeConfigRef.current),
@@ -25473,10 +25065,7 @@ function AthenaWithThreadList({
25473
25065
  linkClicks,
25474
25066
  citationLinks
25475
25067
  });
25476
- return /* @__PURE__ */ jsxRuntime.jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(ThreadListRefreshContext.Provider, { value: handleRefresh, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipProvider, { children: [
25477
- /* @__PURE__ */ jsxRuntime.jsx(AssetPanelThreadPersistence, {}),
25478
- children
25479
- ] }) }) }) });
25068
+ return /* @__PURE__ */ jsxRuntime.jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(ThreadListRefreshContext.Provider, { value: handleRefresh, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children }) }) }) });
25480
25069
  }
25481
25070
  function AthenaProvider({
25482
25071
  children,
@@ -25494,6 +25083,7 @@ function AthenaProvider({
25494
25083
  workbench,
25495
25084
  knowledgeBase,
25496
25085
  systemPrompt,
25086
+ customToolConfigs,
25497
25087
  threadId: threadIdProp,
25498
25088
  enableThreadList = false,
25499
25089
  theme,
@@ -25545,6 +25135,7 @@ function AthenaProvider({
25545
25135
  workbench,
25546
25136
  knowledgeBase,
25547
25137
  systemPrompt,
25138
+ customToolConfigs,
25548
25139
  linkClicks,
25549
25140
  citationLinks,
25550
25141
  children
@@ -25567,6 +25158,7 @@ function AthenaProvider({
25567
25158
  workbench,
25568
25159
  knowledgeBase,
25569
25160
  systemPrompt,
25161
+ customToolConfigs,
25570
25162
  threadId: threadIdProp,
25571
25163
  linkClicks,
25572
25164
  citationLinks,
@@ -59229,6 +58821,273 @@ const MentionExtension = Node3.create({
59229
58821
  };
59230
58822
  }
59231
58823
  });
58824
+ function createJSONStorage(getStorage, options) {
58825
+ let storage;
58826
+ try {
58827
+ storage = getStorage();
58828
+ } catch (e) {
58829
+ return;
58830
+ }
58831
+ const persistStorage = {
58832
+ getItem: (name) => {
58833
+ var _a2;
58834
+ const parse2 = (str2) => {
58835
+ if (str2 === null) {
58836
+ return null;
58837
+ }
58838
+ return JSON.parse(str2, void 0);
58839
+ };
58840
+ const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
58841
+ if (str instanceof Promise) {
58842
+ return str.then(parse2);
58843
+ }
58844
+ return parse2(str);
58845
+ },
58846
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
58847
+ removeItem: (name) => storage.removeItem(name)
58848
+ };
58849
+ return persistStorage;
58850
+ }
58851
+ const toThenable = (fn) => (input) => {
58852
+ try {
58853
+ const result = fn(input);
58854
+ if (result instanceof Promise) {
58855
+ return result;
58856
+ }
58857
+ return {
58858
+ then(onFulfilled) {
58859
+ return toThenable(onFulfilled)(result);
58860
+ },
58861
+ catch(_onRejected) {
58862
+ return this;
58863
+ }
58864
+ };
58865
+ } catch (e) {
58866
+ return {
58867
+ then(_onFulfilled) {
58868
+ return this;
58869
+ },
58870
+ catch(onRejected) {
58871
+ return toThenable(onRejected)(e);
58872
+ }
58873
+ };
58874
+ }
58875
+ };
58876
+ const persistImpl = (config2, baseOptions) => (set2, get2, api) => {
58877
+ let options = {
58878
+ storage: createJSONStorage(() => window.localStorage),
58879
+ partialize: (state) => state,
58880
+ version: 0,
58881
+ merge: (persistedState, currentState) => ({
58882
+ ...currentState,
58883
+ ...persistedState
58884
+ }),
58885
+ ...baseOptions
58886
+ };
58887
+ let hasHydrated = false;
58888
+ let hydrationVersion = 0;
58889
+ const hydrationListeners = /* @__PURE__ */ new Set();
58890
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
58891
+ let storage = options.storage;
58892
+ if (!storage) {
58893
+ return config2(
58894
+ (...args) => {
58895
+ console.warn(
58896
+ `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
58897
+ );
58898
+ set2(...args);
58899
+ },
58900
+ get2,
58901
+ api
58902
+ );
58903
+ }
58904
+ const setItem = () => {
58905
+ const state = options.partialize({ ...get2() });
58906
+ return storage.setItem(options.name, {
58907
+ state,
58908
+ version: options.version
58909
+ });
58910
+ };
58911
+ const savedSetState = api.setState;
58912
+ api.setState = (state, replace2) => {
58913
+ savedSetState(state, replace2);
58914
+ return setItem();
58915
+ };
58916
+ const configResult = config2(
58917
+ (...args) => {
58918
+ set2(...args);
58919
+ return setItem();
58920
+ },
58921
+ get2,
58922
+ api
58923
+ );
58924
+ api.getInitialState = () => configResult;
58925
+ let stateFromStorage;
58926
+ const hydrate = () => {
58927
+ var _a2, _b;
58928
+ if (!storage) return;
58929
+ const currentVersion = ++hydrationVersion;
58930
+ hasHydrated = false;
58931
+ hydrationListeners.forEach((cb) => {
58932
+ var _a22;
58933
+ return cb((_a22 = get2()) != null ? _a22 : configResult);
58934
+ });
58935
+ const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get2()) != null ? _a2 : configResult)) || void 0;
58936
+ return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
58937
+ if (deserializedStorageValue) {
58938
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
58939
+ if (options.migrate) {
58940
+ const migration = options.migrate(
58941
+ deserializedStorageValue.state,
58942
+ deserializedStorageValue.version
58943
+ );
58944
+ if (migration instanceof Promise) {
58945
+ return migration.then((result) => [true, result]);
58946
+ }
58947
+ return [true, migration];
58948
+ }
58949
+ console.error(
58950
+ `State loaded from storage couldn't be migrated since no migrate function was provided`
58951
+ );
58952
+ } else {
58953
+ return [false, deserializedStorageValue.state];
58954
+ }
58955
+ }
58956
+ return [false, void 0];
58957
+ }).then((migrationResult) => {
58958
+ var _a22;
58959
+ if (currentVersion !== hydrationVersion) {
58960
+ return;
58961
+ }
58962
+ const [migrated, migratedState] = migrationResult;
58963
+ stateFromStorage = options.merge(
58964
+ migratedState,
58965
+ (_a22 = get2()) != null ? _a22 : configResult
58966
+ );
58967
+ set2(stateFromStorage, true);
58968
+ if (migrated) {
58969
+ return setItem();
58970
+ }
58971
+ }).then(() => {
58972
+ if (currentVersion !== hydrationVersion) {
58973
+ return;
58974
+ }
58975
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
58976
+ stateFromStorage = get2();
58977
+ hasHydrated = true;
58978
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
58979
+ }).catch((e) => {
58980
+ if (currentVersion !== hydrationVersion) {
58981
+ return;
58982
+ }
58983
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
58984
+ });
58985
+ };
58986
+ api.persist = {
58987
+ setOptions: (newOptions) => {
58988
+ options = {
58989
+ ...options,
58990
+ ...newOptions
58991
+ };
58992
+ if (newOptions.storage) {
58993
+ storage = newOptions.storage;
58994
+ }
58995
+ },
58996
+ clearStorage: () => {
58997
+ storage == null ? void 0 : storage.removeItem(options.name);
58998
+ },
58999
+ getOptions: () => options,
59000
+ rehydrate: () => hydrate(),
59001
+ hasHydrated: () => hasHydrated,
59002
+ onHydrate: (cb) => {
59003
+ hydrationListeners.add(cb);
59004
+ return () => {
59005
+ hydrationListeners.delete(cb);
59006
+ };
59007
+ },
59008
+ onFinishHydration: (cb) => {
59009
+ finishHydrationListeners.add(cb);
59010
+ return () => {
59011
+ finishHydrationListeners.delete(cb);
59012
+ };
59013
+ }
59014
+ };
59015
+ if (!options.skipHydration) {
59016
+ hydrate();
59017
+ }
59018
+ return stateFromStorage || configResult;
59019
+ };
59020
+ const persist = persistImpl;
59021
+ const useAssetPanelStore = create()(
59022
+ persist(
59023
+ (set2, get2) => ({
59024
+ isOpen: false,
59025
+ tabs: [],
59026
+ activeTabId: null,
59027
+ viewMode: "tabs",
59028
+ isFullscreen: false,
59029
+ assetPanelHostCount: 0,
59030
+ autoOpenGeneration: 0,
59031
+ autoOpenedAssets: /* @__PURE__ */ new Map(),
59032
+ registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
59033
+ unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
59034
+ openAsset: (assetId, meta) => set2((s) => {
59035
+ const existing = s.tabs.find((t) => t.id === assetId);
59036
+ if (existing) {
59037
+ const tabs = meta ? s.tabs.map(
59038
+ (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
59039
+ ) : s.tabs;
59040
+ return { isOpen: true, tabs, activeTabId: assetId };
59041
+ }
59042
+ const newTab = {
59043
+ id: assetId,
59044
+ name: (meta == null ? void 0 : meta.name) ?? null,
59045
+ type: (meta == null ? void 0 : meta.type) ?? "unknown"
59046
+ };
59047
+ return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
59048
+ }),
59049
+ closeTab: (assetId) => set2((s) => {
59050
+ var _a2;
59051
+ const tabs = s.tabs.filter((t) => t.id !== assetId);
59052
+ if (tabs.length === 0) {
59053
+ return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
59054
+ }
59055
+ 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;
59056
+ return { tabs, activeTabId };
59057
+ }),
59058
+ setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
59059
+ setViewMode: (mode) => set2({ viewMode: mode }),
59060
+ closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
59061
+ toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
59062
+ resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
59063
+ markAutoOpened: (assetId) => {
59064
+ const state = get2();
59065
+ if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
59066
+ return false;
59067
+ }
59068
+ state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
59069
+ return true;
59070
+ }
59071
+ }),
59072
+ {
59073
+ name: "athena-react-asset-panel",
59074
+ partialize: ({
59075
+ isOpen,
59076
+ tabs,
59077
+ activeTabId,
59078
+ viewMode,
59079
+ isFullscreen
59080
+ }) => ({
59081
+ isOpen,
59082
+ tabs,
59083
+ activeTabId,
59084
+ viewMode,
59085
+ isFullscreen
59086
+ }),
59087
+ storage: createJSONStorage(() => sessionStorage)
59088
+ }
59089
+ )
59090
+ );
59232
59091
  const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
59233
59092
  const ATHENA_PREVIEW_HOSTNAME_SUFFIX = ".previews.athenaintel.com";
59234
59093
  const ATHENA_WORKSPACE_HOSTNAME_SUFFIXES = [".app.athenaintel.com", ".staging-app.athenaintel.com"];
@@ -65077,9 +64936,9 @@ const DEFAULT_SUGGESTIONS = [
65077
64936
  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."
65078
64937
  },
65079
64938
  {
65080
- icon: Search,
65081
- title: "Compare recent AI model launches",
65082
- prompt: "Search the web for the latest major AI model launches from OpenAI, Anthropic, and Google, then summarize the release dates, standout capabilities, and practical tradeoffs in a concise comparison table."
64939
+ icon: ChartColumn,
64940
+ title: "Analyze data and visualize insights",
64941
+ prompt: "Generate a sample quarterly sales dataset across 4 product categories, then create an interactive chart showing revenue trends and category performance over time."
65083
64942
  },
65084
64943
  {
65085
64944
  icon: Presentation,