@axiom-lattice/react-sdk 2.1.104 → 2.1.105

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.d.ts CHANGED
@@ -4,11 +4,11 @@ export * from '@axiom-lattice/protocols';
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { ReactNode, Component } from 'react';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
+ import { SlotConfigType } from '@ant-design/x/es/sender/interface';
7
8
  import { Client, Assistant, CreateAssistantOptions, UpdateAssistantOptions } from '@axiom-lattice/client-sdk';
8
9
  import { Prompts } from '@ant-design/x';
9
10
  import { GetProp, ThemeConfig } from 'antd';
10
11
  export { ThemeConfig } from 'antd';
11
- import { SlotConfigType } from '@ant-design/x/es/sender/interface';
12
12
  import { NodeProps, Node } from '@xyflow/react';
13
13
 
14
14
  /**
@@ -490,1649 +490,1677 @@ declare function useAgentGraph(assistantId: string): {
490
490
  declare function useApi(options?: UseApiOptions): UseApiReturn;
491
491
 
492
492
  /**
493
- * Fetches and manages evaluation projects.
494
- *
495
- * @returns Project list, loading state, error, and CRUD operations
496
- *
497
- * @example
498
- * ```tsx
499
- * const { projects, loading, create, update, remove, refresh } = useEvalProjects();
500
- *
501
- * await create({ name: "My Project" });
502
- * ```
503
- */
504
- declare function useEvalProjects(): {
505
- projects: unknown[];
506
- loading: boolean;
507
- error: Error | null;
508
- create: (data: Record<string, unknown>) => Promise<unknown>;
509
- update: (id: string, patch: Record<string, unknown>) => Promise<void>;
510
- remove: (id: string) => Promise<void>;
511
- refresh: () => Promise<void>;
512
- };
513
-
514
- /**
515
- * Fetches and manages evaluation suites within a project.
516
- *
517
- * @param projectId - The project ID to fetch suites for
518
- * @returns Suite list, loading state, error, and CRUD operations
519
- *
520
- * @example
521
- * ```tsx
522
- * const { suites, loading, create, remove } = useEvalSuites("proj-123");
523
- *
524
- * await create("proj-123", { name: "Accuracy Suite" });
525
- * ```
493
+ * Quick prompt item for quick prompt components
526
494
  */
527
- declare function useEvalSuites(projectId: string): {
528
- suites: unknown[];
529
- loading: boolean;
530
- error: Error | null;
531
- create: (pid: string, data: Record<string, unknown>) => Promise<unknown>;
532
- update: (pid: string, id: string, patch: Record<string, unknown>) => Promise<void>;
533
- remove: (pid: string, id: string) => Promise<void>;
534
- refresh: () => Promise<void>;
535
- };
536
-
495
+ interface QuickPromptItem {
496
+ key: string;
497
+ icon?: ReactNode;
498
+ label: string;
499
+ description?: string;
500
+ content: SlotConfigType[];
501
+ }
537
502
  /**
538
- * Fetches and manages evaluation cases within a suite.
539
- *
540
- * @param projectId - The project ID the suite belongs to
541
- * @param suiteId - The suite ID to fetch cases for
542
- * @returns Case list, loading state, error, and CRUD operations
543
- *
544
- * @example
545
- * ```tsx
546
- * const { cases, loading, create } = useEvalCases("proj-123", "suite-456");
547
- *
548
- * await create("proj-123", "suite-456", { question: "What is 2+2?", answer: "4" });
549
- * ```
503
+ * Quick prompt category for organizing prompt items
550
504
  */
551
- declare function useEvalCases(projectId: string, suiteId: string): {
552
- cases: unknown[];
553
- loading: boolean;
554
- error: Error | null;
555
- create: (pid: string, sid: string, data: Record<string, unknown>) => Promise<unknown>;
556
- update: (pid: string, sid: string, id: string, patch: Record<string, unknown>) => Promise<void>;
557
- remove: (pid: string, sid: string, id: string) => Promise<void>;
558
- refresh: () => Promise<void>;
559
- };
560
-
505
+ interface QuickPromptCategory {
506
+ key: string;
507
+ title: string;
508
+ icon?: ReactNode;
509
+ color?: string;
510
+ items: QuickPromptItem[];
511
+ }
561
512
  /**
562
- * Fetches and manages evaluation runs, optionally scoped to a project.
563
- *
564
- * @param projectId - Optional project ID to filter runs by project
565
- * @returns Run list, loading state, error, and operations (start, abort, remove)
566
- *
567
- * @example
568
- * ```tsx
569
- * const { runs, loading, start, abort } = useEvalRuns("proj-123");
570
- *
571
- * const result = await start("proj-123");
572
- * ```
513
+ * Middleware tool definition
573
514
  */
574
- declare function useEvalRuns(projectId?: string): {
575
- runs: unknown[];
576
- loading: boolean;
577
- error: Error | null;
578
- start: (pid: string) => Promise<{
579
- run_id: string;
580
- }>;
581
- abort: (runId: string) => Promise<void>;
582
- remove: (runId: string) => Promise<void>;
583
- refresh: () => Promise<void>;
584
- };
585
-
515
+ interface MiddlewareToolDefinition {
516
+ id: string;
517
+ name: string;
518
+ description: string;
519
+ }
586
520
  /**
587
- * Streams real-time progress of an evaluation run via SSE.
588
- *
589
- * @param runId - The evaluation run ID to stream, or `null` to disable streaming
590
- * @returns Status, progress counters, connection state, and a stop function
591
- *
592
- * @example
593
- * ```tsx
594
- * const { status, progress, connected, stopStreaming } = useEvalRunStream("run-789");
595
- * // progress: { completed: 5, total: 10, passed: 4, failed: 1 }
596
- * ```
521
+ * JSON Schema property definition for middleware config
597
522
  */
598
- declare function useEvalRunStream(runId: string | null): {
599
- status: string;
600
- progress: {
601
- completed: number;
602
- total: number;
603
- passed: number;
604
- failed: number;
523
+ interface MiddlewareConfigSchemaProperty {
524
+ type: "string" | "number" | "integer" | "boolean" | "object" | "array";
525
+ title?: string;
526
+ description?: string;
527
+ default?: any;
528
+ enum?: string[];
529
+ enumLabels?: Record<string, string>;
530
+ minimum?: number;
531
+ maximum?: number;
532
+ minLength?: number;
533
+ maxLength?: number;
534
+ pattern?: string;
535
+ format?: string;
536
+ widget?: "input" | "textarea" | "select" | "segmented" | "switch" | "numberInput" | "skillSelect" | "databaseSelect" | "metricsSelect" | "topologyEdgeBuilder" | "collectionSelect" | "connectionSelect";
537
+ items?: {
538
+ type: string;
605
539
  };
606
- connected: boolean;
607
- stopStreaming: () => void;
608
- };
609
-
540
+ }
610
541
  /**
611
- * Provider component for the Axiom Lattice client
612
- * @param props - Provider props
613
- * @returns Provider component
542
+ * JSON Schema for middleware configuration
614
543
  */
615
- declare function AxiomLatticeProvider({ config, onUnauthorized, children, }: AxiomLatticeProviderProps): react_jsx_runtime.JSX.Element;
616
- interface UseAxiomLatticeOptions {
617
- assistantId?: string | null;
544
+ interface MiddlewareConfigSchema {
545
+ type: "object";
546
+ title?: string;
547
+ description?: string;
548
+ required?: string[];
549
+ properties: Record<string, MiddlewareConfigSchemaProperty>;
618
550
  }
619
551
  /**
620
- * Hook to get a client for a specific assistant
621
- * @param assistantId - The assistant ID
622
- * @returns Client instance for the assistant
623
- * @throws Error if used outside of AxiomLatticeProvider
552
+ * Middleware type definition
624
553
  */
625
- declare function useClient(assistantId: string): Client;
554
+ interface MiddlewareTypeDefinition {
555
+ type: string;
556
+ name: string;
557
+ description: string;
558
+ icon?: ReactNode;
559
+ schema?: MiddlewareConfigSchema;
560
+ defaultConfig?: Record<string, any>;
561
+ tools?: MiddlewareToolDefinition[];
562
+ connectionSchema?: {
563
+ fields: Record<string, unknown>;
564
+ hasTest?: boolean;
565
+ hasDiscover?: boolean;
566
+ resourceLabel?: string;
567
+ };
568
+ }
626
569
  /**
627
- * Hook to access the Axiom Lattice client
628
- * @returns The Axiom Lattice client
629
- * @throws Error if used outside of AxiomLatticeProvider
630
- * @deprecated Use useClient(assistantId) instead
570
+ * Middleware type for configuration
631
571
  */
632
- declare function useAxiomLattice({ assistantId, }?: UseAxiomLatticeOptions): Client;
633
-
572
+ interface MiddlewareConfigDefinition {
573
+ id: string;
574
+ type: string;
575
+ name: string;
576
+ description: string;
577
+ enabled: boolean;
578
+ config: Record<string, any>;
579
+ /** 可选:限制该中间件暴露的工具列表。不配置则默认暴露所有工具 */
580
+ allowedTools?: string[];
581
+ tools?: MiddlewareToolDefinition[];
582
+ }
634
583
  /**
635
- * Context value for AgentThreadContext
584
+ * Sidebar menu item type
636
585
  */
637
- interface AgentThreadContextValue<T extends UseChatOptions> {
638
- state: ChatStateWithAgent;
639
- sendMessage: (data: {
640
- input?: {
641
- message: string;
642
- files?: {
643
- name: string;
644
- id: string;
645
- }[];
646
- };
647
- command?: {
648
- resume?: {
649
- action: string;
650
- data: Record<string, any> & {
651
- config?: {
652
- thread_id?: string;
653
- work_log_id?: string;
654
- };
655
- };
656
- message: string;
657
- };
658
- update?: any;
659
- send?: {
660
- node: string;
661
- input: any;
662
- };
663
- };
664
- streaming?: boolean;
665
- mode?: 'collect' | 'followup' | 'steer';
666
- }) => Promise<void>;
667
- stopStreaming: () => void;
668
- resumeStream: (messageId?: string) => () => void;
669
- loadMessages: (limit?: number) => Promise<void>;
670
- clearMessages: () => void;
671
- clearError: () => void;
672
- customRunConfig: Record<string, any>;
673
- updateCustomRunConfig: (config: Record<string, any>) => void;
674
- removePendingMessage: (messageId: string) => Promise<boolean>;
675
- abortAgent: () => Promise<void>;
586
+ type SideMenuItemType = "drawer" | "route" | "action";
587
+ interface ResourceFolderConfig {
588
+ name: string;
589
+ displayName?: string;
590
+ allowUpload: boolean;
676
591
  }
677
592
  /**
678
- * Props for AgentThreadProvider
593
+ * Sidebar menu item configuration
679
594
  */
680
- interface AgentThreadProviderProps<T extends UseChatOptions> {
681
- threadId: string | null;
682
- assistantId?: string;
683
- options?: T;
684
- children: ReactNode;
685
- onToolCompleted?: (toolName: string) => void;
686
- onStreamCompleted?: () => void;
687
- }
688
595
  /**
689
- * Provider component for AgentThreadContext.
690
- * Manages all agent thread state and operations including message streaming, interrupts,
691
- * queue management, and agent state polling.
692
- *
693
- * @param props - {@link AgentThreadProviderProps}
694
- * @param props.threadId - The ID of the thread to manage. If `null`, the provider renders nothing.
695
- * @param props.assistantId - The assistant ID to associate with this thread. Falls back to the client's assistant ID if omitted.
696
- * @param props.options - Configuration options for chat behavior (streaming, resume stream polling, initial messages, etc.).
697
- * @param props.children - React children to render within the thread context.
698
- * @param props.onToolCompleted - Callback invoked each time a tool call completes, receiving the tool name.
699
- * @param props.onStreamCompleted - Callback invoked when the SSE stream completes for any message.
700
- *
701
- * @returns A React context provider wrapping children with {@link AgentThreadContext.Provider}, or `null` if no `threadId` is provided.
702
- */
703
- declare function AgentThreadProvider<T extends UseChatOptions>({ threadId, assistantId, options, children, onToolCompleted, onStreamCompleted, }: AgentThreadProviderProps<T>): react_jsx_runtime.JSX.Element | null;
704
- /**
705
- * Hook to access AgentThreadContext.
706
- *
707
- * @param T - The {@link UseChatOptions} type parameter, allowing typed access to options.
708
- * @returns Agent thread context value of type {@link AgentThreadContextValue}.
709
- * @throws {Error} If used outside of an {@link AgentThreadProvider}.
596
+ * Sidebar menu item configuration.
710
597
  *
711
- * @example
712
- * ```tsx
713
- * const { state, sendMessage, stopStreaming, abortAgent } = useAgentThreadContext();
598
+ * Three item types:
599
+ * - `"action"` — clickable button, set `builtin` for predefined behaviors
600
+ * - `"drawer"` opens a slide-out panel, set `content` + `title`
601
+ * - `"route"` — opens a GenUI-registered component in the SideApp area
714
602
  *
715
- * await sendMessage({ input: { message: 'Hello!' } });
603
+ * When providing `sideMenuItems` or `workspaceMenuItems` to `LatticeChatShellConfig`,
604
+ * your array **completely replaces** the defaults. Import `DEFAULT_MENU_ITEMS` or
605
+ * `DEFAULT_WORKSPACE_MENU_ITEMS` to selectively include built-in items:
716
606
  * ```
717
- */
718
- declare function useAgentThreadContext<T extends UseChatOptions>(): AgentThreadContextValue<T>;
719
-
720
- interface UserTenantInfo {
721
- tenantId: string;
722
- role: string;
723
- tenant?: Tenant;
724
- }
725
- interface PersonalAssistantInfo {
726
- assistantId: string;
727
- projectId: string;
728
- workspaceId: string;
729
- /** tenantId for debugging cross-tenant leakage */
730
- tenantId?: string | null;
731
- }
732
- interface AuthContextValue {
733
- user: User | null;
734
- tenants: UserTenantInfo[];
735
- currentTenant: Tenant | null;
736
- personalAssistant: PersonalAssistantInfo | null;
737
- setPersonalAssistant: (info: PersonalAssistantInfo | null) => void;
738
- isAuthenticated: boolean;
739
- isLoading: boolean;
740
- error: string | null;
741
- login: (email: string, password: string) => Promise<{
742
- requiresTenantSelection: boolean;
743
- hasTenants: boolean;
744
- }>;
745
- register: (email: string, password: string, name: string) => Promise<{
746
- message: string;
747
- token?: string;
748
- }>;
749
- logout: () => void;
750
- selectTenant: (tenantId: string) => Promise<void>;
751
- fetchUserTenants: () => Promise<void>;
752
- refreshUser: () => Promise<void>;
753
- clearError: () => void;
754
- changePassword: (currentPassword: string, newPassword: string) => Promise<void>;
755
- }
756
- /**
757
- * Hook to access authentication context. Must be used within an {@link AuthProvider}.
758
- *
759
- * @description
760
- * Provides the full auth state and all auth operations (login, register, logout, tenant selection, etc.).
761
- * Throws an error if no {@link AuthProvider} is found in the component tree. For optional auth,
762
- * use {@link useAuthOptional} instead.
763
- *
764
- * @returns The current {@link AuthContextValue} containing user, tenants, auth state, and auth actions.
765
- *
766
- * @throws {Error} If used outside of an {@link AuthProvider}.
767
- *
768
- * @example
769
- * ```tsx
770
- * const { user, isAuthenticated, login, logout } = useAuth();
771
- *
772
- * const handleLogin = async () => {
773
- * const result = await login('user@example.com', 'password');
774
- * if (result.requiresTenantSelection) {
775
- * // Show tenant picker
776
- * }
777
- * };
607
+ * sideMenuItems: DEFAULT_MENU_ITEMS.filter(i => i.id === "thread-history")
778
608
  * ```
779
609
  */
780
- declare const useAuth: () => AuthContextValue;
781
- /**
782
- * Optional version of useAuth that returns null instead of throwing when AuthProvider is not present.
783
- * Use this when authentication is optional for the component.
784
- *
785
- * @example
786
- * // For required auth - throws if no provider
787
- * const { user } = useAuth();
788
- *
789
- * // For optional auth - returns null if no provider
790
- * const user = useAuthOptional()?.user;
791
- */
792
- declare const useAuthOptional: () => AuthContextValue | null;
610
+ interface SideMenuItemConfig {
611
+ /** Unique identifier for the menu item */
612
+ id: string;
613
+ /** Type of the menu item - drawer or route (SideApp) */
614
+ type: SideMenuItemType;
615
+ /** Display name of the menu item */
616
+ name: string;
617
+ /** Icon component for the menu item */
618
+ icon?: ReactNode;
619
+ /** Order for sorting menu items (lower values first) */
620
+ order?: number;
621
+ /** Whether this is a builtin menu item (new-analysis, thread-history, assistants, skill, skills, tools, workspace, settings, database, metrics, mcp, projects, logout, switch-tenant) */
622
+ builtin?: "new-analysis" | "thread-history" | "assistants" | "skill" | "skills" | "tools" | "workspace" | "settings" | "database" | "metrics" | "mcp" | "projects" | "logout" | "switch-tenant";
623
+ /**
624
+ * Menu group for organizing items
625
+ */
626
+ group?: string;
627
+ /**
628
+ * Whether the menu item is enabled (can be toggled)
629
+ * Defaults to true
630
+ */
631
+ enabled?: boolean;
632
+ /** Content config from DB (for custom menu items) */
633
+ contentConfig?: Record<string, unknown>;
634
+ /** Content to display inside the drawer (for drawer type) */
635
+ content?: ReactNode;
636
+ /** Drawer title (for drawer type) */
637
+ title?: string;
638
+ /** Drawer width in pixels or percentage (for drawer type) */
639
+ width?: string | number;
640
+ /**
641
+ * Whether to display drawer content inline in expanded sidebar mode
642
+ * When true, content shows below the menu item instead of in a drawer
643
+ * Defaults to false, but true for "workspace" builtin
644
+ */
645
+ inline?: boolean;
646
+ /**
647
+ * Maximum height for inline drawer content in pixels
648
+ * Only applies when inline is true
649
+ * Defaults to 400
650
+ */
651
+ inlineMaxHeight?: number;
652
+ /**
653
+ * Whether inline drawer is expanded by default
654
+ * Only applies when inline is true
655
+ * Defaults to false
656
+ */
657
+ inlineDefaultExpanded?: boolean;
658
+ /** Component to render in SideApp (for route type) */
659
+ sideAppComponent?: ReactNode;
660
+ }
793
661
  /**
794
- * Props for {@link AuthProvider}.
662
+ * Lattice Chat Shell configuration interface
795
663
  */
796
- interface AuthProviderProps {
797
- /** Child components that will have access to the auth context. */
798
- children: ReactNode;
799
- /** Base URL of the gateway API (e.g., `http://localhost:3000`). */
664
+ interface LatticeChatShellConfig {
665
+ /**
666
+ * Base URL for the API
667
+ */
800
668
  baseURL: string;
801
- /** Called after a successful login with the user and their tenant memberships. */
802
- onLoginSuccess?: (user: User, tenants: UserTenantInfo[]) => void;
803
- /** Called after a tenant is successfully selected, passing the selected tenant. */
804
- onTenantSelected?: (tenant: Tenant) => void;
805
- /** Called after the user logs out. */
806
- onLogout?: () => void;
669
+ /**
670
+ * API key for authentication (optional)
671
+ */
672
+ apiKey?: string;
673
+ /**
674
+ * Transport method (Server-Sent Events or WebSocket)
675
+ */
676
+ transport?: "sse" | "ws";
677
+ /**
678
+ * Request timeout in milliseconds (optional)
679
+ */
680
+ timeout?: number;
681
+ /**
682
+ * Additional headers to include in requests (optional)
683
+ */
684
+ headers?: Record<string, string>;
685
+ /**
686
+ * Whether users can create new threads from the UI
687
+ * Defaults to true
688
+ */
689
+ enableThreadCreation?: boolean;
690
+ /**
691
+ * Whether users can view the thread list in the sidebar
692
+ * Defaults to true
693
+ */
694
+ enableThreadList?: boolean;
695
+ assistantId?: string;
696
+ showSideMenu?: boolean;
697
+ /**
698
+ * URL of the global shared sandbox, this is used to access the global shared sandbox
699
+ * if not provided, sandbox will be created in the agent's sandbox
700
+ */
701
+ globalSharedSandboxURL?: string;
702
+ /**
703
+ * Available middleware types that can be configured for agents
704
+ * Each middleware type defines its name, description, and default configuration
705
+ * If not provided, default middleware types will be used
706
+ */
707
+ availableMiddlewareTypes?: MiddlewareTypeDefinition[];
708
+ /**
709
+ * Whether users can create new assistants
710
+ * Defaults to true
711
+ */
712
+ enableAssistantCreation?: boolean;
713
+ /**
714
+ * Whether users can edit existing assistants
715
+ * Defaults to true
716
+ */
717
+ enableAssistantEditing?: boolean;
718
+ /**
719
+ * Whether to enable workspace and project management
720
+ * When enabled, shows workspace selector in header and file browser
721
+ * Defaults to false
722
+ */
723
+ enableWorkspace?: boolean;
724
+ /**
725
+ * Whether to load custom menu items from the database (API /api/menu-items).
726
+ * When enabled, WorkspaceResourceManager fetches per-tenant custom menu items
727
+ * and merges them with built-in defaults.
728
+ * Defaults to true.
729
+ */
730
+ enableCustomMenu?: boolean;
731
+ /**
732
+ * Resource folders configuration for workspace
733
+ * Each folder represents a section in the workspace assets panel
734
+ * If not provided, defaults to a single root folder with upload enabled
735
+ */
736
+ resourceFolders?: ResourceFolderConfig[];
737
+ /**
738
+ * Chat sidebar menu items. When provided, completely replaces the
739
+ * default built-in items (New Analysis, History).
740
+ *
741
+ * To selectively include built-in items, import and filter `DEFAULT_MENU_ITEMS`:
742
+ * ```
743
+ * sideMenuItems: DEFAULT_MENU_ITEMS.filter(i => i.id === "thread-history")
744
+ * ```
745
+ * Omit this field to use all defaults.
746
+ */
747
+ sideMenuItems?: SideMenuItemConfig[];
748
+ /**
749
+ * Workspace menu items. When provided, completely replaces the
750
+ * default workspace items (Projects, Metrics, Database, etc.).
751
+ *
752
+ * To selectively include built-in items, import and filter `DEFAULT_WORKSPACE_MENU_ITEMS`:
753
+ * ```
754
+ * workspaceMenuItems: DEFAULT_WORKSPACE_MENU_ITEMS.filter(
755
+ * i => ["workspace_projects", "assistants"].includes(i.id)
756
+ * )
757
+ * ```
758
+ * Omit this field to use all defaults.
759
+ */
760
+ workspaceMenuItems?: SideMenuItemConfig[];
761
+ /**
762
+ * Whether to enable the database picker slot in the chat sender
763
+ * When enabled, shows a database selection button in the sender footer
764
+ * Defaults to true
765
+ */
766
+ enableDatabaseSlot?: boolean;
767
+ /**
768
+ * Whether to enable the skill picker slot in the chat sender
769
+ * When enabled, shows a skill selection button in the sender footer
770
+ * Defaults to true
771
+ */
772
+ enableSkillSlot?: boolean;
773
+ /**
774
+ * Whether to enable the agent picker slot in the chat sender
775
+ * When enabled, shows an agent selection button in the sender footer
776
+ * Defaults to true
777
+ */
778
+ enableAgentSlot?: boolean;
779
+ /**
780
+ * Whether to enable the metrics datasource picker slot in the chat sender
781
+ * When enabled, shows a metrics datasource selection button in the sender footer
782
+ * Defaults to true
783
+ */
784
+ enableMetricsDataSourceSlot?: boolean;
785
+ /**
786
+ * Whether to enable the model selector in the chat sender
787
+ * When enabled, shows a model selection dropdown in the sender footer
788
+ * Defaults to false
789
+ */
790
+ enableModelSelector?: boolean;
791
+ /**
792
+ * Sidebar display mode
793
+ * - "icon": Show only icons (default)
794
+ * - "expanded": Show icons with labels and groups
795
+ * Defaults to "icon"
796
+ */
797
+ sidebarMode?: "icon" | "expanded";
798
+ /**
799
+ * Whether sidebar is expanded by default (only applies when sidebarMode is "expanded")
800
+ * Defaults to true
801
+ */
802
+ sidebarDefaultExpanded?: boolean;
803
+ /**
804
+ * Whether workspace menu is expanded by default
805
+ * Defaults to true
806
+ */
807
+ workspaceMenuDefaultExpanded?: boolean;
808
+ /**
809
+ * Whether to show the expand/collapse toggle button
810
+ * Defaults to true
811
+ */
812
+ sidebarShowToggle?: boolean;
813
+ /**
814
+ * Whether to show the "New Analysis" button in expanded sidebar
815
+ * Defaults to true
816
+ */
817
+ sidebarShowNewAnalysis?: boolean;
818
+ /**
819
+ * Endpoint for fetching middleware type definitions from API.
820
+ * Falls back to DEFAULT_MIDDLEWARE_TYPES on failure.
821
+ */
822
+ middlewareTypesEndpoint?: string;
823
+ /**
824
+ * Logo text displayed in expanded sidebar
825
+ * Defaults to "Lattice"
826
+ */
827
+ sidebarLogoText?: string;
828
+ /**
829
+ * Custom logo icon component
830
+ * If not provided, defaults to Cpu icon
831
+ */
832
+ sidebarLogoIcon?: React__default.ReactNode;
833
+ /**
834
+ * Custom quick prompts data for quick prompt components
835
+ * Allows registering custom prompt categories and items via shell config
836
+ * If not provided, default prompt data will be used
837
+ */
838
+ quickPromptsData?: QuickPromptCategory[];
807
839
  }
808
840
  /**
809
- * Authentication context provider. Wraps the application to provide auth state and operations
810
- * to all descendant components via {@link useAuth} and {@link useAuthOptional}.
811
- *
812
- * @description
813
- * Manages the full authentication lifecycle including:
814
- * - **Login / Register**: Sends credentials to the gateway API and stores the returned user, tenants, and token in `sessionStorage`.
815
- * - **Session restoration**: On mount, reads previously stored user data from `sessionStorage` and also refreshes the tenant list to catch any admin-side role assignments.
816
- * - **Tenant selection**: Calls the gateway API to select a tenant and stores the tenant data.
817
- * - **Logout**: Clears all auth state and `sessionStorage`.
818
- * - **Change password**: Proxies to the gateway password change endpoint.
819
- * - **Token expiration**: Automatically logs out when the gateway returns a 401 with an expired token message.
820
- *
821
- * @param props - {@link AuthProviderProps}
822
- * @param props.children - React children to render within the auth context.
823
- * @param props.baseURL - Base URL of the gateway API.
824
- * @param props.onLoginSuccess - Optional callback invoked after a successful login.
825
- * @param props.onTenantSelected - Optional callback invoked after tenant selection.
826
- * @param props.onLogout - Optional callback invoked on logout.
827
- *
828
- * @returns A React context provider wrapping children with {@link AuthContext.Provider}.
829
- *
830
- * @example
831
- * ```tsx
832
- * <AuthProvider
833
- * baseURL="http://localhost:3000"
834
- * onLoginSuccess={(user) => console.log('Logged in:', user.email)}
835
- * onLogout={() => window.location.reload()}
836
- * >
837
- * <App />
838
- * </AuthProvider>
839
- * ```
841
+ * Lattice Chat Shell context value interface
840
842
  */
841
- declare const AuthProvider: React__default.FC<AuthProviderProps>;
842
-
843
+ interface LatticeChatShellContextValue {
844
+ /**
845
+ * Current configuration
846
+ */
847
+ config: LatticeChatShellConfig;
848
+ /**
849
+ * Update the entire configuration
850
+ */
851
+ updateConfig: (config: Partial<LatticeChatShellConfig>) => void;
852
+ /**
853
+ * Update a specific configuration value
854
+ */
855
+ updateConfigValue: <K extends keyof LatticeChatShellConfig>(key: K, value: LatticeChatShellConfig[K]) => void;
856
+ /**
857
+ * Reset configuration to defaults
858
+ */
859
+ resetConfig: () => void;
860
+ /**
861
+ * Whether the settings modal is open
862
+ */
863
+ settingsModalOpen: boolean;
864
+ /**
865
+ * Set the settings modal open state
866
+ */
867
+ setSettingsModalOpen: (open: boolean) => void;
868
+ }
843
869
  /**
844
- * Login Form Components
845
- * Uses base styles from design system
870
+ * Default middleware type definitions with JSON Schema for configuration
846
871
  */
847
-
848
- interface LoginFormProps {
849
- onSuccess?: () => void;
850
- onCancel?: () => void;
851
- logo?: React__default.ReactNode;
852
- title?: string;
853
- subtitle?: string;
854
- footer?: React__default.ReactNode;
855
- className?: string;
856
- }
857
- declare const LoginForm: React__default.FC<LoginFormProps>;
858
- declare const LoginPage: React__default.FC<any>;
859
- interface RegisterFormProps {
860
- onSuccess?: () => void;
861
- onCancel?: () => void;
862
- logo?: React__default.ReactNode;
863
- title?: string;
864
- subtitle?: string;
865
- footer?: React__default.ReactNode;
866
- className?: string;
867
- }
868
- declare const RegisterForm: React__default.FC<RegisterFormProps>;
869
-
872
+ declare const DEFAULT_MIDDLEWARE_TYPES: MiddlewareTypeDefinition[];
870
873
  /**
871
- * User Profile Components
872
- * Using Axiom Theme with Ant Design
874
+ * Lattice Chat Shell context
873
875
  */
874
-
875
- interface UserProfileProps {
876
- /** Called when user clicks logout */
877
- onLogout?: () => void;
878
- /** Show tenant information */
879
- showTenantSwitcher?: boolean;
880
- /** Custom class name */
881
- className?: string;
882
- }
876
+ declare const LatticeChatShellContext: React__default.Context<LatticeChatShellContextValue>;
883
877
  /**
884
- * User Profile Component
878
+ * Props for LatticeChatShellContextProvider
885
879
  */
886
- declare const UserProfile: React__default.FC<UserProfileProps>;
887
- interface ProtectedRouteProps {
888
- children: React__default.ReactNode;
889
- /** Component to show when not authenticated */
890
- fallback?: React__default.ReactNode;
891
- /** Redirect URL (if using react-router) */
892
- redirectTo?: string;
880
+ interface LatticeChatShellContextProviderProps {
881
+ /**
882
+ * Children components
883
+ */
884
+ children: ReactNode;
885
+ /**
886
+ * Initial configuration (optional)
887
+ */
888
+ initialConfig?: Partial<LatticeChatShellConfig>;
889
+ /**
890
+ * Whether to persist configuration to localStorage (optional, default: false)
891
+ */
892
+ persistToLocalStorage?: boolean;
893
+ /**
894
+ * LocalStorage key for persisting configuration (optional, default: "lattice_chat_shell_config")
895
+ */
896
+ localStorageKey?: string;
893
897
  }
894
898
  /**
895
- * Protected Route Component
896
- * Shows loading state, redirects, or fallback when not authenticated
899
+ * Provider component for LatticeChatShellContext
900
+ * Manages Lattice Chat Shell configuration
897
901
  */
898
- declare const ProtectedRoute: React__default.FC<ProtectedRouteProps>;
899
-
902
+ declare const LatticeChatShellContextProvider: ({ children, initialConfig, persistToLocalStorage, localStorageKey, }: LatticeChatShellContextProviderProps) => react_jsx_runtime.JSX.Element;
900
903
  /**
901
- * Tenant Selector Components
902
- * Uses unified auth styles from design system
904
+ * Hook to access LatticeChatShellContext
905
+ * @returns Lattice Chat Shell context value
906
+ * @throws Error if used outside of LatticeChatShellContextProvider
903
907
  */
908
+ declare const useLatticeChatShellContext: () => LatticeChatShellContextValue;
904
909
 
905
- interface TenantSelectorProps {
906
- tenants: Tenant[];
907
- currentTenantId?: string | null;
908
- onSelect: (tenant: Tenant) => void;
909
- onLogout?: () => void;
910
- isLoading?: boolean;
911
- className?: string;
912
- title?: string;
913
- description?: string;
914
- }
915
- declare const TenantSelector: React__default.FC<TenantSelectorProps>;
916
-
917
- interface ChangePasswordModalProps {
918
- open: boolean;
919
- onClose: () => void;
920
- onSuccess?: () => void;
910
+ interface UseMiddlewareTypesResult {
911
+ middlewareTypes: MiddlewareTypeDefinition[];
912
+ isLoading: boolean;
913
+ isFallback: boolean;
921
914
  }
922
- declare const ChangePasswordModal: React__default.FC<ChangePasswordModalProps>;
915
+ /**
916
+ * Fetch middleware types from API, fallback to DEFAULT_MIDDLEWARE_TYPES on failure.
917
+ */
918
+ declare function useMiddlewareTypes(endpoint?: string): UseMiddlewareTypesResult;
923
919
 
924
- interface UseTenantsOptions {
925
- baseURL: string;
926
- token?: string;
927
- }
928
- interface UseTenantsReturn {
929
- tenants: Tenant[];
930
- isLoading: boolean;
931
- error: string | null;
920
+ /**
921
+ * Fetches and manages evaluation projects.
922
+ *
923
+ * @returns Project list, loading state, error, and CRUD operations
924
+ *
925
+ * @example
926
+ * ```tsx
927
+ * const { projects, loading, create, update, remove, refresh } = useEvalProjects();
928
+ *
929
+ * await create({ name: "My Project" });
930
+ * ```
931
+ */
932
+ declare function useEvalProjects(): {
933
+ projects: unknown[];
934
+ loading: boolean;
935
+ error: Error | null;
936
+ create: (data: Record<string, unknown>) => Promise<unknown>;
937
+ update: (id: string, patch: Record<string, unknown>) => Promise<void>;
938
+ remove: (id: string) => Promise<void>;
932
939
  refresh: () => Promise<void>;
933
- getTenantById: (id: string) => Tenant | undefined;
934
- }
940
+ };
941
+
935
942
  /**
936
- * Fetches and manages a list of tenants from the API.
943
+ * Fetches and manages evaluation suites within a project.
937
944
  *
938
- * @param options - Configuration options
939
- * @param options.baseURL - The base URL of the API gateway
940
- * @param options.token - Optional authentication token
941
- * @returns Tenant list, loading state, error, refresh function, and lookup helper
945
+ * @param projectId - The project ID to fetch suites for
946
+ * @returns Suite list, loading state, error, and CRUD operations
942
947
  *
943
948
  * @example
944
949
  * ```tsx
945
- * const { tenants, isLoading, error, refresh, getTenantById } = useTenants({
946
- * baseURL: "https://api.example.com",
947
- * token: "your-auth-token",
948
- * });
950
+ * const { suites, loading, create, remove } = useEvalSuites("proj-123");
951
+ *
952
+ * await create("proj-123", { name: "Accuracy Suite" });
949
953
  * ```
950
954
  */
951
- declare function useTenants(options: UseTenantsOptions): UseTenantsReturn;
952
- interface UseUsersOptions {
953
- baseURL: string;
954
- tenantId: string;
955
- token?: string;
956
- }
957
- interface UseUsersReturn {
958
- users: _axiom_lattice_protocols.User[];
959
- isLoading: boolean;
960
- error: string | null;
955
+ declare function useEvalSuites(projectId: string): {
956
+ suites: unknown[];
957
+ loading: boolean;
958
+ error: Error | null;
959
+ create: (pid: string, data: Record<string, unknown>) => Promise<unknown>;
960
+ update: (pid: string, id: string, patch: Record<string, unknown>) => Promise<void>;
961
+ remove: (pid: string, id: string) => Promise<void>;
961
962
  refresh: () => Promise<void>;
962
- searchByEmail: (email: string) => Promise<_axiom_lattice_protocols.User | null>;
963
- }
963
+ };
964
+
964
965
  /**
965
- * Fetches and manages a list of users within a tenant.
966
+ * Fetches and manages evaluation cases within a suite.
966
967
  *
967
- * @param options - Configuration options
968
- * @param options.baseURL - The base URL of the API gateway
969
- * @param options.tenantId - The tenant ID to fetch users for
970
- * @param options.token - Optional authentication token
971
- * @returns User list, loading state, error, refresh function, and email search helper
968
+ * @param projectId - The project ID the suite belongs to
969
+ * @param suiteId - The suite ID to fetch cases for
970
+ * @returns Case list, loading state, error, and CRUD operations
972
971
  *
973
972
  * @example
974
973
  * ```tsx
975
- * const { users, isLoading, error, searchByEmail } = useUsers({
976
- * baseURL: "https://api.example.com",
977
- * tenantId: "tenant-123",
978
- * });
974
+ * const { cases, loading, create } = useEvalCases("proj-123", "suite-456");
979
975
  *
980
- * const user = await searchByEmail("user@example.com");
976
+ * await create("proj-123", "suite-456", { question: "What is 2+2?", answer: "4" });
981
977
  * ```
982
978
  */
983
- declare function useUsers(options: UseUsersOptions): UseUsersReturn;
979
+ declare function useEvalCases(projectId: string, suiteId: string): {
980
+ cases: unknown[];
981
+ loading: boolean;
982
+ error: Error | null;
983
+ create: (pid: string, sid: string, data: Record<string, unknown>) => Promise<unknown>;
984
+ update: (pid: string, sid: string, id: string, patch: Record<string, unknown>) => Promise<void>;
985
+ remove: (pid: string, sid: string, id: string) => Promise<void>;
986
+ refresh: () => Promise<void>;
987
+ };
984
988
 
985
- interface ChatErrorBoundaryProps {
986
- /** Display name for this boundary (shown in error messages) */
987
- name?: string;
988
- children: React__default.ReactNode;
989
- fallback?: React__default.ReactNode;
990
- onError?: (error: Error, errorInfo: React__default.ErrorInfo) => void;
991
- }
992
- interface ChatErrorBoundaryState {
993
- hasError: boolean;
989
+ /**
990
+ * Fetches and manages evaluation runs, optionally scoped to a project.
991
+ *
992
+ * @param projectId - Optional project ID to filter runs by project
993
+ * @returns Run list, loading state, error, and operations (start, abort, remove)
994
+ *
995
+ * @example
996
+ * ```tsx
997
+ * const { runs, loading, start, abort } = useEvalRuns("proj-123");
998
+ *
999
+ * const result = await start("proj-123");
1000
+ * ```
1001
+ */
1002
+ declare function useEvalRuns(projectId?: string): {
1003
+ runs: unknown[];
1004
+ loading: boolean;
994
1005
  error: Error | null;
995
- errorInfo: React__default.ErrorInfo | null;
996
- retryKey: number;
1006
+ start: (pid: string) => Promise<{
1007
+ run_id: string;
1008
+ }>;
1009
+ abort: (runId: string) => Promise<void>;
1010
+ remove: (runId: string) => Promise<void>;
1011
+ refresh: () => Promise<void>;
1012
+ };
1013
+
1014
+ /**
1015
+ * Streams real-time progress of an evaluation run via SSE.
1016
+ *
1017
+ * @param runId - The evaluation run ID to stream, or `null` to disable streaming
1018
+ * @returns Status, progress counters, connection state, and a stop function
1019
+ *
1020
+ * @example
1021
+ * ```tsx
1022
+ * const { status, progress, connected, stopStreaming } = useEvalRunStream("run-789");
1023
+ * // progress: { completed: 5, total: 10, passed: 4, failed: 1 }
1024
+ * ```
1025
+ */
1026
+ declare function useEvalRunStream(runId: string | null): {
1027
+ status: string;
1028
+ progress: {
1029
+ completed: number;
1030
+ total: number;
1031
+ passed: number;
1032
+ failed: number;
1033
+ };
1034
+ connected: boolean;
1035
+ stopStreaming: () => void;
1036
+ };
1037
+
1038
+ /**
1039
+ * Provider component for the Axiom Lattice client
1040
+ * @param props - Provider props
1041
+ * @returns Provider component
1042
+ */
1043
+ declare function AxiomLatticeProvider({ config, onUnauthorized, children, }: AxiomLatticeProviderProps): react_jsx_runtime.JSX.Element;
1044
+ interface UseAxiomLatticeOptions {
1045
+ assistantId?: string | null;
997
1046
  }
998
- declare class ChatErrorBoundary extends Component<ChatErrorBoundaryProps, ChatErrorBoundaryState> {
999
- constructor(props: ChatErrorBoundaryProps);
1000
- static getDerivedStateFromError(error: Error): Partial<ChatErrorBoundaryState>;
1001
- componentDidCatch(error: Error, errorInfo: React__default.ErrorInfo): void;
1002
- handleRetry: () => void;
1003
- handleCopyError: () => void;
1004
- render(): React__default.ReactNode;
1047
+ /**
1048
+ * Hook to get a client for a specific assistant
1049
+ * @param assistantId - The assistant ID
1050
+ * @returns Client instance for the assistant
1051
+ * @throws Error if used outside of AxiomLatticeProvider
1052
+ */
1053
+ declare function useClient(assistantId: string): Client;
1054
+ /**
1055
+ * Hook to access the Axiom Lattice client
1056
+ * @returns The Axiom Lattice client
1057
+ * @throws Error if used outside of AxiomLatticeProvider
1058
+ * @deprecated Use useClient(assistantId) instead
1059
+ */
1060
+ declare function useAxiomLattice({ assistantId, }?: UseAxiomLatticeOptions): Client;
1061
+
1062
+ /**
1063
+ * Context value for AgentThreadContext
1064
+ */
1065
+ interface AgentThreadContextValue<T extends UseChatOptions> {
1066
+ state: ChatStateWithAgent;
1067
+ sendMessage: (data: {
1068
+ input?: {
1069
+ message: string;
1070
+ files?: {
1071
+ name: string;
1072
+ id: string;
1073
+ }[];
1074
+ };
1075
+ command?: {
1076
+ resume?: {
1077
+ action: string;
1078
+ data: Record<string, any> & {
1079
+ config?: {
1080
+ thread_id?: string;
1081
+ work_log_id?: string;
1082
+ };
1083
+ };
1084
+ message: string;
1085
+ };
1086
+ update?: any;
1087
+ send?: {
1088
+ node: string;
1089
+ input: any;
1090
+ };
1091
+ };
1092
+ streaming?: boolean;
1093
+ mode?: 'collect' | 'followup' | 'steer';
1094
+ }) => Promise<void>;
1095
+ stopStreaming: () => void;
1096
+ resumeStream: (messageId?: string) => () => void;
1097
+ loadMessages: (limit?: number) => Promise<void>;
1098
+ clearMessages: () => void;
1099
+ clearError: () => void;
1100
+ customRunConfig: Record<string, any>;
1101
+ updateCustomRunConfig: (config: Record<string, any>) => void;
1102
+ removePendingMessage: (messageId: string) => Promise<boolean>;
1103
+ abortAgent: () => Promise<void>;
1005
1104
  }
1006
-
1007
1105
  /**
1008
- * Props for the {@link Chating} component — the core chat interface.
1009
- *
1010
- * Controls appearance, sender behavior, empty-state customization, and
1011
- * optional context injection for the agent.
1106
+ * Props for AgentThreadProvider
1012
1107
  */
1013
- interface ChatingProps {
1014
- /** Agent display name shown in the header. */
1015
- name?: string;
1016
- /** Agent description shown in the header. */
1017
- description?: string;
1018
- /** Fallback message used when the user submits only attachments without text. */
1019
- default_submit_message?: string;
1020
- /** Avatar URL or component for the agent. */
1021
- avatar?: string;
1022
- /** Placeholder content rendered inside the attachment upload area. */
1023
- attachment_placeholder?: React__default.ReactNode;
1024
- /** Custom upload endpoint URL. Defaults to the workspace or thread sandbox upload endpoint. */
1025
- uploadAction?: string;
1026
- /** Quick prompt items displayed between messages. */
1027
- senderPromptsItems?: GetProp<typeof Prompts, "items">;
1028
- /** Extra content rendered in the header area. */
1029
- extra?: React__default.ReactNode;
1030
- /** Additional metadata items for the header. */
1031
- extraMeta?: Array<{
1032
- id: string;
1033
- }>;
1034
- /** Whether to show the agent header bar. Default: true. */
1035
- showHeader?: boolean;
1036
- /** Whether to show the message sender input. Default: true. */
1037
- showSender?: boolean;
1038
- /** Whether to show the Human-in-the-Loop (HITL) container. Default: true. */
1039
- showHITL?: boolean;
1040
- /** Whether to show a refresh button in the header. */
1041
- showRefreshButton?: boolean;
1042
- /**
1043
- * Whether to show the model selector in the sender footer.
1044
- * When provided, overrides the shell config's enableModelSelector.
1045
- */
1046
- showModelSelector?: boolean;
1047
- /** Show database picker in sender footer. Overrides shell config enableDatabaseSlot. */
1048
- showDatabaseSlot?: boolean;
1049
- /** Show skill picker in sender footer. Overrides shell config enableSkillSlot. */
1050
- showSkillSlot?: boolean;
1051
- /** Show agent picker in sender footer. Overrides shell config enableAgentSlot. */
1052
- showAgentSlot?: boolean;
1053
- /** Show metrics data source picker in sender footer. Overrides shell config enableMetricsDataSourceSlot. */
1054
- showMetricsDataSourceSlot?: boolean;
1055
- /** Whether to show the greeting empty state when no messages exist. Default: true. */
1056
- showEmptyState?: boolean;
1057
- /** Custom greeting element displayed in the empty state. */
1058
- emptyStateGreeting?: React__default.ReactNode;
1059
- /** Empty state question line. Default: "Ready to turn..." */
1060
- emptyStateQuestion?: string;
1061
- /** Show skill category prompts in empty state. Default: true. */
1062
- showSkillPrompts?: boolean;
1063
- /** Show business analysis prompts in empty state. Default: true. */
1064
- showQuickAnalysis?: boolean;
1065
- /** Welcome prefix text (e.g., "Hey"). */
1066
- welcomePrefix?: string;
1067
- /** Context string injected before the first user message (e.g. workflow context). */
1068
- systemContext?: string;
1069
- /** Auto-send this message when agent becomes idle (thread ready, not loading). */
1070
- initialMessage?: string | null;
1071
- /** Called after initialMessage has been sent. */
1072
- onInitialMessageSent?: () => void;
1108
+ interface AgentThreadProviderProps<T extends UseChatOptions> {
1109
+ threadId: string | null;
1110
+ assistantId?: string;
1111
+ options?: T;
1112
+ children: ReactNode;
1113
+ onToolCompleted?: (toolName: string) => void;
1114
+ onStreamCompleted?: () => void;
1073
1115
  }
1074
1116
  /**
1075
- * Core chat interface component manages sender input, message display,
1076
- * and agent-streaming state for a single assistant thread.
1117
+ * Provider component for AgentThreadContext.
1118
+ * Manages all agent thread state and operations including message streaming, interrupts,
1119
+ * queue management, and agent state polling.
1077
1120
  *
1078
- * Features:
1079
- * - Empty state with greeting and skill/analysis prompt categories
1080
- * - Message sender with file attachment, skill/agent/database pickers, and model selector
1081
- * - Typing cursor animation during streaming
1082
- * - HITL interrupt handling and pending-message display
1083
- * - Auto-send of {@link ChatingProps.systemContext} and {@link ChatingProps.initialMessage}
1084
- * - Transition animations between empty and active states
1121
+ * @param props - {@link AgentThreadProviderProps}
1122
+ * @param props.threadId - The ID of the thread to manage. If `null`, the provider renders nothing.
1123
+ * @param props.assistantId - The assistant ID to associate with this thread. Falls back to the client's assistant ID if omitted.
1124
+ * @param props.options - Configuration options for chat behavior (streaming, resume stream polling, initial messages, etc.).
1125
+ * @param props.children - React children to render within the thread context.
1126
+ * @param props.onToolCompleted - Callback invoked each time a tool call completes, receiving the tool name.
1127
+ * @param props.onStreamCompleted - Callback invoked when the SSE stream completes for any message.
1085
1128
  *
1086
- * @param props - See {@link ChatingProps}.
1087
- * @returns The full chat UI for the active thread.
1129
+ * @returns A React context provider wrapping children with {@link AgentThreadContext.Provider}, or `null` if no `threadId` is provided.
1130
+ */
1131
+ declare function AgentThreadProvider<T extends UseChatOptions>({ threadId, assistantId, options, children, onToolCompleted, onStreamCompleted, }: AgentThreadProviderProps<T>): react_jsx_runtime.JSX.Element | null;
1132
+ /**
1133
+ * Hook to access AgentThreadContext.
1134
+ *
1135
+ * @param T - The {@link UseChatOptions} type parameter, allowing typed access to options.
1136
+ * @returns Agent thread context value of type {@link AgentThreadContextValue}.
1137
+ * @throws {Error} If used outside of an {@link AgentThreadProvider}.
1088
1138
  *
1089
1139
  * @example
1090
1140
  * ```tsx
1091
- * import { Chating } from "@axiom-lattice/react-sdk";
1141
+ * const { state, sendMessage, stopStreaming, abortAgent } = useAgentThreadContext();
1092
1142
  *
1093
- * <Chating
1094
- * name="Data Analyst"
1095
- * showHeader
1096
- * showSender
1097
- * showModelSelector
1098
- * emptyStateQuestion="What data would you like to analyze?"
1099
- * systemContext="You are analyzing sales data from Q4 2024."
1100
- * />
1143
+ * await sendMessage({ input: { message: 'Hello!' } });
1101
1144
  * ```
1102
- *
1103
- * @remarks
1104
- * - Requires the following ancestor context providers: {@link AgentThreadProvider},
1105
- * {@link ChatUIContextProvider}, {@link LatticeChatShellContextProvider},
1106
- * {@link ConversationContextProvider}, {@link AssistantContextProvider}.
1107
- * - Prop-level feature toggles (e.g. `showModelSelector`) take priority over
1108
- * shell-config-level toggles.
1109
- * - Uses {@link useAgentChat} for all agent communication.
1110
1145
  */
1111
- declare const Chating: React__default.FC<ChatingProps>;
1146
+ declare function useAgentThreadContext<T extends UseChatOptions>(): AgentThreadContextValue<T>;
1112
1147
 
1148
+ interface UserTenantInfo {
1149
+ tenantId: string;
1150
+ role: string;
1151
+ tenant?: Tenant;
1152
+ }
1153
+ interface PersonalAssistantInfo {
1154
+ assistantId: string;
1155
+ projectId: string;
1156
+ workspaceId: string;
1157
+ /** tenantId for debugging cross-tenant leakage */
1158
+ tenantId?: string | null;
1159
+ }
1160
+ interface AuthContextValue {
1161
+ user: User | null;
1162
+ tenants: UserTenantInfo[];
1163
+ currentTenant: Tenant | null;
1164
+ personalAssistant: PersonalAssistantInfo | null;
1165
+ setPersonalAssistant: (info: PersonalAssistantInfo | null) => void;
1166
+ isAuthenticated: boolean;
1167
+ isLoading: boolean;
1168
+ error: string | null;
1169
+ login: (email: string, password: string) => Promise<{
1170
+ requiresTenantSelection: boolean;
1171
+ hasTenants: boolean;
1172
+ }>;
1173
+ register: (email: string, password: string, name: string) => Promise<{
1174
+ message: string;
1175
+ token?: string;
1176
+ }>;
1177
+ logout: () => void;
1178
+ selectTenant: (tenantId: string) => Promise<void>;
1179
+ fetchUserTenants: () => Promise<void>;
1180
+ refreshUser: () => Promise<void>;
1181
+ clearError: () => void;
1182
+ changePassword: (currentPassword: string, newPassword: string) => Promise<void>;
1183
+ }
1113
1184
  /**
1114
- * Props for the {@link LatticeChat} component.
1185
+ * Hook to access authentication context. Must be used within an {@link AuthProvider}.
1115
1186
  *
1116
- * Extends {@link ChatingProps} with thread/assistant identification
1117
- * and optional menu/header slots.
1118
- */
1119
- type AgentChatProps = {
1120
- /** The ID of the currently active thread. If absent, a placeholder is shown prompting users to create a conversation. */
1121
- thread_id?: string;
1122
- /** The assistant ID that backs the chat. Required — feeds the {@link AgentThreadProvider}. */
1123
- assistant_id: string;
1124
- /** Optional menu rendered in the left sidebar column. */
1125
- menu?: React__default.ReactNode;
1126
- /** Optional header rendered above the main chat area. */
1127
- header?: React__default.ReactNode;
1128
- /** Optional right-side header content. Replaces the default folder toggle button. Use {@link FilePanelToggle} to include it. */
1129
- headerRight?: React__default.ReactNode;
1130
- /** Show workspace project selector in header. Default true. */
1131
- showProjectSelector?: boolean;
1132
- /** Content shown when no thread is active. Default: "Please create a conversation first". */
1133
- emptyPlaceholder?: React__default.ReactNode;
1134
- } & ChatingProps;
1135
- /**
1136
- * Top-level chat component for a single assistant thread.
1187
+ * @description
1188
+ * Provides the full auth state and all auth operations (login, register, logout, tenant selection, etc.).
1189
+ * Throws an error if no {@link AuthProvider} is found in the component tree. For optional auth,
1190
+ * use {@link useAuthOptional} instead.
1137
1191
  *
1138
- * Wraps the chat UI in:
1139
- * - {@link AgentThreadProvider} for thread state
1140
- * - {@link ChatUIContextProvider} for UI panel toggles
1141
- * - A responsive {@link ColumnLayout} with menu, main chat, detail panel, and tools panel
1192
+ * @returns The current {@link AuthContextValue} containing user, tenants, auth state, and auth actions.
1142
1193
  *
1143
- * When `thread_id` is empty, a prompt to create a conversation is displayed.
1194
+ * @throws {Error} If used outside of an {@link AuthProvider}.
1144
1195
  *
1145
1196
  * @example
1146
1197
  * ```tsx
1147
- * import { LatticeChat } from "@axiom-lattice/react-sdk";
1198
+ * const { user, isAuthenticated, login, logout } = useAuth();
1148
1199
  *
1149
- * <LatticeChat
1150
- * assistant_id="asst_abc123"
1151
- * thread_id="thread_xyz"
1152
- * showHeader
1153
- * showSender
1154
- * />
1200
+ * const handleLogin = async () => {
1201
+ * const result = await login('user@example.com', 'password');
1202
+ * if (result.requiresTenantSelection) {
1203
+ * // Show tenant picker
1204
+ * }
1205
+ * };
1155
1206
  * ```
1156
- *
1157
- * @remarks
1158
- * - Requires a parent `<LatticeChatShell>` for shell-level configuration (API URL, feature toggles).
1159
- * - The `ChatingProps` are forwarded to the internal {@link Chating} component.
1160
- */
1161
- declare const LatticeChat: React__default.FC<AgentChatProps>;
1162
-
1163
- /**
1164
- * Model runtime configuration passed to the agent when a model is selected.
1165
1207
  */
1166
- interface ModelConfig {
1167
- /** The model key as registered on the server (e.g., "gpt-4o"). */
1168
- modelKey: string;
1169
- /** Sampling temperature (0-2). Higher values produce more random output. */
1170
- temperature?: number;
1171
- /** Maximum tokens in the generated response. */
1172
- maxTokens?: number;
1173
- /** Nucleus sampling parameter (0-1). */
1174
- topP?: number;
1175
- /** Penalty for repeating tokens (-2 to 2). */
1176
- frequencyPenalty?: number;
1177
- /** Penalty for introducing new topics (-2 to 2). */
1178
- presencePenalty?: number;
1179
- }
1208
+ declare const useAuth: () => AuthContextValue;
1180
1209
  /**
1181
- * Model metadata returned by the `/api/models` endpoint.
1210
+ * Optional version of useAuth that returns null instead of throwing when AuthProvider is not present.
1211
+ * Use this when authentication is optional for the component.
1212
+ *
1213
+ * @example
1214
+ * // For required auth - throws if no provider
1215
+ * const { user } = useAuth();
1216
+ *
1217
+ * // For optional auth - returns null if no provider
1218
+ * const user = useAuthOptional()?.user;
1182
1219
  */
1183
- interface ModelInfo {
1184
- /** Unique model key (used as the selection value). */
1185
- key: string;
1186
- /** Provider identifier (e.g., "openai", "azure"). */
1187
- provider: string;
1188
- /** Model name as known by the provider (e.g., "gpt-4o"). */
1189
- model: string;
1190
- /** Human-readable display name for the dropdown. */
1191
- displayName?: string;
1192
- }
1220
+ declare const useAuthOptional: () => AuthContextValue | null;
1193
1221
  /**
1194
- * Props for the {@link ModelSelector} component.
1222
+ * Props for {@link AuthProvider}.
1195
1223
  */
1196
- interface ModelSelectorProps {
1197
- /** Currently selected model configuration (controlled). */
1198
- value?: ModelConfig | null;
1199
- /** Called when the user selects a model. */
1200
- onChange?: (config: ModelConfig | null) => void;
1201
- /** Default model key used when the fetch response includes a matching model. */
1202
- defaultModelKey?: string;
1203
- /** Inline styles applied to the Select element. */
1204
- style?: React__default.CSSProperties;
1224
+ interface AuthProviderProps {
1225
+ /** Child components that will have access to the auth context. */
1226
+ children: ReactNode;
1227
+ /** Base URL of the gateway API (e.g., `http://localhost:3000`). */
1228
+ baseURL: string;
1229
+ /** Called after a successful login with the user and their tenant memberships. */
1230
+ onLoginSuccess?: (user: User, tenants: UserTenantInfo[]) => void;
1231
+ /** Called after a tenant is successfully selected, passing the selected tenant. */
1232
+ onTenantSelected?: (tenant: Tenant) => void;
1233
+ /** Called after the user logs out. */
1234
+ onLogout?: () => void;
1205
1235
  }
1206
1236
  /**
1207
- * A borderless Ant Design `Select` dropdown for choosing the LLM model.
1237
+ * Authentication context provider. Wraps the application to provide auth state and operations
1238
+ * to all descendant components via {@link useAuth} and {@link useAuthOptional}.
1208
1239
  *
1209
- * Fetches available models from `/api/models` on first render and caches the result.
1210
- * When a default model key matches a model in the list, it is auto-selected.
1211
- * The selection is reported via the {@link ModelSelectorProps.onChange} callback,
1212
- * which typically feeds into `updateCustomRunConfig` in the {@link Chating} component.
1240
+ * @description
1241
+ * Manages the full authentication lifecycle including:
1242
+ * - **Login / Register**: Sends credentials to the gateway API and stores the returned user, tenants, and token in `sessionStorage`.
1243
+ * - **Session restoration**: On mount, reads previously stored user data from `sessionStorage` and also refreshes the tenant list to catch any admin-side role assignments.
1244
+ * - **Tenant selection**: Calls the gateway API to select a tenant and stores the tenant data.
1245
+ * - **Logout**: Clears all auth state and `sessionStorage`.
1246
+ * - **Change password**: Proxies to the gateway password change endpoint.
1247
+ * - **Token expiration**: Automatically logs out when the gateway returns a 401 with an expired token message.
1213
1248
  *
1214
- * @param value - Currently selected model config (controlled).
1215
- * @param onChange - Callback when the selection changes.
1216
- * @param defaultModelKey - Model key to auto-select if found in the model list.
1217
- * @param style - Inline styles for the Select wrapper.
1218
- * @returns A compact model selector with hover-highlight background.
1249
+ * @param props - {@link AuthProviderProps}
1250
+ * @param props.children - React children to render within the auth context.
1251
+ * @param props.baseURL - Base URL of the gateway API.
1252
+ * @param props.onLoginSuccess - Optional callback invoked after a successful login.
1253
+ * @param props.onTenantSelected - Optional callback invoked after tenant selection.
1254
+ * @param props.onLogout - Optional callback invoked on logout.
1255
+ *
1256
+ * @returns A React context provider wrapping children with {@link AuthContext.Provider}.
1219
1257
  *
1220
1258
  * @example
1221
1259
  * ```tsx
1222
- * import { ModelSelector } from "@axiom-lattice/react-sdk";
1223
- *
1224
- * <ModelSelector
1225
- * value={modelConfig}
1226
- * onChange={(config) => updateCustomRunConfig({ modelConfig: config })}
1227
- * defaultModelKey="gpt-4o"
1228
- * />
1260
+ * <AuthProvider
1261
+ * baseURL="http://localhost:3000"
1262
+ * onLoginSuccess={(user) => console.log('Logged in:', user.email)}
1263
+ * onLogout={() => window.location.reload()}
1264
+ * >
1265
+ * <App />
1266
+ * </AuthProvider>
1229
1267
  * ```
1230
- *
1231
- * @remarks
1232
- * - Supports both controlled (`value` prop) and uncontrolled (internal state) usage.
1233
- * - Fetch is performed only once per component mount via a ref guard.
1234
- * - The dropdown is intentionally borderless to blend into the sender footer.
1235
1268
  */
1236
- declare const ModelSelector: React__default.FC<ModelSelectorProps>;
1237
-
1238
- declare const MDResponse: React__default.MemoExoticComponent<({ content, context, embeddedLink, interactive, userData, noGenUI, }: {
1239
- context?: any;
1240
- content: string;
1241
- embeddedLink?: boolean;
1242
- interactive?: boolean;
1243
- userData?: any;
1244
- noGenUI?: boolean;
1245
- }) => react_jsx_runtime.JSX.Element>;
1246
- declare const MDViewFormItem: ({ value }: {
1247
- value?: string;
1248
- }) => react_jsx_runtime.JSX.Element;
1269
+ declare const AuthProvider: React__default.FC<AuthProviderProps>;
1249
1270
 
1250
1271
  /**
1251
- * Props passed to every GenUI element component.
1252
- *
1253
- * Each element registered in the GenUI element registry receives these props,
1254
- * with the `data` field carrying the element-specific payload from the agent.
1255
- *
1256
- * @typeParam T - The shape of the element-specific data payload
1272
+ * Login Form Components
1273
+ * Uses base styles from design system
1257
1274
  */
1258
- type ElementProps<T = any> = {
1259
- /** Key identifying which GenUI element component to render */
1260
- component_key: string;
1261
- /** Optional context for the current conversation */
1262
- context?: {
1263
- /** The thread ID associated with this element */
1264
- thread_id?: string;
1265
- /** The assistant ID associated with this element */
1266
- assistant_id?: string;
1267
- };
1268
- /** Element-specific data payload from the agent */
1269
- data: T;
1270
- /** Whether the element supports user interaction (defaults to false) */
1271
- interactive?: boolean;
1272
- /** Whether to open this element in the side app panel by default */
1273
- default_open_in_side_app?: boolean;
1274
- };
1275
+
1276
+ interface LoginFormProps {
1277
+ onSuccess?: () => void;
1278
+ onCancel?: () => void;
1279
+ logo?: React__default.ReactNode;
1280
+ title?: string;
1281
+ subtitle?: string;
1282
+ footer?: React__default.ReactNode;
1283
+ className?: string;
1284
+ }
1285
+ declare const LoginForm: React__default.FC<LoginFormProps>;
1286
+ declare const LoginPage: React__default.FC<any>;
1287
+ interface RegisterFormProps {
1288
+ onSuccess?: () => void;
1289
+ onCancel?: () => void;
1290
+ logo?: React__default.ReactNode;
1291
+ title?: string;
1292
+ subtitle?: string;
1293
+ footer?: React__default.ReactNode;
1294
+ className?: string;
1295
+ }
1296
+ declare const RegisterForm: React__default.FC<RegisterFormProps>;
1297
+
1275
1298
  /**
1276
- * Metadata for a registered GenUI element.
1277
- *
1278
- * Defines how an element is rendered and optionally what action to perform
1279
- * when the user interacts with it.
1299
+ * User Profile Components
1300
+ * Using Axiom Theme with Ant Design
1280
1301
  */
1281
- interface ElementMeta {
1282
- /** The main card-view React component for this element */
1283
- card_view: React.FC<ElementProps>;
1284
- /** Optional side-app panel React component for expanded viewing */
1285
- side_app_view?: React.FC<ElementProps>;
1286
- /** Optional action callback invoked when the user interacts with the element */
1287
- action?: (data: any) => void;
1302
+
1303
+ interface UserProfileProps {
1304
+ /** Called when user clicks logout */
1305
+ onLogout?: () => void;
1306
+ /** Show tenant information */
1307
+ showTenantSwitcher?: boolean;
1308
+ /** Custom class name */
1309
+ className?: string;
1288
1310
  }
1289
1311
  /**
1290
- * Data structure representing a tool call made by the agent.
1291
- *
1292
- * Rendered by GenUI tool card elements to display tool invocations,
1293
- * their arguments, and their results.
1312
+ * User Profile Component
1294
1313
  */
1295
- interface ToolCallData {
1296
- /** Unique identifier for this tool call */
1297
- id: string;
1298
- /** Name of the tool being called */
1299
- name: string;
1300
- /** Arguments passed to the tool */
1301
- args: Record<string, any>;
1302
- /** Distinguishes tool calls from other message types */
1303
- type: "tool_call";
1304
- /** The tool's response, if available */
1305
- response?: string;
1306
- /** Execution status of the tool call */
1307
- status?: "success" | "pending" | "error";
1314
+ declare const UserProfile: React__default.FC<UserProfileProps>;
1315
+ interface ProtectedRouteProps {
1316
+ children: React__default.ReactNode;
1317
+ /** Component to show when not authenticated */
1318
+ fallback?: React__default.ReactNode;
1319
+ /** Redirect URL (if using react-router) */
1320
+ redirectTo?: string;
1308
1321
  }
1309
-
1310
- declare const getElement: (language: string | undefined) => ElementMeta | null;
1311
- declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
1312
-
1313
1322
  /**
1314
- * Tabbed side-app browser that renders GenUI components in the right panel.
1315
- *
1316
- * Manages a tab strip of registered side-app views. When a new component is
1317
- * selected via {@link SideAppBrowserContext}, a tab is added (or activated if
1318
- * it already exists). Tabs are closable and switchable. An "all tabs" dropdown
1319
- * appears when there are 2+ tabs. Uses {@link ChatUIContext} to read/write the
1320
- * active side-app card and open/close the panel.
1321
- *
1322
- * @param region - Which panel region this browser is attached to.
1323
- * `"side"` for the right detail panel (default), `"content"` for the main content area.
1324
- * @returns The tabbed side-app viewer, or an empty state if no tabs are open.
1325
- *
1326
- * @example
1327
- * ```tsx
1328
- * import { SideAppViewBrowser } from "@axiom-lattice/react-sdk";
1329
- *
1330
- * <SideAppViewBrowser region="side" />
1331
- * ```
1332
- *
1333
- * @remarks
1334
- * - Internally renders {@link SideAppBrowserContext.Provider} so that child
1335
- * components can programmatically open new side-apps via `openApp()`.
1336
- * - Component resolution uses {@link getElement} from the GenUI element registry.
1337
- * - Designed to work with {@link ColumnLayout} as the `detail` panel.
1323
+ * Protected Route Component
1324
+ * Shows loading state, redirects, or fallback when not authenticated
1338
1325
  */
1339
- declare const SideAppViewBrowser: React__default.FC<{
1340
- region?: "side" | "content";
1341
- }>;
1326
+ declare const ProtectedRoute: React__default.FC<ProtectedRouteProps>;
1342
1327
 
1343
- type PanelCardData = Record<string, unknown> & {
1344
- component?: ReactNode;
1345
- message?: string;
1346
- };
1347
- type PanelCard = {
1348
- component_key: string;
1349
- data: PanelCardData;
1350
- message?: string;
1351
- context?: {
1352
- thread_id?: string;
1353
- assistant_id?: string;
1354
- };
1355
- };
1356
- declare const ChatUIContext: React__default.Context<{
1357
- detailVisible: boolean;
1358
- setDetailVisible: (visible: boolean) => void;
1359
- detailSize: "small" | "middle" | "large" | "full";
1360
- setDetailSize: (size: "small" | "middle" | "large" | "full") => void;
1361
- detailSelectedCard: PanelCard | null;
1362
- setDetailSelectedCard: (card: PanelCard | null) => void;
1363
- openDetail: (card: PanelCard) => void;
1364
- closeDetail: () => void;
1365
- toolsVisible: boolean;
1366
- setToolsVisible: (visible: boolean) => void;
1367
- toggleTools: () => void;
1368
- toolSelectedCard: PanelCard | null;
1369
- setToolSelectedCard: (card: PanelCard | null) => void;
1370
- openTools: (card: PanelCard) => void;
1371
- closeTools: () => void;
1372
- sideAppVisible: boolean;
1373
- setSideAppVisible: (visible: boolean) => void;
1374
- sideAppSize: "small" | "middle" | "large" | "full";
1375
- setSideAppSize: (size: "small" | "middle" | "large" | "full") => void;
1376
- sideAppSelectedCard: PanelCard | null;
1377
- setSideAppSelectedCard: (card: PanelCard | null) => void;
1378
- openSideApp: (card: PanelCard) => void;
1379
- closeSideApp: () => void;
1380
- menuCollapsed: boolean | undefined;
1381
- setMenuCollapsed: (collapsed: boolean) => void;
1382
- openContentApp: (card: PanelCard) => void;
1383
- closeContentApp: () => void;
1384
- contentAppVisible: boolean;
1385
- setcontentAppVisible: (visible: boolean) => void;
1386
- contentAppSelectedCard: PanelCard | null;
1387
- setContentAppSelectedCard: (card: PanelCard | null) => void;
1388
- }>;
1389
1328
  /**
1390
- * Chat UI context provider. Manages visibility and selected cards for chat panel areas
1391
- * (detail, tools, side app, content app) and the sidebar menu collapsed state.
1392
- *
1393
- * @description
1394
- * Tracks the open/closed state and the currently selected {@link PanelCard} for each panel:
1395
- * - **Detail panel**: A slide-out detail view that displays a chosen card's content.
1396
- * - **Tools panel**: A tools sidebar/drawer for tool-specific cards.
1397
- * - **Side app**: Aliases to the detail panel (shared state).
1398
- * - **Content app**: An inline content area for embedded app cards.
1399
- * - **Menu collapsed**: Whether the sidebar navigation menu is collapsed.
1400
- *
1401
- * Provides action helpers (`openDetail`, `closeDetail`, `openTools`, `toggleTools`, etc.)
1402
- * that set both visibility and selected card atomically.
1403
- *
1404
- * @param props - Provider props.
1405
- * @param props.children - React children to render within the UI context.
1329
+ * Tenant Selector Components
1330
+ * Uses unified auth styles from design system
1331
+ */
1332
+
1333
+ interface TenantSelectorProps {
1334
+ tenants: Tenant[];
1335
+ currentTenantId?: string | null;
1336
+ onSelect: (tenant: Tenant) => void;
1337
+ onLogout?: () => void;
1338
+ isLoading?: boolean;
1339
+ className?: string;
1340
+ title?: string;
1341
+ description?: string;
1342
+ }
1343
+ declare const TenantSelector: React__default.FC<TenantSelectorProps>;
1344
+
1345
+ interface ChangePasswordModalProps {
1346
+ open: boolean;
1347
+ onClose: () => void;
1348
+ onSuccess?: () => void;
1349
+ }
1350
+ declare const ChangePasswordModal: React__default.FC<ChangePasswordModalProps>;
1351
+
1352
+ interface UseTenantsOptions {
1353
+ baseURL: string;
1354
+ token?: string;
1355
+ }
1356
+ interface UseTenantsReturn {
1357
+ tenants: Tenant[];
1358
+ isLoading: boolean;
1359
+ error: string | null;
1360
+ refresh: () => Promise<void>;
1361
+ getTenantById: (id: string) => Tenant | undefined;
1362
+ }
1363
+ /**
1364
+ * Fetches and manages a list of tenants from the API.
1406
1365
  *
1407
- * @returns A React context provider wrapping children with {@link ChatUIContext.Provider}.
1366
+ * @param options - Configuration options
1367
+ * @param options.baseURL - The base URL of the API gateway
1368
+ * @param options.token - Optional authentication token
1369
+ * @returns Tenant list, loading state, error, refresh function, and lookup helper
1408
1370
  *
1409
1371
  * @example
1410
1372
  * ```tsx
1411
- * <ChatUIContextProvider>
1412
- * <ChatLayout />
1413
- * </ChatUIContextProvider>
1373
+ * const { tenants, isLoading, error, refresh, getTenantById } = useTenants({
1374
+ * baseURL: "https://api.example.com",
1375
+ * token: "your-auth-token",
1376
+ * });
1414
1377
  * ```
1415
1378
  */
1416
- declare const ChatUIContextProvider: ({ children, }: {
1417
- children: React__default.ReactNode;
1418
- }) => react_jsx_runtime.JSX.Element;
1379
+ declare function useTenants(options: UseTenantsOptions): UseTenantsReturn;
1380
+ interface UseUsersOptions {
1381
+ baseURL: string;
1382
+ tenantId: string;
1383
+ token?: string;
1384
+ }
1385
+ interface UseUsersReturn {
1386
+ users: _axiom_lattice_protocols.User[];
1387
+ isLoading: boolean;
1388
+ error: string | null;
1389
+ refresh: () => Promise<void>;
1390
+ searchByEmail: (email: string) => Promise<_axiom_lattice_protocols.User | null>;
1391
+ }
1419
1392
  /**
1420
- * Hook to access the chat UI context. Must be used within a {@link ChatUIContextProvider}.
1421
- *
1422
- * @description
1423
- * Returns panel visibility state, selected panel cards, and action functions for controlling
1424
- * the chat interface panels (detail, tools, side app, content app) and menu collapsed state.
1393
+ * Fetches and manages a list of users within a tenant.
1425
1394
  *
1426
- * @returns The current chat UI context value containing panel state and control functions.
1395
+ * @param options - Configuration options
1396
+ * @param options.baseURL - The base URL of the API gateway
1397
+ * @param options.tenantId - The tenant ID to fetch users for
1398
+ * @param options.token - Optional authentication token
1399
+ * @returns User list, loading state, error, refresh function, and email search helper
1427
1400
  *
1428
1401
  * @example
1429
1402
  * ```tsx
1430
- * const { detailVisible, openDetail, closeDetail, toggleTools, menuCollapsed } = useChatUIContext();
1403
+ * const { users, isLoading, error, searchByEmail } = useUsers({
1404
+ * baseURL: "https://api.example.com",
1405
+ * tenantId: "tenant-123",
1406
+ * });
1431
1407
  *
1432
- * const handleCardClick = (card: PanelCard) => {
1433
- * openDetail(card);
1434
- * };
1408
+ * const user = await searchByEmail("user@example.com");
1435
1409
  * ```
1436
1410
  */
1437
- declare const useChatUIContext: () => {
1438
- detailVisible: boolean;
1439
- setDetailVisible: (visible: boolean) => void;
1440
- detailSize: "small" | "middle" | "large" | "full";
1441
- setDetailSize: (size: "small" | "middle" | "large" | "full") => void;
1442
- detailSelectedCard: PanelCard | null;
1443
- setDetailSelectedCard: (card: PanelCard | null) => void;
1444
- openDetail: (card: PanelCard) => void;
1445
- closeDetail: () => void;
1446
- toolsVisible: boolean;
1447
- setToolsVisible: (visible: boolean) => void;
1448
- toggleTools: () => void;
1449
- toolSelectedCard: PanelCard | null;
1450
- setToolSelectedCard: (card: PanelCard | null) => void;
1451
- openTools: (card: PanelCard) => void;
1452
- closeTools: () => void;
1453
- sideAppVisible: boolean;
1454
- setSideAppVisible: (visible: boolean) => void;
1455
- sideAppSize: "small" | "middle" | "large" | "full";
1456
- setSideAppSize: (size: "small" | "middle" | "large" | "full") => void;
1457
- sideAppSelectedCard: PanelCard | null;
1458
- setSideAppSelectedCard: (card: PanelCard | null) => void;
1459
- openSideApp: (card: PanelCard) => void;
1460
- closeSideApp: () => void;
1461
- menuCollapsed: boolean | undefined;
1462
- setMenuCollapsed: (collapsed: boolean) => void;
1463
- openContentApp: (card: PanelCard) => void;
1464
- closeContentApp: () => void;
1465
- contentAppVisible: boolean;
1466
- setcontentAppVisible: (visible: boolean) => void;
1467
- contentAppSelectedCard: PanelCard | null;
1468
- setContentAppSelectedCard: (card: PanelCard | null) => void;
1469
- };
1411
+ declare function useUsers(options: UseUsersOptions): UseUsersReturn;
1470
1412
 
1471
- interface SideAppBrowserContextValue {
1472
- openApp: (card: PanelCard) => void;
1413
+ interface ChatErrorBoundaryProps {
1414
+ /** Display name for this boundary (shown in error messages) */
1415
+ name?: string;
1416
+ children: React__default.ReactNode;
1417
+ fallback?: React__default.ReactNode;
1418
+ onError?: (error: Error, errorInfo: React__default.ErrorInfo) => void;
1473
1419
  }
1474
- declare const SideAppBrowserContext: React$1.Context<SideAppBrowserContextValue | null>;
1475
- declare const useSideAppBrowser: () => SideAppBrowserContextValue | null;
1476
- declare const useSideAppOpener: () => ((card: PanelCard) => void);
1477
-
1478
- /**
1479
- * Thread information for a conversation
1480
- */
1481
- interface ConversationThread {
1482
- id: string;
1483
- label: string;
1484
- createdAt?: string;
1485
- updatedAt?: string;
1420
+ interface ChatErrorBoundaryState {
1421
+ hasError: boolean;
1422
+ error: Error | null;
1423
+ errorInfo: React__default.ErrorInfo | null;
1424
+ retryKey: number;
1486
1425
  }
1426
+ declare class ChatErrorBoundary extends Component<ChatErrorBoundaryProps, ChatErrorBoundaryState> {
1427
+ constructor(props: ChatErrorBoundaryProps);
1428
+ static getDerivedStateFromError(error: Error): Partial<ChatErrorBoundaryState>;
1429
+ componentDidCatch(error: Error, errorInfo: React__default.ErrorInfo): void;
1430
+ handleRetry: () => void;
1431
+ handleCopyError: () => void;
1432
+ render(): React__default.ReactNode;
1433
+ }
1434
+
1487
1435
  /**
1488
- * Conversation context value
1436
+ * Props for the {@link Chating} component — the core chat interface.
1437
+ *
1438
+ * Controls appearance, sender behavior, empty-state customization, and
1439
+ * optional context injection for the agent.
1489
1440
  */
1490
- interface ConversationContextValue {
1491
- /**
1492
- * Current assistant ID
1493
- */
1494
- assistantId: string | null;
1495
- /**
1496
- * Current thread for the assistant
1497
- */
1498
- thread: ConversationThread | null;
1499
- /**
1500
- * Current thread ID
1501
- */
1502
- threadId: string | null;
1503
- /**
1504
- * List of threads for the current assistant
1505
- */
1506
- threads: ConversationThread[];
1507
- /**
1508
- * Whether threads are being loaded
1509
- */
1510
- isLoading: boolean;
1511
- /**
1512
- * Error message if any
1513
- */
1514
- error: Error | null;
1515
- /**
1516
- * Set the current thread
1517
- */
1518
- setThread: (thread: ConversationThread | null) => void;
1519
- /**
1520
- * Select a thread by ID
1521
- */
1522
- selectThread: (threadId: string) => void;
1523
- /**
1524
- * Create a new thread for the current assistant
1525
- */
1526
- createThread: (label?: string) => Promise<ConversationThread>;
1527
- /**
1528
- * List all threads for the current assistant
1529
- */
1530
- listThreads: () => Promise<ConversationThread[]>;
1531
- /**
1532
- * Update thread for the current assistant
1533
- */
1534
- updateThread: (thread: ConversationThread) => Promise<void>;
1535
- /**
1536
- * Get thread by ID
1537
- */
1538
- getThreadById: (threadId: string) => ConversationThread | null;
1539
- /**
1540
- * Delete a thread by ID
1541
- */
1542
- deleteThread: (threadId: string) => Promise<void>;
1543
- /**
1544
- * Clear the current thread
1545
- */
1546
- clearThread: () => void;
1547
- /**
1548
- * Refresh threads for the current assistant
1549
- */
1550
- refresh: () => Promise<void>;
1551
- /**
1552
- * Custom run configuration (cross-thread, assistant-level)
1553
- * Used for metrics datasource and other assistant-wide settings
1554
- */
1555
- customRunConfig: Record<string, any>;
1441
+ interface ChatingProps {
1442
+ /** Agent display name shown in the header. */
1443
+ name?: string;
1444
+ /** Agent description shown in the header. */
1445
+ description?: string;
1446
+ /** Fallback message used when the user submits only attachments without text. */
1447
+ default_submit_message?: string;
1448
+ /** Avatar URL or component for the agent. */
1449
+ avatar?: string;
1450
+ /** Placeholder content rendered inside the attachment upload area. */
1451
+ attachment_placeholder?: React__default.ReactNode;
1452
+ /** Custom upload endpoint URL. Defaults to the workspace or thread sandbox upload endpoint. */
1453
+ uploadAction?: string;
1454
+ /** Quick prompt items displayed between messages. */
1455
+ senderPromptsItems?: GetProp<typeof Prompts, "items">;
1456
+ /** Extra content rendered in the header area. */
1457
+ extra?: React__default.ReactNode;
1458
+ /** Additional metadata items for the header. */
1459
+ extraMeta?: Array<{
1460
+ id: string;
1461
+ }>;
1462
+ /** Whether to show the agent header bar. Default: true. */
1463
+ showHeader?: boolean;
1464
+ /** Whether to show the message sender input. Default: true. */
1465
+ showSender?: boolean;
1466
+ /** Whether to show the Human-in-the-Loop (HITL) container. Default: true. */
1467
+ showHITL?: boolean;
1468
+ /** Whether to show a refresh button in the header. */
1469
+ showRefreshButton?: boolean;
1556
1470
  /**
1557
- * Update custom run configuration
1471
+ * Whether to show the model selector in the sender footer.
1472
+ * When provided, overrides the shell config's enableModelSelector.
1558
1473
  */
1559
- updateCustomRunConfig: (config: Record<string, any>) => void;
1560
- }
1561
- /**
1562
- * Conversation context
1563
- */
1564
- declare const ConversationContext: React$1.Context<ConversationContextValue>;
1565
- /**
1566
- * Props for ConversationContextProvider
1567
- */
1568
- interface ConversationContextProviderProps {
1569
- children: React.ReactNode;
1474
+ showModelSelector?: boolean;
1475
+ /** Show database picker in sender footer. Overrides shell config enableDatabaseSlot. */
1476
+ showDatabaseSlot?: boolean;
1477
+ /** Show skill picker in sender footer. Overrides shell config enableSkillSlot. */
1478
+ showSkillSlot?: boolean;
1479
+ /** Show agent picker in sender footer. Overrides shell config enableAgentSlot. */
1480
+ showAgentSlot?: boolean;
1481
+ /** Show metrics data source picker in sender footer. Overrides shell config enableMetricsDataSourceSlot. */
1482
+ showMetricsDataSourceSlot?: boolean;
1483
+ /** Whether to show the greeting empty state when no messages exist. Default: true. */
1484
+ showEmptyState?: boolean;
1485
+ /** Custom greeting element displayed in the empty state. */
1486
+ emptyStateGreeting?: React__default.ReactNode;
1487
+ /** Empty state question line. Default: "Ready to turn..." */
1488
+ emptyStateQuestion?: string;
1489
+ /** Show skill category prompts in empty state. Default: true. */
1490
+ showSkillPrompts?: boolean;
1491
+ /** Show business analysis prompts in empty state. Default: true. */
1492
+ showQuickAnalysis?: boolean;
1493
+ /** Welcome prefix text (e.g., "Hey"). */
1494
+ welcomePrefix?: string;
1495
+ /** Context string injected before the first user message (e.g. workflow context). */
1496
+ systemContext?: string;
1497
+ /** Auto-send this message when agent becomes idle (thread ready, not loading). */
1498
+ initialMessage?: string | null;
1499
+ /** Called after initialMessage has been sent. */
1500
+ onInitialMessageSent?: () => void;
1570
1501
  }
1571
1502
  /**
1572
- * Generate a thread label from the first message content
1573
- * Extracts first 15 characters of text content, excluding attachments
1574
- */
1575
- declare function generateLabelFromMessage(message: string): string;
1576
- /**
1577
- * Provider component for ConversationContext.
1578
- * Manages conversation thread state for the currently selected assistant.
1579
- *
1580
- * @description
1581
- * Coordinates with {@link AssistantContext} to load threads for the current assistant.
1582
- * Key behaviors:
1583
- * - **Thread loading**: Fetches threads from the API when the assistant changes. If no threads
1584
- * exist, a new thread is automatically created.
1585
- * - **Auto-selection**: Selects the most recently updated thread as the active thread when loading.
1586
- * - **Cross-thread config**: Maintains an assistant-level `customRunConfig` shared across all threads
1587
- * (useful for metrics datasource and other assistant-wide settings).
1588
- * - **Thread operations**: Provides full CRUD operations (create, update, delete, list, select)
1589
- * backed by the client SDK.
1590
- *
1591
- * Requires {@link AssistantContextProvider} ancestor and {@link LatticeChatShellContextProvider}.
1503
+ * Core chat interface component manages sender input, message display,
1504
+ * and agent-streaming state for a single assistant thread.
1592
1505
  *
1593
- * @param props - {@link ConversationContextProviderProps}
1594
- * @param props.children - React children to render within the conversation context.
1506
+ * Features:
1507
+ * - Empty state with greeting and skill/analysis prompt categories
1508
+ * - Message sender with file attachment, skill/agent/database pickers, and model selector
1509
+ * - Typing cursor animation during streaming
1510
+ * - HITL interrupt handling and pending-message display
1511
+ * - Auto-send of {@link ChatingProps.systemContext} and {@link ChatingProps.initialMessage}
1512
+ * - Transition animations between empty and active states
1595
1513
  *
1596
- * @returns A React context provider wrapping children with {@link ConversationContext.Provider}.
1514
+ * @param props - See {@link ChatingProps}.
1515
+ * @returns The full chat UI for the active thread.
1597
1516
  *
1598
1517
  * @example
1599
1518
  * ```tsx
1600
- * <ConversationContextProvider>
1601
- * <ThreadList />
1602
- * </ConversationContextProvider>
1519
+ * import { Chating } from "@axiom-lattice/react-sdk";
1520
+ *
1521
+ * <Chating
1522
+ * name="Data Analyst"
1523
+ * showHeader
1524
+ * showSender
1525
+ * showModelSelector
1526
+ * emptyStateQuestion="What data would you like to analyze?"
1527
+ * systemContext="You are analyzing sales data from Q4 2024."
1528
+ * />
1603
1529
  * ```
1530
+ *
1531
+ * @remarks
1532
+ * - Requires the following ancestor context providers: {@link AgentThreadProvider},
1533
+ * {@link ChatUIContextProvider}, {@link LatticeChatShellContextProvider},
1534
+ * {@link ConversationContextProvider}, {@link AssistantContextProvider}.
1535
+ * - Prop-level feature toggles (e.g. `showModelSelector`) take priority over
1536
+ * shell-config-level toggles.
1537
+ * - Uses {@link useAgentChat} for all agent communication.
1604
1538
  */
1605
- declare const ConversationContextProvider: ({ children, }: ConversationContextProviderProps) => react_jsx_runtime.JSX.Element;
1606
- /**
1607
- * Hook to access ConversationContext
1608
- * @returns Conversation context value
1609
- * @throws Error if used outside of ConversationContextProvider
1610
- */
1611
- declare const useConversationContext: () => ConversationContextValue;
1539
+ declare const Chating: React__default.FC<ChatingProps>;
1612
1540
 
1613
1541
  /**
1614
- * Assistant state interface
1615
- */
1616
- interface AssistantState {
1617
- /**
1618
- * List of all assistants
1619
- */
1620
- assistants: Assistant[];
1621
- /**
1622
- * Currently selected assistant
1623
- */
1624
- currentAssistant: Assistant | null;
1625
- /**
1626
- * Whether data is being loaded
1627
- */
1628
- isLoading: boolean;
1629
- /**
1630
- * Error message if any
1631
- */
1632
- error: Error | null;
1633
- }
1634
- /**
1635
- * Assistant context value interface
1636
- */
1637
- interface AssistantContextValue extends AssistantState {
1638
- /**
1639
- * List all assistants
1640
- */
1641
- listAssistants: () => Promise<void>;
1642
- /**
1643
- * Get a single assistant by ID
1644
- */
1645
- getAssistant: (id: string) => Promise<Assistant>;
1646
- /**
1647
- * Create a new assistant
1648
- */
1649
- createAssistant: (options: CreateAssistantOptions) => Promise<Assistant>;
1650
- /**
1651
- * Update an existing assistant
1652
- */
1653
- updateAssistant: (id: string, options: UpdateAssistantOptions) => Promise<Assistant>;
1654
- /**
1655
- * Delete an assistant
1656
- */
1657
- deleteAssistant: (id: string) => Promise<void>;
1658
- /**
1659
- * Select an assistant as current
1660
- */
1661
- selectAssistant: (id: string) => Promise<void>;
1662
- /**
1663
- * Clear the current assistant selection
1664
- */
1665
- clearCurrentAssistant: () => void;
1666
- /**
1667
- * Refresh the assistant list
1668
- */
1669
- refresh: () => Promise<void>;
1670
- }
1671
- /**
1672
- * Assistant context
1673
- */
1674
- declare const AssistantContext: React$1.Context<AssistantContextValue>;
1675
- /**
1676
- * Props for AssistantContextProvider
1542
+ * Props for the {@link LatticeChat} component.
1543
+ *
1544
+ * Extends {@link ChatingProps} with thread/assistant identification
1545
+ * and optional menu/header slots.
1677
1546
  */
1678
- interface AssistantContextProviderProps {
1679
- /**
1680
- * Children components
1681
- */
1682
- children: React.ReactNode;
1683
- /**
1684
- * Whether to automatically load assistants on mount
1685
- */
1686
- autoLoad?: boolean;
1687
- /**
1688
- * Initial assistant ID to select
1689
- */
1690
- initialAssistantId?: string | null;
1691
- }
1547
+ type AgentChatProps = {
1548
+ /** The ID of the currently active thread. If absent, a placeholder is shown prompting users to create a conversation. */
1549
+ thread_id?: string;
1550
+ /** The assistant ID that backs the chat. Required — feeds the {@link AgentThreadProvider}. */
1551
+ assistant_id: string;
1552
+ /** Optional menu rendered in the left sidebar column. */
1553
+ menu?: React__default.ReactNode;
1554
+ /** Optional header rendered above the main chat area. */
1555
+ header?: React__default.ReactNode;
1556
+ /** Optional right-side header content. Replaces the default folder toggle button. Use {@link FilePanelToggle} to include it. */
1557
+ headerRight?: React__default.ReactNode;
1558
+ /** Show workspace project selector in header. Default true. */
1559
+ showProjectSelector?: boolean;
1560
+ /** Content shown when no thread is active. Default: "Please create a conversation first". */
1561
+ emptyPlaceholder?: React__default.ReactNode;
1562
+ } & ChatingProps;
1692
1563
  /**
1693
- * Provider component for AssistantContext.
1694
- * Manages assistant state and operations including CRUD, selection, and auto-loading.
1695
- *
1696
- * @description
1697
- * Coordinates with the client SDK to provide assistant management:
1698
- * - **Auto-load**: When `autoLoad` is `true` (default), fetches the assistant list on mount.
1699
- * - **Auto-selection**: If `initialAssistantId` is provided, selects that assistant after loading.
1700
- * Otherwise, auto-selects the first available assistant.
1701
- * - **Re-selection**: If the currently selected assistant is removed from the list (e.g., deleted),
1702
- * falls back to selecting the first available assistant.
1703
- * - **CRUD operations**: Provides `createAssistant`, `updateAssistant`, `deleteAssistant`, and
1704
- * `getAssistant` backed by the SDK, keeping local state in sync.
1705
- *
1706
- * Requires an {@link AxiomLatticeProvider} ancestor for the API client.
1564
+ * Top-level chat component for a single assistant thread.
1707
1565
  *
1708
- * @param props - {@link AssistantContextProviderProps}
1709
- * @param props.children - React children to render within the assistant context.
1710
- * @param props.autoLoad - Whether to automatically load assistants on mount. Defaults to `true`.
1711
- * @param props.initialAssistantId - Optional assistant ID to auto-select on load.
1566
+ * Wraps the chat UI in:
1567
+ * - {@link AgentThreadProvider} for thread state
1568
+ * - {@link ChatUIContextProvider} for UI panel toggles
1569
+ * - A responsive {@link ColumnLayout} with menu, main chat, detail panel, and tools panel
1712
1570
  *
1713
- * @returns A React context provider wrapping children with {@link AssistantContext.Provider}.
1571
+ * When `thread_id` is empty, a prompt to create a conversation is displayed.
1714
1572
  *
1715
1573
  * @example
1716
1574
  * ```tsx
1717
- * <AssistantContextProvider initialAssistantId="asst_123">
1718
- * <AssistantSelector />
1719
- * </AssistantContextProvider>
1575
+ * import { LatticeChat } from "@axiom-lattice/react-sdk";
1576
+ *
1577
+ * <LatticeChat
1578
+ * assistant_id="asst_abc123"
1579
+ * thread_id="thread_xyz"
1580
+ * showHeader
1581
+ * showSender
1582
+ * />
1720
1583
  * ```
1584
+ *
1585
+ * @remarks
1586
+ * - Requires a parent `<LatticeChatShell>` for shell-level configuration (API URL, feature toggles).
1587
+ * - The `ChatingProps` are forwarded to the internal {@link Chating} component.
1721
1588
  */
1722
- declare const AssistantContextProvider: ({ children, autoLoad, initialAssistantId, }: AssistantContextProviderProps) => react_jsx_runtime.JSX.Element;
1723
- /**
1724
- * Hook to access AssistantContext
1725
- * @returns Assistant context value
1726
- * @throws Error if used outside of AssistantContextProvider
1727
- */
1728
- declare const useAssistantContext: () => AssistantContextValue;
1589
+ declare const LatticeChat: React__default.FC<AgentChatProps>;
1729
1590
 
1730
1591
  /**
1731
- * Quick prompt item for quick prompt components
1592
+ * Model runtime configuration passed to the agent when a model is selected.
1732
1593
  */
1733
- interface QuickPromptItem {
1734
- key: string;
1735
- icon?: ReactNode;
1736
- label: string;
1737
- description?: string;
1738
- content: SlotConfigType[];
1594
+ interface ModelConfig {
1595
+ /** The model key as registered on the server (e.g., "gpt-4o"). */
1596
+ modelKey: string;
1597
+ /** Sampling temperature (0-2). Higher values produce more random output. */
1598
+ temperature?: number;
1599
+ /** Maximum tokens in the generated response. */
1600
+ maxTokens?: number;
1601
+ /** Nucleus sampling parameter (0-1). */
1602
+ topP?: number;
1603
+ /** Penalty for repeating tokens (-2 to 2). */
1604
+ frequencyPenalty?: number;
1605
+ /** Penalty for introducing new topics (-2 to 2). */
1606
+ presencePenalty?: number;
1739
1607
  }
1740
1608
  /**
1741
- * Quick prompt category for organizing prompt items
1609
+ * Model metadata returned by the `/api/models` endpoint.
1742
1610
  */
1743
- interface QuickPromptCategory {
1611
+ interface ModelInfo {
1612
+ /** Unique model key (used as the selection value). */
1744
1613
  key: string;
1745
- title: string;
1746
- icon?: ReactNode;
1747
- color?: string;
1748
- items: QuickPromptItem[];
1614
+ /** Provider identifier (e.g., "openai", "azure"). */
1615
+ provider: string;
1616
+ /** Model name as known by the provider (e.g., "gpt-4o"). */
1617
+ model: string;
1618
+ /** Human-readable display name for the dropdown. */
1619
+ displayName?: string;
1749
1620
  }
1750
1621
  /**
1751
- * Middleware tool definition
1622
+ * Props for the {@link ModelSelector} component.
1752
1623
  */
1753
- interface MiddlewareToolDefinition {
1754
- id: string;
1755
- name: string;
1756
- description: string;
1624
+ interface ModelSelectorProps {
1625
+ /** Currently selected model configuration (controlled). */
1626
+ value?: ModelConfig | null;
1627
+ /** Called when the user selects a model. */
1628
+ onChange?: (config: ModelConfig | null) => void;
1629
+ /** Default model key used when the fetch response includes a matching model. */
1630
+ defaultModelKey?: string;
1631
+ /** Inline styles applied to the Select element. */
1632
+ style?: React__default.CSSProperties;
1757
1633
  }
1758
1634
  /**
1759
- * JSON Schema property definition for middleware config
1635
+ * A borderless Ant Design `Select` dropdown for choosing the LLM model.
1636
+ *
1637
+ * Fetches available models from `/api/models` on first render and caches the result.
1638
+ * When a default model key matches a model in the list, it is auto-selected.
1639
+ * The selection is reported via the {@link ModelSelectorProps.onChange} callback,
1640
+ * which typically feeds into `updateCustomRunConfig` in the {@link Chating} component.
1641
+ *
1642
+ * @param value - Currently selected model config (controlled).
1643
+ * @param onChange - Callback when the selection changes.
1644
+ * @param defaultModelKey - Model key to auto-select if found in the model list.
1645
+ * @param style - Inline styles for the Select wrapper.
1646
+ * @returns A compact model selector with hover-highlight background.
1647
+ *
1648
+ * @example
1649
+ * ```tsx
1650
+ * import { ModelSelector } from "@axiom-lattice/react-sdk";
1651
+ *
1652
+ * <ModelSelector
1653
+ * value={modelConfig}
1654
+ * onChange={(config) => updateCustomRunConfig({ modelConfig: config })}
1655
+ * defaultModelKey="gpt-4o"
1656
+ * />
1657
+ * ```
1658
+ *
1659
+ * @remarks
1660
+ * - Supports both controlled (`value` prop) and uncontrolled (internal state) usage.
1661
+ * - Fetch is performed only once per component mount via a ref guard.
1662
+ * - The dropdown is intentionally borderless to blend into the sender footer.
1760
1663
  */
1761
- interface MiddlewareConfigSchemaProperty {
1762
- type: "string" | "number" | "integer" | "boolean" | "object" | "array";
1763
- title?: string;
1764
- description?: string;
1765
- default?: any;
1766
- enum?: string[];
1767
- enumLabels?: Record<string, string>;
1768
- minimum?: number;
1769
- maximum?: number;
1770
- minLength?: number;
1771
- maxLength?: number;
1772
- pattern?: string;
1773
- format?: string;
1774
- widget?: "input" | "textarea" | "select" | "segmented" | "switch" | "numberInput" | "skillSelect" | "databaseSelect" | "metricsSelect" | "topologyEdgeBuilder" | "collectionSelect";
1775
- items?: {
1776
- type: string;
1777
- };
1778
- }
1664
+ declare const ModelSelector: React__default.FC<ModelSelectorProps>;
1665
+
1666
+ declare const MDResponse: React__default.MemoExoticComponent<({ content, context, embeddedLink, interactive, userData, noGenUI, }: {
1667
+ context?: any;
1668
+ content: string;
1669
+ embeddedLink?: boolean;
1670
+ interactive?: boolean;
1671
+ userData?: any;
1672
+ noGenUI?: boolean;
1673
+ }) => react_jsx_runtime.JSX.Element>;
1674
+ declare const MDViewFormItem: ({ value }: {
1675
+ value?: string;
1676
+ }) => react_jsx_runtime.JSX.Element;
1677
+
1779
1678
  /**
1780
- * JSON Schema for middleware configuration
1679
+ * Props passed to every GenUI element component.
1680
+ *
1681
+ * Each element registered in the GenUI element registry receives these props,
1682
+ * with the `data` field carrying the element-specific payload from the agent.
1683
+ *
1684
+ * @typeParam T - The shape of the element-specific data payload
1781
1685
  */
1782
- interface MiddlewareConfigSchema {
1783
- type: "object";
1784
- title?: string;
1785
- description?: string;
1786
- required?: string[];
1787
- properties: Record<string, MiddlewareConfigSchemaProperty>;
1788
- }
1686
+ type ElementProps<T = any> = {
1687
+ /** Key identifying which GenUI element component to render */
1688
+ component_key: string;
1689
+ /** Optional context for the current conversation */
1690
+ context?: {
1691
+ /** The thread ID associated with this element */
1692
+ thread_id?: string;
1693
+ /** The assistant ID associated with this element */
1694
+ assistant_id?: string;
1695
+ };
1696
+ /** Element-specific data payload from the agent */
1697
+ data: T;
1698
+ /** Whether the element supports user interaction (defaults to false) */
1699
+ interactive?: boolean;
1700
+ /** Whether to open this element in the side app panel by default */
1701
+ default_open_in_side_app?: boolean;
1702
+ };
1789
1703
  /**
1790
- * Middleware type definition
1704
+ * Metadata for a registered GenUI element.
1705
+ *
1706
+ * Defines how an element is rendered and optionally what action to perform
1707
+ * when the user interacts with it.
1791
1708
  */
1792
- interface MiddlewareTypeDefinition {
1793
- type: string;
1794
- name: string;
1795
- description: string;
1796
- icon?: ReactNode;
1797
- schema?: MiddlewareConfigSchema;
1798
- defaultConfig?: Record<string, any>;
1799
- tools?: MiddlewareToolDefinition[];
1709
+ interface ElementMeta {
1710
+ /** The main card-view React component for this element */
1711
+ card_view: React.FC<ElementProps>;
1712
+ /** Optional side-app panel React component for expanded viewing */
1713
+ side_app_view?: React.FC<ElementProps>;
1714
+ /** Optional action callback invoked when the user interacts with the element */
1715
+ action?: (data: any) => void;
1800
1716
  }
1801
1717
  /**
1802
- * Middleware type for configuration
1718
+ * Data structure representing a tool call made by the agent.
1719
+ *
1720
+ * Rendered by GenUI tool card elements to display tool invocations,
1721
+ * their arguments, and their results.
1803
1722
  */
1804
- interface MiddlewareConfigDefinition {
1723
+ interface ToolCallData {
1724
+ /** Unique identifier for this tool call */
1805
1725
  id: string;
1806
- type: string;
1726
+ /** Name of the tool being called */
1807
1727
  name: string;
1808
- description: string;
1809
- enabled: boolean;
1810
- config: Record<string, any>;
1811
- /** 可选:限制该中间件暴露的工具列表。不配置则默认暴露所有工具 */
1812
- allowedTools?: string[];
1813
- tools?: MiddlewareToolDefinition[];
1728
+ /** Arguments passed to the tool */
1729
+ args: Record<string, any>;
1730
+ /** Distinguishes tool calls from other message types */
1731
+ type: "tool_call";
1732
+ /** The tool's response, if available */
1733
+ response?: string;
1734
+ /** Execution status of the tool call */
1735
+ status?: "success" | "pending" | "error";
1814
1736
  }
1737
+
1738
+ declare const getElement: (language: string | undefined) => ElementMeta | null;
1739
+ declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
1740
+
1815
1741
  /**
1816
- * Sidebar menu item type
1742
+ * Tabbed side-app browser that renders GenUI components in the right panel.
1743
+ *
1744
+ * Manages a tab strip of registered side-app views. When a new component is
1745
+ * selected via {@link SideAppBrowserContext}, a tab is added (or activated if
1746
+ * it already exists). Tabs are closable and switchable. An "all tabs" dropdown
1747
+ * appears when there are 2+ tabs. Uses {@link ChatUIContext} to read/write the
1748
+ * active side-app card and open/close the panel.
1749
+ *
1750
+ * @param region - Which panel region this browser is attached to.
1751
+ * `"side"` for the right detail panel (default), `"content"` for the main content area.
1752
+ * @returns The tabbed side-app viewer, or an empty state if no tabs are open.
1753
+ *
1754
+ * @example
1755
+ * ```tsx
1756
+ * import { SideAppViewBrowser } from "@axiom-lattice/react-sdk";
1757
+ *
1758
+ * <SideAppViewBrowser region="side" />
1759
+ * ```
1760
+ *
1761
+ * @remarks
1762
+ * - Internally renders {@link SideAppBrowserContext.Provider} so that child
1763
+ * components can programmatically open new side-apps via `openApp()`.
1764
+ * - Component resolution uses {@link getElement} from the GenUI element registry.
1765
+ * - Designed to work with {@link ColumnLayout} as the `detail` panel.
1817
1766
  */
1818
- type SideMenuItemType = "drawer" | "route" | "action";
1819
- interface ResourceFolderConfig {
1820
- name: string;
1821
- displayName?: string;
1822
- allowUpload: boolean;
1823
- }
1767
+ declare const SideAppViewBrowser: React__default.FC<{
1768
+ region?: "side" | "content";
1769
+ }>;
1770
+
1771
+ type PanelCardData = Record<string, unknown> & {
1772
+ component?: ReactNode;
1773
+ message?: string;
1774
+ };
1775
+ type PanelCard = {
1776
+ component_key: string;
1777
+ data: PanelCardData;
1778
+ message?: string;
1779
+ context?: {
1780
+ thread_id?: string;
1781
+ assistant_id?: string;
1782
+ };
1783
+ };
1784
+ declare const ChatUIContext: React__default.Context<{
1785
+ detailVisible: boolean;
1786
+ setDetailVisible: (visible: boolean) => void;
1787
+ detailSize: "small" | "middle" | "large" | "full";
1788
+ setDetailSize: (size: "small" | "middle" | "large" | "full") => void;
1789
+ detailSelectedCard: PanelCard | null;
1790
+ setDetailSelectedCard: (card: PanelCard | null) => void;
1791
+ openDetail: (card: PanelCard) => void;
1792
+ closeDetail: () => void;
1793
+ toolsVisible: boolean;
1794
+ setToolsVisible: (visible: boolean) => void;
1795
+ toggleTools: () => void;
1796
+ toolSelectedCard: PanelCard | null;
1797
+ setToolSelectedCard: (card: PanelCard | null) => void;
1798
+ openTools: (card: PanelCard) => void;
1799
+ closeTools: () => void;
1800
+ sideAppVisible: boolean;
1801
+ setSideAppVisible: (visible: boolean) => void;
1802
+ sideAppSize: "small" | "middle" | "large" | "full";
1803
+ setSideAppSize: (size: "small" | "middle" | "large" | "full") => void;
1804
+ sideAppSelectedCard: PanelCard | null;
1805
+ setSideAppSelectedCard: (card: PanelCard | null) => void;
1806
+ openSideApp: (card: PanelCard) => void;
1807
+ closeSideApp: () => void;
1808
+ menuCollapsed: boolean | undefined;
1809
+ setMenuCollapsed: (collapsed: boolean) => void;
1810
+ openContentApp: (card: PanelCard) => void;
1811
+ closeContentApp: () => void;
1812
+ contentAppVisible: boolean;
1813
+ setcontentAppVisible: (visible: boolean) => void;
1814
+ contentAppSelectedCard: PanelCard | null;
1815
+ setContentAppSelectedCard: (card: PanelCard | null) => void;
1816
+ }>;
1824
1817
  /**
1825
- * Sidebar menu item configuration
1818
+ * Chat UI context provider. Manages visibility and selected cards for chat panel areas
1819
+ * (detail, tools, side app, content app) and the sidebar menu collapsed state.
1820
+ *
1821
+ * @description
1822
+ * Tracks the open/closed state and the currently selected {@link PanelCard} for each panel:
1823
+ * - **Detail panel**: A slide-out detail view that displays a chosen card's content.
1824
+ * - **Tools panel**: A tools sidebar/drawer for tool-specific cards.
1825
+ * - **Side app**: Aliases to the detail panel (shared state).
1826
+ * - **Content app**: An inline content area for embedded app cards.
1827
+ * - **Menu collapsed**: Whether the sidebar navigation menu is collapsed.
1828
+ *
1829
+ * Provides action helpers (`openDetail`, `closeDetail`, `openTools`, `toggleTools`, etc.)
1830
+ * that set both visibility and selected card atomically.
1831
+ *
1832
+ * @param props - Provider props.
1833
+ * @param props.children - React children to render within the UI context.
1834
+ *
1835
+ * @returns A React context provider wrapping children with {@link ChatUIContext.Provider}.
1836
+ *
1837
+ * @example
1838
+ * ```tsx
1839
+ * <ChatUIContextProvider>
1840
+ * <ChatLayout />
1841
+ * </ChatUIContextProvider>
1842
+ * ```
1826
1843
  */
1844
+ declare const ChatUIContextProvider: ({ children, }: {
1845
+ children: React__default.ReactNode;
1846
+ }) => react_jsx_runtime.JSX.Element;
1827
1847
  /**
1828
- * Sidebar menu item configuration.
1848
+ * Hook to access the chat UI context. Must be used within a {@link ChatUIContextProvider}.
1829
1849
  *
1830
- * Three item types:
1831
- * - `"action"` clickable button, set `builtin` for predefined behaviors
1832
- * - `"drawer"` opens a slide-out panel, set `content` + `title`
1833
- * - `"route"` — opens a GenUI-registered component in the SideApp area
1850
+ * @description
1851
+ * Returns panel visibility state, selected panel cards, and action functions for controlling
1852
+ * the chat interface panels (detail, tools, side app, content app) and menu collapsed state.
1834
1853
  *
1835
- * When providing `sideMenuItems` or `workspaceMenuItems` to `LatticeChatShellConfig`,
1836
- * your array **completely replaces** the defaults. Import `DEFAULT_MENU_ITEMS` or
1837
- * `DEFAULT_WORKSPACE_MENU_ITEMS` to selectively include built-in items:
1838
- * ```
1839
- * sideMenuItems: DEFAULT_MENU_ITEMS.filter(i => i.id === "thread-history")
1854
+ * @returns The current chat UI context value containing panel state and control functions.
1855
+ *
1856
+ * @example
1857
+ * ```tsx
1858
+ * const { detailVisible, openDetail, closeDetail, toggleTools, menuCollapsed } = useChatUIContext();
1859
+ *
1860
+ * const handleCardClick = (card: PanelCard) => {
1861
+ * openDetail(card);
1862
+ * };
1840
1863
  * ```
1841
1864
  */
1842
- interface SideMenuItemConfig {
1843
- /** Unique identifier for the menu item */
1865
+ declare const useChatUIContext: () => {
1866
+ detailVisible: boolean;
1867
+ setDetailVisible: (visible: boolean) => void;
1868
+ detailSize: "small" | "middle" | "large" | "full";
1869
+ setDetailSize: (size: "small" | "middle" | "large" | "full") => void;
1870
+ detailSelectedCard: PanelCard | null;
1871
+ setDetailSelectedCard: (card: PanelCard | null) => void;
1872
+ openDetail: (card: PanelCard) => void;
1873
+ closeDetail: () => void;
1874
+ toolsVisible: boolean;
1875
+ setToolsVisible: (visible: boolean) => void;
1876
+ toggleTools: () => void;
1877
+ toolSelectedCard: PanelCard | null;
1878
+ setToolSelectedCard: (card: PanelCard | null) => void;
1879
+ openTools: (card: PanelCard) => void;
1880
+ closeTools: () => void;
1881
+ sideAppVisible: boolean;
1882
+ setSideAppVisible: (visible: boolean) => void;
1883
+ sideAppSize: "small" | "middle" | "large" | "full";
1884
+ setSideAppSize: (size: "small" | "middle" | "large" | "full") => void;
1885
+ sideAppSelectedCard: PanelCard | null;
1886
+ setSideAppSelectedCard: (card: PanelCard | null) => void;
1887
+ openSideApp: (card: PanelCard) => void;
1888
+ closeSideApp: () => void;
1889
+ menuCollapsed: boolean | undefined;
1890
+ setMenuCollapsed: (collapsed: boolean) => void;
1891
+ openContentApp: (card: PanelCard) => void;
1892
+ closeContentApp: () => void;
1893
+ contentAppVisible: boolean;
1894
+ setcontentAppVisible: (visible: boolean) => void;
1895
+ contentAppSelectedCard: PanelCard | null;
1896
+ setContentAppSelectedCard: (card: PanelCard | null) => void;
1897
+ };
1898
+
1899
+ interface SideAppBrowserContextValue {
1900
+ openApp: (card: PanelCard) => void;
1901
+ }
1902
+ declare const SideAppBrowserContext: React$1.Context<SideAppBrowserContextValue | null>;
1903
+ declare const useSideAppBrowser: () => SideAppBrowserContextValue | null;
1904
+ declare const useSideAppOpener: () => ((card: PanelCard) => void);
1905
+
1906
+ /**
1907
+ * Thread information for a conversation
1908
+ */
1909
+ interface ConversationThread {
1844
1910
  id: string;
1845
- /** Type of the menu item - drawer or route (SideApp) */
1846
- type: SideMenuItemType;
1847
- /** Display name of the menu item */
1848
- name: string;
1849
- /** Icon component for the menu item */
1850
- icon?: ReactNode;
1851
- /** Order for sorting menu items (lower values first) */
1852
- order?: number;
1853
- /** Whether this is a builtin menu item (new-analysis, thread-history, assistants, skill, skills, tools, workspace, settings, database, metrics, mcp, projects, logout, switch-tenant) */
1854
- builtin?: "new-analysis" | "thread-history" | "assistants" | "skill" | "skills" | "tools" | "workspace" | "settings" | "database" | "metrics" | "mcp" | "projects" | "logout" | "switch-tenant";
1855
- /**
1856
- * Menu group for organizing items
1857
- */
1858
- group?: string;
1859
- /**
1860
- * Whether the menu item is enabled (can be toggled)
1861
- * Defaults to true
1862
- */
1863
- enabled?: boolean;
1864
- /** Content config from DB (for custom menu items) */
1865
- contentConfig?: Record<string, unknown>;
1866
- /** Content to display inside the drawer (for drawer type) */
1867
- content?: ReactNode;
1868
- /** Drawer title (for drawer type) */
1869
- title?: string;
1870
- /** Drawer width in pixels or percentage (for drawer type) */
1871
- width?: string | number;
1872
- /**
1873
- * Whether to display drawer content inline in expanded sidebar mode
1874
- * When true, content shows below the menu item instead of in a drawer
1875
- * Defaults to false, but true for "workspace" builtin
1876
- */
1877
- inline?: boolean;
1878
- /**
1879
- * Maximum height for inline drawer content in pixels
1880
- * Only applies when inline is true
1881
- * Defaults to 400
1882
- */
1883
- inlineMaxHeight?: number;
1884
- /**
1885
- * Whether inline drawer is expanded by default
1886
- * Only applies when inline is true
1887
- * Defaults to false
1888
- */
1889
- inlineDefaultExpanded?: boolean;
1890
- /** Component to render in SideApp (for route type) */
1891
- sideAppComponent?: ReactNode;
1911
+ label: string;
1912
+ createdAt?: string;
1913
+ updatedAt?: string;
1892
1914
  }
1893
1915
  /**
1894
- * Lattice Chat Shell configuration interface
1916
+ * Conversation context value
1895
1917
  */
1896
- interface LatticeChatShellConfig {
1897
- /**
1898
- * Base URL for the API
1899
- */
1900
- baseURL: string;
1901
- /**
1902
- * API key for authentication (optional)
1903
- */
1904
- apiKey?: string;
1905
- /**
1906
- * Transport method (Server-Sent Events or WebSocket)
1907
- */
1908
- transport?: "sse" | "ws";
1909
- /**
1910
- * Request timeout in milliseconds (optional)
1911
- */
1912
- timeout?: number;
1913
- /**
1914
- * Additional headers to include in requests (optional)
1915
- */
1916
- headers?: Record<string, string>;
1917
- /**
1918
- * Whether users can create new threads from the UI
1919
- * Defaults to true
1920
- */
1921
- enableThreadCreation?: boolean;
1918
+ interface ConversationContextValue {
1922
1919
  /**
1923
- * Whether users can view the thread list in the sidebar
1924
- * Defaults to true
1920
+ * Current assistant ID
1925
1921
  */
1926
- enableThreadList?: boolean;
1927
- assistantId?: string;
1928
- showSideMenu?: boolean;
1929
- /**
1930
- * URL of the global shared sandbox, this is used to access the global shared sandbox
1931
- * if not provided, sandbox will be created in the agent's sandbox
1932
- */
1933
- globalSharedSandboxURL?: string;
1934
- /**
1935
- * Available middleware types that can be configured for agents
1936
- * Each middleware type defines its name, description, and default configuration
1937
- * If not provided, default middleware types will be used
1938
- */
1939
- availableMiddlewareTypes?: MiddlewareTypeDefinition[];
1922
+ assistantId: string | null;
1940
1923
  /**
1941
- * Whether users can create new assistants
1942
- * Defaults to true
1924
+ * Current thread for the assistant
1943
1925
  */
1944
- enableAssistantCreation?: boolean;
1945
- /**
1946
- * Whether users can edit existing assistants
1947
- * Defaults to true
1948
- */
1949
- enableAssistantEditing?: boolean;
1926
+ thread: ConversationThread | null;
1950
1927
  /**
1951
- * Whether to enable workspace and project management
1952
- * When enabled, shows workspace selector in header and file browser
1953
- * Defaults to false
1928
+ * Current thread ID
1954
1929
  */
1955
- enableWorkspace?: boolean;
1930
+ threadId: string | null;
1956
1931
  /**
1957
- * Whether to load custom menu items from the database (API /api/menu-items).
1958
- * When enabled, WorkspaceResourceManager fetches per-tenant custom menu items
1959
- * and merges them with built-in defaults.
1960
- * Defaults to true.
1932
+ * List of threads for the current assistant
1961
1933
  */
1962
- enableCustomMenu?: boolean;
1934
+ threads: ConversationThread[];
1963
1935
  /**
1964
- * Resource folders configuration for workspace
1965
- * Each folder represents a section in the workspace assets panel
1966
- * If not provided, defaults to a single root folder with upload enabled
1936
+ * Whether threads are being loaded
1967
1937
  */
1968
- resourceFolders?: ResourceFolderConfig[];
1938
+ isLoading: boolean;
1969
1939
  /**
1970
- * Chat sidebar menu items. When provided, completely replaces the
1971
- * default built-in items (New Analysis, History).
1972
- *
1973
- * To selectively include built-in items, import and filter `DEFAULT_MENU_ITEMS`:
1974
- * ```
1975
- * sideMenuItems: DEFAULT_MENU_ITEMS.filter(i => i.id === "thread-history")
1976
- * ```
1977
- * Omit this field to use all defaults.
1978
- */
1979
- sideMenuItems?: SideMenuItemConfig[];
1940
+ * Error message if any
1941
+ */
1942
+ error: Error | null;
1980
1943
  /**
1981
- * Workspace menu items. When provided, completely replaces the
1982
- * default workspace items (Projects, Metrics, Database, etc.).
1983
- *
1984
- * To selectively include built-in items, import and filter `DEFAULT_WORKSPACE_MENU_ITEMS`:
1985
- * ```
1986
- * workspaceMenuItems: DEFAULT_WORKSPACE_MENU_ITEMS.filter(
1987
- * i => ["workspace_projects", "assistants"].includes(i.id)
1988
- * )
1989
- * ```
1990
- * Omit this field to use all defaults.
1944
+ * Set the current thread
1991
1945
  */
1992
- workspaceMenuItems?: SideMenuItemConfig[];
1946
+ setThread: (thread: ConversationThread | null) => void;
1993
1947
  /**
1994
- * Whether to enable the database picker slot in the chat sender
1995
- * When enabled, shows a database selection button in the sender footer
1996
- * Defaults to true
1948
+ * Select a thread by ID
1997
1949
  */
1998
- enableDatabaseSlot?: boolean;
1950
+ selectThread: (threadId: string) => void;
1999
1951
  /**
2000
- * Whether to enable the skill picker slot in the chat sender
2001
- * When enabled, shows a skill selection button in the sender footer
2002
- * Defaults to true
1952
+ * Create a new thread for the current assistant
2003
1953
  */
2004
- enableSkillSlot?: boolean;
1954
+ createThread: (label?: string) => Promise<ConversationThread>;
2005
1955
  /**
2006
- * Whether to enable the agent picker slot in the chat sender
2007
- * When enabled, shows an agent selection button in the sender footer
2008
- * Defaults to true
1956
+ * List all threads for the current assistant
2009
1957
  */
2010
- enableAgentSlot?: boolean;
1958
+ listThreads: () => Promise<ConversationThread[]>;
2011
1959
  /**
2012
- * Whether to enable the metrics datasource picker slot in the chat sender
2013
- * When enabled, shows a metrics datasource selection button in the sender footer
2014
- * Defaults to true
1960
+ * Update thread for the current assistant
2015
1961
  */
2016
- enableMetricsDataSourceSlot?: boolean;
1962
+ updateThread: (thread: ConversationThread) => Promise<void>;
2017
1963
  /**
2018
- * Whether to enable the model selector in the chat sender
2019
- * When enabled, shows a model selection dropdown in the sender footer
2020
- * Defaults to false
1964
+ * Get thread by ID
2021
1965
  */
2022
- enableModelSelector?: boolean;
1966
+ getThreadById: (threadId: string) => ConversationThread | null;
2023
1967
  /**
2024
- * Sidebar display mode
2025
- * - "icon": Show only icons (default)
2026
- * - "expanded": Show icons with labels and groups
2027
- * Defaults to "icon"
2028
- */
2029
- sidebarMode?: "icon" | "expanded";
1968
+ * Delete a thread by ID
1969
+ */
1970
+ deleteThread: (threadId: string) => Promise<void>;
2030
1971
  /**
2031
- * Whether sidebar is expanded by default (only applies when sidebarMode is "expanded")
2032
- * Defaults to true
1972
+ * Clear the current thread
2033
1973
  */
2034
- sidebarDefaultExpanded?: boolean;
1974
+ clearThread: () => void;
2035
1975
  /**
2036
- * Whether workspace menu is expanded by default
2037
- * Defaults to true
1976
+ * Refresh threads for the current assistant
2038
1977
  */
2039
- workspaceMenuDefaultExpanded?: boolean;
1978
+ refresh: () => Promise<void>;
2040
1979
  /**
2041
- * Whether to show the expand/collapse toggle button
2042
- * Defaults to true
1980
+ * Custom run configuration (cross-thread, assistant-level)
1981
+ * Used for metrics datasource and other assistant-wide settings
2043
1982
  */
2044
- sidebarShowToggle?: boolean;
1983
+ customRunConfig: Record<string, any>;
2045
1984
  /**
2046
- * Whether to show the "New Analysis" button in expanded sidebar
2047
- * Defaults to true
1985
+ * Update custom run configuration
2048
1986
  */
2049
- sidebarShowNewAnalysis?: boolean;
1987
+ updateCustomRunConfig: (config: Record<string, any>) => void;
1988
+ }
1989
+ /**
1990
+ * Conversation context
1991
+ */
1992
+ declare const ConversationContext: React$1.Context<ConversationContextValue>;
1993
+ /**
1994
+ * Props for ConversationContextProvider
1995
+ */
1996
+ interface ConversationContextProviderProps {
1997
+ children: React.ReactNode;
1998
+ }
1999
+ /**
2000
+ * Generate a thread label from the first message content
2001
+ * Extracts first 15 characters of text content, excluding attachments
2002
+ */
2003
+ declare function generateLabelFromMessage(message: string): string;
2004
+ /**
2005
+ * Provider component for ConversationContext.
2006
+ * Manages conversation thread state for the currently selected assistant.
2007
+ *
2008
+ * @description
2009
+ * Coordinates with {@link AssistantContext} to load threads for the current assistant.
2010
+ * Key behaviors:
2011
+ * - **Thread loading**: Fetches threads from the API when the assistant changes. If no threads
2012
+ * exist, a new thread is automatically created.
2013
+ * - **Auto-selection**: Selects the most recently updated thread as the active thread when loading.
2014
+ * - **Cross-thread config**: Maintains an assistant-level `customRunConfig` shared across all threads
2015
+ * (useful for metrics datasource and other assistant-wide settings).
2016
+ * - **Thread operations**: Provides full CRUD operations (create, update, delete, list, select)
2017
+ * backed by the client SDK.
2018
+ *
2019
+ * Requires {@link AssistantContextProvider} ancestor and {@link LatticeChatShellContextProvider}.
2020
+ *
2021
+ * @param props - {@link ConversationContextProviderProps}
2022
+ * @param props.children - React children to render within the conversation context.
2023
+ *
2024
+ * @returns A React context provider wrapping children with {@link ConversationContext.Provider}.
2025
+ *
2026
+ * @example
2027
+ * ```tsx
2028
+ * <ConversationContextProvider>
2029
+ * <ThreadList />
2030
+ * </ConversationContextProvider>
2031
+ * ```
2032
+ */
2033
+ declare const ConversationContextProvider: ({ children, }: ConversationContextProviderProps) => react_jsx_runtime.JSX.Element;
2034
+ /**
2035
+ * Hook to access ConversationContext
2036
+ * @returns Conversation context value
2037
+ * @throws Error if used outside of ConversationContextProvider
2038
+ */
2039
+ declare const useConversationContext: () => ConversationContextValue;
2040
+
2041
+ /**
2042
+ * Assistant state interface
2043
+ */
2044
+ interface AssistantState {
2050
2045
  /**
2051
- * Logo text displayed in expanded sidebar
2052
- * Defaults to "Lattice"
2046
+ * List of all assistants
2053
2047
  */
2054
- sidebarLogoText?: string;
2048
+ assistants: Assistant[];
2055
2049
  /**
2056
- * Custom logo icon component
2057
- * If not provided, defaults to Cpu icon
2050
+ * Currently selected assistant
2058
2051
  */
2059
- sidebarLogoIcon?: React__default.ReactNode;
2052
+ currentAssistant: Assistant | null;
2060
2053
  /**
2061
- * Custom quick prompts data for quick prompt components
2062
- * Allows registering custom prompt categories and items via shell config
2063
- * If not provided, default prompt data will be used
2054
+ * Whether data is being loaded
2064
2055
  */
2065
- quickPromptsData?: QuickPromptCategory[];
2056
+ isLoading: boolean;
2057
+ /**
2058
+ * Error message if any
2059
+ */
2060
+ error: Error | null;
2066
2061
  }
2067
2062
  /**
2068
- * Lattice Chat Shell context value interface
2063
+ * Assistant context value interface
2069
2064
  */
2070
- interface LatticeChatShellContextValue {
2065
+ interface AssistantContextValue extends AssistantState {
2071
2066
  /**
2072
- * Current configuration
2067
+ * List all assistants
2073
2068
  */
2074
- config: LatticeChatShellConfig;
2069
+ listAssistants: () => Promise<void>;
2075
2070
  /**
2076
- * Update the entire configuration
2071
+ * Get a single assistant by ID
2077
2072
  */
2078
- updateConfig: (config: Partial<LatticeChatShellConfig>) => void;
2073
+ getAssistant: (id: string) => Promise<Assistant>;
2079
2074
  /**
2080
- * Update a specific configuration value
2075
+ * Create a new assistant
2081
2076
  */
2082
- updateConfigValue: <K extends keyof LatticeChatShellConfig>(key: K, value: LatticeChatShellConfig[K]) => void;
2077
+ createAssistant: (options: CreateAssistantOptions) => Promise<Assistant>;
2083
2078
  /**
2084
- * Reset configuration to defaults
2079
+ * Update an existing assistant
2085
2080
  */
2086
- resetConfig: () => void;
2081
+ updateAssistant: (id: string, options: UpdateAssistantOptions) => Promise<Assistant>;
2087
2082
  /**
2088
- * Whether the settings modal is open
2083
+ * Delete an assistant
2089
2084
  */
2090
- settingsModalOpen: boolean;
2085
+ deleteAssistant: (id: string) => Promise<void>;
2091
2086
  /**
2092
- * Set the settings modal open state
2087
+ * Select an assistant as current
2093
2088
  */
2094
- setSettingsModalOpen: (open: boolean) => void;
2089
+ selectAssistant: (id: string) => Promise<void>;
2090
+ /**
2091
+ * Clear the current assistant selection
2092
+ */
2093
+ clearCurrentAssistant: () => void;
2094
+ /**
2095
+ * Refresh the assistant list
2096
+ */
2097
+ refresh: () => Promise<void>;
2095
2098
  }
2096
2099
  /**
2097
- * Default middleware type definitions with JSON Schema for configuration
2098
- */
2099
- declare const DEFAULT_MIDDLEWARE_TYPES: MiddlewareTypeDefinition[];
2100
- /**
2101
- * Lattice Chat Shell context
2100
+ * Assistant context
2102
2101
  */
2103
- declare const LatticeChatShellContext: React__default.Context<LatticeChatShellContextValue>;
2102
+ declare const AssistantContext: React$1.Context<AssistantContextValue>;
2104
2103
  /**
2105
- * Props for LatticeChatShellContextProvider
2104
+ * Props for AssistantContextProvider
2106
2105
  */
2107
- interface LatticeChatShellContextProviderProps {
2106
+ interface AssistantContextProviderProps {
2108
2107
  /**
2109
2108
  * Children components
2110
2109
  */
2111
- children: ReactNode;
2112
- /**
2113
- * Initial configuration (optional)
2114
- */
2115
- initialConfig?: Partial<LatticeChatShellConfig>;
2110
+ children: React.ReactNode;
2116
2111
  /**
2117
- * Whether to persist configuration to localStorage (optional, default: false)
2112
+ * Whether to automatically load assistants on mount
2118
2113
  */
2119
- persistToLocalStorage?: boolean;
2114
+ autoLoad?: boolean;
2120
2115
  /**
2121
- * LocalStorage key for persisting configuration (optional, default: "lattice_chat_shell_config")
2116
+ * Initial assistant ID to select
2122
2117
  */
2123
- localStorageKey?: string;
2118
+ initialAssistantId?: string | null;
2124
2119
  }
2125
2120
  /**
2126
- * Provider component for LatticeChatShellContext
2127
- * Manages Lattice Chat Shell configuration
2121
+ * Provider component for AssistantContext.
2122
+ * Manages assistant state and operations including CRUD, selection, and auto-loading.
2123
+ *
2124
+ * @description
2125
+ * Coordinates with the client SDK to provide assistant management:
2126
+ * - **Auto-load**: When `autoLoad` is `true` (default), fetches the assistant list on mount.
2127
+ * - **Auto-selection**: If `initialAssistantId` is provided, selects that assistant after loading.
2128
+ * Otherwise, auto-selects the first available assistant.
2129
+ * - **Re-selection**: If the currently selected assistant is removed from the list (e.g., deleted),
2130
+ * falls back to selecting the first available assistant.
2131
+ * - **CRUD operations**: Provides `createAssistant`, `updateAssistant`, `deleteAssistant`, and
2132
+ * `getAssistant` backed by the SDK, keeping local state in sync.
2133
+ *
2134
+ * Requires an {@link AxiomLatticeProvider} ancestor for the API client.
2135
+ *
2136
+ * @param props - {@link AssistantContextProviderProps}
2137
+ * @param props.children - React children to render within the assistant context.
2138
+ * @param props.autoLoad - Whether to automatically load assistants on mount. Defaults to `true`.
2139
+ * @param props.initialAssistantId - Optional assistant ID to auto-select on load.
2140
+ *
2141
+ * @returns A React context provider wrapping children with {@link AssistantContext.Provider}.
2142
+ *
2143
+ * @example
2144
+ * ```tsx
2145
+ * <AssistantContextProvider initialAssistantId="asst_123">
2146
+ * <AssistantSelector />
2147
+ * </AssistantContextProvider>
2148
+ * ```
2128
2149
  */
2129
- declare const LatticeChatShellContextProvider: ({ children, initialConfig, persistToLocalStorage, localStorageKey, }: LatticeChatShellContextProviderProps) => react_jsx_runtime.JSX.Element;
2150
+ declare const AssistantContextProvider: ({ children, autoLoad, initialAssistantId, }: AssistantContextProviderProps) => react_jsx_runtime.JSX.Element;
2130
2151
  /**
2131
- * Hook to access LatticeChatShellContext
2132
- * @returns Lattice Chat Shell context value
2133
- * @throws Error if used outside of LatticeChatShellContextProvider
2152
+ * Hook to access AssistantContext
2153
+ * @returns Assistant context value
2154
+ * @throws Error if used outside of AssistantContextProvider
2134
2155
  */
2135
- declare const useLatticeChatShellContext: () => LatticeChatShellContextValue;
2156
+ declare const useAssistantContext: () => AssistantContextValue;
2157
+
2158
+ interface Props$1 {
2159
+ connectionType: string;
2160
+ value?: string[];
2161
+ onChange: (keys: string[]) => void;
2162
+ }
2163
+ declare const ConnectionListField: React__default.FC<Props$1>;
2136
2164
 
2137
2165
  /**
2138
2166
  * Represents a single message in the chat UI.
@@ -3417,4 +3445,4 @@ type IframeMessage = {
3417
3445
  };
3418
3446
  declare function generateIframeSrcdoc(): string;
3419
3447
 
3420
- export { type AgentChatProps, AgentConversations, type AgentConversationsProps, type AgentState, AgentThreadProvider, type AgentThreadProviderProps, AssistantContext, AssistantContextProvider, type AssistantContextProviderProps, type AssistantContextValue, AssistantFlow, type AssistantFlowProps, AssistantNode, type AssistantNodeData, type AssistantState, type AttachFile, type AuthContextValue, AuthProvider, AxiomLatticeProvider, type AxiomLatticeProviderProps, type BalanceResult, ChangePasswordModal, type ChangePasswordModalProps, ChannelInstallationsDrawerContent, ChatErrorBoundary, type ChatErrorBoundaryProps, type ChatResponse, ChatSidebar, type ChatSidebarProps, type ChatState, type ChatStateWithAgent, ChatUIContext, ChatUIContextProvider, Chating, type ChatingProps, type ClientConfig, ColumnLayout, type ColumnLayoutProps, ConversationContext, ConversationContextProvider, type ConversationContextProviderProps, type ConversationContextValue, type ConversationThread, CreateAssistantModal, DEFAULT_MENU_ITEMS, DEFAULT_MIDDLEWARE_TYPES, DEFAULT_WORKSPACE_MENU_ITEMS, type ElementMeta, type ElementProps, type EntityAction, EntityCard, EntityCreateTrigger, EntityListShell, EntityListView, EntityRow, EvalPanel, EvalRunResults, EvalSuiteCardList, EvalSuiteDetail, type ExplorerFile, FileExplorer, type FileExplorerProps, FilePanelToggle, type IframeMessage, LatticeAgentWorkspace, LatticeChat, LatticeChatShell, type LatticeChatShellConfig, LatticeChatShellContext, LatticeChatShellContextProvider, type LatticeChatShellContextProviderProps, type LatticeChatShellContextValue, type LatticeChatShellProps, LoginForm, type LoginFormProps, LoginPage, MDResponse, MDViewFormItem, MetricsConfigDrawerContent, type MiddlewareConfigDefinition, type MiddlewareConfigSchema, type MiddlewareConfigSchemaProperty, type MiddlewareToolDefinition, type MiddlewareTypeDefinition, type ModelConfig, type ModelInfo, ModelSelector, type ModelSelectorProps, type PanelCard, type PendingMessage, PersonalAssistantChannelModal, PersonalAssistantPage, ProtectedRoute, type ProtectedRouteProps, type QuickPromptCategory, type QuickPromptItem, RegisterForm, type RegisterFormProps, type ResourceFolderConfig, type SanitizerConfig, ScheduleButton, type ScheduleButtonProps, SideAppBrowserContext, type SideAppBrowserContextValue, SideAppViewBrowser, type SideMenuItemConfig, type SideMenuItemType, SkillCategoryPrompts, type SkillCategoryPromptsProps, SkillFlow, type SkillFlowProps, SkillNode, type SkillNodeData, type StreamEventHandlerOptions, type StreamingError, StreamingHTMLRenderer, type StreamingHTMLRendererProps, TenantSelector, type TenantSelectorProps, type ThreadState, type ToolCallData, type UIMessage, type UseAgentStateOptions, type UseAgentStateReturn, type UseApiOptions, type UseApiReturn, type UseAxiomLatticeOptions, type UseChatOptions, type UseTenantsOptions, type UseTenantsReturn, type UseUsersOptions, type UseUsersReturn, UserProfile, type UserProfileProps, type UserTenantInfo, type ViewMode, ViewToggle, WorkflowAutomationView, WorkflowCanvas, type WorkflowCanvasProps, WorkflowNode, type WorkflowNodeData, WorkspaceResourceManager, type WorkspaceResourceManagerProps, WorkspaceResourceUIContext, animation, axiomAntdTheme, axiomAntdThemeDark, axiomTokens, colors, generateIframeSrcdoc, generateLabelFromMessage, getAxiomAntdTheme, getElement, radius, regsiterElement, shadows, spacing, typography, useAgentChat, useAgentGraph, useAgentState, useAgentThreadContext, useApi, useAssistantContext, useAuth, useAuthOptional, useAxiomLattice, useAxiomTheme, useChat, useChatUIContext, useClient, useConversationContext, useEvalCases, useEvalProjects, useEvalRunStream, useEvalRuns, useEvalSuites, useLatticeChatShellContext, useSideAppBrowser, useSideAppOpener, useTenants, useUsers };
3448
+ export { type AgentChatProps, AgentConversations, type AgentConversationsProps, type AgentState, AgentThreadProvider, type AgentThreadProviderProps, AssistantContext, AssistantContextProvider, type AssistantContextProviderProps, type AssistantContextValue, AssistantFlow, type AssistantFlowProps, AssistantNode, type AssistantNodeData, type AssistantState, type AttachFile, type AuthContextValue, AuthProvider, AxiomLatticeProvider, type AxiomLatticeProviderProps, type BalanceResult, ChangePasswordModal, type ChangePasswordModalProps, ChannelInstallationsDrawerContent, ChatErrorBoundary, type ChatErrorBoundaryProps, type ChatResponse, ChatSidebar, type ChatSidebarProps, type ChatState, type ChatStateWithAgent, ChatUIContext, ChatUIContextProvider, Chating, type ChatingProps, type ClientConfig, ColumnLayout, type ColumnLayoutProps, ConnectionListField, ConversationContext, ConversationContextProvider, type ConversationContextProviderProps, type ConversationContextValue, type ConversationThread, CreateAssistantModal, DEFAULT_MENU_ITEMS, DEFAULT_MIDDLEWARE_TYPES, DEFAULT_WORKSPACE_MENU_ITEMS, type ElementMeta, type ElementProps, type EntityAction, EntityCard, EntityCreateTrigger, EntityListShell, EntityListView, EntityRow, EvalPanel, EvalRunResults, EvalSuiteCardList, EvalSuiteDetail, type ExplorerFile, FileExplorer, type FileExplorerProps, FilePanelToggle, type IframeMessage, LatticeAgentWorkspace, LatticeChat, LatticeChatShell, type LatticeChatShellConfig, LatticeChatShellContext, LatticeChatShellContextProvider, type LatticeChatShellContextProviderProps, type LatticeChatShellContextValue, type LatticeChatShellProps, LoginForm, type LoginFormProps, LoginPage, MDResponse, MDViewFormItem, MetricsConfigDrawerContent, type MiddlewareConfigDefinition, type MiddlewareConfigSchema, type MiddlewareConfigSchemaProperty, type MiddlewareToolDefinition, type MiddlewareTypeDefinition, type ModelConfig, type ModelInfo, ModelSelector, type ModelSelectorProps, type PanelCard, type PendingMessage, PersonalAssistantChannelModal, PersonalAssistantPage, ProtectedRoute, type ProtectedRouteProps, type QuickPromptCategory, type QuickPromptItem, RegisterForm, type RegisterFormProps, type ResourceFolderConfig, type SanitizerConfig, ScheduleButton, type ScheduleButtonProps, SideAppBrowserContext, type SideAppBrowserContextValue, SideAppViewBrowser, type SideMenuItemConfig, type SideMenuItemType, SkillCategoryPrompts, type SkillCategoryPromptsProps, SkillFlow, type SkillFlowProps, SkillNode, type SkillNodeData, type StreamEventHandlerOptions, type StreamingError, StreamingHTMLRenderer, type StreamingHTMLRendererProps, TenantSelector, type TenantSelectorProps, type ThreadState, type ToolCallData, type UIMessage, type UseAgentStateOptions, type UseAgentStateReturn, type UseApiOptions, type UseApiReturn, type UseAxiomLatticeOptions, type UseChatOptions, type UseTenantsOptions, type UseTenantsReturn, type UseUsersOptions, type UseUsersReturn, UserProfile, type UserProfileProps, type UserTenantInfo, type ViewMode, ViewToggle, WorkflowAutomationView, WorkflowCanvas, type WorkflowCanvasProps, WorkflowNode, type WorkflowNodeData, WorkspaceResourceManager, type WorkspaceResourceManagerProps, WorkspaceResourceUIContext, animation, axiomAntdTheme, axiomAntdThemeDark, axiomTokens, colors, generateIframeSrcdoc, generateLabelFromMessage, getAxiomAntdTheme, getElement, radius, regsiterElement, shadows, spacing, typography, useAgentChat, useAgentGraph, useAgentState, useAgentThreadContext, useApi, useAssistantContext, useAuth, useAuthOptional, useAxiomLattice, useAxiomTheme, useChat, useChatUIContext, useClient, useConversationContext, useEvalCases, useEvalProjects, useEvalRunStream, useEvalRuns, useEvalSuites, useLatticeChatShellContext, useMiddlewareTypes, useSideAppBrowser, useSideAppOpener, useTenants, useUsers };