@athenaintel/react 0.4.6 → 0.5.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/README.md +51 -0
- package/dist/index.cjs +279 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +308 -4
- package/dist/index.js +279 -104
- package/dist/index.js.map +1 -1
- package/dist/styles.css +35 -10
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @athenaintel/react
|
|
2
|
+
|
|
3
|
+
React SDK for building AI-powered chat applications with the Athena platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @athenaintel/react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { AthenaProvider, AthenaChat, Toolkits } from '@athenaintel/react';
|
|
15
|
+
import '@athenaintel/react/styles.css';
|
|
16
|
+
|
|
17
|
+
function App() {
|
|
18
|
+
return (
|
|
19
|
+
<AthenaProvider
|
|
20
|
+
apiKey="your-api-key"
|
|
21
|
+
tools={[Toolkits.DOCUMENT, Toolkits.WEB_SEARCH]}
|
|
22
|
+
>
|
|
23
|
+
<AthenaChat />
|
|
24
|
+
</AthenaProvider>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Theming
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { themes } from '@athenaintel/react';
|
|
33
|
+
|
|
34
|
+
<AthenaProvider theme={themes.dark}>
|
|
35
|
+
<AthenaProvider theme={{ ...themes.dark, primary: '#8b5cf6' }}>
|
|
36
|
+
<AthenaProvider theme={{ primary: '#e11d48', radius: '1rem' }}>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Preset themes: `light`, `dark`, `midnight`, `warm`, `purple`, `green`.
|
|
40
|
+
|
|
41
|
+
## Key Components
|
|
42
|
+
|
|
43
|
+
- **`<AthenaProvider>`** — Runtime, auth, theming, and configuration
|
|
44
|
+
- **`<AthenaChat>`** — Full chat UI with composer, messages, and tool rendering
|
|
45
|
+
- **`<AthenaLayout>`** — Split-pane layout with asset panel
|
|
46
|
+
- **`<ThreadList>`** — Conversation history sidebar
|
|
47
|
+
- **`Toolkits`** — Constants for all available backend toolkits
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
Proprietary. For licensed enterprise customers only.
|
package/dist/index.cjs
CHANGED
|
@@ -16435,45 +16435,16 @@ function useParentAuth() {
|
|
|
16435
16435
|
const [authToken, setAuthToken] = React.useState(null);
|
|
16436
16436
|
const readySignalSent = React.useRef(false);
|
|
16437
16437
|
React.useEffect(() => {
|
|
16438
|
-
const isInIframe = window.parent !== window;
|
|
16439
|
-
if (process.env.NODE_ENV !== "production") {
|
|
16440
|
-
console.log("[AthenaAuth] useParentAuth mounted", {
|
|
16441
|
-
isInIframe,
|
|
16442
|
-
currentOrigin: window.location.origin,
|
|
16443
|
-
currentUrl: window.location.href
|
|
16444
|
-
});
|
|
16445
|
-
}
|
|
16446
16438
|
const handler = (event) => {
|
|
16447
|
-
|
|
16448
|
-
if (process.env.NODE_ENV !== "production") {
|
|
16449
|
-
console.log("[AthenaAuth] Received PostMessage", {
|
|
16450
|
-
type: (_a2 = event.data) == null ? void 0 : _a2.type,
|
|
16451
|
-
origin: event.origin,
|
|
16452
|
-
isTrusted: isTrustedOrigin(event.origin)
|
|
16453
|
-
});
|
|
16454
|
-
}
|
|
16455
|
-
if (!isTrustedOrigin(event.origin)) {
|
|
16456
|
-
if (process.env.NODE_ENV !== "production") {
|
|
16457
|
-
console.warn("[AthenaAuth] Rejected PostMessage — untrusted origin:", event.origin);
|
|
16458
|
-
}
|
|
16459
|
-
return;
|
|
16460
|
-
}
|
|
16439
|
+
if (!isTrustedOrigin(event.origin)) return;
|
|
16461
16440
|
if (event.data && typeof event.data === "object" && event.data.type === "athena-auth" && typeof event.data.token === "string") {
|
|
16462
|
-
if (process.env.NODE_ENV !== "production") {
|
|
16463
|
-
console.log("[AthenaAuth] PropelAuth token received via PostMessage, length:", event.data.token.length);
|
|
16464
|
-
}
|
|
16465
16441
|
setAuthToken(event.data.token);
|
|
16466
16442
|
}
|
|
16467
16443
|
};
|
|
16468
16444
|
window.addEventListener("message", handler);
|
|
16469
|
-
if (!readySignalSent.current &&
|
|
16470
|
-
if (process.env.NODE_ENV !== "production") {
|
|
16471
|
-
console.log("[AthenaAuth] Sending athena-auth-ready signal to parent");
|
|
16472
|
-
}
|
|
16445
|
+
if (!readySignalSent.current && window.parent !== window) {
|
|
16473
16446
|
window.parent.postMessage({ type: "athena-auth-ready" }, "*");
|
|
16474
16447
|
readySignalSent.current = true;
|
|
16475
|
-
} else if (!isInIframe && process.env.NODE_ENV !== "production") {
|
|
16476
|
-
console.log("[AthenaAuth] Not in iframe — skipping parent auth (standalone mode)");
|
|
16477
16448
|
}
|
|
16478
16449
|
return () => window.removeEventListener("message", handler);
|
|
16479
16450
|
}, []);
|
|
@@ -20798,24 +20769,12 @@ const useAthenaRuntime = (config2) => {
|
|
|
20798
20769
|
initialState: { messages: initialMessages ?? [] },
|
|
20799
20770
|
converter,
|
|
20800
20771
|
api: apiUrl,
|
|
20801
|
-
headers: async () => {
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
|
|
20805
|
-
|
|
20806
|
-
|
|
20807
|
-
tokenPrefix: tokenRef.current ? tokenRef.current.substring(0, 20) + "..." : void 0,
|
|
20808
|
-
apiKeyPrefix: apiKeyRef.current ? apiKeyRef.current.substring(0, 10) + "..." : void 0,
|
|
20809
|
-
apiUrl
|
|
20810
|
-
});
|
|
20811
|
-
}
|
|
20812
|
-
return {
|
|
20813
|
-
// Prefer parent-injected PropelAuth token over hardcoded API key
|
|
20814
|
-
...authHeaders,
|
|
20815
|
-
"Accept-Encoding": "identity",
|
|
20816
|
-
Accept: "text/event-stream"
|
|
20817
|
-
};
|
|
20818
|
-
},
|
|
20772
|
+
headers: async () => ({
|
|
20773
|
+
// Prefer parent-injected PropelAuth token over hardcoded API key
|
|
20774
|
+
...tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : apiKeyRef.current ? { "X-API-KEY": apiKeyRef.current } : {},
|
|
20775
|
+
"Accept-Encoding": "identity",
|
|
20776
|
+
Accept: "text/event-stream"
|
|
20777
|
+
}),
|
|
20819
20778
|
onResponse: () => {
|
|
20820
20779
|
if (process.env.NODE_ENV !== "production") {
|
|
20821
20780
|
console.log("[AthenaSDK] Stream connected");
|
|
@@ -24148,6 +24107,10 @@ function useAthenaConfig() {
|
|
|
24148
24107
|
}
|
|
24149
24108
|
return ctx;
|
|
24150
24109
|
}
|
|
24110
|
+
const ThreadLoadingContext = React.createContext(false);
|
|
24111
|
+
function useThreadLoading() {
|
|
24112
|
+
return React.useContext(ThreadLoadingContext);
|
|
24113
|
+
}
|
|
24151
24114
|
const ThreadListContext = React.createContext(null);
|
|
24152
24115
|
function useThreadListStore() {
|
|
24153
24116
|
const store = React.useContext(ThreadListContext);
|
|
@@ -24158,10 +24121,6 @@ function useThreadListStore() {
|
|
|
24158
24121
|
}
|
|
24159
24122
|
return store;
|
|
24160
24123
|
}
|
|
24161
|
-
const ThreadLoadingContext = React.createContext(false);
|
|
24162
|
-
function useThreadLoading() {
|
|
24163
|
-
return React.useContext(ThreadLoadingContext);
|
|
24164
|
-
}
|
|
24165
24124
|
function getAuthHeaders(auth) {
|
|
24166
24125
|
if (auth.token) {
|
|
24167
24126
|
return { Authorization: `Bearer ${auth.token}` };
|
|
@@ -24275,6 +24234,178 @@ function createThreadListStore(config2) {
|
|
|
24275
24234
|
store.getState().fetchThreads();
|
|
24276
24235
|
return store;
|
|
24277
24236
|
}
|
|
24237
|
+
const THEME_TO_CSS = {
|
|
24238
|
+
primary: "--primary",
|
|
24239
|
+
primaryForeground: "--primary-foreground",
|
|
24240
|
+
background: "--background",
|
|
24241
|
+
foreground: "--foreground",
|
|
24242
|
+
muted: "--muted",
|
|
24243
|
+
mutedForeground: "--muted-foreground",
|
|
24244
|
+
accent: "--accent",
|
|
24245
|
+
accentForeground: "--accent-foreground",
|
|
24246
|
+
secondary: "--secondary",
|
|
24247
|
+
secondaryForeground: "--secondary-foreground",
|
|
24248
|
+
card: "--card",
|
|
24249
|
+
cardForeground: "--card-foreground",
|
|
24250
|
+
popover: "--popover",
|
|
24251
|
+
popoverForeground: "--popover-foreground",
|
|
24252
|
+
destructive: "--destructive",
|
|
24253
|
+
border: "--border",
|
|
24254
|
+
input: "--input",
|
|
24255
|
+
ring: "--ring",
|
|
24256
|
+
radius: "--radius",
|
|
24257
|
+
// Extended SDK-specific variables
|
|
24258
|
+
sidebarBackground: "--sidebar-background",
|
|
24259
|
+
sidebarBorder: "--sidebar-border",
|
|
24260
|
+
userBubble: "--user-bubble",
|
|
24261
|
+
userBubbleForeground: "--user-bubble-foreground",
|
|
24262
|
+
assistantForeground: "--assistant-foreground",
|
|
24263
|
+
composerBorder: "--composer-border",
|
|
24264
|
+
composerRadius: "--composer-radius"
|
|
24265
|
+
};
|
|
24266
|
+
function themeToStyleVars(theme) {
|
|
24267
|
+
const vars = {};
|
|
24268
|
+
for (const [key, value] of Object.entries(theme)) {
|
|
24269
|
+
if (value != null && THEME_TO_CSS[key]) {
|
|
24270
|
+
vars[THEME_TO_CSS[key]] = value;
|
|
24271
|
+
}
|
|
24272
|
+
}
|
|
24273
|
+
return vars;
|
|
24274
|
+
}
|
|
24275
|
+
const themes = {
|
|
24276
|
+
/** Default light theme. Neutral grays with blue accent. */
|
|
24277
|
+
light: {
|
|
24278
|
+
background: "oklch(0.99 0 0)",
|
|
24279
|
+
foreground: "oklch(0.13 0 0)",
|
|
24280
|
+
primary: "oklch(0.55 0.2 250)",
|
|
24281
|
+
primaryForeground: "oklch(1 0 0)",
|
|
24282
|
+
secondary: "oklch(0.96 0.005 250)",
|
|
24283
|
+
secondaryForeground: "oklch(0.13 0 0)",
|
|
24284
|
+
muted: "oklch(0.96 0.005 250)",
|
|
24285
|
+
mutedForeground: "oklch(0.5 0.02 250)",
|
|
24286
|
+
accent: "oklch(0.94 0.01 250)",
|
|
24287
|
+
accentForeground: "oklch(0.13 0 0)",
|
|
24288
|
+
card: "oklch(0.99 0 0)",
|
|
24289
|
+
cardForeground: "oklch(0.13 0 0)",
|
|
24290
|
+
popover: "oklch(0.99 0 0)",
|
|
24291
|
+
popoverForeground: "oklch(0.13 0 0)",
|
|
24292
|
+
destructive: "oklch(0.55 0.22 27)",
|
|
24293
|
+
border: "oklch(0.91 0.005 250)",
|
|
24294
|
+
input: "oklch(0.91 0.005 250)",
|
|
24295
|
+
ring: "oklch(0.55 0.2 250)",
|
|
24296
|
+
radius: "0.625rem"
|
|
24297
|
+
},
|
|
24298
|
+
/** Dark theme. Deep gray background with lighter text. */
|
|
24299
|
+
dark: {
|
|
24300
|
+
background: "oklch(0.15 0 0)",
|
|
24301
|
+
foreground: "oklch(0.95 0 0)",
|
|
24302
|
+
primary: "oklch(0.7 0.15 250)",
|
|
24303
|
+
primaryForeground: "oklch(0.13 0 0)",
|
|
24304
|
+
secondary: "oklch(0.22 0 0)",
|
|
24305
|
+
secondaryForeground: "oklch(0.95 0 0)",
|
|
24306
|
+
muted: "oklch(0.22 0 0)",
|
|
24307
|
+
mutedForeground: "oklch(0.65 0 0)",
|
|
24308
|
+
accent: "oklch(0.25 0 0)",
|
|
24309
|
+
accentForeground: "oklch(0.95 0 0)",
|
|
24310
|
+
card: "oklch(0.18 0 0)",
|
|
24311
|
+
cardForeground: "oklch(0.95 0 0)",
|
|
24312
|
+
popover: "oklch(0.18 0 0)",
|
|
24313
|
+
popoverForeground: "oklch(0.95 0 0)",
|
|
24314
|
+
destructive: "oklch(0.65 0.2 25)",
|
|
24315
|
+
border: "oklch(1 0 0 / 10%)",
|
|
24316
|
+
input: "oklch(1 0 0 / 15%)",
|
|
24317
|
+
ring: "oklch(0.7 0.15 250)",
|
|
24318
|
+
radius: "0.625rem"
|
|
24319
|
+
},
|
|
24320
|
+
/** Midnight theme. Deep navy with soft blue tones. */
|
|
24321
|
+
midnight: {
|
|
24322
|
+
background: "oklch(0.16 0.02 260)",
|
|
24323
|
+
foreground: "oklch(0.92 0.01 250)",
|
|
24324
|
+
primary: "oklch(0.68 0.16 250)",
|
|
24325
|
+
primaryForeground: "oklch(0.98 0 0)",
|
|
24326
|
+
secondary: "oklch(0.22 0.02 260)",
|
|
24327
|
+
secondaryForeground: "oklch(0.92 0.01 250)",
|
|
24328
|
+
muted: "oklch(0.22 0.02 260)",
|
|
24329
|
+
mutedForeground: "oklch(0.6 0.04 250)",
|
|
24330
|
+
accent: "oklch(0.26 0.03 260)",
|
|
24331
|
+
accentForeground: "oklch(0.92 0.01 250)",
|
|
24332
|
+
card: "oklch(0.19 0.02 260)",
|
|
24333
|
+
cardForeground: "oklch(0.92 0.01 250)",
|
|
24334
|
+
popover: "oklch(0.19 0.02 260)",
|
|
24335
|
+
popoverForeground: "oklch(0.92 0.01 250)",
|
|
24336
|
+
destructive: "oklch(0.65 0.2 25)",
|
|
24337
|
+
border: "oklch(0.3 0.03 260)",
|
|
24338
|
+
input: "oklch(0.3 0.03 260)",
|
|
24339
|
+
ring: "oklch(0.68 0.16 250)",
|
|
24340
|
+
radius: "0.625rem"
|
|
24341
|
+
},
|
|
24342
|
+
/** Warm earthy theme. Brown and sand tones. */
|
|
24343
|
+
warm: {
|
|
24344
|
+
background: "oklch(0.98 0.005 80)",
|
|
24345
|
+
foreground: "oklch(0.2 0.02 50)",
|
|
24346
|
+
primary: "oklch(0.55 0.12 50)",
|
|
24347
|
+
primaryForeground: "oklch(0.98 0 0)",
|
|
24348
|
+
secondary: "oklch(0.94 0.01 80)",
|
|
24349
|
+
secondaryForeground: "oklch(0.2 0.02 50)",
|
|
24350
|
+
muted: "oklch(0.95 0.01 80)",
|
|
24351
|
+
mutedForeground: "oklch(0.5 0.03 50)",
|
|
24352
|
+
accent: "oklch(0.92 0.015 80)",
|
|
24353
|
+
accentForeground: "oklch(0.2 0.02 50)",
|
|
24354
|
+
card: "oklch(0.98 0.005 80)",
|
|
24355
|
+
cardForeground: "oklch(0.2 0.02 50)",
|
|
24356
|
+
popover: "oklch(0.98 0.005 80)",
|
|
24357
|
+
popoverForeground: "oklch(0.2 0.02 50)",
|
|
24358
|
+
destructive: "oklch(0.55 0.2 25)",
|
|
24359
|
+
border: "oklch(0.9 0.01 80)",
|
|
24360
|
+
input: "oklch(0.9 0.01 80)",
|
|
24361
|
+
ring: "oklch(0.55 0.12 50)",
|
|
24362
|
+
radius: "0.75rem"
|
|
24363
|
+
},
|
|
24364
|
+
/** Purple creative theme. Vibrant purple accent. */
|
|
24365
|
+
purple: {
|
|
24366
|
+
background: "oklch(0.99 0.003 310)",
|
|
24367
|
+
foreground: "oklch(0.15 0.02 310)",
|
|
24368
|
+
primary: "oklch(0.55 0.22 310)",
|
|
24369
|
+
primaryForeground: "oklch(1 0 0)",
|
|
24370
|
+
secondary: "oklch(0.96 0.01 310)",
|
|
24371
|
+
secondaryForeground: "oklch(0.15 0.02 310)",
|
|
24372
|
+
muted: "oklch(0.96 0.01 310)",
|
|
24373
|
+
mutedForeground: "oklch(0.5 0.04 310)",
|
|
24374
|
+
accent: "oklch(0.94 0.015 310)",
|
|
24375
|
+
accentForeground: "oklch(0.15 0.02 310)",
|
|
24376
|
+
card: "oklch(0.99 0.003 310)",
|
|
24377
|
+
cardForeground: "oklch(0.15 0.02 310)",
|
|
24378
|
+
popover: "oklch(0.99 0.003 310)",
|
|
24379
|
+
popoverForeground: "oklch(0.15 0.02 310)",
|
|
24380
|
+
destructive: "oklch(0.55 0.22 27)",
|
|
24381
|
+
border: "oklch(0.92 0.005 310)",
|
|
24382
|
+
input: "oklch(0.92 0.005 310)",
|
|
24383
|
+
ring: "oklch(0.55 0.22 310)",
|
|
24384
|
+
radius: "0.75rem"
|
|
24385
|
+
},
|
|
24386
|
+
/** Green nature theme. Fresh green tones. */
|
|
24387
|
+
green: {
|
|
24388
|
+
background: "oklch(0.99 0.003 150)",
|
|
24389
|
+
foreground: "oklch(0.15 0.02 150)",
|
|
24390
|
+
primary: "oklch(0.55 0.18 155)",
|
|
24391
|
+
primaryForeground: "oklch(1 0 0)",
|
|
24392
|
+
secondary: "oklch(0.96 0.01 150)",
|
|
24393
|
+
secondaryForeground: "oklch(0.15 0.02 150)",
|
|
24394
|
+
muted: "oklch(0.96 0.01 150)",
|
|
24395
|
+
mutedForeground: "oklch(0.5 0.03 150)",
|
|
24396
|
+
accent: "oklch(0.94 0.015 150)",
|
|
24397
|
+
accentForeground: "oklch(0.15 0.02 150)",
|
|
24398
|
+
card: "oklch(0.99 0.003 150)",
|
|
24399
|
+
cardForeground: "oklch(0.15 0.02 150)",
|
|
24400
|
+
popover: "oklch(0.99 0.003 150)",
|
|
24401
|
+
popoverForeground: "oklch(0.15 0.02 150)",
|
|
24402
|
+
destructive: "oklch(0.55 0.22 27)",
|
|
24403
|
+
border: "oklch(0.92 0.008 150)",
|
|
24404
|
+
input: "oklch(0.92 0.008 150)",
|
|
24405
|
+
ring: "oklch(0.55 0.18 155)",
|
|
24406
|
+
radius: "0.625rem"
|
|
24407
|
+
}
|
|
24408
|
+
};
|
|
24278
24409
|
function AthenaRuntimeInner({
|
|
24279
24410
|
children,
|
|
24280
24411
|
apiUrl,
|
|
@@ -24293,7 +24424,9 @@ function AthenaRuntimeInner({
|
|
|
24293
24424
|
initialMessages
|
|
24294
24425
|
}) {
|
|
24295
24426
|
const auiTools = React.useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
|
|
24296
|
-
const aui = useAui({
|
|
24427
|
+
const aui = useAui({
|
|
24428
|
+
tools: auiTools
|
|
24429
|
+
});
|
|
24297
24430
|
const runtime = useAthenaRuntime({
|
|
24298
24431
|
apiUrl,
|
|
24299
24432
|
backendUrl,
|
|
@@ -24315,17 +24448,6 @@ function AthenaRuntimeInner({
|
|
|
24315
24448
|
);
|
|
24316
24449
|
return /* @__PURE__ */ jsxRuntime.jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children }) }) });
|
|
24317
24450
|
}
|
|
24318
|
-
function useActiveThreadFromStore(store) {
|
|
24319
|
-
return React.useSyncExternalStore(
|
|
24320
|
-
(cb) => {
|
|
24321
|
-
if (!store) return () => {
|
|
24322
|
-
};
|
|
24323
|
-
return store.subscribe(cb);
|
|
24324
|
-
},
|
|
24325
|
-
() => (store == null ? void 0 : store.getState().activeThreadId) ?? null,
|
|
24326
|
-
() => null
|
|
24327
|
-
);
|
|
24328
|
-
}
|
|
24329
24451
|
function AthenaProvider({
|
|
24330
24452
|
children,
|
|
24331
24453
|
apiKey,
|
|
@@ -24340,23 +24462,14 @@ function AthenaProvider({
|
|
|
24340
24462
|
knowledgeBase,
|
|
24341
24463
|
systemPrompt,
|
|
24342
24464
|
threadId: threadIdProp,
|
|
24343
|
-
enableThreadList = false
|
|
24465
|
+
enableThreadList = false,
|
|
24466
|
+
theme
|
|
24344
24467
|
}) {
|
|
24345
24468
|
const frontendToolNames = React.useMemo(() => Object.keys(frontendTools), [frontendTools]);
|
|
24469
|
+
const themeStyleVars = React.useMemo(() => theme ? themeToStyleVars(theme) : void 0, [theme]);
|
|
24346
24470
|
const parentAuthToken = useParentAuth();
|
|
24347
24471
|
const effectiveToken = tokenProp ?? parentAuthToken;
|
|
24348
24472
|
const effectiveBackendUrl = backendUrl ?? DEFAULT_BACKEND_URL;
|
|
24349
|
-
React.useEffect(() => {
|
|
24350
|
-
if (process.env.NODE_ENV !== "production") {
|
|
24351
|
-
console.log("[AthenaAuth] AthenaProvider auth state", {
|
|
24352
|
-
hasTokenProp: !!tokenProp,
|
|
24353
|
-
hasParentAuthToken: !!parentAuthToken,
|
|
24354
|
-
hasEffectiveToken: !!effectiveToken,
|
|
24355
|
-
hasApiKey: !!apiKey,
|
|
24356
|
-
authMethod: effectiveToken ? "Bearer token (PropelAuth)" : apiKey ? "X-API-KEY" : "NONE"
|
|
24357
|
-
});
|
|
24358
|
-
}
|
|
24359
|
-
}, [tokenProp, parentAuthToken, effectiveToken, apiKey]);
|
|
24360
24473
|
const threadListStoreRef = React.useRef(null);
|
|
24361
24474
|
if (enableThreadList && !threadListStoreRef.current) {
|
|
24362
24475
|
threadListStoreRef.current = createThreadListStore({
|
|
@@ -24365,9 +24478,7 @@ function AthenaProvider({
|
|
|
24365
24478
|
token: effectiveToken
|
|
24366
24479
|
});
|
|
24367
24480
|
}
|
|
24368
|
-
const activeThreadId =
|
|
24369
|
-
enableThreadList ? threadListStoreRef.current : null
|
|
24370
|
-
);
|
|
24481
|
+
const activeThreadId = threadListStoreRef.current ? useStore$1(threadListStoreRef.current, (s) => s.activeThreadId) : null;
|
|
24371
24482
|
const [displayedThreadId, setDisplayedThreadId] = React.useState(null);
|
|
24372
24483
|
const [loadedMessages, setLoadedMessages] = React.useState(void 0);
|
|
24373
24484
|
const [isLoadingThread, setIsLoadingThread] = React.useState(false);
|
|
@@ -24386,21 +24497,14 @@ function AthenaProvider({
|
|
|
24386
24497
|
let cancelled = false;
|
|
24387
24498
|
setIsLoadingThread(true);
|
|
24388
24499
|
getThreadState(effectiveBackendUrl, { apiKey, token: effectiveToken }, activeThreadId).then((state) => {
|
|
24389
|
-
var _a3;
|
|
24390
24500
|
if (cancelled) return;
|
|
24391
|
-
if (process.env.NODE_ENV !== "production") {
|
|
24392
|
-
console.log("[AthenaThreads] Loaded thread state", {
|
|
24393
|
-
threadId: activeThreadId,
|
|
24394
|
-
messageCount: ((_a3 = state.messages) == null ? void 0 : _a3.length) ?? 0
|
|
24395
|
-
});
|
|
24396
|
-
}
|
|
24397
24501
|
setLoadedMessages(state.messages ?? []);
|
|
24398
24502
|
setDisplayedThreadId(activeThreadId);
|
|
24399
24503
|
setIsLoadingThread(false);
|
|
24400
24504
|
}).catch((err) => {
|
|
24401
24505
|
if (cancelled) return;
|
|
24402
24506
|
if (process.env.NODE_ENV !== "production") {
|
|
24403
|
-
console.
|
|
24507
|
+
console.error("[AthenaSDK] Failed to load thread state:", err);
|
|
24404
24508
|
}
|
|
24405
24509
|
setLoadedMessages(void 0);
|
|
24406
24510
|
setDisplayedThreadId(activeThreadId);
|
|
@@ -24411,7 +24515,7 @@ function AthenaProvider({
|
|
|
24411
24515
|
};
|
|
24412
24516
|
}, [activeThreadId, displayedThreadId, enableThreadList, effectiveBackendUrl, apiKey, effectiveToken]);
|
|
24413
24517
|
const resolvedThreadId = threadIdProp ?? displayedThreadId ?? void 0;
|
|
24414
|
-
const
|
|
24518
|
+
const runtimeContent = /* @__PURE__ */ jsxRuntime.jsx(ThreadLoadingContext.Provider, { value: isLoadingThread, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24415
24519
|
AthenaRuntimeInner,
|
|
24416
24520
|
{
|
|
24417
24521
|
apiUrl,
|
|
@@ -24432,8 +24536,12 @@ function AthenaProvider({
|
|
|
24432
24536
|
},
|
|
24433
24537
|
resolvedThreadId ?? "__new__"
|
|
24434
24538
|
) });
|
|
24539
|
+
let inner = runtimeContent;
|
|
24435
24540
|
if (enableThreadList && threadListStoreRef.current) {
|
|
24436
|
-
|
|
24541
|
+
inner = /* @__PURE__ */ jsxRuntime.jsx(ThreadListContext.Provider, { value: threadListStoreRef.current, children: inner });
|
|
24542
|
+
}
|
|
24543
|
+
if (themeStyleVars) {
|
|
24544
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "athena-themed", style: themeStyleVars, children: inner });
|
|
24437
24545
|
}
|
|
24438
24546
|
return inner;
|
|
24439
24547
|
}
|
|
@@ -62473,6 +62581,14 @@ const AssistantActionBar = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
|
62473
62581
|
]
|
|
62474
62582
|
}
|
|
62475
62583
|
);
|
|
62584
|
+
const UserMessage = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
62585
|
+
MessagePrimitiveRoot,
|
|
62586
|
+
{
|
|
62587
|
+
className: "aui-user-message-root fade-in slide-in-from-bottom-1 mx-auto flex w-full max-w-(--thread-max-width) animate-in justify-end px-2 py-3 duration-150",
|
|
62588
|
+
"data-role": "user",
|
|
62589
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(MessagePrimitiveParts, { components: { Text: TiptapText } }) })
|
|
62590
|
+
}
|
|
62591
|
+
);
|
|
62476
62592
|
const ThreadLoadingOverlay = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62477
62593
|
"div",
|
|
62478
62594
|
{
|
|
@@ -62511,27 +62627,15 @@ const ThreadLoadingOverlay = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
|
62511
62627
|
style: {
|
|
62512
62628
|
fontSize: 13,
|
|
62513
62629
|
fontWeight: 500,
|
|
62514
|
-
color: "var(--muted-foreground, #888)"
|
|
62515
|
-
letterSpacing: "0.01em"
|
|
62630
|
+
color: "var(--muted-foreground, #888)"
|
|
62516
62631
|
},
|
|
62517
62632
|
children: "Loading conversation…"
|
|
62518
62633
|
}
|
|
62519
62634
|
),
|
|
62520
|
-
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
62521
|
-
@keyframes aui-spin { to { transform: rotate(360deg); } }
|
|
62522
|
-
@keyframes aui-overlay-in { from { opacity: 0; } to { opacity: 1; } }
|
|
62523
|
-
` })
|
|
62635
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `@keyframes aui-spin { to { transform: rotate(360deg); } } @keyframes aui-overlay-in { from { opacity: 0; } to { opacity: 1; } }` })
|
|
62524
62636
|
]
|
|
62525
62637
|
}
|
|
62526
62638
|
);
|
|
62527
|
-
const UserMessage = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
62528
|
-
MessagePrimitiveRoot,
|
|
62529
|
-
{
|
|
62530
|
-
className: "aui-user-message-root fade-in slide-in-from-bottom-1 mx-auto flex w-full max-w-(--thread-max-width) animate-in justify-end px-2 py-3 duration-150",
|
|
62531
|
-
"data-role": "user",
|
|
62532
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(MessagePrimitiveParts, { components: { Text: TiptapText } }) })
|
|
62533
|
-
}
|
|
62534
|
-
);
|
|
62535
62639
|
const embedCache = /* @__PURE__ */ new Map();
|
|
62536
62640
|
function useAssetEmbed(assetId, options = {
|
|
62537
62641
|
backendUrl: ""
|
|
@@ -62935,6 +63039,74 @@ function useComposerAttachment() {
|
|
|
62935
63039
|
}, [aui]);
|
|
62936
63040
|
return { addFile, addContent, clear };
|
|
62937
63041
|
}
|
|
63042
|
+
const Toolkits = {
|
|
63043
|
+
/** Web search and page browsing. */
|
|
63044
|
+
WEB_SEARCH: "web_search_browse_toolkit",
|
|
63045
|
+
/** SQL query execution. */
|
|
63046
|
+
SQL: "sql_toolkit",
|
|
63047
|
+
/** Athena Code development environment. */
|
|
63048
|
+
ATHENA_CODE: "athena_code_toolkit",
|
|
63049
|
+
/** Document comments and collaboration. */
|
|
63050
|
+
COMMENTS: "comments_toolkit",
|
|
63051
|
+
/** Visual canvas creation. */
|
|
63052
|
+
CANVAS: "canvas_toolkit",
|
|
63053
|
+
/** PostgreSQL database management. */
|
|
63054
|
+
DATABASE: "database_toolkit",
|
|
63055
|
+
/** Asset collections management. */
|
|
63056
|
+
COLLECTIONS: "collections_toolkit",
|
|
63057
|
+
/** Charts, dashboards, and figures. */
|
|
63058
|
+
VISUALIZATIONS: "visualizations_toolkit",
|
|
63059
|
+
/** Custom UI creation. */
|
|
63060
|
+
USER_INTERFACE: "user_interface_toolkit",
|
|
63061
|
+
/** Agent Operating Procedures. */
|
|
63062
|
+
AOP: "aop_toolkit",
|
|
63063
|
+
/** Ephemeral compute environments. */
|
|
63064
|
+
COMPUTER_ASSET: "computer_asset_toolkit",
|
|
63065
|
+
/** Web browser automation. */
|
|
63066
|
+
BROWSER: "browser_toolkit",
|
|
63067
|
+
/** Virtual machine management. */
|
|
63068
|
+
VM: "vm_toolkit",
|
|
63069
|
+
/** Jupyter notebook execution. */
|
|
63070
|
+
NOTEBOOK: "notebook_toolkit",
|
|
63071
|
+
/** Presentation slide editing. */
|
|
63072
|
+
PRESENTATION: "presentation_toolkit",
|
|
63073
|
+
/** PowerPoint presentation creation from templates. */
|
|
63074
|
+
POWERPOINT: "powerpoint_deck_toolkit",
|
|
63075
|
+
/** Workspace file management (Spaces). */
|
|
63076
|
+
DRIVE: "olympus_drive_toolkit",
|
|
63077
|
+
/** Python code execution. */
|
|
63078
|
+
PYTHON: "python_toolkit",
|
|
63079
|
+
/** Multi-account email and calendar (Gmail + Outlook). */
|
|
63080
|
+
EMAIL: "unified_email_toolkit",
|
|
63081
|
+
/** Legacy email and calendar operations. */
|
|
63082
|
+
EMAIL_CALENDAR: "email_calendar_toolkit",
|
|
63083
|
+
/** Spreadsheet operations. */
|
|
63084
|
+
SPREADSHEET: "spreadsheet_toolkit",
|
|
63085
|
+
/** Athena document editing. */
|
|
63086
|
+
DOCUMENT: "document_toolkit",
|
|
63087
|
+
/** Word document backend operations. */
|
|
63088
|
+
WORD_DOCUMENT: "word_document_be_toolkit",
|
|
63089
|
+
/** Go-To-Market management. */
|
|
63090
|
+
GTM: "gtm_toolkit",
|
|
63091
|
+
/** Marketing campaign management. */
|
|
63092
|
+
MARKETING: "marketing_toolkit",
|
|
63093
|
+
/** FDE implementations and workflows. */
|
|
63094
|
+
FDE: "fde_toolkit",
|
|
63095
|
+
/** Code repository search via Greptile. */
|
|
63096
|
+
GREPTILE: "greptile_toolkit",
|
|
63097
|
+
/** SharePoint / Google Drive / workspace file access. */
|
|
63098
|
+
EXTERNAL_DRIVE: "external_drive_toolkit",
|
|
63099
|
+
/** Reusable playbooks and prompts. */
|
|
63100
|
+
PLAYBOOK: "playbook_toolkit",
|
|
63101
|
+
/** Local Chrome browser control via tunnel. */
|
|
63102
|
+
DEVICE_TUNNEL: "device_tunnel_toolkit",
|
|
63103
|
+
/** Project management. */
|
|
63104
|
+
PROJECTS: "projects_toolkit",
|
|
63105
|
+
/** Task Studio script execution. */
|
|
63106
|
+
TASK_STUDIO: "task_studio_toolkit",
|
|
63107
|
+
/** User memory and preferences. */
|
|
63108
|
+
PREFERENCES: "preferences_toolkit"
|
|
63109
|
+
};
|
|
62938
63110
|
exports.AppendDocumentToolUI = AppendDocumentToolUI;
|
|
62939
63111
|
exports.AssetPanel = AssetPanel;
|
|
62940
63112
|
exports.AthenaChat = AthenaChat;
|
|
@@ -62963,6 +63135,7 @@ exports.ToolFallbackError = ToolFallbackError;
|
|
|
62963
63135
|
exports.ToolFallbackResult = ToolFallbackResult;
|
|
62964
63136
|
exports.ToolFallbackRoot = ToolFallbackRoot;
|
|
62965
63137
|
exports.ToolFallbackTrigger = ToolFallbackTrigger;
|
|
63138
|
+
exports.Toolkits = Toolkits;
|
|
62966
63139
|
exports.Tooltip = Tooltip;
|
|
62967
63140
|
exports.TooltipContent = TooltipContent;
|
|
62968
63141
|
exports.TooltipIconButton = TooltipIconButton;
|
|
@@ -62975,6 +63148,8 @@ exports.cn = cn;
|
|
|
62975
63148
|
exports.createThreadListStore = createThreadListStore;
|
|
62976
63149
|
exports.getAssetInfo = getAssetInfo;
|
|
62977
63150
|
exports.resetAssetAutoOpen = resetAssetAutoOpen;
|
|
63151
|
+
exports.themeToStyleVars = themeToStyleVars;
|
|
63152
|
+
exports.themes = themes;
|
|
62978
63153
|
exports.tryParseJson = tryParseJson$1;
|
|
62979
63154
|
exports.useActiveThreadId = useActiveThreadId;
|
|
62980
63155
|
exports.useAppendToComposer = useAppendToComposer;
|