@athenaintel/react 0.13.0 → 0.14.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.
Files changed (61) hide show
  1. package/dist/chat-ui/auth/sign-in-card.d.ts +57 -0
  2. package/dist/chat-ui/composer/composer-action.d.ts +5 -0
  3. package/dist/chat-ui/composer/pending-attachment-uploads.d.ts +5 -0
  4. package/dist/chat-ui/composer/tiptap-composer.d.ts +35 -0
  5. package/dist/chat-ui/index.d.ts +34 -0
  6. package/dist/chat-ui/lib/asset-urls.d.ts +6 -0
  7. package/dist/chat-ui/mentions/mention-chip.d.ts +38 -0
  8. package/dist/chat-ui/mentions/mention-extension.d.ts +35 -0
  9. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.d.ts +15 -0
  10. package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +10 -0
  11. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.d.ts +22 -0
  12. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.d.ts +9 -0
  13. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.d.ts +10 -0
  14. package/dist/chat-ui/mentions/suggestions/components/menu-item.d.ts +12 -0
  15. package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +13 -0
  16. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.d.ts +4 -0
  17. package/dist/chat-ui/mentions/suggestions/components/menu-summary.d.ts +13 -0
  18. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.d.ts +19 -0
  19. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.d.ts +64 -0
  20. package/dist/chat-ui/mentions/suggestions/components/utils.d.ts +8 -0
  21. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +41 -0
  22. package/dist/chat-ui/mentions/suggestions/data/item-cache.d.ts +76 -0
  23. package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +29 -0
  24. package/dist/chat-ui/mentions/suggestions/data/scope-registry.d.ts +105 -0
  25. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.d.ts +25 -0
  26. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +59 -0
  27. package/dist/chat-ui/mentions/suggestions/data/types.d.ts +156 -0
  28. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +37 -0
  29. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +34 -0
  30. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.d.ts +13 -0
  31. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.d.ts +5 -0
  32. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.d.ts +5 -0
  33. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +25 -0
  34. package/dist/chat-ui/mentions/suggestions/shims.d.ts +19 -0
  35. package/dist/chat-ui/messages/message-components.d.ts +56 -0
  36. package/dist/chat-ui/messages/running-indicator.d.ts +10 -0
  37. package/dist/chat-ui/thread/chat-composer-dock.d.ts +22 -0
  38. package/dist/chat-ui/thread/chat-thread-shell.d.ts +46 -0
  39. package/dist/chat-ui/thread/composer-send-or-stop.d.ts +44 -0
  40. package/dist/chat-ui.cjs +6217 -0
  41. package/dist/chat-ui.cjs.map +1 -0
  42. package/dist/chat-ui.js +6217 -0
  43. package/dist/chat-ui.js.map +1 -0
  44. package/dist/index.cjs +8513 -36126
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.js +7944 -35557
  47. package/dist/index.js.map +1 -1
  48. package/dist/mentions/mention-suggestion-list.d.ts +1 -1
  49. package/dist/mentions/use-mention-suggestions.d.ts +3 -2
  50. package/dist/scope-registry-B9XYV-FT.js +28480 -0
  51. package/dist/scope-registry-B9XYV-FT.js.map +1 -0
  52. package/dist/scope-registry-Bti8l_Xy.cjs +28495 -0
  53. package/dist/scope-registry-Bti8l_Xy.cjs.map +1 -0
  54. package/dist/styles.css +1 -1
  55. package/dist/threads/api.d.ts +1 -0
  56. package/dist/threads/conversation-list-fetcher.d.ts +40 -0
  57. package/package.json +16 -4
  58. package/src/chat-ui/styles/theme.css +30 -0
  59. package/src/chat-ui/tailwind-preset.js +57 -0
  60. package/dist/mentions/scope-registry.d.ts +0 -21
  61. package/dist/mentions/types.d.ts +0 -39
@@ -0,0 +1,105 @@
1
+ import { type ItemCache } from './item-cache';
2
+ import type { FetchState, MenuScope, SourceFn } from './types';
3
+ /**
4
+ * Scope Registry
5
+ *
6
+ * Plain object + pure functions for managing source functions.
7
+ * Each scope has a source function, config, and fetch state per query.
8
+ */
9
+ /**
10
+ * Scope registry entry - per menu scope
11
+ * Stores source function, config, and fetch state per query
12
+ */
13
+ export interface ScopeRegistryEntry {
14
+ scope: MenuScope;
15
+ sourceFn: SourceFn;
16
+ sourceConfig: any;
17
+ fetchStates: Record<string, FetchState>;
18
+ isFlat?: boolean;
19
+ }
20
+ /**
21
+ * Scope registry - plain object
22
+ * Maps MenuScope → ScopeRegistryEntry
23
+ */
24
+ export interface ScopeRegistry {
25
+ entries: Record<MenuScope, ScopeRegistryEntry>;
26
+ scopeBindings: Map<MenuScope, MenuScope>;
27
+ }
28
+ /**
29
+ * Create empty registry
30
+ */
31
+ export declare function createScopeRegistry(): ScopeRegistry;
32
+ /**
33
+ * Register a source function for a specific scope
34
+ * Creates full entry immediately with empty fetchStates
35
+ *
36
+ * @param registry - Registry to mutate
37
+ * @param scope - Scope identifier
38
+ * @param sourceFn - Pure function to fetch/transform items
39
+ * @param sourceConfig - Any configuration the source function needs (can include getters!)
40
+ * @param isFlat - If true, items won't get navigatesToScope (flat list, no hierarchy)
41
+ */
42
+ export declare function registerSource(registry: ScopeRegistry, scope: MenuScope, sourceFn: SourceFn, sourceConfig?: any, isFlat?: boolean): void;
43
+ /**
44
+ * Unregister a source (cleanup)
45
+ */
46
+ export declare function unregisterSource(registry: ScopeRegistry, scope: MenuScope): void;
47
+ /**
48
+ * Get or create entry for scope
49
+ * Auto-inherits source function from parent if not explicitly registered
50
+ *
51
+ * @param registry - Registry to read/mutate
52
+ * @param scope - Scope to get entry for
53
+ * @param parentScope - Optional parent scope (for inheritance)
54
+ * @returns Entry (may be newly created)
55
+ */
56
+ export declare function getEntry(registry: ScopeRegistry, scope: MenuScope, parentScope?: MenuScope): ScopeRegistryEntry;
57
+ /**
58
+ * Get fetch state for a specific scope + query combination
59
+ * Returns a default FetchState if not found
60
+ */
61
+ export declare function getFetchState(registry: ScopeRegistry, scope: MenuScope, query: string, parentScope?: MenuScope): FetchState;
62
+ /**
63
+ * Update fetch state (mutates registry - use inside updateWithImmer!)
64
+ * Ensures the entry exists in the registry before updating
65
+ */
66
+ export declare function updateFetchState(registry: ScopeRegistry, scope: MenuScope, query: string, updates: Partial<FetchState>, parentScope?: MenuScope): void;
67
+ /**
68
+ * Invalidate a scope - removes scope from items and resets fetch states
69
+ * Use when dynamic data changes (e.g., workspace members updated, tabs closed)
70
+ *
71
+ * Items lose this scope but stay in cache if they have other scopes.
72
+ * Only removes items completely if they have no scopes left.
73
+ *
74
+ * @param registry - Registry to mutate
75
+ * @param cache - Cache to mutate (imported type from item-cache)
76
+ * @param scope - Scope to invalidate
77
+ */
78
+ export declare function invalidateScope(registry: ScopeRegistry, cache: ItemCache, scope: MenuScope): void;
79
+ /**
80
+ * Bind two scopes: browse scope → search scope
81
+ * When user types a query in the browse scope, UI switches to search scope
82
+ *
83
+ * Example:
84
+ * bindScopes(registry, 'root', 'global_search')
85
+ * → Typing in root scope switches to global_search
86
+ *
87
+ * @param registry - Registry to mutate
88
+ * @param browseScope - The scope shown when browsing (no query)
89
+ * @param searchScope - The scope shown when searching (has query)
90
+ */
91
+ export declare function bindScopes(registry: ScopeRegistry, browseScope: MenuScope, searchScope: MenuScope): void;
92
+ /**
93
+ * Get the search scope for a browse scope (if bound)
94
+ * Returns null if no binding exists
95
+ *
96
+ * @param registry - Registry to read
97
+ * @param browseScope - The scope to check
98
+ * @returns Search scope or null
99
+ */
100
+ export declare function getSearchScope(registry: ScopeRegistry, browseScope: MenuScope): MenuScope | null;
101
+ /**
102
+ * Check if a scope is configured as flat (no hierarchy)
103
+ * Returns false if scope not found (safe default = hierarchical)
104
+ */
105
+ export declare function isFlat(registry: ScopeRegistry, scope: MenuScope): boolean;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Maps Athena asset types to SVG icon file names.
3
+ *
4
+ * The SVG files are bundled by the host app, which declares where they are
5
+ * served from via `configureAssetIconBasePath`. Hosts that don't bundle them
6
+ * fall back to the Lucide icons carried on every menu item.
7
+ */
8
+ /**
9
+ * Point the mention UI at the host's copy of the asset-type SVGs.
10
+ * `basePath` is resolved against the host document; a trailing "/" is added
11
+ * when the caller omits it.
12
+ */
13
+ export declare function configureAssetIconBasePath({ basePath, }: {
14
+ basePath: string | null;
15
+ }): void;
16
+ /**
17
+ * Get the SVG thumbnail URL for an Athena asset type, or undefined when the
18
+ * host app does not bundle the icon files.
19
+ */
20
+ export declare function assetTypeToThumb(assetType: string | null | undefined): string | undefined;
21
+ /**
22
+ * Get Lucide icon name fallback for an asset type.
23
+ * Used when thumbnailUrl can't load.
24
+ */
25
+ export declare function assetTypeToIcon(assetType: string | null | undefined): string;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Mention data sources shared by every chat host.
3
+ *
4
+ * Each source function implements the SourceFn interface:
5
+ * (context: SourceContext) => Promise<SourceResult>
6
+ *
7
+ * Sources are either:
8
+ * - FETCHERS: Call GraphQL API (assets, folders, team, etc.)
9
+ * - TRANSFORMERS: Return static/local data (root categories, host-provided items)
10
+ */
11
+ import type { MenuItem, SourceFn, WebpageMention } from "../types";
12
+ import { type MentionAuthContext } from "../api-client";
13
+ export interface RootCategoriesConfig {
14
+ categories: string[];
15
+ getWebpages: () => readonly WebpageMention[];
16
+ }
17
+ export declare function buildRootMenuItems({ categories, webpages, }: {
18
+ categories: readonly string[];
19
+ webpages: readonly WebpageMention[];
20
+ }): MenuItem[];
21
+ export declare const transformRootCategories: SourceFn<RootCategoriesConfig>;
22
+ export interface AssetsConfig {
23
+ auth: MentionAuthContext;
24
+ limit?: number;
25
+ }
26
+ export declare const fetchAssets: SourceFn<AssetsConfig>;
27
+ export interface FavoritesConfig {
28
+ auth: MentionAuthContext;
29
+ limit?: number;
30
+ }
31
+ export declare const fetchFavorites: SourceFn<FavoritesConfig>;
32
+ export interface FoldersConfig {
33
+ auth: MentionAuthContext;
34
+ limit?: number;
35
+ }
36
+ export declare const fetchFolders: SourceFn<FoldersConfig>;
37
+ export interface FolderContentsConfig {
38
+ auth: MentionAuthContext;
39
+ limit?: number;
40
+ }
41
+ export declare const fetchFolderContents: SourceFn<FolderContentsConfig>;
42
+ export interface TypedAssetsConfig {
43
+ auth: MentionAuthContext;
44
+ includeOnlyTypes: string[];
45
+ limit?: number;
46
+ }
47
+ export declare const fetchTypedAssets: SourceFn<TypedAssetsConfig>;
48
+ export interface TeamConfig {
49
+ auth: MentionAuthContext;
50
+ }
51
+ export declare const fetchTeam: SourceFn<TeamConfig>;
52
+ export interface DrivesConfig {
53
+ auth: MentionAuthContext;
54
+ }
55
+ export declare const fetchDrives: SourceFn<DrivesConfig>;
56
+ export interface GlobalSearchConfig {
57
+ auth: MentionAuthContext;
58
+ }
59
+ export declare const fetchGlobalSearch: SourceFn<GlobalSearchConfig>;
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Core types for mention suggestions data layer
3
+ */
4
+ /**
5
+ * MenuScope - A navigable container in the mention menu hierarchy
6
+ *
7
+ * Conceptual model:
8
+ * - SCOPE = Container/Group you navigate INTO (e.g., "athena_assets", "folder_123")
9
+ * - ITEM = Individual mentionable thing you SELECT (e.g., specific asset, tool)
10
+ *
11
+ * Scopes form a navigation hierarchy:
12
+ * root → athena_assets → folder_123 → subfolder_456
13
+ *
14
+ * Items can be visible in multiple scopes simultaneously:
15
+ * Asset "Report.pdf" is in both "folder_123" AND "asset_search" results
16
+ */
17
+ export type MenuScope = string;
18
+ export declare const MentionMenuSection: {
19
+ readonly CURRENT_WEBPAGE: "current-webpage";
20
+ readonly OTHER_WEBPAGES: "other-webpages";
21
+ readonly LIBRARY: "library";
22
+ };
23
+ export type MentionMenuSection = (typeof MentionMenuSection)[keyof typeof MentionMenuSection];
24
+ export interface WebpageMention {
25
+ tabId: number;
26
+ title: string;
27
+ url: string;
28
+ isCurrent: boolean;
29
+ }
30
+ export interface WebpageMentionScope {
31
+ primaryTabId: number;
32
+ tabGroupId: number | null;
33
+ allowedTabIds: readonly number[];
34
+ }
35
+ /**
36
+ * Selector result - provides current state + loading indicators
37
+ * Used by the UI to get immediate access to data and loading state
38
+ */
39
+ export interface MenuItemsSelector {
40
+ items: MenuItem[];
41
+ isFetching: boolean;
42
+ hasMore: boolean;
43
+ }
44
+ /**
45
+ * MenuItem - individual mentionable item
46
+ * Icon fields match MentionIcon component props exactly - no transforms needed at render time!
47
+ *
48
+ * Multi-scope system: Items can belong to multiple scopes simultaneously
49
+ * Example: An asset can be visible in 'athena_assets', 'folder_123', and 'my_spaces'
50
+ */
51
+ export interface MenuItem {
52
+ id: string;
53
+ name: string;
54
+ type: 'menu' | 'asset' | 'folder' | 'tool' | 'toolkit' | 'drive' | 'user' | 'task' | 'tab' | 'workspace_item' | 'drive_catalog' | 'placeholder';
55
+ thumbnailUrl?: string;
56
+ fallbackIcon: string;
57
+ visibleInScopes: Set<MenuScope>;
58
+ navigatesToScope?: MenuScope;
59
+ isNavigationOnly?: boolean;
60
+ extra?: Record<string, any>;
61
+ description?: string;
62
+ url?: string;
63
+ menuSection?: MentionMenuSection;
64
+ updatedAt?: string;
65
+ email?: string;
66
+ version?: string;
67
+ parentMenuId?: string;
68
+ }
69
+ /**
70
+ * FetchState - fetch status and pagination state for a specific query
71
+ * Managed by orchestrator, not returned by sources
72
+ */
73
+ export interface FetchState {
74
+ isFetching: boolean;
75
+ hasNextPage: boolean;
76
+ fetchNext: (() => void) | null;
77
+ error: Error | null;
78
+ meta: unknown;
79
+ }
80
+ /**
81
+ * FetchMetadata - Common metadata fields used by orchestrator
82
+ * Sources can extend this with their own fields (e.g., pageToken, cursor)
83
+ */
84
+ export interface FetchMetadata {
85
+ validatedCount?: number;
86
+ fetchAttempts?: number;
87
+ [key: string]: unknown;
88
+ }
89
+ /**
90
+ * New source to register dynamically
91
+ * Returned by sources when they discover navigable items (folders, catalogs, etc.)
92
+ */
93
+ export interface SourceToRegister {
94
+ scope: MenuScope;
95
+ sourceFn: SourceFn;
96
+ sourceConfig?: any;
97
+ isFlat?: boolean;
98
+ }
99
+ /**
100
+ * Scope binding to register dynamically
101
+ * Binds a browse scope to a search scope (hot scope swap on query)
102
+ */
103
+ export interface ScopeBindingToRegister {
104
+ browseScope: MenuScope;
105
+ searchScope: MenuScope;
106
+ }
107
+ /**
108
+ * Source result - returned by all source functions
109
+ *
110
+ * Sources come in two flavors:
111
+ * 1. TRANSFORMERS - Transform existing data (no API calls)
112
+ * Examples: tools, toolkits, workspace members, opened spaces
113
+ * Pattern: Read from store/ref → transform → return items
114
+ *
115
+ * 2. FETCHERS - Fetch from API (async operations)
116
+ * Examples: internal assets, folders, SharePoint items
117
+ * Pattern: Call GraphQL/REST → transform response → return items
118
+ *
119
+ * 3. HYBRID - Behavior depends on query
120
+ * Example: Root menu (transformer when no query, fetcher with query)
121
+ *
122
+ * Original design: Sources can return new sources to register!
123
+ * This allows discovered items (folders, catalogs) to be dynamically registered
124
+ * without circular dependencies (orchestrator handles registration centrally)
125
+ */
126
+ export interface SourceResult {
127
+ items: MenuItem[];
128
+ pagination?: {
129
+ hasMore: boolean;
130
+ totalCount?: number;
131
+ consumedCount?: number;
132
+ };
133
+ meta?: Record<string, unknown>;
134
+ sources?: SourceToRegister[];
135
+ bindings?: ScopeBindingToRegister[];
136
+ }
137
+ /**
138
+ * Source function context
139
+ *
140
+ * Sources are pure functions - just fetch/transform and return items!
141
+ * Orchestrator handles sync/deduplication via Cache.addItems() with scope tagging
142
+ */
143
+ export interface SourceContext<TConfig = any> {
144
+ scope: MenuScope;
145
+ query: string;
146
+ fetchState: FetchState;
147
+ sourceConfig: TConfig;
148
+ }
149
+ /**
150
+ * Source function type
151
+ *
152
+ * Pure function that provides items for a scope + query combination.
153
+ * Can be a transformer (reads from store) or fetcher (calls API).
154
+ * State (pagination, sourceConfig) is stored externally in registry entry.
155
+ */
156
+ export type SourceFn<TConfig = any> = (context: SourceContext<TConfig>) => Promise<SourceResult>;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Chrome Extension Mention Suggestions Store
3
+ *
4
+ * Full Olympus-style mention store with all categories:
5
+ * Favorites, Assets, Projects, Browse Profiles, Folders,
6
+ * current/group webpages, Team, Workspace, Drives + Global Search.
7
+ *
8
+ * Uses registry + cache architecture from Olympus with
9
+ * async data fetching via GraphQL.
10
+ */
11
+ import { Store } from "@tanstack/store";
12
+ import { type ItemCache } from "./item-cache";
13
+ import { type ScopeRegistry } from "./scope-registry";
14
+ import type { WebpageMention } from "./types";
15
+ export declare function webpageMentionFingerprint(webpages: readonly WebpageMention[]): string;
16
+ export interface MentionSuggestionsStoreState {
17
+ registry: ScopeRegistry;
18
+ cache: ItemCache;
19
+ }
20
+ export type MentionSuggestionsStore = Store<MentionSuggestionsStoreState>;
21
+ /**
22
+ * All mention menu categories, in display order.
23
+ */
24
+ export declare const ROOT_MENTION_CATEGORIES: readonly ["favorites", "assets", "projects", "browse_profiles", "folders", "team", "drives"];
25
+ export type MentionRootCategory = (typeof ROOT_MENTION_CATEGORIES)[number];
26
+ /**
27
+ * Creates a stable MentionSuggestionsStore.
28
+ * Uses MentionAuthCtx for API credentials.
29
+ */
30
+ export declare function useMentionSuggestions({ webpages, rootCategories, }: {
31
+ webpages: readonly WebpageMention[];
32
+ /** Categories shown at the top level; hosts can narrow the default set. */
33
+ rootCategories?: readonly MentionRootCategory[];
34
+ }): {
35
+ store: MentionSuggestionsStore;
36
+ invalidate: (scope: string) => void;
37
+ };
@@ -0,0 +1,34 @@
1
+ import type { MenuItem, MenuScope } from './types';
2
+ import type { MentionSuggestionsStore } from './use-mention-suggestions';
3
+ /**
4
+ * useMenuItems - Like React Query, but for menu items
5
+ *
6
+ * Clean, automatic hook that:
7
+ * - Reads items from store (reactive!)
8
+ * - Auto-fetches if needed (in useEffect)
9
+ * - Returns clean interface { items, isFetching, hasMore }
10
+ *
11
+ * Usage:
12
+ * ```typescript
13
+ * const { items, isFetching, hasMore } = useMenuItems(store, {
14
+ * scope: 'athena_folders',
15
+ * query: 'doc',
16
+ * minItems: 10,
17
+ * parentScope: 'root'
18
+ * });
19
+ * ```
20
+ */
21
+ export interface UseMenuItemsOptions {
22
+ scope: MenuScope;
23
+ query?: string;
24
+ minItems?: number;
25
+ parentScope?: MenuScope;
26
+ }
27
+ export interface UseMenuItemsResult {
28
+ items: MenuItem[];
29
+ isFetching: boolean;
30
+ hasMore: boolean;
31
+ loadMore: () => void;
32
+ targetCount: number;
33
+ }
34
+ export declare function useMenuItems(store: MentionSuggestionsStore, options: UseMenuItemsOptions): UseMenuItemsResult;
@@ -0,0 +1,13 @@
1
+ import type { MenuItem } from '../types';
2
+ /**
3
+ * Filter items by query match and sort by relevance
4
+ *
5
+ * Note: Items are already filtered by scope in getFilteredItems()
6
+ * This function only handles query matching and scoring.
7
+ *
8
+ * @param items - Items already filtered by scope
9
+ * @param query - Search query text
10
+ * @param _scope - Current scope (unused, kept for signature compatibility)
11
+ * @returns Filtered and sorted items
12
+ */
13
+ export declare function filterItems(items: MenuItem[], query: string, _scope: string): MenuItem[];
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Checks if all words in the query appear in the item name (in any order).
3
+ * This enables multi-word search like "ask devin" matching "Devin Ask Question".
4
+ */
5
+ export declare function matchesMultiWordQuery(itemName: string, query: string): boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Calculates a match score for sorting results.
3
+ * Higher scores indicate better matches.
4
+ */
5
+ export declare function getMatchScore(itemName: string, query: string): number;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Tiptap Mention Suggestions Extension
3
+ *
4
+ * Integrates the mention popup with Tiptap's suggestion plugin.
5
+ * Ported from Olympus — same lifecycle management.
6
+ */
7
+ import { Extension } from "@tiptap/core";
8
+ import type { MentionSuggestionsStore } from "./data/use-mention-suggestions";
9
+ import type { MenuItem } from "./data/types";
10
+ export interface MentionSuggestionRenderProps {
11
+ query: string;
12
+ command: (item: MenuItem) => void;
13
+ clientRect: (() => DOMRect | null) | null;
14
+ editor: any;
15
+ }
16
+ export type MentionSuggestionCallbacks = {
17
+ onStart: (props: MentionSuggestionRenderProps) => void;
18
+ onUpdate: (props: MentionSuggestionRenderProps) => void;
19
+ onKeyDown: (event: KeyboardEvent) => boolean;
20
+ onExit: () => void;
21
+ };
22
+ export declare const MentionSuggestionsExtension: Extension<{
23
+ store: MentionSuggestionsStore | null;
24
+ callbacks: MentionSuggestionCallbacks | null;
25
+ }, any>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shims for Olympus-specific imports.
3
+ *
4
+ * The Olympus mention system imports from @/lib/utils, @/store/*, etc.
5
+ * These shims provide Chrome-extension-compatible replacements so the
6
+ * Olympus UI components can be used as-is.
7
+ */
8
+ import { cn } from "cnfast";
9
+ export { cn };
10
+ export declare const useDebugMenuStore: () => {
11
+ showDebugMenu: boolean;
12
+ };
13
+ export declare function Spinner({ className }: {
14
+ className?: string;
15
+ }): import("react/jsx-runtime").JSX.Element;
16
+ export declare const toast: {
17
+ error: (msg: string) => void;
18
+ success: (msg: string) => void;
19
+ };
@@ -0,0 +1,56 @@
1
+ import { type ToolCallMessagePartComponent } from "@assistant-ui/react";
2
+ import "@assistant-ui/react-markdown/styles/dot.css";
3
+ import type { ButtonHTMLAttributes, FC, ReactNode } from "react";
4
+ import type { ComposerAction } from "../composer/composer-action";
5
+ export declare function IconButton({ children, tooltip, className, ...props }: ButtonHTMLAttributes<HTMLButtonElement> & {
6
+ tooltip: string;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ export declare function SmallIconButton({ children, tooltip, className, ...props }: ButtonHTMLAttributes<HTMLButtonElement> & {
9
+ tooltip: string;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ export declare const BranchPicker: FC;
12
+ /** Assistant markdown with Athena mention chips and fenced code blocks. */
13
+ export declare const MarkdownText: FC;
14
+ export declare const UserMessage: FC;
15
+ export interface CreateAssistantMessageOptions {
16
+ /** Host-registered card for tools without a dedicated UI. */
17
+ toolFallback: ToolCallMessagePartComponent;
18
+ /** Extra action-bar controls appended after copy/regenerate. */
19
+ extraActions?: ReactNode;
20
+ /**
21
+ * Renders the message body. Hosts that group content into activity
22
+ * timelines supply their own; the default renders markdown and tool cards.
23
+ */
24
+ content?: FC;
25
+ }
26
+ /**
27
+ * Builds the assistant bubble. Call this once per host (memoized on its
28
+ * inputs) so the returned component identity stays stable across renders.
29
+ */
30
+ export declare function createAssistantMessage({ toolFallback, extraActions, content: Content, }: CreateAssistantMessageOptions): FC;
31
+ /** Panel chrome: the thread card and the header row that sits inside it. */
32
+ export declare const THREAD_PANEL_CLASS = "m-1 flex min-h-0 flex-1 flex-col overflow-hidden rounded-[18px] border border-dashed border-amber-500 bg-background shadow-[0_1px_10px_rgba(54,45,33,0.08)]";
33
+ export declare const THREAD_HEADER_CLASS = "flex items-center justify-between gap-2 px-3 py-2";
34
+ export declare const THREAD_HEADER_ACTIONS_CLASS = "flex min-w-0 items-center justify-end gap-1.5";
35
+ /** Pill used for the header's leading control (agent picker, host label). */
36
+ export declare const THREAD_HEADER_PILL_CLASS = "inline-flex h-7 max-w-[170px] items-center gap-1.5 rounded-md border border-neutral-200 bg-white px-2 text-xs font-medium text-neutral-800 shadow-sm";
37
+ export declare const THREAD_HEADER_ICON_CLASS = "size-[18px]";
38
+ /** Composer chrome: the dock around the composer, its surface and its rows. */
39
+ export declare const COMPOSER_DOCK_CLASS = "bg-background px-2.5 pb-2 pt-1.5";
40
+ export declare const COMPOSER_SURFACE_CLASS = "relative flex flex-col gap-1 rounded-xl border border-neutral-200 bg-white shadow-[0_2px_10px_rgba(54,45,33,0.08)]";
41
+ export declare const COMPOSER_EDITOR_ROW_CLASS = "px-2.5 pt-1";
42
+ export declare const COMPOSER_TOOLBAR_CLASS = "flex items-center gap-1 border-t border-neutral-100 px-2 py-1.5";
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<{
46
+ onStop: () => void;
47
+ disabled?: boolean;
48
+ title?: string;
49
+ }>;
50
+ /** Send control, which becomes a queue control while a run is in flight. */
51
+ export declare const ComposerSendButton: FC<{
52
+ action: Extract<ComposerAction, "send" | "queue">;
53
+ onSend: () => void;
54
+ disabled?: boolean;
55
+ title?: string;
56
+ }>;
@@ -0,0 +1,10 @@
1
+ import type { ThreadMessage } from "@assistant-ui/react";
2
+ import type { FC } from "react";
3
+ export declare function hasVisibleContent(content: ThreadMessage["content"]): boolean;
4
+ export declare const TextShimmerLoader: FC<{
5
+ text?: string;
6
+ className?: string;
7
+ }>;
8
+ export declare const ThreadRunningIndicator: FC<{
9
+ text?: string;
10
+ }>;
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from "react";
2
+ export interface ChatComposerDockProps {
3
+ /** Rendered inside the dock, above the composer surface (error banners). */
4
+ aboveSurface?: ReactNode;
5
+ /**
6
+ * Rendered inside the surface above the editor row: context chips,
7
+ * restore notices, attachment strips.
8
+ */
9
+ beforeEditor?: ReactNode;
10
+ /** The editor element (a TiptapComposer, typically ref-held by the host). */
11
+ editor: ReactNode;
12
+ /** Toolbar contents before the spacer (attach buttons, pickers). */
13
+ toolbarStart?: ReactNode;
14
+ /** Toolbar contents after the spacer (voice, capture, send/stop). */
15
+ toolbarEnd: ReactNode;
16
+ }
17
+ /**
18
+ * The shared composer scaffolding: dock padding, the bordered surface, the
19
+ * editor row, and the toolbar with its start/end slots around a flexible
20
+ * spacer. Hosts supply the editor element and toolbar controls.
21
+ */
22
+ export declare function ChatComposerDock({ aboveSurface, beforeEditor, editor, toolbarStart, toolbarEnd, }: ChatComposerDockProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,46 @@
1
+ import type { FC, ReactNode } from "react";
2
+ export interface ChatThreadMessageComponents {
3
+ UserMessage: FC;
4
+ AssistantMessage: FC;
5
+ }
6
+ export interface ChatThreadShellProps {
7
+ /**
8
+ * Rendered above the viewport, inside the panel: header rows, slide-over
9
+ * panels, and anything else the host docks at the top.
10
+ */
11
+ header?: ReactNode;
12
+ /** Status/approval banners rendered between the header and the viewport. */
13
+ banners?: ReactNode;
14
+ /**
15
+ * Nodes rendered inside the scroll viewport before the message column —
16
+ * absolutely-positioned overlays (thread-switch skeletons) and invisible
17
+ * observers (read receipts).
18
+ */
19
+ viewportOverlay?: ReactNode;
20
+ /** Empty-thread state, rendered via ThreadPrimitive.Empty when provided. */
21
+ welcome?: ReactNode;
22
+ /** Message renderers for ThreadPrimitive.Messages. */
23
+ components: ChatThreadMessageComponents;
24
+ /**
25
+ * Wraps the messages element — for hosts that provide message-scoped
26
+ * context (e.g. activity-grouping providers). Must render its argument.
27
+ */
28
+ renderMessages?: (messages: ReactNode) => ReactNode;
29
+ /**
30
+ * Rendered between the viewport and the composer: connection banners,
31
+ * queued-message trays.
32
+ */
33
+ belowViewport?: ReactNode;
34
+ /** The composer dock (or a read-only notice replacing it). */
35
+ composer?: ReactNode;
36
+ }
37
+ /**
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.
41
+ *
42
+ * Hosts express their genuine divergences through the slots above; the
43
+ * layout, scroll behaviour, and empty/running states stay identical across
44
+ * surfaces so fixes land once.
45
+ */
46
+ export declare function ChatThreadShell({ header, banners, viewportOverlay, welcome, components, renderMessages, belowViewport, composer, }: ChatThreadShellProps): import("react/jsx-runtime").JSX.Element;