@athenaintel/react 0.10.33 → 0.10.35
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 +27 -0
- package/dist/assets/AssetPanel.d.ts +6 -0
- package/dist/assets/AthenaAssetEmbed.d.ts +17 -0
- package/dist/assets/AthenaLayout.d.ts +13 -0
- package/dist/assets/asset-embed-messages.d.ts +27 -0
- package/dist/assets/asset-panel-store.d.ts +65 -0
- package/dist/assets/asset-panel-url.d.ts +17 -0
- package/dist/assets/use-asset-embed.d.ts +45 -0
- package/dist/auth/AthenaAuthContext.d.ts +26 -0
- package/dist/auth/AthenaAuthProvider.d.ts +43 -0
- package/dist/auth/AthenaSSOProvider.d.ts +91 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/types.d.ts +66 -0
- package/dist/chat/AthenaChat.d.ts +64 -0
- package/dist/chat/ComposerEditorContext.d.ts +30 -0
- package/dist/chat/athena-citation-links.d.ts +18 -0
- package/dist/chat/super-grouping/CollapsibleGroup.d.ts +15 -0
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +35 -0
- package/dist/chat/super-grouping/grouping-function.d.ts +19 -0
- package/dist/chat/super-grouping/tool-status-labels.d.ts +1 -0
- package/dist/chat/super-grouping/toolkit-map.d.ts +9 -0
- package/dist/chat/tiptap-composer.d.ts +7 -0
- package/dist/chat/tiptap-text.d.ts +4 -0
- package/dist/chat/tooltip-icon-button.d.ts +7 -0
- package/dist/composer/AttachmentContext.d.ts +27 -0
- package/dist/composer/ComposerAttachmentPreview.d.ts +9 -0
- package/dist/composer/ComposerDropZone.d.ts +13 -0
- package/dist/composer/ComposerQuotePreview.d.ts +12 -0
- package/dist/composer/FileUploadButton.d.ts +15 -0
- package/dist/composer/QuoteContext.d.ts +33 -0
- package/dist/composer/build-composed-message.d.ts +15 -0
- package/dist/composer/clipboard.d.ts +6 -0
- package/dist/composer/index.d.ts +18 -0
- package/dist/composer/useAppendToComposer.d.ts +14 -0
- package/dist/composer/useComposerAttachment.d.ts +14 -0
- package/dist/composer/useFileUpload.d.ts +35 -0
- package/dist/composer/useSendMessage.d.ts +21 -0
- package/dist/index.cjs +1996 -1440
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +81 -1545
- package/dist/index.js +1997 -1441
- package/dist/index.js.map +1 -1
- package/dist/lib/athena-urls.d.ts +32 -0
- package/dist/lib/posthog/capture-gate.d.ts +72 -0
- package/dist/lib/posthog/wrap-posthog-client.d.ts +11 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/mentions/composer-keybinds.d.ts +5 -0
- package/dist/mentions/mention-extension.d.ts +6 -0
- package/dist/mentions/mention-icons.d.ts +4 -0
- package/dist/mentions/mention-node-view.d.ts +2 -0
- package/dist/mentions/mention-suggestion-list.d.ts +14 -0
- package/dist/mentions/mention-suggestion-popup.d.ts +15 -0
- package/dist/mentions/mention-suggestions-extension.d.ts +11 -0
- package/dist/mentions/mention-types.d.ts +21 -0
- package/dist/mentions/mention-utils.d.ts +23 -0
- package/dist/mentions/scope-registry.d.ts +21 -0
- package/dist/mentions/types.d.ts +39 -0
- package/dist/mentions/use-mention-suggestions.d.ts +28 -0
- package/dist/provider/AthenaContext.d.ts +11 -0
- package/dist/provider/AthenaProvider.d.ts +86 -0
- package/dist/provider/PostHogProvider.d.ts +14 -0
- package/dist/provider/citation-links.d.ts +61 -0
- package/dist/provider/config.d.ts +20 -0
- package/dist/provider/types.d.ts +4 -0
- package/dist/runtime/auth.d.ts +45 -0
- package/dist/runtime/converter.d.ts +5 -0
- package/dist/runtime/external-message-converter.d.ts +21 -0
- package/dist/runtime/schemas.d.ts +24 -0
- package/dist/runtime/useAthenaRuntime.d.ts +47 -0
- package/dist/theme/index.d.ts +215 -0
- package/dist/threads/ThreadList.d.ts +4 -0
- package/dist/threads/adapter.d.ts +42 -0
- package/dist/threads/api.d.ts +49 -0
- package/dist/threads/index.d.ts +5 -0
- package/dist/threads/title.d.ts +4 -0
- package/dist/threads/useActiveThreadStateHydration.d.ts +14 -0
- package/dist/threads/useAthenaThreadManager.d.ts +25 -0
- package/dist/threads/useThreadTitlePolling.d.ts +14 -0
- package/dist/toolkits/index.d.ts +89 -0
- package/dist/tools/NestedPtcMessages.d.ts +14 -0
- package/dist/tools/append-document-tool-ui.d.ts +2 -0
- package/dist/tools/asset-utils.d.ts +6 -0
- package/dist/tools/auto-open-tools.d.ts +8 -0
- package/dist/tools/read-asset-tool-ui.d.ts +2 -0
- package/dist/tools/tool-fallback.d.ts +34 -0
- package/dist/tools/tool-uis.d.ts +62 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/package.json +9 -10
- package/dist/auth.d.ts +0 -240
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AssistantRuntime } from '@assistant-ui/react';
|
|
2
|
+
export { DEFAULT_API_URL, DEFAULT_BACKEND_URL } from '../lib/athena-urls';
|
|
3
|
+
export interface AthenaRuntimeConfig {
|
|
4
|
+
/** URL for the chat streaming endpoint. Defaults to Athena production sync server. */
|
|
5
|
+
apiUrl?: string;
|
|
6
|
+
/** URL for the sync server resume endpoint. Derived from apiUrl if not provided. */
|
|
7
|
+
resumeApiUrl?: string;
|
|
8
|
+
/** URL for the Athena backend API. Defaults to Athena production API. */
|
|
9
|
+
backendUrl?: string;
|
|
10
|
+
/** API key for authentication. Used when no auth token is provided. */
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
/** PropelAuth token from parent window. Takes priority over apiKey. */
|
|
13
|
+
token?: string | null;
|
|
14
|
+
/** Resolve the latest token immediately before a request (for expiring clients). */
|
|
15
|
+
getToken?: () => string | null | Promise<string | null>;
|
|
16
|
+
/** Called when the transport reports an authentication failure. */
|
|
17
|
+
onUnauthorized?: () => void | Promise<void>;
|
|
18
|
+
/** LLM model identifier. */
|
|
19
|
+
model?: string;
|
|
20
|
+
/** Agent name to use. */
|
|
21
|
+
agent?: string;
|
|
22
|
+
/** Backend toolkit IDs to enable. */
|
|
23
|
+
tools?: string[];
|
|
24
|
+
/** Frontend tool IDs to include in enabled_tools. */
|
|
25
|
+
frontendToolIds?: string[];
|
|
26
|
+
/** Asset IDs to include in the workbench. */
|
|
27
|
+
workbench?: string[];
|
|
28
|
+
/** Knowledge base IDs for RAG context. */
|
|
29
|
+
knowledgeBase?: string[];
|
|
30
|
+
/** System prompt override. */
|
|
31
|
+
systemPrompt?: string;
|
|
32
|
+
/** Custom tool configurations (e.g. MCP servers). Passed as custom_tool_configs in runConfig. */
|
|
33
|
+
customToolConfigs?: Record<string, unknown>;
|
|
34
|
+
/** Client app identifier for session filtering. Sent as app_id in runConfig.custom. */
|
|
35
|
+
appId?: string;
|
|
36
|
+
/** Thread ID override. Auto-generated if not provided. */
|
|
37
|
+
threadId?: string;
|
|
38
|
+
/** Request channel. Defaults to "web". Use "chrome_extension" for the browser extension. */
|
|
39
|
+
channel?: string;
|
|
40
|
+
/** Device ID for device tunnel routing (chrome extension). */
|
|
41
|
+
deviceId?: string;
|
|
42
|
+
/** Additional fields merged into the request body. */
|
|
43
|
+
extraBody?: Record<string, unknown>;
|
|
44
|
+
/** Additional fields merged into runConfig.custom. */
|
|
45
|
+
extraRunConfig?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export declare const useAthenaRuntime: (config: AthenaRuntimeConfig) => AssistantRuntime;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Athena SDK Theming System
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* import { AthenaProvider, themes } from '@athenaintel/react';
|
|
6
|
+
*
|
|
7
|
+
* // Use a preset theme
|
|
8
|
+
* <AthenaProvider theme={themes.dark}>
|
|
9
|
+
*
|
|
10
|
+
* // Customize a preset
|
|
11
|
+
* <AthenaProvider theme={{ ...themes.dark, primary: '#8b5cf6' }}>
|
|
12
|
+
*
|
|
13
|
+
* // Full custom theme
|
|
14
|
+
* <AthenaProvider theme={{ primary: '#2563eb', background: '#fafafa', radius: '1rem' }}>
|
|
15
|
+
*/
|
|
16
|
+
export interface AthenaTheme {
|
|
17
|
+
/** Brand / accent color. Send button, active states, focus ring, spinner. */
|
|
18
|
+
primary?: string;
|
|
19
|
+
/** Text color on primary background. Set this with `primary` when you change contrast significantly. */
|
|
20
|
+
primaryForeground?: string;
|
|
21
|
+
/** Page / panel background. */
|
|
22
|
+
background?: string;
|
|
23
|
+
/** Primary text color. */
|
|
24
|
+
foreground?: string;
|
|
25
|
+
/** Subtle background. User message bubble, sidebar hover, thread highlight. */
|
|
26
|
+
muted?: string;
|
|
27
|
+
/** De-emphasized text. Timestamps, placeholders, sidebar items. */
|
|
28
|
+
mutedForeground?: string;
|
|
29
|
+
/** Hover / focus highlight background. */
|
|
30
|
+
accent?: string;
|
|
31
|
+
/** Text on accent background. */
|
|
32
|
+
accentForeground?: string;
|
|
33
|
+
/** Secondary surface color. */
|
|
34
|
+
secondary?: string;
|
|
35
|
+
/** Text on secondary surface. */
|
|
36
|
+
secondaryForeground?: string;
|
|
37
|
+
/** Card / modal surface color. */
|
|
38
|
+
card?: string;
|
|
39
|
+
/** Text on card surface. */
|
|
40
|
+
cardForeground?: string;
|
|
41
|
+
/** Popover / tooltip / dropdown surface. */
|
|
42
|
+
popover?: string;
|
|
43
|
+
/** Text on popover surface. */
|
|
44
|
+
popoverForeground?: string;
|
|
45
|
+
/** Error / danger color. Error banners, delete actions. */
|
|
46
|
+
destructive?: string;
|
|
47
|
+
/** Default border color. Dividers, card borders. */
|
|
48
|
+
border?: string;
|
|
49
|
+
/** Input field border color. Composer border. */
|
|
50
|
+
input?: string;
|
|
51
|
+
/** Focus ring color. Composer focus ring. */
|
|
52
|
+
ring?: string;
|
|
53
|
+
/** Base border radius for all rounded corners. e.g. '0.5rem', '0.75rem', '0' */
|
|
54
|
+
radius?: string;
|
|
55
|
+
/** Font family for all text. e.g. "'Inter', sans-serif", "system-ui" */
|
|
56
|
+
fontFamily?: string;
|
|
57
|
+
/** Sidebar background color. Falls back to muted with transparency. */
|
|
58
|
+
sidebarBackground?: string;
|
|
59
|
+
/** Sidebar border color. Falls back to border. */
|
|
60
|
+
sidebarBorder?: string;
|
|
61
|
+
/** Sidebar width. e.g. '280px', '20rem'. */
|
|
62
|
+
sidebarWidth?: string;
|
|
63
|
+
/** User message bubble background. Falls back to muted. */
|
|
64
|
+
userBubble?: string;
|
|
65
|
+
/** User message bubble text color. Falls back to foreground. Set this when `userBubble` is dark or saturated. */
|
|
66
|
+
userBubbleForeground?: string;
|
|
67
|
+
/** User message bubble border radius. e.g. '1rem', '0.5rem'. */
|
|
68
|
+
userBubbleRadius?: string;
|
|
69
|
+
/** Assistant message text color. Falls back to foreground. Set this when `assistantBubble` reduces contrast. */
|
|
70
|
+
assistantForeground?: string;
|
|
71
|
+
/** Assistant message bubble background. Transparent by default. */
|
|
72
|
+
assistantBubble?: string;
|
|
73
|
+
/** Composer border color. Falls back to input. */
|
|
74
|
+
composerBorder?: string;
|
|
75
|
+
/** Composer border radius. Falls back to radius-based default. */
|
|
76
|
+
composerRadius?: string;
|
|
77
|
+
/** Max width of the chat thread area. e.g. '44rem', '56rem'. */
|
|
78
|
+
threadMaxWidth?: string;
|
|
79
|
+
}
|
|
80
|
+
/** Convert an AthenaTheme object to a CSS variables style object. */
|
|
81
|
+
export declare function themeToStyleVars(theme: AthenaTheme): Record<string, string>;
|
|
82
|
+
export declare const themes: {
|
|
83
|
+
/** Default light theme. Neutral grays with blue accent. */
|
|
84
|
+
readonly light: {
|
|
85
|
+
background: string;
|
|
86
|
+
foreground: string;
|
|
87
|
+
primary: string;
|
|
88
|
+
primaryForeground: string;
|
|
89
|
+
secondary: string;
|
|
90
|
+
secondaryForeground: string;
|
|
91
|
+
muted: string;
|
|
92
|
+
mutedForeground: string;
|
|
93
|
+
accent: string;
|
|
94
|
+
accentForeground: string;
|
|
95
|
+
card: string;
|
|
96
|
+
cardForeground: string;
|
|
97
|
+
popover: string;
|
|
98
|
+
popoverForeground: string;
|
|
99
|
+
destructive: string;
|
|
100
|
+
border: string;
|
|
101
|
+
input: string;
|
|
102
|
+
ring: string;
|
|
103
|
+
radius: string;
|
|
104
|
+
};
|
|
105
|
+
/** Dark theme. Deep gray background with lighter text. */
|
|
106
|
+
readonly dark: {
|
|
107
|
+
background: string;
|
|
108
|
+
foreground: string;
|
|
109
|
+
primary: string;
|
|
110
|
+
primaryForeground: string;
|
|
111
|
+
secondary: string;
|
|
112
|
+
secondaryForeground: string;
|
|
113
|
+
muted: string;
|
|
114
|
+
mutedForeground: string;
|
|
115
|
+
accent: string;
|
|
116
|
+
accentForeground: string;
|
|
117
|
+
card: string;
|
|
118
|
+
cardForeground: string;
|
|
119
|
+
popover: string;
|
|
120
|
+
popoverForeground: string;
|
|
121
|
+
destructive: string;
|
|
122
|
+
border: string;
|
|
123
|
+
input: string;
|
|
124
|
+
ring: string;
|
|
125
|
+
radius: string;
|
|
126
|
+
};
|
|
127
|
+
/** Midnight theme. Deep navy with soft blue tones. */
|
|
128
|
+
readonly midnight: {
|
|
129
|
+
background: string;
|
|
130
|
+
foreground: string;
|
|
131
|
+
primary: string;
|
|
132
|
+
primaryForeground: string;
|
|
133
|
+
secondary: string;
|
|
134
|
+
secondaryForeground: string;
|
|
135
|
+
muted: string;
|
|
136
|
+
mutedForeground: string;
|
|
137
|
+
accent: string;
|
|
138
|
+
accentForeground: string;
|
|
139
|
+
card: string;
|
|
140
|
+
cardForeground: string;
|
|
141
|
+
popover: string;
|
|
142
|
+
popoverForeground: string;
|
|
143
|
+
destructive: string;
|
|
144
|
+
border: string;
|
|
145
|
+
input: string;
|
|
146
|
+
ring: string;
|
|
147
|
+
radius: string;
|
|
148
|
+
};
|
|
149
|
+
/** Warm earthy theme. Brown and sand tones. */
|
|
150
|
+
readonly warm: {
|
|
151
|
+
background: string;
|
|
152
|
+
foreground: string;
|
|
153
|
+
primary: string;
|
|
154
|
+
primaryForeground: string;
|
|
155
|
+
secondary: string;
|
|
156
|
+
secondaryForeground: string;
|
|
157
|
+
muted: string;
|
|
158
|
+
mutedForeground: string;
|
|
159
|
+
accent: string;
|
|
160
|
+
accentForeground: string;
|
|
161
|
+
card: string;
|
|
162
|
+
cardForeground: string;
|
|
163
|
+
popover: string;
|
|
164
|
+
popoverForeground: string;
|
|
165
|
+
destructive: string;
|
|
166
|
+
border: string;
|
|
167
|
+
input: string;
|
|
168
|
+
ring: string;
|
|
169
|
+
radius: string;
|
|
170
|
+
};
|
|
171
|
+
/** Purple creative theme. Vibrant purple accent. */
|
|
172
|
+
readonly purple: {
|
|
173
|
+
background: string;
|
|
174
|
+
foreground: string;
|
|
175
|
+
primary: string;
|
|
176
|
+
primaryForeground: string;
|
|
177
|
+
secondary: string;
|
|
178
|
+
secondaryForeground: string;
|
|
179
|
+
muted: string;
|
|
180
|
+
mutedForeground: string;
|
|
181
|
+
accent: string;
|
|
182
|
+
accentForeground: string;
|
|
183
|
+
card: string;
|
|
184
|
+
cardForeground: string;
|
|
185
|
+
popover: string;
|
|
186
|
+
popoverForeground: string;
|
|
187
|
+
destructive: string;
|
|
188
|
+
border: string;
|
|
189
|
+
input: string;
|
|
190
|
+
ring: string;
|
|
191
|
+
radius: string;
|
|
192
|
+
};
|
|
193
|
+
/** Green nature theme. Fresh green tones. */
|
|
194
|
+
readonly green: {
|
|
195
|
+
background: string;
|
|
196
|
+
foreground: string;
|
|
197
|
+
primary: string;
|
|
198
|
+
primaryForeground: string;
|
|
199
|
+
secondary: string;
|
|
200
|
+
secondaryForeground: string;
|
|
201
|
+
muted: string;
|
|
202
|
+
mutedForeground: string;
|
|
203
|
+
accent: string;
|
|
204
|
+
accentForeground: string;
|
|
205
|
+
card: string;
|
|
206
|
+
cardForeground: string;
|
|
207
|
+
popover: string;
|
|
208
|
+
popoverForeground: string;
|
|
209
|
+
destructive: string;
|
|
210
|
+
border: string;
|
|
211
|
+
input: string;
|
|
212
|
+
ring: string;
|
|
213
|
+
radius: string;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RemoteThreadListAdapter implementation for Athena/Agora backend.
|
|
3
|
+
* Maps our Agora API to the assistant-ui RemoteThreadListAdapter interface.
|
|
4
|
+
*
|
|
5
|
+
* Message loading for existing threads happens via the sync server's resume API
|
|
6
|
+
* (triggered by useAthenaRuntime), NOT via a ThreadHistoryAdapter.
|
|
7
|
+
*/
|
|
8
|
+
import type { RemoteThreadListAdapter } from '@assistant-ui/react';
|
|
9
|
+
interface AthenaThreadListAdapterConfig {
|
|
10
|
+
backendUrl: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
token?: string | null;
|
|
13
|
+
appId?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Context for passing the current thread's remoteId from the unstable_Provider
|
|
17
|
+
* down to the runtimeHook, without requiring useAui() in the hook.
|
|
18
|
+
*/
|
|
19
|
+
export declare const AthenaThreadIdContext: import("react").Context<string | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Read the current assistant-ui thread item's remote ID.
|
|
22
|
+
*
|
|
23
|
+
* This must be used inside assistant-ui's ThreadListItemRuntimeProvider.
|
|
24
|
+
* It is available before `unstable_Provider` renders its children, so the
|
|
25
|
+
* per-thread runtime hook can use it to hydrate existing threads.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useAthenaAuiThreadRemoteId(): string | undefined;
|
|
28
|
+
/** Read the current thread's remote ID (set by the adapter's unstable_Provider). */
|
|
29
|
+
export declare function useAthenaThreadId(): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Hook that returns a RemoteThreadListAdapter for the Athena platform.
|
|
32
|
+
* Integrates with our Agora REST API for thread CRUD.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useAthenaThreadListAdapter(config: AthenaThreadListAdapterConfig): RemoteThreadListAdapter;
|
|
35
|
+
/**
|
|
36
|
+
* Context for exposing a thread list refresh callback.
|
|
37
|
+
* Provided by AthenaWithThreadList, consumed by ThreadList.
|
|
38
|
+
*/
|
|
39
|
+
export declare const ThreadListRefreshContext: import("react").Context<(() => void) | null>;
|
|
40
|
+
/** Trigger a re-fetch of the thread list. No-op outside of thread list mode. */
|
|
41
|
+
export declare function useRefreshThreadList(): (() => void) | null;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Athena thread API client.
|
|
3
|
+
* Calls existing REST endpoints for thread CRUD.
|
|
4
|
+
*/
|
|
5
|
+
export interface ThreadSummary {
|
|
6
|
+
thread_id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
created_at: string;
|
|
9
|
+
updated_at: string;
|
|
10
|
+
last_message: string | null;
|
|
11
|
+
message_count: number;
|
|
12
|
+
state: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface ThreadListResponse {
|
|
15
|
+
threads: ThreadSummary[];
|
|
16
|
+
}
|
|
17
|
+
export interface ThreadCreateResponse {
|
|
18
|
+
thread_id: string;
|
|
19
|
+
}
|
|
20
|
+
interface AuthConfig {
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
token?: string | null;
|
|
23
|
+
}
|
|
24
|
+
export declare function listThreads(backendUrl: string, auth: AuthConfig, opts?: {
|
|
25
|
+
limit?: number;
|
|
26
|
+
offset?: number;
|
|
27
|
+
exclude_triggered?: boolean;
|
|
28
|
+
app_id?: string;
|
|
29
|
+
}): Promise<ThreadListResponse>;
|
|
30
|
+
export declare function createThread(backendUrl: string, auth: AuthConfig, opts?: {
|
|
31
|
+
systemPrompt?: string;
|
|
32
|
+
enabledTools?: string[];
|
|
33
|
+
appId?: string;
|
|
34
|
+
}): Promise<ThreadCreateResponse>;
|
|
35
|
+
export interface ThreadStateResponse {
|
|
36
|
+
thread_id: string;
|
|
37
|
+
messages: unknown[];
|
|
38
|
+
status?: string;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Fetch persisted thread state from the conversations API.
|
|
43
|
+
*
|
|
44
|
+
* This endpoint is the same source used by Athena's conversation sidebar and
|
|
45
|
+
* supports API-key auth plus BYO SSO session tokens sent as Bearer tokens.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getThreadState(backendUrl: string, auth: AuthConfig, threadId: string): Promise<ThreadStateResponse>;
|
|
48
|
+
export declare function archiveThread(backendUrl: string, auth: AuthConfig, threadId: string): Promise<void>;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ThreadList } from './ThreadList';
|
|
2
|
+
export type { ThreadListProps } from './ThreadList';
|
|
3
|
+
export type { ThreadSummary } from './api';
|
|
4
|
+
export { useAthenaThreadManager } from './useAthenaThreadManager';
|
|
5
|
+
export type { AthenaThreadManagerState } from './useAthenaThreadManager';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ThreadMessage } from "@assistant-ui/react";
|
|
2
|
+
export declare function isSerializedContentPartsTitle(title: string): boolean;
|
|
3
|
+
export declare function normalizeThreadTitle(title: string | null | undefined): string | undefined;
|
|
4
|
+
export declare function getFallbackTitleFromMessages(messages: readonly ThreadMessage[]): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ActiveThreadStateHydrationConfig {
|
|
2
|
+
backendUrl: string;
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
token?: string | null;
|
|
5
|
+
}
|
|
6
|
+
type HydratableThreadState = {
|
|
7
|
+
metadata?: {
|
|
8
|
+
remoteId?: string;
|
|
9
|
+
};
|
|
10
|
+
threadId: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const selectHydratableThreadId: (state: HydratableThreadState) => string | null;
|
|
13
|
+
export declare function useActiveThreadStateHydration({ backendUrl, apiKey, token, }: ActiveThreadStateHydrationConfig): void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public hook for managing thread state and navigation.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the underlying runtime to provide a clean, Athena-branded API
|
|
5
|
+
* for reading the active thread, listing threads, and switching between them.
|
|
6
|
+
*
|
|
7
|
+
* Must be used inside `<AthenaProvider enableThreadList>`.
|
|
8
|
+
*/
|
|
9
|
+
import { type ThreadListState } from '@assistant-ui/react';
|
|
10
|
+
export interface AthenaThreadManagerState {
|
|
11
|
+
/** The backend thread ID of the currently active thread, or null if not yet synced. */
|
|
12
|
+
activeThreadId: string | null;
|
|
13
|
+
/** Whether the thread list is still loading from the backend. */
|
|
14
|
+
isListLoading: boolean;
|
|
15
|
+
/** Whether the current thread is loading its message history (e.g. after a thread switch). */
|
|
16
|
+
isThreadLoading: boolean;
|
|
17
|
+
/** Switch the chat to a different thread by its backend thread ID. */
|
|
18
|
+
switchToThread: (threadId: string) => Promise<void>;
|
|
19
|
+
/** Create and switch to a new empty thread. */
|
|
20
|
+
switchToNewThread: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
type ActiveThreadState = Pick<ThreadListState, 'mainThreadId' | 'threadItems'>;
|
|
23
|
+
export declare const selectActiveThreadRemoteId: (state: ActiveThreadState) => string | null;
|
|
24
|
+
export declare function useAthenaThreadManager(): AthenaThreadManagerState | null;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal hook that polls the thread list to pick up a freshly-generated
|
|
3
|
+
* title after the user sends the first message in a new thread.
|
|
4
|
+
*
|
|
5
|
+
* The Agora backend generates thread titles asynchronously from the first
|
|
6
|
+
* user message, so the title usually isn't available at the moment the
|
|
7
|
+
* thread is created. Without this, new threads show as "New conversation"
|
|
8
|
+
* in the sidebar until the user manually refreshes.
|
|
9
|
+
*
|
|
10
|
+
* Triggers when the active thread has messages but no title yet, then
|
|
11
|
+
* polls every second (after a 5s initial delay) until a title appears
|
|
12
|
+
* or a max duration elapses.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useThreadTitlePolling(refresh: () => void): void;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend toolkit IDs.
|
|
3
|
+
*
|
|
4
|
+
* Pass these to the `tools` prop on `<AthenaProvider>` to enable backend toolkits.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { Toolkits } from '@athenaintel/react';
|
|
8
|
+
*
|
|
9
|
+
* <AthenaProvider tools={[Toolkits.DOCUMENT, Toolkits.SPREADSHEET, Toolkits.WEB_SEARCH]}>
|
|
10
|
+
*/
|
|
11
|
+
export declare const Toolkits: {
|
|
12
|
+
/** Web search and page browsing. */
|
|
13
|
+
readonly WEB_SEARCH: 'web_search_browse_toolkit';
|
|
14
|
+
/** SQL query execution. */
|
|
15
|
+
readonly SQL: 'sql_toolkit';
|
|
16
|
+
/** Azure Blob Storage catalog file operations. */
|
|
17
|
+
readonly AZURE_BLOB_STORAGE: 'azure_blob_storage_toolkit';
|
|
18
|
+
/** Document comments and collaboration. */
|
|
19
|
+
readonly COMMENTS: 'comments_toolkit';
|
|
20
|
+
/** Visual canvas creation. */
|
|
21
|
+
readonly CANVAS: 'canvas_toolkit';
|
|
22
|
+
/** PostgreSQL database management. */
|
|
23
|
+
readonly DATABASE: 'database_toolkit';
|
|
24
|
+
/** Asset collections management. */
|
|
25
|
+
readonly COLLECTIONS: 'collections_toolkit';
|
|
26
|
+
/** Charts, dashboards, and figures. */
|
|
27
|
+
readonly VISUALIZATIONS: 'visualizations_toolkit';
|
|
28
|
+
/** Custom UI creation. */
|
|
29
|
+
readonly USER_INTERFACE: 'user_interface_toolkit';
|
|
30
|
+
/** Agent Operating Procedures. */
|
|
31
|
+
readonly AOP: 'aop_toolkit';
|
|
32
|
+
/** Ephemeral compute environments. */
|
|
33
|
+
readonly COMPUTER_ASSET: 'computer_asset_toolkit';
|
|
34
|
+
/** Web browser automation. */
|
|
35
|
+
readonly BROWSER: 'browser_toolkit';
|
|
36
|
+
/** Virtual machine management. */
|
|
37
|
+
readonly VM: 'vm_toolkit';
|
|
38
|
+
/** Jupyter notebook execution. */
|
|
39
|
+
readonly NOTEBOOK: 'notebook_toolkit';
|
|
40
|
+
/** Presentation slide editing. */
|
|
41
|
+
readonly PRESENTATION: 'presentation_toolkit';
|
|
42
|
+
/** Presentation slide editing (OnlyOffice, deprecated). */
|
|
43
|
+
readonly PRESENTATION_ONLYOFFICE: 'presentation_onlyoffice_toolkit';
|
|
44
|
+
/** PowerPoint presentation creation from templates. */
|
|
45
|
+
readonly POWERPOINT: 'powerpoint_deck_toolkit';
|
|
46
|
+
/** PowerPoint presentation creation from templates (pptx-studio). */
|
|
47
|
+
readonly PRESENTATION_PPTX_STUDIO: 'presentation_pptx_studio_toolkit';
|
|
48
|
+
/** Workspace file management (Olympus Drive). */
|
|
49
|
+
readonly DRIVE: 'olympus_drive_toolkit';
|
|
50
|
+
/** Python code execution. */
|
|
51
|
+
readonly PYTHON: 'python_toolkit';
|
|
52
|
+
/** Multi-account email and calendar (Gmail + Outlook). */
|
|
53
|
+
readonly EMAIL: 'unified_email_toolkit';
|
|
54
|
+
/** Legacy email and calendar operations. */
|
|
55
|
+
readonly EMAIL_CALENDAR: 'email_calendar_toolkit';
|
|
56
|
+
/** Spreadsheet operations. */
|
|
57
|
+
readonly SPREADSHEET: 'spreadsheet_toolkit';
|
|
58
|
+
/** Athena document editing. */
|
|
59
|
+
readonly DOCUMENT: 'document_toolkit';
|
|
60
|
+
/** Word document backend operations. */
|
|
61
|
+
readonly WORD_DOCUMENT: 'word_document_be_toolkit';
|
|
62
|
+
/** Go-To-Market management. */
|
|
63
|
+
readonly GTM: 'gtm_toolkit';
|
|
64
|
+
/** Marketing campaign management. */
|
|
65
|
+
readonly MARKETING: 'marketing_toolkit';
|
|
66
|
+
/** FDE implementations and workflows. */
|
|
67
|
+
readonly FDE: 'fde_toolkit';
|
|
68
|
+
/** SharePoint / Google Drive / workspace file access. */
|
|
69
|
+
readonly EXTERNAL_DRIVE: 'external_drive_toolkit';
|
|
70
|
+
/** Reusable playbooks and prompts. */
|
|
71
|
+
readonly PLAYBOOK: 'playbook_toolkit';
|
|
72
|
+
/** Local Chrome browser control via tunnel. */
|
|
73
|
+
readonly DEVICE_TUNNEL: 'device_tunnel_toolkit';
|
|
74
|
+
/** Project management. */
|
|
75
|
+
readonly PROJECTS: 'projects_toolkit';
|
|
76
|
+
/** Task Studio script execution. */
|
|
77
|
+
readonly TASK_STUDIO: 'task_studio_toolkit';
|
|
78
|
+
/** User memory and preferences. */
|
|
79
|
+
readonly PREFERENCES: 'preferences_toolkit';
|
|
80
|
+
};
|
|
81
|
+
/** A toolkit ID string. */
|
|
82
|
+
export type ToolkitId = (typeof Toolkits)[keyof typeof Toolkits];
|
|
83
|
+
export interface ToolkitDisplayInfo {
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
icon?: string;
|
|
88
|
+
}
|
|
89
|
+
export declare const getToolkitDisplayInfo: (id: string) => ToolkitDisplayInfo;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MessagePrimitive } from "@assistant-ui/react";
|
|
2
|
+
import { type ComponentProps, type FC, type PropsWithChildren } from "react";
|
|
3
|
+
import type { ToolCallMessagePartComponent } from "@assistant-ui/react";
|
|
4
|
+
type PartsComponents = ComponentProps<typeof MessagePrimitive.Parts>["components"];
|
|
5
|
+
export declare const NestedPtcComponentsProvider: FC<PropsWithChildren<{
|
|
6
|
+
components: PartsComponents;
|
|
7
|
+
}>>;
|
|
8
|
+
export declare const useNestedPtcComponents: (fallback: ToolCallMessagePartComponent) => PartsComponents;
|
|
9
|
+
export interface NestedPtcMessagesProps {
|
|
10
|
+
components: PartsComponents;
|
|
11
|
+
messageClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const NestedPtcMessages: FC<NestedPtcMessagesProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Toolkit } from '@assistant-ui/react';
|
|
2
|
+
/**
|
|
3
|
+
* Default frontend tools that auto-open the asset a tool just created or
|
|
4
|
+
* touched. Registered automatically by `AthenaProvider` / `AthenaChat`; pass
|
|
5
|
+
* `disableAutoOpen` to turn off, or override individual entries via
|
|
6
|
+
* `frontendTools`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_AUTO_OPEN_TOOLS: Toolkit;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ToolCallMessagePartStatus, type ToolCallMessagePartComponent } from "@assistant-ui/react";
|
|
2
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible";
|
|
3
|
+
export declare function clearAutoOpenedAssets(): void;
|
|
4
|
+
export type ToolFallbackRootProps = Omit<React.ComponentProps<typeof Collapsible>, "open" | "onOpenChange"> & {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare function ToolFallbackRoot({ className, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, children, ...props }: ToolFallbackRootProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function ToolFallbackTrigger({ toolName, argsText, result, status, className, ...props }: React.ComponentProps<typeof CollapsibleTrigger> & {
|
|
11
|
+
toolName: string;
|
|
12
|
+
argsText?: string;
|
|
13
|
+
result?: unknown;
|
|
14
|
+
status?: ToolCallMessagePartStatus;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function ToolFallbackContent({ className, children, ...props }: React.ComponentProps<typeof CollapsibleContent>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function ToolFallbackArgs({ argsText, className, ...props }: React.ComponentProps<"div"> & {
|
|
18
|
+
argsText?: string;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
declare function ToolFallbackResult({ result, className, ...props }: React.ComponentProps<"div"> & {
|
|
21
|
+
result?: unknown;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
declare function ToolFallbackError({ status, className, ...props }: React.ComponentProps<"div"> & {
|
|
24
|
+
status?: ToolCallMessagePartStatus;
|
|
25
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
26
|
+
declare const ToolFallback: ToolCallMessagePartComponent & {
|
|
27
|
+
Root: typeof ToolFallbackRoot;
|
|
28
|
+
Trigger: typeof ToolFallbackTrigger;
|
|
29
|
+
Content: typeof ToolFallbackContent;
|
|
30
|
+
Args: typeof ToolFallbackArgs;
|
|
31
|
+
Result: typeof ToolFallbackResult;
|
|
32
|
+
Error: typeof ToolFallbackError;
|
|
33
|
+
};
|
|
34
|
+
export { ToolFallback, ToolFallbackRoot, ToolFallbackTrigger, ToolFallbackContent, ToolFallbackArgs, ToolFallbackResult, ToolFallbackError, };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ToolCallMessagePartComponent } from "@assistant-ui/react";
|
|
2
|
+
import { type AssetType } from "../assets/asset-panel-store";
|
|
3
|
+
export declare function normalizeResult(result: unknown): Record<string, unknown> | null;
|
|
4
|
+
export declare function truncate(text: string, max: number): string;
|
|
5
|
+
/** Format a tool name like `create_new_sheet` → "Create New Sheet" */
|
|
6
|
+
export declare function formatToolName(name: string): string;
|
|
7
|
+
export type ToolStatus = "running" | "complete" | "incomplete" | "requires-action";
|
|
8
|
+
export declare function ToolCard({ icon: Icon, status, title, subtitle, toolName, badge, error, children, args, result, }: {
|
|
9
|
+
icon: React.ElementType;
|
|
10
|
+
status: ToolStatus;
|
|
11
|
+
title: string;
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
toolName?: string;
|
|
14
|
+
badge?: string;
|
|
15
|
+
error?: string | null;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
args?: Record<string, unknown>;
|
|
18
|
+
result?: unknown;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function ExpandableSection({ label, children, defaultOpen, }: {
|
|
21
|
+
label?: string;
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const WebSearchToolUI: ToolCallMessagePartComponent;
|
|
26
|
+
export declare const BrowseToolUI: ToolCallMessagePartComponent;
|
|
27
|
+
export declare const EmailSearchToolUI: ToolCallMessagePartComponent;
|
|
28
|
+
export declare function resetAssetAutoOpen(): void;
|
|
29
|
+
export declare const CreateDocumentToolUI: ToolCallMessagePartComponent;
|
|
30
|
+
export declare const CreateSheetToolUI: ToolCallMessagePartComponent;
|
|
31
|
+
export declare const CreatePresentationToolUI: ToolCallMessagePartComponent;
|
|
32
|
+
export declare const StudioCreateWorkbookToolUI: ToolCallMessagePartComponent;
|
|
33
|
+
export declare const StudioAddSheetToolUI: ToolCallMessagePartComponent;
|
|
34
|
+
export declare const StudioOpenWorkbookToolUI: ToolCallMessagePartComponent;
|
|
35
|
+
export declare const StudioCreatePresentationToolUI: ToolCallMessagePartComponent;
|
|
36
|
+
export declare const StudioOpenPresentationToolUI: ToolCallMessagePartComponent;
|
|
37
|
+
export declare const StudioAddSlideToolUI: ToolCallMessagePartComponent;
|
|
38
|
+
export declare const StudioCreateDocumentToolUI: ToolCallMessagePartComponent;
|
|
39
|
+
export declare const StudioCreateParagraphToolUI: ToolCallMessagePartComponent;
|
|
40
|
+
export declare const StudioOpenDocumentToolUI: ToolCallMessagePartComponent;
|
|
41
|
+
export declare const CreateEmailDraftToolUI: ToolCallMessagePartComponent;
|
|
42
|
+
export declare const CreateNotebookToolUI: ToolCallMessagePartComponent;
|
|
43
|
+
export declare const RunPythonCodeToolUI: ToolCallMessagePartComponent;
|
|
44
|
+
export declare const ExecutePresentationCodeToolUI: ToolCallMessagePartComponent;
|
|
45
|
+
export declare const OpenAssetToolUI: ToolCallMessagePartComponent;
|
|
46
|
+
export declare const DescribeDatabaseToolUI: ToolCallMessagePartComponent;
|
|
47
|
+
export declare const ListDatabaseTablesToolUI: ToolCallMessagePartComponent;
|
|
48
|
+
export declare const GetDatabaseTableSchemaToolUI: ToolCallMessagePartComponent;
|
|
49
|
+
export declare const RunSqlToolUI: ToolCallMessagePartComponent;
|
|
50
|
+
export declare const UpdateSheetRangeToolUI: ToolCallMessagePartComponent;
|
|
51
|
+
export declare const BulkFormatSheetRangeToolUI: ToolCallMessagePartComponent;
|
|
52
|
+
export declare const SetRowColumnDimensionsToolUI: ToolCallMessagePartComponent;
|
|
53
|
+
export declare function createAssetToolUI(config: {
|
|
54
|
+
icon: React.ElementType;
|
|
55
|
+
assetType: AssetType;
|
|
56
|
+
runningLabel: string;
|
|
57
|
+
doneLabel: string;
|
|
58
|
+
}): ToolCallMessagePartComponent;
|
|
59
|
+
export declare const CaptureMomentToolUI: ToolCallMessagePartComponent;
|
|
60
|
+
export declare const CaptureSlideScreenshotToolUI: ToolCallMessagePartComponent;
|
|
61
|
+
export declare const OpenBrowserToolUI: ToolCallMessagePartComponent;
|
|
62
|
+
export declare const TOOL_UI_REGISTRY: Record<string, ToolCallMessagePartComponent>;
|