@athenaintel/react 0.14.0 → 0.15.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.
@@ -13,6 +13,12 @@ interface EditorHandle {
13
13
  isEmpty: () => boolean;
14
14
  /** Insert text at the end of the editor. */
15
15
  insertText: (text: string) => void;
16
+ /**
17
+ * Submit the draft through the composer's canonical send path — the same
18
+ * path the editor's Enter keybinding uses, including quote/attachment
19
+ * composition and upload/mid-run guards.
20
+ */
21
+ submit: () => void;
16
22
  }
17
23
  type EditorRef = MutableRefObject<EditorHandle | null>;
18
24
  interface EditorContextValue {
@@ -1,5 +1,12 @@
1
1
  export type ComposerAction = "send" | "queue" | "stop";
2
- export declare function resolveComposerAction({ hasDraft, isRunning, }: {
2
+ export declare function resolveComposerAction({ hasDraft, isRunning, canQueue, }: {
3
3
  hasDraft: boolean;
4
4
  isRunning: boolean;
5
+ /**
6
+ * Whether a draft may be queued behind an active run. Transports without a
7
+ * server-owned queue (the SDK's legacy assistant-transport) pass false so a
8
+ * running thread always resolves to stop — a mid-run dispatch there would
9
+ * orphan the in-flight run.
10
+ */
11
+ canQueue?: boolean;
5
12
  }): ComposerAction;
@@ -12,7 +12,7 @@ export type { ChatThreadMessageComponents, ChatThreadShellProps, } from "./threa
12
12
  export { ChatComposerDock } from "./thread/chat-composer-dock";
13
13
  export type { ChatComposerDockProps } from "./thread/chat-composer-dock";
14
14
  export { ComposerSendOrStop } from "./thread/composer-send-or-stop";
15
- export type { ComposerSendOrStopProps, ComposerStopControls, } from "./thread/composer-send-or-stop";
15
+ export type { ComposerSendOrStopComponents, ComposerSendOrStopProps, ComposerStopControls, ComposerSubmitHandle, } from "./thread/composer-send-or-stop";
16
16
  export { TiptapComposer, plainTextToTiptapContent, type TiptapComposerHandle, type TiptapComposerProps, } from "./composer/tiptap-composer";
17
17
  export { PendingAttachmentUploads } from "./composer/pending-attachment-uploads";
18
18
  export { resolveComposerAction, type ComposerAction, } from "./composer/composer-action";
@@ -29,6 +29,6 @@ export { buildRootMenuItems } from "./mentions/suggestions/data/sources";
29
29
  export { assetTypeToIcon, assetTypeToThumb, configureAssetIconBasePath, } from "./mentions/suggestions/data/sources/asset-type-icons";
30
30
  export { MentionMenuSection, type MenuItem, type MenuScope, type WebpageMention, type WebpageMentionScope, } from "./mentions/suggestions/data/types";
31
31
  export { createOlympusAssetUrl } from "./lib/asset-urls";
32
- export { COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, BranchPicker, ComposerSendButton, ComposerStopButton, IconButton, MarkdownText, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage, type CreateAssistantMessageOptions, } from "./messages/message-components";
32
+ export { COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, BranchPicker, ComposerSendButton, ComposerStopButton, type ComposerSendButtonProps, type ComposerStopButtonProps, IconButton, MarkdownText, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage, type CreateAssistantMessageOptions, } from "./messages/message-components";
33
33
  export { TextShimmerLoader, ThreadRunningIndicator, } from "./messages/running-indicator";
34
34
  export { SignInCard, SignInConsent, SignInFallbackSection, SignInSecondaryButton, SignInSelect, SignInTextField, } from "./auth/sign-in-card";
@@ -41,16 +41,18 @@ export declare const COMPOSER_SURFACE_CLASS = "relative flex flex-col gap-1 roun
41
41
  export declare const COMPOSER_EDITOR_ROW_CLASS = "px-2.5 pt-1";
42
42
  export declare const COMPOSER_TOOLBAR_CLASS = "flex items-center gap-1 border-t border-neutral-100 px-2 py-1.5";
43
43
  export declare const THREAD_SCROLL_TO_BOTTOM_CLASS = "inline-flex items-center justify-center rounded-full border bg-background/80 p-1 shadow-sm backdrop-blur transition-opacity hover:bg-accent disabled:invisible";
44
- /** Stop control shown while a run is in flight and there is nothing queued. */
45
- export declare const ComposerStopButton: FC<{
44
+ export interface ComposerStopButtonProps {
46
45
  onStop: () => void;
47
46
  disabled?: boolean;
48
47
  title?: string;
49
- }>;
50
- /** Send control, which becomes a queue control while a run is in flight. */
51
- export declare const ComposerSendButton: FC<{
48
+ }
49
+ export interface ComposerSendButtonProps {
52
50
  action: Extract<ComposerAction, "send" | "queue">;
53
51
  onSend: () => void;
54
52
  disabled?: boolean;
55
53
  title?: string;
56
- }>;
54
+ }
55
+ /** Stop control shown while a run is in flight and there is nothing queued. */
56
+ export declare const ComposerStopButton: FC<ComposerStopButtonProps>;
57
+ /** Send control, which becomes a queue control while a run is in flight. */
58
+ export declare const ComposerSendButton: FC<ComposerSendButtonProps>;
@@ -1,5 +1,17 @@
1
1
  import type { ReactNode } from "react";
2
2
  export interface ChatComposerDockProps {
3
+ /**
4
+ * Replaces the dock chrome (padding + background around the surface).
5
+ * Hosts with their own composer chrome system (AthenaChat's `aui-*`
6
+ * classes) pass their chrome here; the scaffolding structure stays shared.
7
+ */
8
+ className?: string;
9
+ /** Replaces the bordered composer-surface chrome. */
10
+ surfaceClassName?: string;
11
+ /** Replaces the editor-row chrome. */
12
+ editorRowClassName?: string;
13
+ /** Replaces the toolbar-row chrome. */
14
+ toolbarClassName?: string;
3
15
  /** Rendered inside the dock, above the composer surface (error banners). */
4
16
  aboveSurface?: ReactNode;
5
17
  /**
@@ -19,4 +31,4 @@ export interface ChatComposerDockProps {
19
31
  * editor row, and the toolbar with its start/end slots around a flexible
20
32
  * spacer. Hosts supply the editor element and toolbar controls.
21
33
  */
22
- export declare function ChatComposerDock({ aboveSurface, beforeEditor, editor, toolbarStart, toolbarEnd, }: ChatComposerDockProps): import("react/jsx-runtime").JSX.Element;
34
+ export declare function ChatComposerDock({ className, surfaceClassName, editorRowClassName, toolbarClassName, aboveSurface, beforeEditor, editor, toolbarStart, toolbarEnd, }: ChatComposerDockProps): import("react/jsx-runtime").JSX.Element;
@@ -4,6 +4,13 @@ export interface ChatThreadMessageComponents {
4
4
  AssistantMessage: FC;
5
5
  }
6
6
  export interface ChatThreadShellProps {
7
+ /**
8
+ * Rendered as the first child of the panel — for absolutely-positioned
9
+ * scrims that must cover the whole panel (AthenaChat's thread-loading
10
+ * overlay). The shell does not force a positioning context; hosts include
11
+ * `relative` in `panelClassName` when the scrim anchors to the panel.
12
+ */
13
+ overlay?: ReactNode;
7
14
  /**
8
15
  * Rendered above the viewport, inside the panel: header rows, slide-over
9
16
  * panels, and anything else the host docks at the top.
@@ -13,8 +20,8 @@ export interface ChatThreadShellProps {
13
20
  banners?: ReactNode;
14
21
  /**
15
22
  * Nodes rendered inside the scroll viewport before the message column —
16
- * absolutely-positioned overlays (thread-switch skeletons) and invisible
17
- * observers (read receipts).
23
+ * absolutely/sticky-positioned overlays (thread-switch skeletons,
24
+ * scroll-to-top controls) and invisible observers (read receipts).
18
25
  */
19
26
  viewportOverlay?: ReactNode;
20
27
  /** Empty-thread state, rendered via ThreadPrimitive.Empty when provided. */
@@ -33,14 +40,58 @@ export interface ChatThreadShellProps {
33
40
  belowViewport?: ReactNode;
34
41
  /** The composer dock (or a read-only notice replacing it). */
35
42
  composer?: ReactNode;
43
+ /**
44
+ * Replaces the docked-panel card chrome — for hosts that render a
45
+ * full-page column (AthenaChat's `aui-*` surface) instead of the
46
+ * side-panel/task-pane card.
47
+ */
48
+ panelClassName?: string;
49
+ /**
50
+ * Value of the `--thread-max-width` variable read by width-capped
51
+ * message/welcome/footer columns. Panels fill their width (the default,
52
+ * "100%"); full-page hosts cap the column (AthenaChat defaults to 44rem).
53
+ */
54
+ maxWidth?: string;
55
+ /**
56
+ * Anchors the latest turn to the top of the viewport instead of pinning
57
+ * scroll to the bottom (AthenaChat). Omitted = the primitive's default.
58
+ */
59
+ turnAnchor?: "top" | "bottom";
60
+ /** Replaces the scroll-viewport chrome (padding, overflow tuning). */
61
+ viewportClassName?: string;
62
+ /**
63
+ * Replaces the message-column chrome. Hosts whose welcome screen centers
64
+ * vertically make this a flex column so the welcome node can grow.
65
+ */
66
+ contentClassName?: string;
67
+ /**
68
+ * Thread-level "Thinking..." indicator rendered after the messages. Hosts
69
+ * whose message components render their own per-message indicators pass
70
+ * null so the two never double up.
71
+ */
72
+ runningIndicator?: ReactNode;
73
+ /**
74
+ * Replaces the default centered scroll-to-bottom pill inside the sticky
75
+ * viewport footer (AthenaChat floats a circular button above its composer).
76
+ */
77
+ scrollToBottom?: ReactNode;
78
+ /**
79
+ * Content docked inside the sticky viewport footer, after the
80
+ * scroll-to-bottom control — for hosts whose banners + composer float over
81
+ * the scrolling messages (AthenaChat) instead of sitting below the
82
+ * viewport via `belowViewport`/`composer`.
83
+ */
84
+ viewportFooter?: ReactNode;
85
+ /** Replaces the sticky viewport-footer chrome. */
86
+ viewportFooterClassName?: string;
36
87
  }
37
88
  /**
38
- * The shared side-panel/task-pane thread layout: panel chrome, scroll
39
- * viewport with welcome + messages + running indicator, the sticky
40
- * scroll-to-bottom control, and the host-supplied composer dock.
89
+ * The shared thread layout: panel chrome, scroll viewport with welcome +
90
+ * messages + running indicator, the sticky scroll-to-bottom control, and the
91
+ * host-supplied composer dock.
41
92
  *
42
93
  * Hosts express their genuine divergences through the slots above; the
43
94
  * layout, scroll behaviour, and empty/running states stay identical across
44
95
  * surfaces so fixes land once.
45
96
  */
46
- export declare function ChatThreadShell({ header, banners, viewportOverlay, welcome, components, renderMessages, belowViewport, composer, }: ChatThreadShellProps): import("react/jsx-runtime").JSX.Element;
97
+ export declare function ChatThreadShell({ overlay, header, banners, viewportOverlay, welcome, components, renderMessages, belowViewport, composer, panelClassName, maxWidth, turnAnchor, viewportClassName, contentClassName, runningIndicator, scrollToBottom, viewportFooter, viewportFooterClassName, }: ChatThreadShellProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,14 @@
1
1
  import type { FC, RefObject } from "react";
2
2
  import { type ComposerAction } from "../composer/composer-action";
3
- import type { TiptapComposerHandle } from "../composer/tiptap-composer";
3
+ import { type ComposerSendButtonProps, type ComposerStopButtonProps } from "../messages/message-components";
4
+ /**
5
+ * The slice of a composer handle this control needs: something whose draft
6
+ * can be submitted. `TiptapComposerHandle` satisfies it; hosts with their own
7
+ * editor plumbing (the SDK's AthenaChat) expose a compatible handle.
8
+ */
9
+ export interface ComposerSubmitHandle {
10
+ submit: () => void | Promise<void>;
11
+ }
4
12
  export interface ComposerStopControls {
5
13
  /**
6
14
  * Cancels the active run via the runtime. Returns false when cancellation
@@ -9,9 +17,23 @@ export interface ComposerStopControls {
9
17
  */
10
18
  cancelRun: () => boolean;
11
19
  }
20
+ /**
21
+ * Control renderers, for hosts with their own published theming contract
22
+ * (AthenaChat's `aui-*` class system). Defaults render the shared buttons.
23
+ */
24
+ export interface ComposerSendOrStopComponents {
25
+ SendButton?: FC<ComposerSendButtonProps>;
26
+ StopButton?: FC<ComposerStopButtonProps>;
27
+ }
12
28
  export interface ComposerSendOrStopProps {
13
- composerRef: RefObject<TiptapComposerHandle | null>;
29
+ composerRef: RefObject<ComposerSubmitHandle | null>;
14
30
  hasDraft: boolean;
31
+ /**
32
+ * Whether a draft may queue behind an active run (server-owned queue).
33
+ * Hosts on transports without a queue pass false so an active run always
34
+ * resolves to stop. Defaults to true.
35
+ */
36
+ canQueue?: boolean;
15
37
  /** Disables both send and stop (e.g. while a conversation restores). */
16
38
  disabled?: boolean;
17
39
  /**
@@ -35,6 +57,7 @@ export interface ComposerSendOrStopProps {
35
57
  * work sequence it around `controls.cancelRun()`. Default: cancel the run.
36
58
  */
37
59
  onStop?: (controls: ComposerStopControls) => void;
60
+ components?: ComposerSendOrStopComponents;
38
61
  }
39
62
  /**
40
63
  * The shared send/queue/stop control: sends the composer draft, queues it as