@athenaintel/react 0.1.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/dist/index.cjs +61679 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +291 -0
- package/dist/index.js +61663 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +100 -0
- package/package.json +80 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { AssistantRuntime } from '@assistant-ui/react';
|
|
2
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
3
|
+
import { ClassValue } from 'clsx';
|
|
4
|
+
import { Collapsible as Collapsible_2 } from 'radix-ui';
|
|
5
|
+
import { ComponentPropsWithRef } from 'react';
|
|
6
|
+
import { FC } from 'react';
|
|
7
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
8
|
+
import { JSX } from 'react/jsx-runtime';
|
|
9
|
+
import * as React_2 from 'react';
|
|
10
|
+
import { ReactNode } from 'react';
|
|
11
|
+
import { RefAttributes } from 'react';
|
|
12
|
+
import { Store } from '@tanstack/react-store';
|
|
13
|
+
import { ToolCallMessagePartComponent } from '@assistant-ui/react';
|
|
14
|
+
import { ToolCallMessagePartStatus } from '@assistant-ui/react';
|
|
15
|
+
import { Toolkit } from '@assistant-ui/react';
|
|
16
|
+
import { Tooltip as Tooltip_2 } from 'radix-ui';
|
|
17
|
+
import { VariantProps } from 'class-variance-authority';
|
|
18
|
+
|
|
19
|
+
export declare const AppendDocumentToolUI: ToolCallMessagePartComponent;
|
|
20
|
+
|
|
21
|
+
declare type AssetIconType = "doc" | "pdf" | "sheet";
|
|
22
|
+
|
|
23
|
+
export declare const AthenaChat: FC<AthenaChatProps>;
|
|
24
|
+
|
|
25
|
+
export declare interface AthenaChatProps {
|
|
26
|
+
/** CSS class name for the root element. */
|
|
27
|
+
className?: string;
|
|
28
|
+
/** Welcome heading text. Defaults to "Hello there!" */
|
|
29
|
+
welcomeMessage?: string;
|
|
30
|
+
/** Welcome subheading text. */
|
|
31
|
+
welcomeSubtext?: string;
|
|
32
|
+
/** Maximum width for the thread content. Defaults to "44rem". */
|
|
33
|
+
maxWidth?: string;
|
|
34
|
+
/** Additional tool UIs to register by name. */
|
|
35
|
+
toolUIs?: Record<string, ToolCallMessagePartComponent>;
|
|
36
|
+
/** Mention tools available in the composer. */
|
|
37
|
+
mentionTools?: MentionTool[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export declare function AthenaProvider({ children, apiKey, token: tokenProp, agent, model, tools, frontendTools, apiUrl, backendUrl, workbench, knowledgeBase, systemPrompt, threadId, }: AthenaProviderProps): JSX.Element;
|
|
41
|
+
|
|
42
|
+
export declare interface AthenaProviderProps {
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
/** API key for authentication. Used when running standalone (not in Olympus iframe). */
|
|
45
|
+
apiKey?: string;
|
|
46
|
+
/** PropelAuth token. If provided, takes priority over apiKey. If omitted, the SDK
|
|
47
|
+
* will automatically listen for a token from the parent window via PostMessage. */
|
|
48
|
+
token?: string;
|
|
49
|
+
/** Agent name to use. Defaults to 'athena_assist_agent'. */
|
|
50
|
+
agent?: string;
|
|
51
|
+
/** LLM model identifier. Defaults to 'claude-sonnet-4-6-low'. */
|
|
52
|
+
model?: string;
|
|
53
|
+
/** Backend toolkit IDs to enable (e.g. 'document_toolkit', 'web_search_browse_toolkit'). */
|
|
54
|
+
tools?: string[];
|
|
55
|
+
/** Frontend tools that execute in the browser. The agent can invoke these. */
|
|
56
|
+
frontendTools?: Toolkit;
|
|
57
|
+
/** URL for the chat streaming endpoint. Defaults to Athena production. */
|
|
58
|
+
apiUrl?: string;
|
|
59
|
+
/** URL for the Agora backend API. Defaults to Athena production. */
|
|
60
|
+
backendUrl?: string;
|
|
61
|
+
/** Asset IDs to include in the workbench. */
|
|
62
|
+
workbench?: string[];
|
|
63
|
+
/** Knowledge base IDs for RAG context. */
|
|
64
|
+
knowledgeBase?: string[];
|
|
65
|
+
/** System prompt override. */
|
|
66
|
+
systemPrompt?: string;
|
|
67
|
+
/** Thread ID override. Auto-generated if not provided. */
|
|
68
|
+
threadId?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export declare interface AthenaRuntimeConfig {
|
|
72
|
+
/** URL for the chat streaming endpoint. Defaults to Athena production sync server. */
|
|
73
|
+
apiUrl?: string;
|
|
74
|
+
/** URL for the Agora backend API. Defaults to Athena production API. */
|
|
75
|
+
backendUrl?: string;
|
|
76
|
+
/** API key for authentication. Used when no auth token is provided. */
|
|
77
|
+
apiKey?: string;
|
|
78
|
+
/** PropelAuth token from parent window. Takes priority over apiKey. */
|
|
79
|
+
token?: string | null;
|
|
80
|
+
/** LLM model identifier. */
|
|
81
|
+
model?: string;
|
|
82
|
+
/** Agent name to use. */
|
|
83
|
+
agent?: string;
|
|
84
|
+
/** Backend toolkit IDs to enable. */
|
|
85
|
+
tools?: string[];
|
|
86
|
+
/** Frontend tool IDs to include in enabled_tools. */
|
|
87
|
+
frontendToolIds?: string[];
|
|
88
|
+
/** Asset IDs to include in the workbench. */
|
|
89
|
+
workbench?: string[];
|
|
90
|
+
/** Knowledge base IDs for RAG context. */
|
|
91
|
+
knowledgeBase?: string[];
|
|
92
|
+
/** System prompt override. */
|
|
93
|
+
systemPrompt?: string;
|
|
94
|
+
/** Thread ID override. Auto-generated if not provided. */
|
|
95
|
+
threadId?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export declare const BrowseToolUI: ToolCallMessagePartComponent;
|
|
99
|
+
|
|
100
|
+
export declare function Button({ className, variant, size, asChild, ...props }: React_2.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
101
|
+
asChild?: boolean;
|
|
102
|
+
}): JSX.Element;
|
|
103
|
+
|
|
104
|
+
export declare const buttonVariants: (props?: ({
|
|
105
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
106
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
107
|
+
} & ClassProp) | undefined) => string;
|
|
108
|
+
|
|
109
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
110
|
+
|
|
111
|
+
export declare function Collapsible({ ...props }: React.ComponentProps<typeof Collapsible_2.Root>): JSX.Element;
|
|
112
|
+
|
|
113
|
+
export declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof Collapsible_2.CollapsibleContent>): JSX.Element;
|
|
114
|
+
|
|
115
|
+
export declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof Collapsible_2.CollapsibleTrigger>): JSX.Element;
|
|
116
|
+
|
|
117
|
+
export declare const CreateDocumentToolUI: ToolCallMessagePartComponent;
|
|
118
|
+
|
|
119
|
+
export declare const CreateEmailDraftToolUI: ToolCallMessagePartComponent;
|
|
120
|
+
|
|
121
|
+
export declare const EmailSearchToolUI: ToolCallMessagePartComponent;
|
|
122
|
+
|
|
123
|
+
declare interface FetchState {
|
|
124
|
+
isFetching: boolean;
|
|
125
|
+
hasNextPage: boolean;
|
|
126
|
+
error: Error | null;
|
|
127
|
+
meta: unknown;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export declare function getAssetInfo(assetId: string): {
|
|
131
|
+
name: string;
|
|
132
|
+
icon: AssetIconType;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/** Item cache: deduplicates items by ID, tracks scope membership */
|
|
136
|
+
declare interface ItemCache {
|
|
137
|
+
items: Map<string, MenuItem>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare interface MentionSuggestionsState {
|
|
141
|
+
registry: ScopeRegistry;
|
|
142
|
+
cache: ItemCache;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare type MentionSuggestionsStore = Store<MentionSuggestionsState>;
|
|
146
|
+
|
|
147
|
+
export declare interface MentionTool {
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
description?: string;
|
|
151
|
+
icon?: string;
|
|
152
|
+
type: "tool" | "toolkit";
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare interface MenuItem {
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
type: "menu" | "tool" | "toolkit";
|
|
159
|
+
fallbackIcon: string;
|
|
160
|
+
description?: string;
|
|
161
|
+
visibleInScopes: Set<MenuScope>;
|
|
162
|
+
navigatesToScope?: MenuScope;
|
|
163
|
+
isNavigationOnly?: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Core types for mention suggestions data layer
|
|
168
|
+
* Simplified from Olympus — only Tool and Toolkit types
|
|
169
|
+
*/
|
|
170
|
+
declare type MenuScope = string;
|
|
171
|
+
|
|
172
|
+
export declare const ReadAssetToolUI: ToolCallMessagePartComponent;
|
|
173
|
+
|
|
174
|
+
declare interface ScopeRegistry {
|
|
175
|
+
entries: Map<MenuScope, ScopeRegistryEntry>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare interface ScopeRegistryEntry {
|
|
179
|
+
sourceFn: SourceFn;
|
|
180
|
+
fetchStates: Map<string, FetchState>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare interface SourceContext {
|
|
184
|
+
scope: MenuScope;
|
|
185
|
+
query: string;
|
|
186
|
+
fetchState: FetchState;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
declare type SourceFn = (context: SourceContext) => Promise<SourceResult>;
|
|
190
|
+
|
|
191
|
+
declare interface SourceResult {
|
|
192
|
+
items: MenuItem[];
|
|
193
|
+
pagination?: {
|
|
194
|
+
hasMore: boolean;
|
|
195
|
+
totalCount?: number;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export declare const TiptapComposer: FC<TiptapComposerProps>;
|
|
200
|
+
|
|
201
|
+
export declare interface TiptapComposerProps {
|
|
202
|
+
tools?: MentionTool[];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export declare const TiptapText: FC<{
|
|
206
|
+
text: string;
|
|
207
|
+
}>;
|
|
208
|
+
|
|
209
|
+
export declare const TOOL_UI_REGISTRY: Record<string, ToolCallMessagePartComponent>;
|
|
210
|
+
|
|
211
|
+
export { ToolCallMessagePartComponent }
|
|
212
|
+
|
|
213
|
+
export declare const ToolFallback: ToolCallMessagePartComponent & {
|
|
214
|
+
Root: typeof ToolFallbackRoot;
|
|
215
|
+
Trigger: typeof ToolFallbackTrigger;
|
|
216
|
+
Content: typeof ToolFallbackContent;
|
|
217
|
+
Args: typeof ToolFallbackArgs;
|
|
218
|
+
Result: typeof ToolFallbackResult;
|
|
219
|
+
Error: typeof ToolFallbackError;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export declare function ToolFallbackArgs({ argsText, className, ...props }: React.ComponentProps<"div"> & {
|
|
223
|
+
argsText?: string;
|
|
224
|
+
}): JSX.Element | null;
|
|
225
|
+
|
|
226
|
+
export declare function ToolFallbackContent({ className, children, ...props }: React.ComponentProps<typeof CollapsibleContent>): JSX.Element;
|
|
227
|
+
|
|
228
|
+
export declare function ToolFallbackError({ status, className, ...props }: React.ComponentProps<"div"> & {
|
|
229
|
+
status?: ToolCallMessagePartStatus;
|
|
230
|
+
}): JSX.Element | null;
|
|
231
|
+
|
|
232
|
+
export declare function ToolFallbackResult({ result, className, ...props }: React.ComponentProps<"div"> & {
|
|
233
|
+
result?: unknown;
|
|
234
|
+
}): JSX.Element | null;
|
|
235
|
+
|
|
236
|
+
export declare function ToolFallbackRoot({ className, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, children, ...props }: ToolFallbackRootProps): JSX.Element;
|
|
237
|
+
|
|
238
|
+
declare type ToolFallbackRootProps = Omit<React.ComponentProps<typeof Collapsible>, "open" | "onOpenChange"> & {
|
|
239
|
+
open?: boolean;
|
|
240
|
+
onOpenChange?: (open: boolean) => void;
|
|
241
|
+
defaultOpen?: boolean;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export declare function ToolFallbackTrigger({ toolName, argsText, result, status, className, ...props }: React.ComponentProps<typeof CollapsibleTrigger> & {
|
|
245
|
+
toolName: string;
|
|
246
|
+
argsText?: string;
|
|
247
|
+
result?: unknown;
|
|
248
|
+
status?: ToolCallMessagePartStatus;
|
|
249
|
+
}): JSX.Element;
|
|
250
|
+
|
|
251
|
+
export { Toolkit }
|
|
252
|
+
|
|
253
|
+
export declare function Tooltip({ ...props }: React_2.ComponentProps<typeof Tooltip_2.Root>): JSX.Element;
|
|
254
|
+
|
|
255
|
+
export declare function TooltipContent({ className, sideOffset, children, ...props }: React_2.ComponentProps<typeof Tooltip_2.Content>): JSX.Element;
|
|
256
|
+
|
|
257
|
+
export declare const TooltipIconButton: ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>;
|
|
258
|
+
|
|
259
|
+
export declare type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
|
|
260
|
+
tooltip: string;
|
|
261
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export declare function TooltipProvider({ delayDuration, ...props }: React_2.ComponentProps<typeof Tooltip_2.Provider>): JSX.Element;
|
|
265
|
+
|
|
266
|
+
export declare function TooltipTrigger({ ...props }: React_2.ComponentProps<typeof Tooltip_2.Trigger>): JSX.Element;
|
|
267
|
+
|
|
268
|
+
export declare function tryParseJson(text: string): Record<string, unknown> | null;
|
|
269
|
+
|
|
270
|
+
export declare const useAthenaRuntime: (config: AthenaRuntimeConfig) => AssistantRuntime;
|
|
271
|
+
|
|
272
|
+
export declare function useMentionSuggestions(tools: MentionTool[]): MentionSuggestionsStore;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Listens for auth tokens sent from a parent window via PostMessage.
|
|
276
|
+
*
|
|
277
|
+
* When the app runs inside an Olympus iframe, the parent sends
|
|
278
|
+
* the user's PropelAuth access token so the chat authenticates as the
|
|
279
|
+
* actual viewer — not the hardcoded API key owner.
|
|
280
|
+
*
|
|
281
|
+
* Protocol:
|
|
282
|
+
* Parent -> iframe: { type: 'athena-auth', token: '<propel-access-token>' }
|
|
283
|
+
* iframe -> Parent: { type: 'athena-auth-ready' }
|
|
284
|
+
*
|
|
285
|
+
* Falls back to null when running standalone (no parent window).
|
|
286
|
+
*/
|
|
287
|
+
export declare function useParentAuth(): string | null;
|
|
288
|
+
|
|
289
|
+
export declare const WebSearchToolUI: ToolCallMessagePartComponent;
|
|
290
|
+
|
|
291
|
+
export { }
|