@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.js CHANGED
@@ -24314,6 +24314,7 @@ const useAthenaRuntime = (config2) => {
24314
24314
  workbench = [],
24315
24315
  knowledgeBase = [],
24316
24316
  systemPrompt,
24317
+ customToolConfigs,
24317
24318
  threadId: threadIdProp
24318
24319
  } = config2;
24319
24320
  const resolvedResumeApiUrl = resumeApiUrl ?? apiUrl.replace(/\/api\/chat$/, "/api/resume");
@@ -24338,7 +24339,8 @@ const useAthenaRuntime = (config2) => {
24338
24339
  model,
24339
24340
  workbench,
24340
24341
  knowledgeBase,
24341
- systemPrompt
24342
+ systemPrompt,
24343
+ customToolConfigs
24342
24344
  });
24343
24345
  runConfigRef.current = {
24344
24346
  enabledTools,
@@ -24346,7 +24348,8 @@ const useAthenaRuntime = (config2) => {
24346
24348
  model,
24347
24349
  workbench,
24348
24350
  knowledgeBase,
24349
- systemPrompt
24351
+ systemPrompt,
24352
+ customToolConfigs
24350
24353
  };
24351
24354
  const isExistingThread = !!threadIdProp;
24352
24355
  const runtime = useAssistantTransportRuntime({
@@ -24456,7 +24459,8 @@ const useAthenaRuntime = (config2) => {
24456
24459
  plan_mode_enabled: false,
24457
24460
  workbench: currentRunConfig.workbench,
24458
24461
  knowledge_base: currentRunConfig.knowledgeBase,
24459
- ...currentRunConfig.systemPrompt ? { system_prompt: currentRunConfig.systemPrompt } : {}
24462
+ ...currentRunConfig.systemPrompt ? { system_prompt: currentRunConfig.systemPrompt } : {},
24463
+ ...currentRunConfig.customToolConfigs ? { custom_tool_configs: currentRunConfig.customToolConfigs } : {}
24460
24464
  },
24461
24465
  persistToolInvocationLogs: true
24462
24466
  };
@@ -24496,424 +24500,6 @@ const useAthenaRuntime = (config2) => {
24496
24500
  }, [isExistingThread, runtime, threadId, backendUrl]);
24497
24501
  return runtime;
24498
24502
  };
24499
- function createJSONStorage(getStorage, options) {
24500
- let storage;
24501
- try {
24502
- storage = getStorage();
24503
- } catch (e) {
24504
- return;
24505
- }
24506
- const persistStorage = {
24507
- getItem: (name) => {
24508
- var _a2;
24509
- const parse2 = (str2) => {
24510
- if (str2 === null) {
24511
- return null;
24512
- }
24513
- return JSON.parse(str2, void 0);
24514
- };
24515
- const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
24516
- if (str instanceof Promise) {
24517
- return str.then(parse2);
24518
- }
24519
- return parse2(str);
24520
- },
24521
- setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
24522
- removeItem: (name) => storage.removeItem(name)
24523
- };
24524
- return persistStorage;
24525
- }
24526
- const toThenable = (fn) => (input) => {
24527
- try {
24528
- const result = fn(input);
24529
- if (result instanceof Promise) {
24530
- return result;
24531
- }
24532
- return {
24533
- then(onFulfilled) {
24534
- return toThenable(onFulfilled)(result);
24535
- },
24536
- catch(_onRejected) {
24537
- return this;
24538
- }
24539
- };
24540
- } catch (e) {
24541
- return {
24542
- then(_onFulfilled) {
24543
- return this;
24544
- },
24545
- catch(onRejected) {
24546
- return toThenable(onRejected)(e);
24547
- }
24548
- };
24549
- }
24550
- };
24551
- const persistImpl = (config2, baseOptions) => (set2, get2, api) => {
24552
- let options = {
24553
- storage: createJSONStorage(() => window.localStorage),
24554
- partialize: (state) => state,
24555
- version: 0,
24556
- merge: (persistedState, currentState) => ({
24557
- ...currentState,
24558
- ...persistedState
24559
- }),
24560
- ...baseOptions
24561
- };
24562
- let hasHydrated = false;
24563
- let hydrationVersion = 0;
24564
- const hydrationListeners = /* @__PURE__ */ new Set();
24565
- const finishHydrationListeners = /* @__PURE__ */ new Set();
24566
- let storage = options.storage;
24567
- if (!storage) {
24568
- return config2(
24569
- (...args) => {
24570
- console.warn(
24571
- `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
24572
- );
24573
- set2(...args);
24574
- },
24575
- get2,
24576
- api
24577
- );
24578
- }
24579
- const setItem = () => {
24580
- const state = options.partialize({ ...get2() });
24581
- return storage.setItem(options.name, {
24582
- state,
24583
- version: options.version
24584
- });
24585
- };
24586
- const savedSetState = api.setState;
24587
- api.setState = (state, replace2) => {
24588
- savedSetState(state, replace2);
24589
- return setItem();
24590
- };
24591
- const configResult = config2(
24592
- (...args) => {
24593
- set2(...args);
24594
- return setItem();
24595
- },
24596
- get2,
24597
- api
24598
- );
24599
- api.getInitialState = () => configResult;
24600
- let stateFromStorage;
24601
- const hydrate = () => {
24602
- var _a2, _b;
24603
- if (!storage) return;
24604
- const currentVersion = ++hydrationVersion;
24605
- hasHydrated = false;
24606
- hydrationListeners.forEach((cb) => {
24607
- var _a22;
24608
- return cb((_a22 = get2()) != null ? _a22 : configResult);
24609
- });
24610
- const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get2()) != null ? _a2 : configResult)) || void 0;
24611
- return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
24612
- if (deserializedStorageValue) {
24613
- if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
24614
- if (options.migrate) {
24615
- const migration = options.migrate(
24616
- deserializedStorageValue.state,
24617
- deserializedStorageValue.version
24618
- );
24619
- if (migration instanceof Promise) {
24620
- return migration.then((result) => [true, result]);
24621
- }
24622
- return [true, migration];
24623
- }
24624
- console.error(
24625
- `State loaded from storage couldn't be migrated since no migrate function was provided`
24626
- );
24627
- } else {
24628
- return [false, deserializedStorageValue.state];
24629
- }
24630
- }
24631
- return [false, void 0];
24632
- }).then((migrationResult) => {
24633
- var _a22;
24634
- if (currentVersion !== hydrationVersion) {
24635
- return;
24636
- }
24637
- const [migrated, migratedState] = migrationResult;
24638
- stateFromStorage = options.merge(
24639
- migratedState,
24640
- (_a22 = get2()) != null ? _a22 : configResult
24641
- );
24642
- set2(stateFromStorage, true);
24643
- if (migrated) {
24644
- return setItem();
24645
- }
24646
- }).then(() => {
24647
- if (currentVersion !== hydrationVersion) {
24648
- return;
24649
- }
24650
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
24651
- stateFromStorage = get2();
24652
- hasHydrated = true;
24653
- finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
24654
- }).catch((e) => {
24655
- if (currentVersion !== hydrationVersion) {
24656
- return;
24657
- }
24658
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
24659
- });
24660
- };
24661
- api.persist = {
24662
- setOptions: (newOptions) => {
24663
- options = {
24664
- ...options,
24665
- ...newOptions
24666
- };
24667
- if (newOptions.storage) {
24668
- storage = newOptions.storage;
24669
- }
24670
- },
24671
- clearStorage: () => {
24672
- storage == null ? void 0 : storage.removeItem(options.name);
24673
- },
24674
- getOptions: () => options,
24675
- rehydrate: () => hydrate(),
24676
- hasHydrated: () => hasHydrated,
24677
- onHydrate: (cb) => {
24678
- hydrationListeners.add(cb);
24679
- return () => {
24680
- hydrationListeners.delete(cb);
24681
- };
24682
- },
24683
- onFinishHydration: (cb) => {
24684
- finishHydrationListeners.add(cb);
24685
- return () => {
24686
- finishHydrationListeners.delete(cb);
24687
- };
24688
- }
24689
- };
24690
- if (!options.skipHydration) {
24691
- hydrate();
24692
- }
24693
- return stateFromStorage || configResult;
24694
- };
24695
- const persist = persistImpl;
24696
- const useAssetPanelStore = create()(
24697
- persist(
24698
- (set2, get2) => ({
24699
- isOpen: false,
24700
- tabs: [],
24701
- activeTabId: null,
24702
- viewMode: "tabs",
24703
- isFullscreen: false,
24704
- assetPanelHostCount: 0,
24705
- autoOpenGeneration: 0,
24706
- autoOpenedAssets: /* @__PURE__ */ new Map(),
24707
- registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
24708
- unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
24709
- openAsset: (assetId, meta) => set2((s) => {
24710
- const existing = s.tabs.find((t) => t.id === assetId);
24711
- if (existing) {
24712
- const tabs = meta ? s.tabs.map(
24713
- (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
24714
- ) : s.tabs;
24715
- return { isOpen: true, tabs, activeTabId: assetId };
24716
- }
24717
- const newTab = {
24718
- id: assetId,
24719
- name: (meta == null ? void 0 : meta.name) ?? null,
24720
- type: (meta == null ? void 0 : meta.type) ?? "unknown"
24721
- };
24722
- return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
24723
- }),
24724
- closeTab: (assetId) => set2((s) => {
24725
- var _a2;
24726
- const tabs = s.tabs.filter((t) => t.id !== assetId);
24727
- if (tabs.length === 0) {
24728
- return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
24729
- }
24730
- 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;
24731
- return { tabs, activeTabId };
24732
- }),
24733
- setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
24734
- setViewMode: (mode) => set2({ viewMode: mode }),
24735
- closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
24736
- toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
24737
- resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
24738
- markAutoOpened: (assetId) => {
24739
- const state = get2();
24740
- if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
24741
- return false;
24742
- }
24743
- state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
24744
- return true;
24745
- }
24746
- }),
24747
- {
24748
- name: "athena-react-asset-panel",
24749
- partialize: ({
24750
- isOpen,
24751
- tabs,
24752
- activeTabId,
24753
- viewMode,
24754
- isFullscreen
24755
- }) => ({
24756
- isOpen,
24757
- tabs,
24758
- activeTabId,
24759
- viewMode,
24760
- isFullscreen
24761
- }),
24762
- storage: createJSONStorage(() => sessionStorage)
24763
- }
24764
- )
24765
- );
24766
- const THREAD_SNAPSHOT_STORAGE_KEY = "athena-react-asset-panel-thread-snapshots";
24767
- const DEFAULT_ASSET_PANEL_SNAPSHOT = {
24768
- isOpen: false,
24769
- tabs: [],
24770
- activeTabId: null,
24771
- viewMode: "tabs",
24772
- isFullscreen: false
24773
- };
24774
- const useBrowserLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
24775
- const selectAssetPanelSnapshot = (state) => ({
24776
- isOpen: state.isOpen,
24777
- tabs: state.tabs,
24778
- activeTabId: state.activeTabId,
24779
- viewMode: state.viewMode,
24780
- isFullscreen: state.isFullscreen
24781
- });
24782
- const areSnapshotsEqual = (left, right) => {
24783
- if (left.isOpen !== right.isOpen || left.activeTabId !== right.activeTabId || left.viewMode !== right.viewMode || left.isFullscreen !== right.isFullscreen || left.tabs.length !== right.tabs.length) {
24784
- return false;
24785
- }
24786
- return left.tabs.every((tab, index2) => {
24787
- const otherTab = right.tabs[index2];
24788
- return otherTab !== void 0 && tab.id === otherTab.id && tab.name === otherTab.name && tab.type === otherTab.type;
24789
- });
24790
- };
24791
- const getSessionStorage = () => {
24792
- if (typeof window === "undefined") {
24793
- return null;
24794
- }
24795
- try {
24796
- return sessionStorage;
24797
- } catch {
24798
- return null;
24799
- }
24800
- };
24801
- const readAllThreadSnapshots = () => {
24802
- const storage = getSessionStorage();
24803
- if (!storage) {
24804
- return {};
24805
- }
24806
- try {
24807
- const raw = storage.getItem(THREAD_SNAPSHOT_STORAGE_KEY);
24808
- if (!raw) {
24809
- return {};
24810
- }
24811
- const parsed = JSON.parse(raw);
24812
- if (!parsed || typeof parsed !== "object") {
24813
- return {};
24814
- }
24815
- return parsed;
24816
- } catch {
24817
- return {};
24818
- }
24819
- };
24820
- const writeAllThreadSnapshots = (snapshots) => {
24821
- const storage = getSessionStorage();
24822
- if (!storage) {
24823
- return;
24824
- }
24825
- try {
24826
- storage.setItem(THREAD_SNAPSHOT_STORAGE_KEY, JSON.stringify(snapshots));
24827
- } catch {
24828
- }
24829
- };
24830
- const readThreadSnapshot = (threadInfo) => {
24831
- const snapshots = readAllThreadSnapshots();
24832
- if (threadInfo.remoteId && snapshots[threadInfo.remoteId]) {
24833
- return snapshots[threadInfo.remoteId];
24834
- }
24835
- return snapshots[threadInfo.threadId] ?? DEFAULT_ASSET_PANEL_SNAPSHOT;
24836
- };
24837
- const writeThreadSnapshot = (threadInfo, snapshot) => {
24838
- const keys2 = [threadInfo.threadId, threadInfo.remoteId].filter(
24839
- (value) => Boolean(value)
24840
- );
24841
- if (keys2.length === 0) {
24842
- return;
24843
- }
24844
- const snapshots = readAllThreadSnapshots();
24845
- let didChange = false;
24846
- for (const key of keys2) {
24847
- if (areSnapshotsEqual(snapshots[key] ?? DEFAULT_ASSET_PANEL_SNAPSHOT, snapshot)) {
24848
- continue;
24849
- }
24850
- snapshots[key] = snapshot;
24851
- didChange = true;
24852
- }
24853
- if (didChange) {
24854
- writeAllThreadSnapshots(snapshots);
24855
- }
24856
- };
24857
- function AssetPanelThreadPersistence() {
24858
- const mainThreadId = useAuiState((state) => state.threads.mainThreadId);
24859
- const activeRemoteId = useAuiState((state) => {
24860
- const activeThread = state.threads.threadItems.find(
24861
- (thread) => thread.id === state.threads.mainThreadId
24862
- );
24863
- return (activeThread == null ? void 0 : activeThread.remoteId) ?? null;
24864
- });
24865
- const panelSnapshot = useAssetPanelStore(selectAssetPanelSnapshot);
24866
- const previousThreadRef = useRef(null);
24867
- const pendingPersistSkipKeyRef = useRef(null);
24868
- useBrowserLayoutEffect(() => {
24869
- if (!mainThreadId) {
24870
- return;
24871
- }
24872
- const activeThread = {
24873
- threadId: mainThreadId,
24874
- remoteId: activeRemoteId
24875
- };
24876
- const previousThread = previousThreadRef.current;
24877
- const didThreadChange = !previousThread || previousThread.threadId !== activeThread.threadId || previousThread.remoteId !== activeThread.remoteId;
24878
- if (!didThreadChange) {
24879
- return;
24880
- }
24881
- if (previousThread) {
24882
- writeThreadSnapshot(
24883
- previousThread,
24884
- selectAssetPanelSnapshot(useAssetPanelStore.getState())
24885
- );
24886
- }
24887
- previousThreadRef.current = activeThread;
24888
- pendingPersistSkipKeyRef.current = activeThread.remoteId ?? activeThread.threadId;
24889
- const snapshotToRestore = readThreadSnapshot(activeThread);
24890
- const currentSnapshot = selectAssetPanelSnapshot(useAssetPanelStore.getState());
24891
- if (!areSnapshotsEqual(currentSnapshot, snapshotToRestore)) {
24892
- useAssetPanelStore.setState((state) => ({
24893
- ...state,
24894
- ...snapshotToRestore
24895
- }));
24896
- }
24897
- }, [mainThreadId, activeRemoteId]);
24898
- useEffect(() => {
24899
- if (!mainThreadId) {
24900
- return;
24901
- }
24902
- const activeThreadKey = activeRemoteId ?? mainThreadId;
24903
- if (pendingPersistSkipKeyRef.current === activeThreadKey) {
24904
- pendingPersistSkipKeyRef.current = null;
24905
- return;
24906
- }
24907
- writeThreadSnapshot(
24908
- {
24909
- threadId: mainThreadId,
24910
- remoteId: activeRemoteId
24911
- },
24912
- panelSnapshot
24913
- );
24914
- }, [mainThreadId, activeRemoteId, panelSnapshot]);
24915
- return null;
24916
- }
24917
24503
  function TooltipProvider({
24918
24504
  delayDuration = 0,
24919
24505
  ...props
@@ -25302,6 +24888,7 @@ function AthenaStandalone({
25302
24888
  workbench,
25303
24889
  knowledgeBase,
25304
24890
  systemPrompt,
24891
+ customToolConfigs,
25305
24892
  threadId,
25306
24893
  linkClicks,
25307
24894
  citationLinks
@@ -25320,6 +24907,7 @@ function AthenaStandalone({
25320
24907
  workbench,
25321
24908
  knowledgeBase,
25322
24909
  systemPrompt,
24910
+ customToolConfigs,
25323
24911
  threadId
25324
24912
  });
25325
24913
  const athenaConfig = useAthenaConfigValue({
@@ -25346,6 +24934,7 @@ function useAthenaRuntimeHook(config2) {
25346
24934
  workbench: config2.workbench,
25347
24935
  knowledgeBase: config2.knowledgeBase,
25348
24936
  systemPrompt: config2.systemPrompt,
24937
+ customToolConfigs: config2.customToolConfigs,
25349
24938
  threadId: remoteId
25350
24939
  });
25351
24940
  }
@@ -25364,6 +24953,7 @@ function AthenaWithThreadList({
25364
24953
  workbench,
25365
24954
  knowledgeBase,
25366
24955
  systemPrompt,
24956
+ customToolConfigs,
25367
24957
  linkClicks,
25368
24958
  citationLinks
25369
24959
  }) {
@@ -25383,7 +24973,8 @@ function AthenaWithThreadList({
25383
24973
  frontendToolIds,
25384
24974
  workbench,
25385
24975
  knowledgeBase,
25386
- systemPrompt
24976
+ systemPrompt,
24977
+ customToolConfigs
25387
24978
  });
25388
24979
  runtimeConfigRef.current = {
25389
24980
  apiUrl,
@@ -25396,7 +24987,8 @@ function AthenaWithThreadList({
25396
24987
  frontendToolIds,
25397
24988
  workbench,
25398
24989
  knowledgeBase,
25399
- systemPrompt
24990
+ systemPrompt,
24991
+ customToolConfigs
25400
24992
  };
25401
24993
  const runtimeHook = useCallback(
25402
24994
  () => useAthenaRuntimeHook(runtimeConfigRef.current),
@@ -25434,10 +25026,7 @@ function AthenaWithThreadList({
25434
25026
  linkClicks,
25435
25027
  citationLinks
25436
25028
  });
25437
- return /* @__PURE__ */ jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(ThreadListRefreshContext.Provider, { value: handleRefresh, children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
25438
- /* @__PURE__ */ jsx(AssetPanelThreadPersistence, {}),
25439
- children
25440
- ] }) }) }) });
25029
+ return /* @__PURE__ */ jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(ThreadListRefreshContext.Provider, { value: handleRefresh, children: /* @__PURE__ */ jsx(TooltipProvider, { children }) }) }) });
25441
25030
  }
25442
25031
  function AthenaProvider({
25443
25032
  children,
@@ -25455,6 +25044,7 @@ function AthenaProvider({
25455
25044
  workbench,
25456
25045
  knowledgeBase,
25457
25046
  systemPrompt,
25047
+ customToolConfigs,
25458
25048
  threadId: threadIdProp,
25459
25049
  enableThreadList = false,
25460
25050
  theme,
@@ -25506,6 +25096,7 @@ function AthenaProvider({
25506
25096
  workbench,
25507
25097
  knowledgeBase,
25508
25098
  systemPrompt,
25099
+ customToolConfigs,
25509
25100
  linkClicks,
25510
25101
  citationLinks,
25511
25102
  children
@@ -25528,6 +25119,7 @@ function AthenaProvider({
25528
25119
  workbench,
25529
25120
  knowledgeBase,
25530
25121
  systemPrompt,
25122
+ customToolConfigs,
25531
25123
  threadId: threadIdProp,
25532
25124
  linkClicks,
25533
25125
  citationLinks,
@@ -59190,6 +58782,273 @@ const MentionExtension = Node3.create({
59190
58782
  };
59191
58783
  }
59192
58784
  });
58785
+ function createJSONStorage(getStorage, options) {
58786
+ let storage;
58787
+ try {
58788
+ storage = getStorage();
58789
+ } catch (e) {
58790
+ return;
58791
+ }
58792
+ const persistStorage = {
58793
+ getItem: (name) => {
58794
+ var _a2;
58795
+ const parse2 = (str2) => {
58796
+ if (str2 === null) {
58797
+ return null;
58798
+ }
58799
+ return JSON.parse(str2, void 0);
58800
+ };
58801
+ const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
58802
+ if (str instanceof Promise) {
58803
+ return str.then(parse2);
58804
+ }
58805
+ return parse2(str);
58806
+ },
58807
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
58808
+ removeItem: (name) => storage.removeItem(name)
58809
+ };
58810
+ return persistStorage;
58811
+ }
58812
+ const toThenable = (fn) => (input) => {
58813
+ try {
58814
+ const result = fn(input);
58815
+ if (result instanceof Promise) {
58816
+ return result;
58817
+ }
58818
+ return {
58819
+ then(onFulfilled) {
58820
+ return toThenable(onFulfilled)(result);
58821
+ },
58822
+ catch(_onRejected) {
58823
+ return this;
58824
+ }
58825
+ };
58826
+ } catch (e) {
58827
+ return {
58828
+ then(_onFulfilled) {
58829
+ return this;
58830
+ },
58831
+ catch(onRejected) {
58832
+ return toThenable(onRejected)(e);
58833
+ }
58834
+ };
58835
+ }
58836
+ };
58837
+ const persistImpl = (config2, baseOptions) => (set2, get2, api) => {
58838
+ let options = {
58839
+ storage: createJSONStorage(() => window.localStorage),
58840
+ partialize: (state) => state,
58841
+ version: 0,
58842
+ merge: (persistedState, currentState) => ({
58843
+ ...currentState,
58844
+ ...persistedState
58845
+ }),
58846
+ ...baseOptions
58847
+ };
58848
+ let hasHydrated = false;
58849
+ let hydrationVersion = 0;
58850
+ const hydrationListeners = /* @__PURE__ */ new Set();
58851
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
58852
+ let storage = options.storage;
58853
+ if (!storage) {
58854
+ return config2(
58855
+ (...args) => {
58856
+ console.warn(
58857
+ `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
58858
+ );
58859
+ set2(...args);
58860
+ },
58861
+ get2,
58862
+ api
58863
+ );
58864
+ }
58865
+ const setItem = () => {
58866
+ const state = options.partialize({ ...get2() });
58867
+ return storage.setItem(options.name, {
58868
+ state,
58869
+ version: options.version
58870
+ });
58871
+ };
58872
+ const savedSetState = api.setState;
58873
+ api.setState = (state, replace2) => {
58874
+ savedSetState(state, replace2);
58875
+ return setItem();
58876
+ };
58877
+ const configResult = config2(
58878
+ (...args) => {
58879
+ set2(...args);
58880
+ return setItem();
58881
+ },
58882
+ get2,
58883
+ api
58884
+ );
58885
+ api.getInitialState = () => configResult;
58886
+ let stateFromStorage;
58887
+ const hydrate = () => {
58888
+ var _a2, _b;
58889
+ if (!storage) return;
58890
+ const currentVersion = ++hydrationVersion;
58891
+ hasHydrated = false;
58892
+ hydrationListeners.forEach((cb) => {
58893
+ var _a22;
58894
+ return cb((_a22 = get2()) != null ? _a22 : configResult);
58895
+ });
58896
+ const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get2()) != null ? _a2 : configResult)) || void 0;
58897
+ return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
58898
+ if (deserializedStorageValue) {
58899
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
58900
+ if (options.migrate) {
58901
+ const migration = options.migrate(
58902
+ deserializedStorageValue.state,
58903
+ deserializedStorageValue.version
58904
+ );
58905
+ if (migration instanceof Promise) {
58906
+ return migration.then((result) => [true, result]);
58907
+ }
58908
+ return [true, migration];
58909
+ }
58910
+ console.error(
58911
+ `State loaded from storage couldn't be migrated since no migrate function was provided`
58912
+ );
58913
+ } else {
58914
+ return [false, deserializedStorageValue.state];
58915
+ }
58916
+ }
58917
+ return [false, void 0];
58918
+ }).then((migrationResult) => {
58919
+ var _a22;
58920
+ if (currentVersion !== hydrationVersion) {
58921
+ return;
58922
+ }
58923
+ const [migrated, migratedState] = migrationResult;
58924
+ stateFromStorage = options.merge(
58925
+ migratedState,
58926
+ (_a22 = get2()) != null ? _a22 : configResult
58927
+ );
58928
+ set2(stateFromStorage, true);
58929
+ if (migrated) {
58930
+ return setItem();
58931
+ }
58932
+ }).then(() => {
58933
+ if (currentVersion !== hydrationVersion) {
58934
+ return;
58935
+ }
58936
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
58937
+ stateFromStorage = get2();
58938
+ hasHydrated = true;
58939
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
58940
+ }).catch((e) => {
58941
+ if (currentVersion !== hydrationVersion) {
58942
+ return;
58943
+ }
58944
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
58945
+ });
58946
+ };
58947
+ api.persist = {
58948
+ setOptions: (newOptions) => {
58949
+ options = {
58950
+ ...options,
58951
+ ...newOptions
58952
+ };
58953
+ if (newOptions.storage) {
58954
+ storage = newOptions.storage;
58955
+ }
58956
+ },
58957
+ clearStorage: () => {
58958
+ storage == null ? void 0 : storage.removeItem(options.name);
58959
+ },
58960
+ getOptions: () => options,
58961
+ rehydrate: () => hydrate(),
58962
+ hasHydrated: () => hasHydrated,
58963
+ onHydrate: (cb) => {
58964
+ hydrationListeners.add(cb);
58965
+ return () => {
58966
+ hydrationListeners.delete(cb);
58967
+ };
58968
+ },
58969
+ onFinishHydration: (cb) => {
58970
+ finishHydrationListeners.add(cb);
58971
+ return () => {
58972
+ finishHydrationListeners.delete(cb);
58973
+ };
58974
+ }
58975
+ };
58976
+ if (!options.skipHydration) {
58977
+ hydrate();
58978
+ }
58979
+ return stateFromStorage || configResult;
58980
+ };
58981
+ const persist = persistImpl;
58982
+ const useAssetPanelStore = create()(
58983
+ persist(
58984
+ (set2, get2) => ({
58985
+ isOpen: false,
58986
+ tabs: [],
58987
+ activeTabId: null,
58988
+ viewMode: "tabs",
58989
+ isFullscreen: false,
58990
+ assetPanelHostCount: 0,
58991
+ autoOpenGeneration: 0,
58992
+ autoOpenedAssets: /* @__PURE__ */ new Map(),
58993
+ registerAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
58994
+ unregisterAssetPanelHost: () => set2((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
58995
+ openAsset: (assetId, meta) => set2((s) => {
58996
+ const existing = s.tabs.find((t) => t.id === assetId);
58997
+ if (existing) {
58998
+ const tabs = meta ? s.tabs.map(
58999
+ (t) => t.id === assetId ? { ...t, name: meta.name ?? t.name, type: meta.type ?? t.type } : t
59000
+ ) : s.tabs;
59001
+ return { isOpen: true, tabs, activeTabId: assetId };
59002
+ }
59003
+ const newTab = {
59004
+ id: assetId,
59005
+ name: (meta == null ? void 0 : meta.name) ?? null,
59006
+ type: (meta == null ? void 0 : meta.type) ?? "unknown"
59007
+ };
59008
+ return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
59009
+ }),
59010
+ closeTab: (assetId) => set2((s) => {
59011
+ var _a2;
59012
+ const tabs = s.tabs.filter((t) => t.id !== assetId);
59013
+ if (tabs.length === 0) {
59014
+ return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };
59015
+ }
59016
+ 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;
59017
+ return { tabs, activeTabId };
59018
+ }),
59019
+ setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
59020
+ setViewMode: (mode) => set2({ viewMode: mode }),
59021
+ closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
59022
+ toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
59023
+ resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
59024
+ markAutoOpened: (assetId) => {
59025
+ const state = get2();
59026
+ if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
59027
+ return false;
59028
+ }
59029
+ state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
59030
+ return true;
59031
+ }
59032
+ }),
59033
+ {
59034
+ name: "athena-react-asset-panel",
59035
+ partialize: ({
59036
+ isOpen,
59037
+ tabs,
59038
+ activeTabId,
59039
+ viewMode,
59040
+ isFullscreen
59041
+ }) => ({
59042
+ isOpen,
59043
+ tabs,
59044
+ activeTabId,
59045
+ viewMode,
59046
+ isFullscreen
59047
+ }),
59048
+ storage: createJSONStorage(() => sessionStorage)
59049
+ }
59050
+ )
59051
+ );
59193
59052
  const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
59194
59053
  const ATHENA_PREVIEW_HOSTNAME_SUFFIX = ".previews.athenaintel.com";
59195
59054
  const ATHENA_WORKSPACE_HOSTNAME_SUFFIXES = [".app.athenaintel.com", ".staging-app.athenaintel.com"];
@@ -65038,9 +64897,9 @@ const DEFAULT_SUGGESTIONS = [
65038
64897
  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."
65039
64898
  },
65040
64899
  {
65041
- icon: Search,
65042
- title: "Compare recent AI model launches",
65043
- 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."
64900
+ icon: ChartColumn,
64901
+ title: "Analyze data and visualize insights",
64902
+ prompt: "Generate a sample quarterly sales dataset across 4 product categories, then create an interactive chart showing revenue trends and category performance over time."
65044
64903
  },
65045
64904
  {
65046
64905
  icon: Presentation,