@athenaintel/react 0.10.34 → 0.10.36
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 +31 -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 +50 -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 +1595 -1432
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +81 -1545
- package/dist/index.js +1596 -1433
- 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 @@
|
|
|
1
|
+
export declare function getToolStatusLabel(toolName: string, status: 'running' | 'complete' | 'error' | 'incomplete' | undefined): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default `getToolGroupKey` implementation used by the SDK's tool grouping.
|
|
3
|
+
* Returns the toolkit display key for a tool name, or `undefined` if the tool
|
|
4
|
+
* is ungrouped or unknown.
|
|
5
|
+
*
|
|
6
|
+
* Override per-app by passing `getToolGroupKey` to `<AthenaChat>`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultGetToolGroupKey: (toolName: string) => string | undefined;
|
|
9
|
+
export type GetToolGroupKey = (toolName: string) => string | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import { type MentionTool, type MentionRootCategory } from "../mentions/use-mention-suggestions";
|
|
3
|
+
export interface TiptapComposerProps {
|
|
4
|
+
tools?: MentionTool[];
|
|
5
|
+
rootCategories?: readonly MentionRootCategory[];
|
|
6
|
+
}
|
|
7
|
+
export declare const TiptapComposer: FC<TiptapComposerProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from "react";
|
|
2
|
+
import { Button } from "../ui/button";
|
|
3
|
+
export type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
|
|
4
|
+
tooltip: string;
|
|
5
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
6
|
+
};
|
|
7
|
+
export declare const TooltipIconButton: import("react").ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { UploadedAsset } from './useFileUpload';
|
|
3
|
+
interface AttachmentContextValue {
|
|
4
|
+
attachments: UploadedAsset[];
|
|
5
|
+
addAttachments: (assets: UploadedAsset[]) => void;
|
|
6
|
+
removeAttachment: (id: string) => void;
|
|
7
|
+
clearAttachments: () => void;
|
|
8
|
+
/** True when one or more files are currently being uploaded. */
|
|
9
|
+
isUploading: boolean;
|
|
10
|
+
setIsUploading: (v: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function AttachmentProvider({ children }: {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function useAttachments(): AttachmentContextValue;
|
|
16
|
+
/**
|
|
17
|
+
* Build the markdown references for the current attachments.
|
|
18
|
+
* Returns empty string if no attachments.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Use `buildAttachmentMarkdownWithAppUrl` to avoid defaulting links to the production Athena app URL.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildAttachmentMarkdown(attachments: UploadedAsset[]): string;
|
|
23
|
+
export declare function buildAttachmentMarkdownWithAppUrl({ attachments, appUrl, }: {
|
|
24
|
+
attachments: UploadedAsset[];
|
|
25
|
+
appUrl?: string;
|
|
26
|
+
}): string;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
export interface ComposerAttachmentPreviewProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Renders uploaded file pills above the composer.
|
|
7
|
+
* Each pill shows the file name and a dismiss button.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ComposerAttachmentPreview: FC<ComposerAttachmentPreviewProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
import { type UploadedAsset } from './useFileUpload';
|
|
3
|
+
export interface ComposerDropZoneProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Called after files are uploaded via drag-and-drop. */
|
|
7
|
+
onUpload?: (assets: UploadedAsset[]) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wraps the composer area with drag-and-drop file upload support.
|
|
11
|
+
* Shows a visual drop indicator when files are dragged over.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ComposerDropZone: FC<ComposerDropZoneProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
export interface ComposerQuotePreviewProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Renders a quote preview pill above the composer when text has been quoted
|
|
7
|
+
* (via Cmd+L, text selection, or PostMessage from an iframe).
|
|
8
|
+
*
|
|
9
|
+
* Shows the quoted text with source attribution and a dismiss button.
|
|
10
|
+
* Clears automatically after message send (handled by ComposerWithQuote).
|
|
11
|
+
*/
|
|
12
|
+
export declare const ComposerQuotePreview: FC<ComposerQuotePreviewProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { type UploadedAsset } from './useFileUpload';
|
|
3
|
+
export interface FileUploadButtonProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Called after files are uploaded successfully. Receives the created assets. */
|
|
6
|
+
onUpload?: (assets: UploadedAsset[]) => void;
|
|
7
|
+
/** Accepted file types (MIME pattern). Defaults to all files. */
|
|
8
|
+
accept?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Paperclip button that opens a file picker and uploads selected files to Athena.
|
|
12
|
+
* After upload, adds files to the attachment context so they appear as pills
|
|
13
|
+
* above the composer and get included when the message is sent.
|
|
14
|
+
*/
|
|
15
|
+
export declare const FileUploadButton: FC<FileUploadButtonProps>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface QuoteData {
|
|
3
|
+
/** The selected/quoted text. */
|
|
4
|
+
text: string;
|
|
5
|
+
/** Title of the source (e.g., asset title, document name). */
|
|
6
|
+
sourceTitle?: string;
|
|
7
|
+
/** Asset ID of the source (for attribution). */
|
|
8
|
+
sourceAssetId?: string;
|
|
9
|
+
/** Message ID of the source message (when quoting from chat). */
|
|
10
|
+
sourceMessageId?: string;
|
|
11
|
+
/** Role of the source message ('assistant' | 'user'). */
|
|
12
|
+
sourceRole?: string;
|
|
13
|
+
}
|
|
14
|
+
interface QuoteContextValue {
|
|
15
|
+
quote: QuoteData | null;
|
|
16
|
+
setQuote: (quote: QuoteData | null) => void;
|
|
17
|
+
clearQuote: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function QuoteProvider({ children }: {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function useQuote(): QuoteContextValue;
|
|
23
|
+
/**
|
|
24
|
+
* Listens for:
|
|
25
|
+
* 1. Cmd+L / Ctrl+L keydown — grabs the current text selection and sets it as a quote.
|
|
26
|
+
* `preventDefault` stops the browser from focusing the URL bar.
|
|
27
|
+
* 2. PostMessage events from child iframes (asset panels, embedded content)
|
|
28
|
+
* with type `athena-add-to-composer`.
|
|
29
|
+
*
|
|
30
|
+
* Mount this once inside AthenaProvider.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useQuoteFromPostMessage(): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UploadedAsset } from './useFileUpload';
|
|
2
|
+
import type { QuoteData } from './QuoteContext';
|
|
3
|
+
/**
|
|
4
|
+
* Assembles a composed message from attachments, a quote, and user text.
|
|
5
|
+
* Used by both the TipTap Enter-key submit and the send-button click handler
|
|
6
|
+
* to avoid duplicating the message-assembly logic.
|
|
7
|
+
*
|
|
8
|
+
* Returns an empty string if all inputs are empty.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildComposedMessage(opts: {
|
|
11
|
+
attachments?: UploadedAsset[];
|
|
12
|
+
quote?: QuoteData | null;
|
|
13
|
+
userText?: string;
|
|
14
|
+
appUrl?: string;
|
|
15
|
+
}): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { useAppendToComposer } from './useAppendToComposer';
|
|
2
|
+
export { useSendMessage } from './useSendMessage';
|
|
3
|
+
export type { SendMessageOptions } from './useSendMessage';
|
|
4
|
+
export { useComposerAttachment } from './useComposerAttachment';
|
|
5
|
+
export { useFileUpload } from './useFileUpload';
|
|
6
|
+
export type { UploadedAsset, UploadProgress, UseFileUploadReturn } from './useFileUpload';
|
|
7
|
+
export { FileUploadButton } from './FileUploadButton';
|
|
8
|
+
export type { FileUploadButtonProps } from './FileUploadButton';
|
|
9
|
+
export { ComposerQuotePreview } from './ComposerQuotePreview';
|
|
10
|
+
export type { ComposerQuotePreviewProps } from './ComposerQuotePreview';
|
|
11
|
+
export { ComposerAttachmentPreview } from './ComposerAttachmentPreview';
|
|
12
|
+
export type { ComposerAttachmentPreviewProps } from './ComposerAttachmentPreview';
|
|
13
|
+
export { AttachmentProvider, useAttachments } from './AttachmentContext';
|
|
14
|
+
export { QuoteProvider, useQuote, useQuoteFromPostMessage } from './QuoteContext';
|
|
15
|
+
export type { QuoteData } from './QuoteContext';
|
|
16
|
+
export { ComposerDropZone } from './ComposerDropZone';
|
|
17
|
+
export type { ComposerDropZoneProps } from './ComposerDropZone';
|
|
18
|
+
export { buildComposedMessage } from './build-composed-message';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to programmatically append text to the composer without sending it.
|
|
3
|
+
*
|
|
4
|
+
* Use `useSendMessage()` for workflow shortcuts or other UI that should
|
|
5
|
+
* immediately submit a prompt.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const append = useAppendToComposer();
|
|
9
|
+
* append("some text to add");
|
|
10
|
+
* append("quoted text", { replace: true }); // replaces existing text
|
|
11
|
+
*/
|
|
12
|
+
export declare function useAppendToComposer(): (text: string, opts?: {
|
|
13
|
+
replace?: boolean;
|
|
14
|
+
}) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for programmatic composer file attachment control.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* const { addFile, addContent, clear } = useComposerAttachment();
|
|
6
|
+
* addFile(fileObject);
|
|
7
|
+
* addContent("data.csv", "col1,col2\n1,2");
|
|
8
|
+
* clear();
|
|
9
|
+
*/
|
|
10
|
+
export declare function useComposerAttachment(): {
|
|
11
|
+
addFile: (file: File) => void;
|
|
12
|
+
addContent: (name: string, content: string) => void;
|
|
13
|
+
clear: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface UploadedAsset {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
fileSize: number;
|
|
6
|
+
mediaType: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UploadProgress {
|
|
9
|
+
current: number;
|
|
10
|
+
total: number;
|
|
11
|
+
fileName: string;
|
|
12
|
+
/** 0–1 normalized progress for the current file */
|
|
13
|
+
percent: number;
|
|
14
|
+
}
|
|
15
|
+
export interface UseFileUploadReturn {
|
|
16
|
+
/** Upload one or more files to Athena. Returns the created asset(s). */
|
|
17
|
+
upload: (files: File[]) => Promise<UploadedAsset[]>;
|
|
18
|
+
/** Whether an upload is currently in progress. */
|
|
19
|
+
isUploading: boolean;
|
|
20
|
+
/** Upload progress info (null when idle). */
|
|
21
|
+
progress: UploadProgress | null;
|
|
22
|
+
/** Last upload error (null when no error). */
|
|
23
|
+
error: string | null;
|
|
24
|
+
/** Clear the error state. */
|
|
25
|
+
clearError: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook for uploading files to the Athena platform via the Athena upload endpoint.
|
|
29
|
+
* Files become Athena assets (documents, spreadsheets, PDFs, images, etc.).
|
|
30
|
+
*
|
|
31
|
+
* Usage:
|
|
32
|
+
* const { upload, isUploading, progress, error } = useFileUpload();
|
|
33
|
+
* const assets = await upload(fileList);
|
|
34
|
+
*/
|
|
35
|
+
export declare function useFileUpload(): UseFileUploadReturn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface SendMessageOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Replace the current composer text before sending.
|
|
4
|
+
* Defaults to `true`.
|
|
5
|
+
*/
|
|
6
|
+
replace?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hook to programmatically send a user message from anywhere inside AthenaProvider.
|
|
10
|
+
*
|
|
11
|
+
* This is intended for custom workflow buttons, sidebar shortcuts, or other UI
|
|
12
|
+
* that lives outside the AthenaChat thread tree. Unlike `aui.thread().append()`,
|
|
13
|
+
* this uses the provider-scoped composer runtime and does not depend on
|
|
14
|
+
* ThreadPrimitive context.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* const sendMessage = useSendMessage();
|
|
18
|
+
* await sendMessage("Run the quarterly workflow");
|
|
19
|
+
* await sendMessage("Add this follow-up", { replace: false });
|
|
20
|
+
*/
|
|
21
|
+
export declare function useSendMessage(): (text: string, options?: SendMessageOptions) => Promise<void>;
|