@athenaintel/react 0.8.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 +42 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +43 -13
- package/dist/index.js.map +1 -1
- package/dist/styles.css +10 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -226,20 +226,30 @@ export declare interface AthenaTheme {
|
|
|
226
226
|
ring?: string;
|
|
227
227
|
/** Base border radius for all rounded corners. e.g. '0.5rem', '0.75rem', '0' */
|
|
228
228
|
radius?: string;
|
|
229
|
+
/** Font family for all text. e.g. "'Inter', sans-serif", "system-ui" */
|
|
230
|
+
fontFamily?: string;
|
|
229
231
|
/** Sidebar background color. Falls back to muted with transparency. */
|
|
230
232
|
sidebarBackground?: string;
|
|
231
233
|
/** Sidebar border color. Falls back to border. */
|
|
232
234
|
sidebarBorder?: string;
|
|
235
|
+
/** Sidebar width. e.g. '280px', '20rem'. */
|
|
236
|
+
sidebarWidth?: string;
|
|
233
237
|
/** User message bubble background. Falls back to muted. */
|
|
234
238
|
userBubble?: string;
|
|
235
239
|
/** User message bubble text color. Falls back to foreground. */
|
|
236
240
|
userBubbleForeground?: string;
|
|
241
|
+
/** User message bubble border radius. e.g. '1rem', '0.5rem'. */
|
|
242
|
+
userBubbleRadius?: string;
|
|
237
243
|
/** Assistant message text color. Falls back to foreground. */
|
|
238
244
|
assistantForeground?: string;
|
|
245
|
+
/** Assistant message bubble background. Transparent by default. */
|
|
246
|
+
assistantBubble?: string;
|
|
239
247
|
/** Composer border color. Falls back to input. */
|
|
240
248
|
composerBorder?: string;
|
|
241
249
|
/** Composer border radius. Falls back to radius-based default. */
|
|
242
250
|
composerRadius?: string;
|
|
251
|
+
/** Max width of the chat thread area. e.g. '44rem', '56rem'. */
|
|
252
|
+
threadMaxWidth?: string;
|
|
243
253
|
}
|
|
244
254
|
|
|
245
255
|
export declare const BrowseToolUI: ToolCallMessagePartComponent;
|
|
@@ -897,6 +907,9 @@ export declare function useParentBridge(): ParentBridgeState;
|
|
|
897
907
|
|
|
898
908
|
export declare function useQuote(): QuoteContextValue;
|
|
899
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
|
+
|
|
900
913
|
export declare type ViewMode = 'tabs' | 'tiled';
|
|
901
914
|
|
|
902
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",
|
|
@@ -24357,14 +24365,19 @@ const THEME_TO_CSS = {
|
|
|
24357
24365
|
input: "--input",
|
|
24358
24366
|
ring: "--ring",
|
|
24359
24367
|
radius: "--radius",
|
|
24368
|
+
fontFamily: "--font-family",
|
|
24360
24369
|
// Extended SDK-specific variables
|
|
24361
24370
|
sidebarBackground: "--sidebar-background",
|
|
24362
24371
|
sidebarBorder: "--sidebar-border",
|
|
24372
|
+
sidebarWidth: "--sidebar-width",
|
|
24363
24373
|
userBubble: "--user-bubble",
|
|
24364
24374
|
userBubbleForeground: "--user-bubble-foreground",
|
|
24375
|
+
userBubbleRadius: "--user-bubble-radius",
|
|
24365
24376
|
assistantForeground: "--assistant-foreground",
|
|
24377
|
+
assistantBubble: "--assistant-bubble",
|
|
24366
24378
|
composerBorder: "--composer-border",
|
|
24367
|
-
composerRadius: "--composer-radius"
|
|
24379
|
+
composerRadius: "--composer-radius",
|
|
24380
|
+
threadMaxWidth: "--thread-max-width"
|
|
24368
24381
|
};
|
|
24369
24382
|
function themeToStyleVars(theme) {
|
|
24370
24383
|
const vars = {};
|
|
@@ -24579,10 +24592,13 @@ function AthenaWithThreadList({
|
|
|
24579
24592
|
knowledgeBase,
|
|
24580
24593
|
systemPrompt
|
|
24581
24594
|
}) {
|
|
24595
|
+
const [refreshKey, setRefreshKey] = useState(0);
|
|
24596
|
+
const handleRefresh = useCallback(() => setRefreshKey((k) => k + 1), []);
|
|
24582
24597
|
const adapter = useAthenaThreadListAdapter({
|
|
24583
24598
|
backendUrl,
|
|
24584
24599
|
apiKey,
|
|
24585
|
-
token
|
|
24600
|
+
token,
|
|
24601
|
+
refreshKey
|
|
24586
24602
|
});
|
|
24587
24603
|
const runtimeConfigRef = useRef({
|
|
24588
24604
|
apiUrl,
|
|
@@ -24624,7 +24640,7 @@ function AthenaWithThreadList({
|
|
|
24624
24640
|
() => ({ backendUrl, apiKey, token }),
|
|
24625
24641
|
[backendUrl, apiKey, token]
|
|
24626
24642
|
);
|
|
24627
|
-
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 }) }) }) });
|
|
24628
24644
|
}
|
|
24629
24645
|
function AthenaProvider({
|
|
24630
24646
|
children,
|
|
@@ -64286,10 +64302,23 @@ const AthenaLayout = ({
|
|
|
64286
64302
|
] });
|
|
64287
64303
|
};
|
|
64288
64304
|
function ThreadList({ className }) {
|
|
64305
|
+
const refresh = useRefreshThreadList();
|
|
64289
64306
|
return /* @__PURE__ */ jsxs(ThreadListPrimitiveRoot, { className: cn("flex flex-col gap-1", className), children: [
|
|
64290
|
-
/* @__PURE__ */ jsxs(
|
|
64291
|
-
/* @__PURE__ */
|
|
64292
|
-
|
|
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
|
+
)
|
|
64293
64322
|
] }),
|
|
64294
64323
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsx(
|
|
64295
64324
|
ThreadListPrimitiveItems,
|
|
@@ -64477,6 +64506,7 @@ export {
|
|
|
64477
64506
|
useMentionSuggestions,
|
|
64478
64507
|
useParentAuth,
|
|
64479
64508
|
useParentBridge,
|
|
64480
|
-
useQuote
|
|
64509
|
+
useQuote,
|
|
64510
|
+
useRefreshThreadList
|
|
64481
64511
|
};
|
|
64482
64512
|
//# sourceMappingURL=index.js.map
|