@athenaintel/react 0.9.0 → 0.9.1
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 +36 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +37 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -907,6 +907,9 @@ export declare function useParentBridge(): ParentBridgeState;
|
|
|
907
907
|
|
|
908
908
|
export declare function useQuote(): QuoteContextValue;
|
|
909
909
|
|
|
910
|
+
/** Trigger a re-fetch of the thread list. No-op outside of thread list mode. */
|
|
911
|
+
export declare function useRefreshThreadList(): (() => void) | null;
|
|
912
|
+
|
|
910
913
|
export declare type ViewMode = 'tabs' | 'tiled';
|
|
911
914
|
|
|
912
915
|
export declare const WebSearchToolUI: ToolCallMessagePartComponent;
|
package/dist/index.js
CHANGED
|
@@ -16487,8 +16487,10 @@ function useParentBridge() {
|
|
|
16487
16487
|
setState((prev) => ({
|
|
16488
16488
|
...prev,
|
|
16489
16489
|
apiUrl: typeof event.data.apiUrl === "string" ? event.data.apiUrl : prev.apiUrl,
|
|
16490
|
-
backendUrl: typeof event.data.backendUrl === "string" ? event.data.backendUrl : prev.backendUrl
|
|
16491
|
-
ready
|
|
16490
|
+
backendUrl: typeof event.data.backendUrl === "string" ? event.data.backendUrl : prev.backendUrl
|
|
16491
|
+
// Don't set ready here — wait for athena-auth (token) or the timeout.
|
|
16492
|
+
// Setting ready on config alone causes a race: the thread list fires
|
|
16493
|
+
// before the token arrives, falling back to X-API-KEY.
|
|
16492
16494
|
}));
|
|
16493
16495
|
}
|
|
16494
16496
|
if (event.data.type === "athena-auth" && typeof event.data.token === "string") {
|
|
@@ -16506,9 +16508,7 @@ function useParentBridge() {
|
|
|
16506
16508
|
readySignalSent.current = true;
|
|
16507
16509
|
}
|
|
16508
16510
|
const timer = setTimeout(() => {
|
|
16509
|
-
|
|
16510
|
-
setState((prev) => ({ ...prev, ready: true }));
|
|
16511
|
-
}
|
|
16511
|
+
setState((prev) => prev.ready ? prev : { ...prev, ready: true });
|
|
16512
16512
|
}, BRIDGE_TIMEOUT_MS);
|
|
16513
16513
|
return () => {
|
|
16514
16514
|
window.removeEventListener("message", handler);
|
|
@@ -24296,6 +24296,9 @@ function useAthenaThreadListAdapter(config2) {
|
|
|
24296
24296
|
);
|
|
24297
24297
|
return useMemo(() => ({
|
|
24298
24298
|
async list() {
|
|
24299
|
+
if (!auth.token && !auth.apiKey) {
|
|
24300
|
+
return { threads: [] };
|
|
24301
|
+
}
|
|
24299
24302
|
try {
|
|
24300
24303
|
const { threads } = await listThreads(configRef.current.backendUrl, auth);
|
|
24301
24304
|
return {
|
|
@@ -24335,7 +24338,12 @@ function useAthenaThreadListAdapter(config2) {
|
|
|
24335
24338
|
};
|
|
24336
24339
|
},
|
|
24337
24340
|
unstable_Provider
|
|
24338
|
-
|
|
24341
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24342
|
+
}), [auth, unstable_Provider, config2.refreshKey]);
|
|
24343
|
+
}
|
|
24344
|
+
const ThreadListRefreshContext = createContext(null);
|
|
24345
|
+
function useRefreshThreadList() {
|
|
24346
|
+
return useContext(ThreadListRefreshContext);
|
|
24339
24347
|
}
|
|
24340
24348
|
const THEME_TO_CSS = {
|
|
24341
24349
|
primary: "--primary",
|
|
@@ -24584,10 +24592,13 @@ function AthenaWithThreadList({
|
|
|
24584
24592
|
knowledgeBase,
|
|
24585
24593
|
systemPrompt
|
|
24586
24594
|
}) {
|
|
24595
|
+
const [refreshKey, setRefreshKey] = useState(0);
|
|
24596
|
+
const handleRefresh = useCallback(() => setRefreshKey((k) => k + 1), []);
|
|
24587
24597
|
const adapter = useAthenaThreadListAdapter({
|
|
24588
24598
|
backendUrl,
|
|
24589
24599
|
apiKey,
|
|
24590
|
-
token
|
|
24600
|
+
token,
|
|
24601
|
+
refreshKey
|
|
24591
24602
|
});
|
|
24592
24603
|
const runtimeConfigRef = useRef({
|
|
24593
24604
|
apiUrl,
|
|
@@ -24629,7 +24640,7 @@ function AthenaWithThreadList({
|
|
|
24629
24640
|
() => ({ backendUrl, apiKey, token }),
|
|
24630
24641
|
[backendUrl, apiKey, token]
|
|
24631
24642
|
);
|
|
24632
|
-
return /* @__PURE__ */ jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(TooltipProvider, { children }) }) });
|
|
24643
|
+
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 }) }) }) });
|
|
24633
24644
|
}
|
|
24634
24645
|
function AthenaProvider({
|
|
24635
24646
|
children,
|
|
@@ -64291,10 +64302,23 @@ const AthenaLayout = ({
|
|
|
64291
64302
|
] });
|
|
64292
64303
|
};
|
|
64293
64304
|
function ThreadList({ className }) {
|
|
64305
|
+
const refresh = useRefreshThreadList();
|
|
64294
64306
|
return /* @__PURE__ */ jsxs(ThreadListPrimitiveRoot, { className: cn("flex flex-col gap-1", className), children: [
|
|
64295
|
-
/* @__PURE__ */ jsxs(
|
|
64296
|
-
/* @__PURE__ */
|
|
64297
|
-
|
|
64307
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
64308
|
+
/* @__PURE__ */ jsxs(ThreadListPrimitiveNew, { className: "flex flex-1 items-center gap-2 rounded-lg border border-border/60 px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground", children: [
|
|
64309
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-4" }),
|
|
64310
|
+
"New Chat"
|
|
64311
|
+
] }),
|
|
64312
|
+
refresh && /* @__PURE__ */ jsx(
|
|
64313
|
+
"button",
|
|
64314
|
+
{
|
|
64315
|
+
type: "button",
|
|
64316
|
+
onClick: refresh,
|
|
64317
|
+
className: "flex items-center justify-center rounded-lg border border-border/60 p-2 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
64318
|
+
title: "Refresh threads",
|
|
64319
|
+
children: /* @__PURE__ */ jsx(RefreshCw, { className: "size-4" })
|
|
64320
|
+
}
|
|
64321
|
+
)
|
|
64298
64322
|
] }),
|
|
64299
64323
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsx(
|
|
64300
64324
|
ThreadListPrimitiveItems,
|
|
@@ -64482,6 +64506,7 @@ export {
|
|
|
64482
64506
|
useMentionSuggestions,
|
|
64483
64507
|
useParentAuth,
|
|
64484
64508
|
useParentBridge,
|
|
64485
|
-
useQuote
|
|
64509
|
+
useQuote,
|
|
64510
|
+
useRefreshThreadList
|
|
64486
64511
|
};
|
|
64487
64512
|
//# sourceMappingURL=index.js.map
|