@athenaintel/react 0.10.6 → 0.10.8

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
@@ -495,13 +495,13 @@ export declare interface AthenaTheme {
495
495
  * Must be used inside `<AthenaProvider enableThreadList>`.
496
496
  */
497
497
  export declare interface AthenaThreadManagerState {
498
- /** The ID of the currently active thread, or null if not yet available. */
498
+ /** The backend thread ID of the currently active thread, or null if not yet synced. */
499
499
  activeThreadId: string | null;
500
- /** All available (non-archived) thread IDs, sorted by most recent. */
501
- threadIds: readonly string[];
502
500
  /** Whether the thread list is still loading from the backend. */
503
- isLoading: boolean;
504
- /** Switch the chat to a different thread by ID. */
501
+ isListLoading: boolean;
502
+ /** Whether the current thread is loading its message history (e.g. after a thread switch). */
503
+ isThreadLoading: boolean;
504
+ /** Switch the chat to a different thread by its backend thread ID. */
505
505
  switchToThread: (threadId: string) => Promise<void>;
506
506
  /** Create and switch to a new empty thread. */
507
507
  switchToNewThread: () => Promise<void>;
package/dist/index.js CHANGED
@@ -66588,9 +66588,12 @@ function ThreadListItem() {
66588
66588
  }
66589
66589
  function useAthenaThreadManager() {
66590
66590
  const runtime = useAssistantRuntime({ optional: true });
66591
- const threadId = useThread({ optional: true, selector: (s) => s.threadId });
66592
- const threadIds = useThreadList({ optional: true, selector: (s) => s.threadIds });
66593
- const isLoading = useThreadList({ optional: true, selector: (s) => s.isLoading });
66591
+ const remoteId = useThread({ optional: true, selector: (s) => {
66592
+ var _a2;
66593
+ return (_a2 = s.metadata) == null ? void 0 : _a2.remoteId;
66594
+ } });
66595
+ const isThreadLoading = useThread({ optional: true, selector: (s) => s.isLoading }) ?? false;
66596
+ const isListLoading = useThreadList({ optional: true, selector: (s) => s.isLoading });
66594
66597
  const runtimeRef = useRef(runtime);
66595
66598
  runtimeRef.current = runtime;
66596
66599
  const switchToThread = useCallback(
@@ -66601,19 +66604,19 @@ function useAthenaThreadManager() {
66601
66604
  () => runtimeRef.current.threads.switchToNewThread(),
66602
66605
  []
66603
66606
  );
66604
- const activeThreadId = threadId ?? null;
66607
+ const activeThreadId = remoteId ?? null;
66605
66608
  return useMemo(() => {
66606
- if (!runtime || threadIds == null || isLoading == null) {
66609
+ if (!runtime || isListLoading == null) {
66607
66610
  return null;
66608
66611
  }
66609
66612
  return {
66610
66613
  activeThreadId,
66611
- threadIds,
66612
- isLoading,
66614
+ isListLoading,
66615
+ isThreadLoading,
66613
66616
  switchToThread,
66614
66617
  switchToNewThread
66615
66618
  };
66616
- }, [runtime, activeThreadId, threadIds, isLoading, switchToThread, switchToNewThread]);
66619
+ }, [runtime, activeThreadId, isListLoading, isThreadLoading, switchToThread, switchToNewThread]);
66617
66620
  }
66618
66621
  function useAppendToComposer() {
66619
66622
  const aui = useAui();