@athenaintel/react 0.10.5 → 0.10.7

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,11 @@ 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
501
  isLoading: boolean;
504
- /** Switch the chat to a different thread by ID. */
502
+ /** Switch the chat to a different thread by its backend thread ID. */
505
503
  switchToThread: (threadId: string) => Promise<void>;
506
504
  /** Create and switch to a new empty thread. */
507
505
  switchToNewThread: () => Promise<void>;
package/dist/index.js CHANGED
@@ -66588,28 +66588,33 @@ 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 threadList = useThreadList({ optional: true });
66591
+ const remoteId = useThread({ optional: true, selector: (s) => {
66592
+ var _a2;
66593
+ return (_a2 = s.metadata) == null ? void 0 : _a2.remoteId;
66594
+ } });
66595
+ const isLoading = useThreadList({ optional: true, selector: (s) => s.isLoading });
66596
+ const runtimeRef = useRef(runtime);
66597
+ runtimeRef.current = runtime;
66593
66598
  const switchToThread = useCallback(
66594
- (id) => runtime.threads.switchToThread(id),
66595
- [runtime]
66599
+ (id) => runtimeRef.current.threads.switchToThread(id),
66600
+ []
66596
66601
  );
66597
66602
  const switchToNewThread = useCallback(
66598
- () => runtime.threads.switchToNewThread(),
66599
- [runtime]
66603
+ () => runtimeRef.current.threads.switchToNewThread(),
66604
+ []
66600
66605
  );
66606
+ const activeThreadId = remoteId ?? null;
66601
66607
  return useMemo(() => {
66602
- if (!runtime || !threadList) {
66608
+ if (!runtime || isLoading == null) {
66603
66609
  return null;
66604
66610
  }
66605
66611
  return {
66606
- activeThreadId: threadId ?? null,
66607
- threadIds: threadList.threadIds,
66608
- isLoading: threadList.isLoading,
66612
+ activeThreadId,
66613
+ isLoading,
66609
66614
  switchToThread,
66610
66615
  switchToNewThread
66611
66616
  };
66612
- }, [runtime, threadId, threadList, switchToThread, switchToNewThread]);
66617
+ }, [runtime, activeThreadId, isLoading, switchToThread, switchToNewThread]);
66613
66618
  }
66614
66619
  function useAppendToComposer() {
66615
66620
  const aui = useAui();