@axiom-lattice/react-sdk 2.1.103 → 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.mts 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,1643 +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.
596
+ * Sidebar menu item configuration.
692
597
  *
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}.
710
- *
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;
793
- /**
794
- * Props for {@link AuthProvider}.
795
- */
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`). */
800
- 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;
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;
807
660
  }
808
661
  /**
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
- * ```
840
- */
841
- declare const AuthProvider: React__default.FC<AuthProviderProps>;
842
-
843
- /**
844
- * Login Form Components
845
- * Uses base styles from design system
662
+ * Lattice Chat Shell configuration interface
846
663
  */
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;
664
+ interface LatticeChatShellConfig {
665
+ /**
666
+ * Base URL for the API
667
+ */
668
+ baseURL: string;
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[];
867
839
  }
868
- declare const RegisterForm: React__default.FC<RegisterFormProps>;
869
-
870
840
  /**
871
- * User Profile Components
872
- * Using Axiom Theme with Ant Design
841
+ * Lattice Chat Shell context value interface
873
842
  */
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;
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;
882
868
  }
883
869
  /**
884
- * User Profile Component
870
+ * Default middleware type definitions with JSON Schema for configuration
885
871
  */
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;
893
- }
872
+ declare const DEFAULT_MIDDLEWARE_TYPES: MiddlewareTypeDefinition[];
894
873
  /**
895
- * Protected Route Component
896
- * Shows loading state, redirects, or fallback when not authenticated
874
+ * Lattice Chat Shell context
897
875
  */
898
- declare const ProtectedRoute: React__default.FC<ProtectedRouteProps>;
899
-
876
+ declare const LatticeChatShellContext: React__default.Context<LatticeChatShellContextValue>;
900
877
  /**
901
- * Tenant Selector Components
902
- * Uses unified auth styles from design system
878
+ * Props for LatticeChatShellContextProvider
903
879
  */
904
-
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;
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;
921
897
  }
922
- declare const ChangePasswordModal: React__default.FC<ChangePasswordModalProps>;
898
+ /**
899
+ * Provider component for LatticeChatShellContext
900
+ * Manages Lattice Chat Shell configuration
901
+ */
902
+ declare const LatticeChatShellContextProvider: ({ children, initialConfig, persistToLocalStorage, localStorageKey, }: LatticeChatShellContextProviderProps) => react_jsx_runtime.JSX.Element;
903
+ /**
904
+ * Hook to access LatticeChatShellContext
905
+ * @returns Lattice Chat Shell context value
906
+ * @throws Error if used outside of LatticeChatShellContextProvider
907
+ */
908
+ declare const useLatticeChatShellContext: () => LatticeChatShellContextValue;
923
909
 
924
- interface UseTenantsOptions {
925
- baseURL: string;
926
- token?: string;
927
- }
928
- interface UseTenantsReturn {
929
- tenants: Tenant[];
910
+ interface UseMiddlewareTypesResult {
911
+ middlewareTypes: MiddlewareTypeDefinition[];
930
912
  isLoading: boolean;
931
- error: string | null;
932
- refresh: () => Promise<void>;
933
- getTenantById: (id: string) => Tenant | undefined;
913
+ isFallback: boolean;
934
914
  }
935
915
  /**
936
- * Fetches and manages a list of tenants from the API.
916
+ * Fetch middleware types from API, fallback to DEFAULT_MIDDLEWARE_TYPES on failure.
917
+ */
918
+ declare function useMiddlewareTypes(endpoint?: string): UseMiddlewareTypesResult;
919
+
920
+ /**
921
+ * Fetches and manages evaluation projects.
937
922
  *
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
923
+ * @returns Project list, loading state, error, and CRUD operations
942
924
  *
943
925
  * @example
944
926
  * ```tsx
945
- * const { tenants, isLoading, error, refresh, getTenantById } = useTenants({
946
- * baseURL: "https://api.example.com",
947
- * token: "your-auth-token",
948
- * });
927
+ * const { projects, loading, create, update, remove, refresh } = useEvalProjects();
928
+ *
929
+ * await create({ name: "My Project" });
949
930
  * ```
950
931
  */
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;
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>;
961
939
  refresh: () => Promise<void>;
962
- searchByEmail: (email: string) => Promise<_axiom_lattice_protocols.User | null>;
963
- }
940
+ };
941
+
964
942
  /**
965
- * Fetches and manages a list of users within a tenant.
943
+ * Fetches and manages evaluation suites within a project.
966
944
  *
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
945
+ * @param projectId - The project ID to fetch suites for
946
+ * @returns Suite list, loading state, error, and CRUD operations
972
947
  *
973
948
  * @example
974
949
  * ```tsx
975
- * const { users, isLoading, error, searchByEmail } = useUsers({
976
- * baseURL: "https://api.example.com",
977
- * tenantId: "tenant-123",
978
- * });
950
+ * const { suites, loading, create, remove } = useEvalSuites("proj-123");
979
951
  *
980
- * const user = await searchByEmail("user@example.com");
952
+ * await create("proj-123", { name: "Accuracy Suite" });
981
953
  * ```
982
954
  */
983
- declare function useUsers(options: UseUsersOptions): UseUsersReturn;
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>;
962
+ refresh: () => Promise<void>;
963
+ };
984
964
 
985
- interface ChatErrorBoundaryProps {
986
- children: React__default.ReactNode;
987
- fallback?: React__default.ReactNode;
988
- onError?: (error: Error, errorInfo: React__default.ErrorInfo) => void;
989
- }
990
- interface ChatErrorBoundaryState {
991
- hasError: boolean;
965
+ /**
966
+ * Fetches and manages evaluation cases within a suite.
967
+ *
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
971
+ *
972
+ * @example
973
+ * ```tsx
974
+ * const { cases, loading, create } = useEvalCases("proj-123", "suite-456");
975
+ *
976
+ * await create("proj-123", "suite-456", { question: "What is 2+2?", answer: "4" });
977
+ * ```
978
+ */
979
+ declare function useEvalCases(projectId: string, suiteId: string): {
980
+ cases: unknown[];
981
+ loading: boolean;
992
982
  error: Error | null;
993
- retryKey: number;
994
- }
995
- declare class ChatErrorBoundary extends Component<ChatErrorBoundaryProps, ChatErrorBoundaryState> {
996
- constructor(props: ChatErrorBoundaryProps);
997
- static getDerivedStateFromError(error: Error): Partial<ChatErrorBoundaryState>;
998
- componentDidCatch(error: Error, errorInfo: React__default.ErrorInfo): void;
999
- handleRetry: () => void;
1000
- render(): React__default.ReactNode;
1001
- }
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
+ };
1002
988
 
1003
989
  /**
1004
- * Props for the {@link Chating} component the core chat interface.
990
+ * Fetches and manages evaluation runs, optionally scoped to a project.
1005
991
  *
1006
- * Controls appearance, sender behavior, empty-state customization, and
1007
- * optional context injection for the agent.
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
+ * ```
1008
1001
  */
1009
- interface ChatingProps {
1010
- /** Agent display name shown in the header. */
1011
- name?: string;
1012
- /** Agent description shown in the header. */
1013
- description?: string;
1014
- /** Fallback message used when the user submits only attachments without text. */
1015
- default_submit_message?: string;
1016
- /** Avatar URL or component for the agent. */
1017
- avatar?: string;
1018
- /** Placeholder content rendered inside the attachment upload area. */
1019
- attachment_placeholder?: React__default.ReactNode;
1020
- /** Custom upload endpoint URL. Defaults to the workspace or thread sandbox upload endpoint. */
1021
- uploadAction?: string;
1022
- /** Quick prompt items displayed between messages. */
1023
- senderPromptsItems?: GetProp<typeof Prompts, "items">;
1024
- /** Extra content rendered in the header area. */
1025
- extra?: React__default.ReactNode;
1026
- /** Additional metadata items for the header. */
1027
- extraMeta?: Array<{
1028
- id: string;
1002
+ declare function useEvalRuns(projectId?: string): {
1003
+ runs: unknown[];
1004
+ loading: boolean;
1005
+ error: Error | null;
1006
+ start: (pid: string) => Promise<{
1007
+ run_id: string;
1029
1008
  }>;
1030
- /** Whether to show the agent header bar. Default: true. */
1031
- showHeader?: boolean;
1032
- /** Whether to show the message sender input. Default: true. */
1033
- showSender?: boolean;
1034
- /** Whether to show the Human-in-the-Loop (HITL) container. Default: true. */
1035
- showHITL?: boolean;
1036
- /** Whether to show a refresh button in the header. */
1037
- showRefreshButton?: boolean;
1038
- /**
1039
- * Whether to show the model selector in the sender footer.
1040
- * When provided, overrides the shell config's enableModelSelector.
1041
- */
1042
- showModelSelector?: boolean;
1043
- /** Show database picker in sender footer. Overrides shell config enableDatabaseSlot. */
1044
- showDatabaseSlot?: boolean;
1045
- /** Show skill picker in sender footer. Overrides shell config enableSkillSlot. */
1046
- showSkillSlot?: boolean;
1047
- /** Show agent picker in sender footer. Overrides shell config enableAgentSlot. */
1048
- showAgentSlot?: boolean;
1049
- /** Show metrics data source picker in sender footer. Overrides shell config enableMetricsDataSourceSlot. */
1050
- showMetricsDataSourceSlot?: boolean;
1051
- /** Whether to show the greeting empty state when no messages exist. Default: true. */
1052
- showEmptyState?: boolean;
1053
- /** Custom greeting element displayed in the empty state. */
1054
- emptyStateGreeting?: React__default.ReactNode;
1055
- /** Empty state question line. Default: "Ready to turn..." */
1056
- emptyStateQuestion?: string;
1057
- /** Show skill category prompts in empty state. Default: true. */
1058
- showSkillPrompts?: boolean;
1059
- /** Show business analysis prompts in empty state. Default: true. */
1060
- showQuickAnalysis?: boolean;
1061
- /** Welcome prefix text (e.g., "Hey"). */
1062
- welcomePrefix?: string;
1063
- /** Context string injected before the first user message (e.g. workflow context). */
1064
- systemContext?: string;
1065
- /** Auto-send this message when agent becomes idle (thread ready, not loading). */
1066
- initialMessage?: string | null;
1067
- /** Called after initialMessage has been sent. */
1068
- onInitialMessageSent?: () => void;
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;
1046
+ }
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>;
1069
1104
  }
1070
1105
  /**
1071
- * Core chat interface component — manages sender input, message display,
1072
- * and agent-streaming state for a single assistant thread.
1106
+ * Props for AgentThreadProvider
1107
+ */
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;
1115
+ }
1116
+ /**
1117
+ * Provider component for AgentThreadContext.
1118
+ * Manages all agent thread state and operations including message streaming, interrupts,
1119
+ * queue management, and agent state polling.
1073
1120
  *
1074
- * Features:
1075
- * - Empty state with greeting and skill/analysis prompt categories
1076
- * - Message sender with file attachment, skill/agent/database pickers, and model selector
1077
- * - Typing cursor animation during streaming
1078
- * - HITL interrupt handling and pending-message display
1079
- * - Auto-send of {@link ChatingProps.systemContext} and {@link ChatingProps.initialMessage}
1080
- * - 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.
1081
1128
  *
1082
- * @param props - See {@link ChatingProps}.
1083
- * @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}.
1084
1138
  *
1085
1139
  * @example
1086
1140
  * ```tsx
1087
- * import { Chating } from "@axiom-lattice/react-sdk";
1141
+ * const { state, sendMessage, stopStreaming, abortAgent } = useAgentThreadContext();
1088
1142
  *
1089
- * <Chating
1090
- * name="Data Analyst"
1091
- * showHeader
1092
- * showSender
1093
- * showModelSelector
1094
- * emptyStateQuestion="What data would you like to analyze?"
1095
- * systemContext="You are analyzing sales data from Q4 2024."
1096
- * />
1143
+ * await sendMessage({ input: { message: 'Hello!' } });
1097
1144
  * ```
1098
- *
1099
- * @remarks
1100
- * - Requires the following ancestor context providers: {@link AgentThreadProvider},
1101
- * {@link ChatUIContextProvider}, {@link LatticeChatShellContextProvider},
1102
- * {@link ConversationContextProvider}, {@link AssistantContextProvider}.
1103
- * - Prop-level feature toggles (e.g. `showModelSelector`) take priority over
1104
- * shell-config-level toggles.
1105
- * - Uses {@link useAgentChat} for all agent communication.
1106
1145
  */
1107
- declare const Chating: React__default.FC<ChatingProps>;
1146
+ declare function useAgentThreadContext<T extends UseChatOptions>(): AgentThreadContextValue<T>;
1108
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
+ }
1109
1184
  /**
1110
- * Props for the {@link LatticeChat} component.
1185
+ * Hook to access authentication context. Must be used within an {@link AuthProvider}.
1111
1186
  *
1112
- * Extends {@link ChatingProps} with thread/assistant identification
1113
- * and optional menu/header slots.
1114
- */
1115
- type AgentChatProps = {
1116
- /** The ID of the currently active thread. If absent, a placeholder is shown prompting users to create a conversation. */
1117
- thread_id?: string;
1118
- /** The assistant ID that backs the chat. Required — feeds the {@link AgentThreadProvider}. */
1119
- assistant_id: string;
1120
- /** Optional menu rendered in the left sidebar column. */
1121
- menu?: React__default.ReactNode;
1122
- /** Optional header rendered above the main chat area. */
1123
- header?: React__default.ReactNode;
1124
- /** Optional right-side header content. Replaces the default folder toggle button. Use {@link FilePanelToggle} to include it. */
1125
- headerRight?: React__default.ReactNode;
1126
- /** Show workspace project selector in header. Default true. */
1127
- showProjectSelector?: boolean;
1128
- /** Content shown when no thread is active. Default: "Please create a conversation first". */
1129
- emptyPlaceholder?: React__default.ReactNode;
1130
- } & ChatingProps;
1131
- /**
1132
- * 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.
1133
1191
  *
1134
- * Wraps the chat UI in:
1135
- * - {@link AgentThreadProvider} for thread state
1136
- * - {@link ChatUIContextProvider} for UI panel toggles
1137
- * - 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.
1138
1193
  *
1139
- * When `thread_id` is empty, a prompt to create a conversation is displayed.
1194
+ * @throws {Error} If used outside of an {@link AuthProvider}.
1140
1195
  *
1141
1196
  * @example
1142
1197
  * ```tsx
1143
- * import { LatticeChat } from "@axiom-lattice/react-sdk";
1198
+ * const { user, isAuthenticated, login, logout } = useAuth();
1144
1199
  *
1145
- * <LatticeChat
1146
- * assistant_id="asst_abc123"
1147
- * thread_id="thread_xyz"
1148
- * showHeader
1149
- * showSender
1150
- * />
1200
+ * const handleLogin = async () => {
1201
+ * const result = await login('user@example.com', 'password');
1202
+ * if (result.requiresTenantSelection) {
1203
+ * // Show tenant picker
1204
+ * }
1205
+ * };
1151
1206
  * ```
1152
- *
1153
- * @remarks
1154
- * - Requires a parent `<LatticeChatShell>` for shell-level configuration (API URL, feature toggles).
1155
- * - The `ChatingProps` are forwarded to the internal {@link Chating} component.
1156
- */
1157
- declare const LatticeChat: React__default.FC<AgentChatProps>;
1158
-
1159
- /**
1160
- * Model runtime configuration passed to the agent when a model is selected.
1161
1207
  */
1162
- interface ModelConfig {
1163
- /** The model key as registered on the server (e.g., "gpt-4o"). */
1164
- modelKey: string;
1165
- /** Sampling temperature (0-2). Higher values produce more random output. */
1166
- temperature?: number;
1167
- /** Maximum tokens in the generated response. */
1168
- maxTokens?: number;
1169
- /** Nucleus sampling parameter (0-1). */
1170
- topP?: number;
1171
- /** Penalty for repeating tokens (-2 to 2). */
1172
- frequencyPenalty?: number;
1173
- /** Penalty for introducing new topics (-2 to 2). */
1174
- presencePenalty?: number;
1175
- }
1208
+ declare const useAuth: () => AuthContextValue;
1176
1209
  /**
1177
- * 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;
1178
1219
  */
1179
- interface ModelInfo {
1180
- /** Unique model key (used as the selection value). */
1181
- key: string;
1182
- /** Provider identifier (e.g., "openai", "azure"). */
1183
- provider: string;
1184
- /** Model name as known by the provider (e.g., "gpt-4o"). */
1185
- model: string;
1186
- /** Human-readable display name for the dropdown. */
1187
- displayName?: string;
1188
- }
1220
+ declare const useAuthOptional: () => AuthContextValue | null;
1189
1221
  /**
1190
- * Props for the {@link ModelSelector} component.
1222
+ * Props for {@link AuthProvider}.
1191
1223
  */
1192
- interface ModelSelectorProps {
1193
- /** Currently selected model configuration (controlled). */
1194
- value?: ModelConfig | null;
1195
- /** Called when the user selects a model. */
1196
- onChange?: (config: ModelConfig | null) => void;
1197
- /** Default model key used when the fetch response includes a matching model. */
1198
- defaultModelKey?: string;
1199
- /** Inline styles applied to the Select element. */
1200
- 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;
1201
1235
  }
1202
1236
  /**
1203
- * 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}.
1204
1239
  *
1205
- * Fetches available models from `/api/models` on first render and caches the result.
1206
- * When a default model key matches a model in the list, it is auto-selected.
1207
- * The selection is reported via the {@link ModelSelectorProps.onChange} callback,
1208
- * 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.
1209
1248
  *
1210
- * @param value - Currently selected model config (controlled).
1211
- * @param onChange - Callback when the selection changes.
1212
- * @param defaultModelKey - Model key to auto-select if found in the model list.
1213
- * @param style - Inline styles for the Select wrapper.
1214
- * @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}.
1215
1257
  *
1216
1258
  * @example
1217
1259
  * ```tsx
1218
- * import { ModelSelector } from "@axiom-lattice/react-sdk";
1219
- *
1220
- * <ModelSelector
1221
- * value={modelConfig}
1222
- * onChange={(config) => updateCustomRunConfig({ modelConfig: config })}
1223
- * defaultModelKey="gpt-4o"
1224
- * />
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>
1225
1267
  * ```
1226
- *
1227
- * @remarks
1228
- * - Supports both controlled (`value` prop) and uncontrolled (internal state) usage.
1229
- * - Fetch is performed only once per component mount via a ref guard.
1230
- * - The dropdown is intentionally borderless to blend into the sender footer.
1231
1268
  */
1232
- declare const ModelSelector: React__default.FC<ModelSelectorProps>;
1233
-
1234
- declare const MDResponse: React__default.MemoExoticComponent<({ content, context, embeddedLink, interactive, userData, noGenUI, }: {
1235
- context?: any;
1236
- content: string;
1237
- embeddedLink?: boolean;
1238
- interactive?: boolean;
1239
- userData?: any;
1240
- noGenUI?: boolean;
1241
- }) => react_jsx_runtime.JSX.Element>;
1242
- declare const MDViewFormItem: ({ value }: {
1243
- value?: string;
1244
- }) => react_jsx_runtime.JSX.Element;
1269
+ declare const AuthProvider: React__default.FC<AuthProviderProps>;
1245
1270
 
1246
1271
  /**
1247
- * Props passed to every GenUI element component.
1248
- *
1249
- * Each element registered in the GenUI element registry receives these props,
1250
- * with the `data` field carrying the element-specific payload from the agent.
1251
- *
1252
- * @typeParam T - The shape of the element-specific data payload
1272
+ * Login Form Components
1273
+ * Uses base styles from design system
1253
1274
  */
1254
- type ElementProps<T = any> = {
1255
- /** Key identifying which GenUI element component to render */
1256
- component_key: string;
1257
- /** Optional context for the current conversation */
1258
- context?: {
1259
- /** The thread ID associated with this element */
1260
- thread_id?: string;
1261
- /** The assistant ID associated with this element */
1262
- assistant_id?: string;
1263
- };
1264
- /** Element-specific data payload from the agent */
1265
- data: T;
1266
- /** Whether the element supports user interaction (defaults to false) */
1267
- interactive?: boolean;
1268
- /** Whether to open this element in the side app panel by default */
1269
- default_open_in_side_app?: boolean;
1270
- };
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
+
1271
1298
  /**
1272
- * Metadata for a registered GenUI element.
1273
- *
1274
- * Defines how an element is rendered and optionally what action to perform
1275
- * when the user interacts with it.
1299
+ * User Profile Components
1300
+ * Using Axiom Theme with Ant Design
1276
1301
  */
1277
- interface ElementMeta {
1278
- /** The main card-view React component for this element */
1279
- card_view: React.FC<ElementProps>;
1280
- /** Optional side-app panel React component for expanded viewing */
1281
- side_app_view?: React.FC<ElementProps>;
1282
- /** Optional action callback invoked when the user interacts with the element */
1283
- 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;
1284
1310
  }
1285
1311
  /**
1286
- * Data structure representing a tool call made by the agent.
1287
- *
1288
- * Rendered by GenUI tool card elements to display tool invocations,
1289
- * their arguments, and their results.
1312
+ * User Profile Component
1290
1313
  */
1291
- interface ToolCallData {
1292
- /** Unique identifier for this tool call */
1293
- id: string;
1294
- /** Name of the tool being called */
1295
- name: string;
1296
- /** Arguments passed to the tool */
1297
- args: Record<string, any>;
1298
- /** Distinguishes tool calls from other message types */
1299
- type: "tool_call";
1300
- /** The tool's response, if available */
1301
- response?: string;
1302
- /** Execution status of the tool call */
1303
- 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;
1304
1321
  }
1305
-
1306
- declare const getElement: (language: string | undefined) => ElementMeta | null;
1307
- declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
1322
+ /**
1323
+ * Protected Route Component
1324
+ * Shows loading state, redirects, or fallback when not authenticated
1325
+ */
1326
+ declare const ProtectedRoute: React__default.FC<ProtectedRouteProps>;
1308
1327
 
1309
1328
  /**
1310
- * Tabbed side-app browser that renders GenUI components in the right panel.
1311
- *
1312
- * Manages a tab strip of registered side-app views. When a new component is
1313
- * selected via {@link SideAppBrowserContext}, a tab is added (or activated if
1314
- * it already exists). Tabs are closable and switchable. An "all tabs" dropdown
1315
- * appears when there are 2+ tabs. Uses {@link ChatUIContext} to read/write the
1316
- * active side-app card and open/close the panel.
1317
- *
1318
- * @param region - Which panel region this browser is attached to.
1319
- * `"side"` for the right detail panel (default), `"content"` for the main content area.
1320
- * @returns The tabbed side-app viewer, or an empty state if no tabs are open.
1321
- *
1322
- * @example
1323
- * ```tsx
1324
- * import { SideAppViewBrowser } from "@axiom-lattice/react-sdk";
1325
- *
1326
- * <SideAppViewBrowser region="side" />
1327
- * ```
1328
- *
1329
- * @remarks
1330
- * - Internally renders {@link SideAppBrowserContext.Provider} so that child
1331
- * components can programmatically open new side-apps via `openApp()`.
1332
- * - Component resolution uses {@link getElement} from the GenUI element registry.
1333
- * - Designed to work with {@link ColumnLayout} as the `detail` panel.
1329
+ * Tenant Selector Components
1330
+ * Uses unified auth styles from design system
1334
1331
  */
1335
- declare const SideAppViewBrowser: React__default.FC<{
1336
- region?: "side" | "content";
1337
- }>;
1338
1332
 
1339
- type PanelCardData = Record<string, unknown> & {
1340
- component?: ReactNode;
1341
- message?: string;
1342
- };
1343
- type PanelCard = {
1344
- component_key: string;
1345
- data: PanelCardData;
1346
- message?: string;
1347
- context?: {
1348
- thread_id?: string;
1349
- assistant_id?: string;
1350
- };
1351
- };
1352
- declare const ChatUIContext: React__default.Context<{
1353
- detailVisible: boolean;
1354
- setDetailVisible: (visible: boolean) => void;
1355
- detailSize: "small" | "middle" | "large" | "full";
1356
- setDetailSize: (size: "small" | "middle" | "large" | "full") => void;
1357
- detailSelectedCard: PanelCard | null;
1358
- setDetailSelectedCard: (card: PanelCard | null) => void;
1359
- openDetail: (card: PanelCard) => void;
1360
- closeDetail: () => void;
1361
- toolsVisible: boolean;
1362
- setToolsVisible: (visible: boolean) => void;
1363
- toggleTools: () => void;
1364
- toolSelectedCard: PanelCard | null;
1365
- setToolSelectedCard: (card: PanelCard | null) => void;
1366
- openTools: (card: PanelCard) => void;
1367
- closeTools: () => void;
1368
- sideAppVisible: boolean;
1369
- setSideAppVisible: (visible: boolean) => void;
1370
- sideAppSize: "small" | "middle" | "large" | "full";
1371
- setSideAppSize: (size: "small" | "middle" | "large" | "full") => void;
1372
- sideAppSelectedCard: PanelCard | null;
1373
- setSideAppSelectedCard: (card: PanelCard | null) => void;
1374
- openSideApp: (card: PanelCard) => void;
1375
- closeSideApp: () => void;
1376
- menuCollapsed: boolean | undefined;
1377
- setMenuCollapsed: (collapsed: boolean) => void;
1378
- openContentApp: (card: PanelCard) => void;
1379
- closeContentApp: () => void;
1380
- contentAppVisible: boolean;
1381
- setcontentAppVisible: (visible: boolean) => void;
1382
- contentAppSelectedCard: PanelCard | null;
1383
- setContentAppSelectedCard: (card: PanelCard | null) => void;
1384
- }>;
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
+ }
1385
1363
  /**
1386
- * Chat UI context provider. Manages visibility and selected cards for chat panel areas
1387
- * (detail, tools, side app, content app) and the sidebar menu collapsed state.
1388
- *
1389
- * @description
1390
- * Tracks the open/closed state and the currently selected {@link PanelCard} for each panel:
1391
- * - **Detail panel**: A slide-out detail view that displays a chosen card's content.
1392
- * - **Tools panel**: A tools sidebar/drawer for tool-specific cards.
1393
- * - **Side app**: Aliases to the detail panel (shared state).
1394
- * - **Content app**: An inline content area for embedded app cards.
1395
- * - **Menu collapsed**: Whether the sidebar navigation menu is collapsed.
1396
- *
1397
- * Provides action helpers (`openDetail`, `closeDetail`, `openTools`, `toggleTools`, etc.)
1398
- * that set both visibility and selected card atomically.
1399
- *
1400
- * @param props - Provider props.
1401
- * @param props.children - React children to render within the UI context.
1364
+ * Fetches and manages a list of tenants from the API.
1402
1365
  *
1403
- * @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
1404
1370
  *
1405
1371
  * @example
1406
1372
  * ```tsx
1407
- * <ChatUIContextProvider>
1408
- * <ChatLayout />
1409
- * </ChatUIContextProvider>
1373
+ * const { tenants, isLoading, error, refresh, getTenantById } = useTenants({
1374
+ * baseURL: "https://api.example.com",
1375
+ * token: "your-auth-token",
1376
+ * });
1410
1377
  * ```
1411
1378
  */
1412
- declare const ChatUIContextProvider: ({ children, }: {
1413
- children: React__default.ReactNode;
1414
- }) => 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
+ }
1415
1392
  /**
1416
- * Hook to access the chat UI context. Must be used within a {@link ChatUIContextProvider}.
1417
- *
1418
- * @description
1419
- * Returns panel visibility state, selected panel cards, and action functions for controlling
1420
- * 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.
1421
1394
  *
1422
- * @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
1423
1400
  *
1424
1401
  * @example
1425
1402
  * ```tsx
1426
- * 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
+ * });
1427
1407
  *
1428
- * const handleCardClick = (card: PanelCard) => {
1429
- * openDetail(card);
1430
- * };
1408
+ * const user = await searchByEmail("user@example.com");
1431
1409
  * ```
1432
1410
  */
1433
- declare const useChatUIContext: () => {
1434
- detailVisible: boolean;
1435
- setDetailVisible: (visible: boolean) => void;
1436
- detailSize: "small" | "middle" | "large" | "full";
1437
- setDetailSize: (size: "small" | "middle" | "large" | "full") => void;
1438
- detailSelectedCard: PanelCard | null;
1439
- setDetailSelectedCard: (card: PanelCard | null) => void;
1440
- openDetail: (card: PanelCard) => void;
1441
- closeDetail: () => void;
1442
- toolsVisible: boolean;
1443
- setToolsVisible: (visible: boolean) => void;
1444
- toggleTools: () => void;
1445
- toolSelectedCard: PanelCard | null;
1446
- setToolSelectedCard: (card: PanelCard | null) => void;
1447
- openTools: (card: PanelCard) => void;
1448
- closeTools: () => void;
1449
- sideAppVisible: boolean;
1450
- setSideAppVisible: (visible: boolean) => void;
1451
- sideAppSize: "small" | "middle" | "large" | "full";
1452
- setSideAppSize: (size: "small" | "middle" | "large" | "full") => void;
1453
- sideAppSelectedCard: PanelCard | null;
1454
- setSideAppSelectedCard: (card: PanelCard | null) => void;
1455
- openSideApp: (card: PanelCard) => void;
1456
- closeSideApp: () => void;
1457
- menuCollapsed: boolean | undefined;
1458
- setMenuCollapsed: (collapsed: boolean) => void;
1459
- openContentApp: (card: PanelCard) => void;
1460
- closeContentApp: () => void;
1461
- contentAppVisible: boolean;
1462
- setcontentAppVisible: (visible: boolean) => void;
1463
- contentAppSelectedCard: PanelCard | null;
1464
- setContentAppSelectedCard: (card: PanelCard | null) => void;
1465
- };
1466
-
1467
- interface SideAppBrowserContextValue {
1468
- openApp: (card: PanelCard) => void;
1469
- }
1470
- declare const SideAppBrowserContext: React$1.Context<SideAppBrowserContextValue | null>;
1471
- declare const useSideAppBrowser: () => SideAppBrowserContextValue | null;
1472
- declare const useSideAppOpener: () => ((card: PanelCard) => void);
1411
+ declare function useUsers(options: UseUsersOptions): UseUsersReturn;
1473
1412
 
1474
- /**
1475
- * Thread information for a conversation
1476
- */
1477
- interface ConversationThread {
1478
- id: string;
1479
- label: string;
1480
- createdAt?: string;
1481
- updatedAt?: string;
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;
1482
1419
  }
1483
- /**
1484
- * Conversation context value
1485
- */
1486
- interface ConversationContextValue {
1487
- /**
1488
- * Current assistant ID
1489
- */
1490
- assistantId: string | null;
1491
- /**
1492
- * Current thread for the assistant
1493
- */
1494
- thread: ConversationThread | null;
1495
- /**
1496
- * Current thread ID
1497
- */
1498
- threadId: string | null;
1499
- /**
1500
- * List of threads for the current assistant
1501
- */
1502
- threads: ConversationThread[];
1503
- /**
1504
- * Whether threads are being loaded
1505
- */
1506
- isLoading: boolean;
1507
- /**
1508
- * Error message if any
1509
- */
1420
+ interface ChatErrorBoundaryState {
1421
+ hasError: boolean;
1510
1422
  error: Error | null;
1511
- /**
1512
- * Set the current thread
1513
- */
1514
- setThread: (thread: ConversationThread | null) => void;
1515
- /**
1516
- * Select a thread by ID
1517
- */
1518
- selectThread: (threadId: string) => void;
1519
- /**
1520
- * Create a new thread for the current assistant
1521
- */
1522
- createThread: (label?: string) => Promise<ConversationThread>;
1523
- /**
1524
- * List all threads for the current assistant
1525
- */
1526
- listThreads: () => Promise<ConversationThread[]>;
1527
- /**
1528
- * Update thread for the current assistant
1529
- */
1530
- updateThread: (thread: ConversationThread) => Promise<void>;
1531
- /**
1532
- * Get thread by ID
1533
- */
1534
- getThreadById: (threadId: string) => ConversationThread | null;
1535
- /**
1536
- * Delete a thread by ID
1537
- */
1538
- deleteThread: (threadId: string) => Promise<void>;
1539
- /**
1540
- * Clear the current thread
1541
- */
1542
- clearThread: () => void;
1543
- /**
1544
- * Refresh threads for the current assistant
1545
- */
1546
- refresh: () => Promise<void>;
1547
- /**
1548
- * Custom run configuration (cross-thread, assistant-level)
1549
- * Used for metrics datasource and other assistant-wide settings
1550
- */
1551
- customRunConfig: Record<string, any>;
1552
- /**
1553
- * Update custom run configuration
1554
- */
1555
- updateCustomRunConfig: (config: Record<string, any>) => void;
1423
+ errorInfo: React__default.ErrorInfo | null;
1424
+ retryKey: number;
1556
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
+
1557
1435
  /**
1558
- * Conversation context
1559
- */
1560
- declare const ConversationContext: React$1.Context<ConversationContextValue>;
1561
- /**
1562
- * Props for ConversationContextProvider
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.
1563
1440
  */
1564
- interface ConversationContextProviderProps {
1565
- children: React.ReactNode;
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;
1470
+ /**
1471
+ * Whether to show the model selector in the sender footer.
1472
+ * When provided, overrides the shell config's enableModelSelector.
1473
+ */
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;
1566
1501
  }
1567
1502
  /**
1568
- * Generate a thread label from the first message content
1569
- * Extracts first 15 characters of text content, excluding attachments
1570
- */
1571
- declare function generateLabelFromMessage(message: string): string;
1572
- /**
1573
- * Provider component for ConversationContext.
1574
- * Manages conversation thread state for the currently selected assistant.
1575
- *
1576
- * @description
1577
- * Coordinates with {@link AssistantContext} to load threads for the current assistant.
1578
- * Key behaviors:
1579
- * - **Thread loading**: Fetches threads from the API when the assistant changes. If no threads
1580
- * exist, a new thread is automatically created.
1581
- * - **Auto-selection**: Selects the most recently updated thread as the active thread when loading.
1582
- * - **Cross-thread config**: Maintains an assistant-level `customRunConfig` shared across all threads
1583
- * (useful for metrics datasource and other assistant-wide settings).
1584
- * - **Thread operations**: Provides full CRUD operations (create, update, delete, list, select)
1585
- * backed by the client SDK.
1586
- *
1587
- * 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.
1588
1505
  *
1589
- * @param props - {@link ConversationContextProviderProps}
1590
- * @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
1591
1513
  *
1592
- * @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.
1593
1516
  *
1594
1517
  * @example
1595
1518
  * ```tsx
1596
- * <ConversationContextProvider>
1597
- * <ThreadList />
1598
- * </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
+ * />
1599
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.
1600
1538
  */
1601
- declare const ConversationContextProvider: ({ children, }: ConversationContextProviderProps) => react_jsx_runtime.JSX.Element;
1602
- /**
1603
- * Hook to access ConversationContext
1604
- * @returns Conversation context value
1605
- * @throws Error if used outside of ConversationContextProvider
1606
- */
1607
- declare const useConversationContext: () => ConversationContextValue;
1539
+ declare const Chating: React__default.FC<ChatingProps>;
1608
1540
 
1609
1541
  /**
1610
- * Assistant state interface
1611
- */
1612
- interface AssistantState {
1613
- /**
1614
- * List of all assistants
1615
- */
1616
- assistants: Assistant[];
1617
- /**
1618
- * Currently selected assistant
1619
- */
1620
- currentAssistant: Assistant | null;
1621
- /**
1622
- * Whether data is being loaded
1623
- */
1624
- isLoading: boolean;
1625
- /**
1626
- * Error message if any
1627
- */
1628
- error: Error | null;
1629
- }
1630
- /**
1631
- * Assistant context value interface
1632
- */
1633
- interface AssistantContextValue extends AssistantState {
1634
- /**
1635
- * List all assistants
1636
- */
1637
- listAssistants: () => Promise<void>;
1638
- /**
1639
- * Get a single assistant by ID
1640
- */
1641
- getAssistant: (id: string) => Promise<Assistant>;
1642
- /**
1643
- * Create a new assistant
1644
- */
1645
- createAssistant: (options: CreateAssistantOptions) => Promise<Assistant>;
1646
- /**
1647
- * Update an existing assistant
1648
- */
1649
- updateAssistant: (id: string, options: UpdateAssistantOptions) => Promise<Assistant>;
1650
- /**
1651
- * Delete an assistant
1652
- */
1653
- deleteAssistant: (id: string) => Promise<void>;
1654
- /**
1655
- * Select an assistant as current
1656
- */
1657
- selectAssistant: (id: string) => Promise<void>;
1658
- /**
1659
- * Clear the current assistant selection
1660
- */
1661
- clearCurrentAssistant: () => void;
1662
- /**
1663
- * Refresh the assistant list
1664
- */
1665
- refresh: () => Promise<void>;
1666
- }
1667
- /**
1668
- * Assistant context
1669
- */
1670
- declare const AssistantContext: React$1.Context<AssistantContextValue>;
1671
- /**
1672
- * 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.
1673
1546
  */
1674
- interface AssistantContextProviderProps {
1675
- /**
1676
- * Children components
1677
- */
1678
- children: React.ReactNode;
1679
- /**
1680
- * Whether to automatically load assistants on mount
1681
- */
1682
- autoLoad?: boolean;
1683
- /**
1684
- * Initial assistant ID to select
1685
- */
1686
- initialAssistantId?: string | null;
1687
- }
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;
1688
1563
  /**
1689
- * Provider component for AssistantContext.
1690
- * Manages assistant state and operations including CRUD, selection, and auto-loading.
1691
- *
1692
- * @description
1693
- * Coordinates with the client SDK to provide assistant management:
1694
- * - **Auto-load**: When `autoLoad` is `true` (default), fetches the assistant list on mount.
1695
- * - **Auto-selection**: If `initialAssistantId` is provided, selects that assistant after loading.
1696
- * Otherwise, auto-selects the first available assistant.
1697
- * - **Re-selection**: If the currently selected assistant is removed from the list (e.g., deleted),
1698
- * falls back to selecting the first available assistant.
1699
- * - **CRUD operations**: Provides `createAssistant`, `updateAssistant`, `deleteAssistant`, and
1700
- * `getAssistant` backed by the SDK, keeping local state in sync.
1701
- *
1702
- * Requires an {@link AxiomLatticeProvider} ancestor for the API client.
1564
+ * Top-level chat component for a single assistant thread.
1703
1565
  *
1704
- * @param props - {@link AssistantContextProviderProps}
1705
- * @param props.children - React children to render within the assistant context.
1706
- * @param props.autoLoad - Whether to automatically load assistants on mount. Defaults to `true`.
1707
- * @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
1708
1570
  *
1709
- * @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.
1710
1572
  *
1711
1573
  * @example
1712
1574
  * ```tsx
1713
- * <AssistantContextProvider initialAssistantId="asst_123">
1714
- * <AssistantSelector />
1715
- * </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
+ * />
1716
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.
1717
1588
  */
1718
- declare const AssistantContextProvider: ({ children, autoLoad, initialAssistantId, }: AssistantContextProviderProps) => react_jsx_runtime.JSX.Element;
1719
- /**
1720
- * Hook to access AssistantContext
1721
- * @returns Assistant context value
1722
- * @throws Error if used outside of AssistantContextProvider
1723
- */
1724
- declare const useAssistantContext: () => AssistantContextValue;
1589
+ declare const LatticeChat: React__default.FC<AgentChatProps>;
1725
1590
 
1726
1591
  /**
1727
- * Quick prompt item for quick prompt components
1592
+ * Model runtime configuration passed to the agent when a model is selected.
1728
1593
  */
1729
- interface QuickPromptItem {
1730
- key: string;
1731
- icon?: ReactNode;
1732
- label: string;
1733
- description?: string;
1734
- 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;
1735
1607
  }
1736
1608
  /**
1737
- * Quick prompt category for organizing prompt items
1609
+ * Model metadata returned by the `/api/models` endpoint.
1738
1610
  */
1739
- interface QuickPromptCategory {
1611
+ interface ModelInfo {
1612
+ /** Unique model key (used as the selection value). */
1740
1613
  key: string;
1741
- title: string;
1742
- icon?: ReactNode;
1743
- color?: string;
1744
- 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;
1745
1620
  }
1746
1621
  /**
1747
- * Middleware tool definition
1622
+ * Props for the {@link ModelSelector} component.
1748
1623
  */
1749
- interface MiddlewareToolDefinition {
1750
- id: string;
1751
- name: string;
1752
- 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;
1753
1633
  }
1754
1634
  /**
1755
- * 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.
1756
1663
  */
1757
- interface MiddlewareConfigSchemaProperty {
1758
- type: "string" | "number" | "integer" | "boolean" | "object" | "array";
1759
- title?: string;
1760
- description?: string;
1761
- default?: any;
1762
- enum?: string[];
1763
- enumLabels?: Record<string, string>;
1764
- minimum?: number;
1765
- maximum?: number;
1766
- minLength?: number;
1767
- maxLength?: number;
1768
- pattern?: string;
1769
- format?: string;
1770
- widget?: "input" | "textarea" | "select" | "segmented" | "switch" | "numberInput" | "skillSelect" | "databaseSelect" | "metricsSelect" | "topologyEdgeBuilder" | "collectionSelect";
1771
- items?: {
1772
- type: string;
1773
- };
1774
- }
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
+
1775
1678
  /**
1776
- * 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
1777
1685
  */
1778
- interface MiddlewareConfigSchema {
1779
- type: "object";
1780
- title?: string;
1781
- description?: string;
1782
- required?: string[];
1783
- properties: Record<string, MiddlewareConfigSchemaProperty>;
1784
- }
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
+ };
1785
1703
  /**
1786
- * 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.
1787
1708
  */
1788
- interface MiddlewareTypeDefinition {
1789
- type: string;
1790
- name: string;
1791
- description: string;
1792
- icon?: ReactNode;
1793
- schema?: MiddlewareConfigSchema;
1794
- defaultConfig?: Record<string, any>;
1795
- 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;
1796
1716
  }
1797
1717
  /**
1798
- * 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.
1799
1722
  */
1800
- interface MiddlewareConfigDefinition {
1723
+ interface ToolCallData {
1724
+ /** Unique identifier for this tool call */
1801
1725
  id: string;
1802
- type: string;
1726
+ /** Name of the tool being called */
1803
1727
  name: string;
1804
- description: string;
1805
- enabled: boolean;
1806
- config: Record<string, any>;
1807
- 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";
1808
1736
  }
1737
+
1738
+ declare const getElement: (language: string | undefined) => ElementMeta | null;
1739
+ declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
1740
+
1809
1741
  /**
1810
- * 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.
1811
1766
  */
1812
- type SideMenuItemType = "drawer" | "route" | "action";
1813
- interface ResourceFolderConfig {
1814
- name: string;
1815
- displayName?: string;
1816
- allowUpload: boolean;
1817
- }
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
+ }>;
1818
1817
  /**
1819
- * 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
+ * ```
1820
1843
  */
1844
+ declare const ChatUIContextProvider: ({ children, }: {
1845
+ children: React__default.ReactNode;
1846
+ }) => react_jsx_runtime.JSX.Element;
1821
1847
  /**
1822
- * Sidebar menu item configuration.
1848
+ * Hook to access the chat UI context. Must be used within a {@link ChatUIContextProvider}.
1823
1849
  *
1824
- * Three item types:
1825
- * - `"action"` clickable button, set `builtin` for predefined behaviors
1826
- * - `"drawer"` opens a slide-out panel, set `content` + `title`
1827
- * - `"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.
1828
1853
  *
1829
- * When providing `sideMenuItems` or `workspaceMenuItems` to `LatticeChatShellConfig`,
1830
- * your array **completely replaces** the defaults. Import `DEFAULT_MENU_ITEMS` or
1831
- * `DEFAULT_WORKSPACE_MENU_ITEMS` to selectively include built-in items:
1832
- * ```
1833
- * 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
+ * };
1834
1863
  * ```
1835
1864
  */
1836
- interface SideMenuItemConfig {
1837
- /** 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 {
1838
1910
  id: string;
1839
- /** Type of the menu item - drawer or route (SideApp) */
1840
- type: SideMenuItemType;
1841
- /** Display name of the menu item */
1842
- name: string;
1843
- /** Icon component for the menu item */
1844
- icon?: ReactNode;
1845
- /** Order for sorting menu items (lower values first) */
1846
- order?: number;
1847
- /** Whether this is a builtin menu item (new-analysis, thread-history, assistants, skill, skills, tools, workspace, settings, database, metrics, mcp, projects, logout, switch-tenant) */
1848
- builtin?: "new-analysis" | "thread-history" | "assistants" | "skill" | "skills" | "tools" | "workspace" | "settings" | "database" | "metrics" | "mcp" | "projects" | "logout" | "switch-tenant";
1849
- /**
1850
- * Menu group for organizing items
1851
- */
1852
- group?: string;
1853
- /**
1854
- * Whether the menu item is enabled (can be toggled)
1855
- * Defaults to true
1856
- */
1857
- enabled?: boolean;
1858
- /** Content config from DB (for custom menu items) */
1859
- contentConfig?: Record<string, unknown>;
1860
- /** Content to display inside the drawer (for drawer type) */
1861
- content?: ReactNode;
1862
- /** Drawer title (for drawer type) */
1863
- title?: string;
1864
- /** Drawer width in pixels or percentage (for drawer type) */
1865
- width?: string | number;
1866
- /**
1867
- * Whether to display drawer content inline in expanded sidebar mode
1868
- * When true, content shows below the menu item instead of in a drawer
1869
- * Defaults to false, but true for "workspace" builtin
1870
- */
1871
- inline?: boolean;
1872
- /**
1873
- * Maximum height for inline drawer content in pixels
1874
- * Only applies when inline is true
1875
- * Defaults to 400
1876
- */
1877
- inlineMaxHeight?: number;
1878
- /**
1879
- * Whether inline drawer is expanded by default
1880
- * Only applies when inline is true
1881
- * Defaults to false
1882
- */
1883
- inlineDefaultExpanded?: boolean;
1884
- /** Component to render in SideApp (for route type) */
1885
- sideAppComponent?: ReactNode;
1911
+ label: string;
1912
+ createdAt?: string;
1913
+ updatedAt?: string;
1886
1914
  }
1887
1915
  /**
1888
- * Lattice Chat Shell configuration interface
1916
+ * Conversation context value
1889
1917
  */
1890
- interface LatticeChatShellConfig {
1891
- /**
1892
- * Base URL for the API
1893
- */
1894
- baseURL: string;
1895
- /**
1896
- * API key for authentication (optional)
1897
- */
1898
- apiKey?: string;
1899
- /**
1900
- * Transport method (Server-Sent Events or WebSocket)
1901
- */
1902
- transport?: "sse" | "ws";
1903
- /**
1904
- * Request timeout in milliseconds (optional)
1905
- */
1906
- timeout?: number;
1918
+ interface ConversationContextValue {
1907
1919
  /**
1908
- * Additional headers to include in requests (optional)
1920
+ * Current assistant ID
1909
1921
  */
1910
- headers?: Record<string, string>;
1922
+ assistantId: string | null;
1911
1923
  /**
1912
- * Whether users can create new threads from the UI
1913
- * Defaults to true
1924
+ * Current thread for the assistant
1914
1925
  */
1915
- enableThreadCreation?: boolean;
1926
+ thread: ConversationThread | null;
1916
1927
  /**
1917
- * Whether users can view the thread list in the sidebar
1918
- * Defaults to true
1928
+ * Current thread ID
1919
1929
  */
1920
- enableThreadList?: boolean;
1921
- assistantId?: string;
1922
- showSideMenu?: boolean;
1923
- /**
1924
- * URL of the global shared sandbox, this is used to access the global shared sandbox
1925
- * if not provided, sandbox will be created in the agent's sandbox
1926
- */
1927
- globalSharedSandboxURL?: string;
1928
- /**
1929
- * Available middleware types that can be configured for agents
1930
- * Each middleware type defines its name, description, and default configuration
1931
- * If not provided, default middleware types will be used
1932
- */
1933
- availableMiddlewareTypes?: MiddlewareTypeDefinition[];
1930
+ threadId: string | null;
1934
1931
  /**
1935
- * Whether users can create new assistants
1936
- * Defaults to true
1932
+ * List of threads for the current assistant
1937
1933
  */
1938
- enableAssistantCreation?: boolean;
1939
- /**
1940
- * Whether users can edit existing assistants
1941
- * Defaults to true
1942
- */
1943
- enableAssistantEditing?: boolean;
1934
+ threads: ConversationThread[];
1944
1935
  /**
1945
- * Whether to enable workspace and project management
1946
- * When enabled, shows workspace selector in header and file browser
1947
- * Defaults to false
1936
+ * Whether threads are being loaded
1948
1937
  */
1949
- enableWorkspace?: boolean;
1938
+ isLoading: boolean;
1950
1939
  /**
1951
- * Whether to load custom menu items from the database (API /api/menu-items).
1952
- * When enabled, WorkspaceResourceManager fetches per-tenant custom menu items
1953
- * and merges them with built-in defaults.
1954
- * Defaults to true.
1940
+ * Error message if any
1955
1941
  */
1956
- enableCustomMenu?: boolean;
1942
+ error: Error | null;
1957
1943
  /**
1958
- * Resource folders configuration for workspace
1959
- * Each folder represents a section in the workspace assets panel
1960
- * If not provided, defaults to a single root folder with upload enabled
1944
+ * Set the current thread
1961
1945
  */
1962
- resourceFolders?: ResourceFolderConfig[];
1963
- /**
1964
- * Chat sidebar menu items. When provided, completely replaces the
1965
- * default built-in items (New Analysis, History).
1966
- *
1967
- * To selectively include built-in items, import and filter `DEFAULT_MENU_ITEMS`:
1968
- * ```
1969
- * sideMenuItems: DEFAULT_MENU_ITEMS.filter(i => i.id === "thread-history")
1970
- * ```
1971
- * Omit this field to use all defaults.
1972
- */
1973
- sideMenuItems?: SideMenuItemConfig[];
1946
+ setThread: (thread: ConversationThread | null) => void;
1974
1947
  /**
1975
- * Workspace menu items. When provided, completely replaces the
1976
- * default workspace items (Projects, Metrics, Database, etc.).
1977
- *
1978
- * To selectively include built-in items, import and filter `DEFAULT_WORKSPACE_MENU_ITEMS`:
1979
- * ```
1980
- * workspaceMenuItems: DEFAULT_WORKSPACE_MENU_ITEMS.filter(
1981
- * i => ["workspace_projects", "assistants"].includes(i.id)
1982
- * )
1983
- * ```
1984
- * Omit this field to use all defaults.
1948
+ * Select a thread by ID
1985
1949
  */
1986
- workspaceMenuItems?: SideMenuItemConfig[];
1950
+ selectThread: (threadId: string) => void;
1987
1951
  /**
1988
- * Whether to enable the database picker slot in the chat sender
1989
- * When enabled, shows a database selection button in the sender footer
1990
- * Defaults to true
1952
+ * Create a new thread for the current assistant
1991
1953
  */
1992
- enableDatabaseSlot?: boolean;
1993
- /**
1994
- * Whether to enable the skill picker slot in the chat sender
1995
- * When enabled, shows a skill selection button in the sender footer
1996
- * Defaults to true
1954
+ createThread: (label?: string) => Promise<ConversationThread>;
1955
+ /**
1956
+ * List all threads for the current assistant
1997
1957
  */
1998
- enableSkillSlot?: boolean;
1958
+ listThreads: () => Promise<ConversationThread[]>;
1999
1959
  /**
2000
- * Whether to enable the agent picker slot in the chat sender
2001
- * When enabled, shows an agent selection button in the sender footer
2002
- * Defaults to true
1960
+ * Update thread for the current assistant
2003
1961
  */
2004
- enableAgentSlot?: boolean;
1962
+ updateThread: (thread: ConversationThread) => Promise<void>;
2005
1963
  /**
2006
- * Whether to enable the metrics datasource picker slot in the chat sender
2007
- * When enabled, shows a metrics datasource selection button in the sender footer
2008
- * Defaults to true
1964
+ * Get thread by ID
2009
1965
  */
2010
- enableMetricsDataSourceSlot?: boolean;
1966
+ getThreadById: (threadId: string) => ConversationThread | null;
2011
1967
  /**
2012
- * Whether to enable the model selector in the chat sender
2013
- * When enabled, shows a model selection dropdown in the sender footer
2014
- * Defaults to false
1968
+ * Delete a thread by ID
2015
1969
  */
2016
- enableModelSelector?: boolean;
1970
+ deleteThread: (threadId: string) => Promise<void>;
2017
1971
  /**
2018
- * Sidebar display mode
2019
- * - "icon": Show only icons (default)
2020
- * - "expanded": Show icons with labels and groups
2021
- * Defaults to "icon"
2022
- */
2023
- sidebarMode?: "icon" | "expanded";
1972
+ * Clear the current thread
1973
+ */
1974
+ clearThread: () => void;
2024
1975
  /**
2025
- * Whether sidebar is expanded by default (only applies when sidebarMode is "expanded")
2026
- * Defaults to true
1976
+ * Refresh threads for the current assistant
2027
1977
  */
2028
- sidebarDefaultExpanded?: boolean;
1978
+ refresh: () => Promise<void>;
2029
1979
  /**
2030
- * Whether workspace menu is expanded by default
2031
- * Defaults to true
1980
+ * Custom run configuration (cross-thread, assistant-level)
1981
+ * Used for metrics datasource and other assistant-wide settings
2032
1982
  */
2033
- workspaceMenuDefaultExpanded?: boolean;
1983
+ customRunConfig: Record<string, any>;
2034
1984
  /**
2035
- * Whether to show the expand/collapse toggle button
2036
- * Defaults to true
1985
+ * Update custom run configuration
2037
1986
  */
2038
- sidebarShowToggle?: 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 {
2039
2045
  /**
2040
- * Whether to show the "New Analysis" button in expanded sidebar
2041
- * Defaults to true
2046
+ * List of all assistants
2042
2047
  */
2043
- sidebarShowNewAnalysis?: boolean;
2048
+ assistants: Assistant[];
2044
2049
  /**
2045
- * Logo text displayed in expanded sidebar
2046
- * Defaults to "Lattice"
2050
+ * Currently selected assistant
2047
2051
  */
2048
- sidebarLogoText?: string;
2052
+ currentAssistant: Assistant | null;
2049
2053
  /**
2050
- * Custom logo icon component
2051
- * If not provided, defaults to Cpu icon
2054
+ * Whether data is being loaded
2052
2055
  */
2053
- sidebarLogoIcon?: React__default.ReactNode;
2056
+ isLoading: boolean;
2054
2057
  /**
2055
- * Custom quick prompts data for quick prompt components
2056
- * Allows registering custom prompt categories and items via shell config
2057
- * If not provided, default prompt data will be used
2058
+ * Error message if any
2058
2059
  */
2059
- quickPromptsData?: QuickPromptCategory[];
2060
+ error: Error | null;
2060
2061
  }
2061
2062
  /**
2062
- * Lattice Chat Shell context value interface
2063
+ * Assistant context value interface
2063
2064
  */
2064
- interface LatticeChatShellContextValue {
2065
+ interface AssistantContextValue extends AssistantState {
2065
2066
  /**
2066
- * Current configuration
2067
+ * List all assistants
2067
2068
  */
2068
- config: LatticeChatShellConfig;
2069
+ listAssistants: () => Promise<void>;
2069
2070
  /**
2070
- * Update the entire configuration
2071
+ * Get a single assistant by ID
2071
2072
  */
2072
- updateConfig: (config: Partial<LatticeChatShellConfig>) => void;
2073
+ getAssistant: (id: string) => Promise<Assistant>;
2073
2074
  /**
2074
- * Update a specific configuration value
2075
+ * Create a new assistant
2075
2076
  */
2076
- updateConfigValue: <K extends keyof LatticeChatShellConfig>(key: K, value: LatticeChatShellConfig[K]) => void;
2077
+ createAssistant: (options: CreateAssistantOptions) => Promise<Assistant>;
2077
2078
  /**
2078
- * Reset configuration to defaults
2079
+ * Update an existing assistant
2079
2080
  */
2080
- resetConfig: () => void;
2081
+ updateAssistant: (id: string, options: UpdateAssistantOptions) => Promise<Assistant>;
2081
2082
  /**
2082
- * Whether the settings modal is open
2083
+ * Delete an assistant
2083
2084
  */
2084
- settingsModalOpen: boolean;
2085
+ deleteAssistant: (id: string) => Promise<void>;
2085
2086
  /**
2086
- * Set the settings modal open state
2087
+ * Select an assistant as current
2087
2088
  */
2088
- 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>;
2089
2098
  }
2090
2099
  /**
2091
- * Default middleware type definitions with JSON Schema for configuration
2092
- */
2093
- declare const DEFAULT_MIDDLEWARE_TYPES: MiddlewareTypeDefinition[];
2094
- /**
2095
- * Lattice Chat Shell context
2100
+ * Assistant context
2096
2101
  */
2097
- declare const LatticeChatShellContext: React__default.Context<LatticeChatShellContextValue>;
2102
+ declare const AssistantContext: React$1.Context<AssistantContextValue>;
2098
2103
  /**
2099
- * Props for LatticeChatShellContextProvider
2104
+ * Props for AssistantContextProvider
2100
2105
  */
2101
- interface LatticeChatShellContextProviderProps {
2106
+ interface AssistantContextProviderProps {
2102
2107
  /**
2103
2108
  * Children components
2104
2109
  */
2105
- children: ReactNode;
2106
- /**
2107
- * Initial configuration (optional)
2108
- */
2109
- initialConfig?: Partial<LatticeChatShellConfig>;
2110
+ children: React.ReactNode;
2110
2111
  /**
2111
- * Whether to persist configuration to localStorage (optional, default: false)
2112
+ * Whether to automatically load assistants on mount
2112
2113
  */
2113
- persistToLocalStorage?: boolean;
2114
+ autoLoad?: boolean;
2114
2115
  /**
2115
- * LocalStorage key for persisting configuration (optional, default: "lattice_chat_shell_config")
2116
+ * Initial assistant ID to select
2116
2117
  */
2117
- localStorageKey?: string;
2118
+ initialAssistantId?: string | null;
2118
2119
  }
2119
2120
  /**
2120
- * Provider component for LatticeChatShellContext
2121
- * 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
+ * ```
2122
2149
  */
2123
- 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;
2124
2151
  /**
2125
- * Hook to access LatticeChatShellContext
2126
- * @returns Lattice Chat Shell context value
2127
- * @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
2128
2155
  */
2129
- 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>;
2130
2164
 
2131
2165
  /**
2132
2166
  * Represents a single message in the chat UI.
@@ -2788,6 +2822,125 @@ interface SkillCategoryPromptsProps {
2788
2822
  }
2789
2823
  declare const SkillCategoryPrompts: React__default.FC<SkillCategoryPromptsProps>;
2790
2824
 
2825
+ interface ViewToggleOption {
2826
+ mode: string;
2827
+ icon: React__default.ComponentType<{
2828
+ size?: number | string;
2829
+ }>;
2830
+ label?: string;
2831
+ }
2832
+ interface ViewToggleProps {
2833
+ value: string;
2834
+ onChange: (mode: string) => void;
2835
+ options?: ViewToggleOption[];
2836
+ }
2837
+ declare const ViewToggle: React__default.FC<ViewToggleProps>;
2838
+
2839
+ interface EntityAction<T> {
2840
+ key: string;
2841
+ icon: React__default.ComponentType<{
2842
+ size?: number | string;
2843
+ }>;
2844
+ label?: string;
2845
+ onClick: (item: T) => void;
2846
+ danger?: boolean;
2847
+ }
2848
+ type ViewMode = "grid" | "list";
2849
+ type ActionsStyle = "icon" | "button";
2850
+
2851
+ interface EntityCardProps<T> {
2852
+ item: T;
2853
+ onClick?: (item: T) => void;
2854
+ renderIcon?: (item: T) => React__default.ReactNode;
2855
+ renderPrimary: (item: T) => React__default.ReactNode;
2856
+ renderSecondary?: (item: T) => React__default.ReactNode;
2857
+ renderFooter?: (item: T) => React__default.ReactNode;
2858
+ renderHeaderActions?: (item: T) => React__default.ReactNode;
2859
+ renderDetails?: (item: T) => React__default.ReactNode;
2860
+ actions?: EntityAction<T>[];
2861
+ actionsPosition?: "hover" | "always";
2862
+ actionsStyle?: ActionsStyle;
2863
+ className?: string;
2864
+ }
2865
+ declare const EntityCard: <T>({ item, onClick, renderIcon, renderPrimary, renderSecondary, renderFooter, renderHeaderActions, renderDetails, actions, actionsPosition, actionsStyle, className, }: EntityCardProps<T>) => React__default.ReactElement;
2866
+
2867
+ interface EntityRowProps<T> {
2868
+ item: T;
2869
+ onClick?: (item: T) => void;
2870
+ renderIcon?: (item: T) => React__default.ReactNode;
2871
+ renderPrimary: (item: T) => React__default.ReactNode;
2872
+ renderSecondary?: (item: T) => React__default.ReactNode;
2873
+ renderFooter?: (item: T) => React__default.ReactNode;
2874
+ renderHeaderActions?: (item: T) => React__default.ReactNode;
2875
+ renderDetails?: (item: T) => React__default.ReactNode;
2876
+ actions?: EntityAction<T>[];
2877
+ actionsPosition?: "hover" | "always";
2878
+ actionsStyle?: ActionsStyle;
2879
+ className?: string;
2880
+ }
2881
+ declare const EntityRow: <T>({ item, onClick, renderIcon, renderPrimary, renderSecondary, renderFooter, renderHeaderActions, renderDetails, actions, actionsPosition, actionsStyle, className, }: EntityRowProps<T>) => React__default.ReactElement;
2882
+
2883
+ interface EntityCreateTriggerProps {
2884
+ viewMode: ViewMode;
2885
+ label: string;
2886
+ icon?: React__default.ComponentType<{
2887
+ size?: number | string;
2888
+ }>;
2889
+ onClick: () => void;
2890
+ }
2891
+ declare const EntityCreateTrigger: React__default.FC<EntityCreateTriggerProps>;
2892
+
2893
+ interface EntityListShellProps {
2894
+ title: string;
2895
+ subtitle?: React__default.ReactNode;
2896
+ headerLeft?: React__default.ReactNode;
2897
+ headerRight?: React__default.ReactNode;
2898
+ loading: boolean;
2899
+ isEmpty: boolean;
2900
+ renderLoading?: () => React__default.ReactNode;
2901
+ renderEmpty?: () => React__default.ReactNode;
2902
+ emptyIcon?: React__default.ReactNode;
2903
+ emptyTitle?: string;
2904
+ emptyDescription?: string;
2905
+ children: React__default.ReactNode;
2906
+ itemCount?: number;
2907
+ itemName?: string;
2908
+ className?: string;
2909
+ }
2910
+ declare const EntityListShell: React__default.FC<EntityListShellProps>;
2911
+
2912
+ interface EntityListViewProps<T> {
2913
+ items: T[];
2914
+ loading: boolean;
2915
+ keyExtractor: (item: T) => string;
2916
+ title: string;
2917
+ itemName?: string;
2918
+ renderIcon?: (item: T) => React__default.ReactNode;
2919
+ renderPrimary: (item: T) => React__default.ReactNode;
2920
+ renderSecondary?: (item: T) => React__default.ReactNode;
2921
+ renderFooter?: (item: T) => React__default.ReactNode;
2922
+ renderHeaderActions?: (item: T) => React__default.ReactNode;
2923
+ renderDetails?: (item: T) => React__default.ReactNode;
2924
+ onItemClick?: (item: T) => void;
2925
+ itemActions?: EntityAction<T>[];
2926
+ actionsPosition?: "hover" | "always";
2927
+ actionsStyle?: ActionsStyle;
2928
+ createLabel?: string;
2929
+ onCreateClick?: () => void;
2930
+ headerLeft?: React__default.ReactNode;
2931
+ headerRight?: React__default.ReactNode;
2932
+ defaultViewMode?: ViewMode;
2933
+ showViewToggle?: boolean;
2934
+ emptyIcon?: React__default.ReactNode;
2935
+ emptyTitle?: string;
2936
+ emptyDescription?: string;
2937
+ renderEmpty?: () => React__default.ReactNode;
2938
+ renderGridItem?: (item: T) => React__default.ReactNode;
2939
+ renderListItem?: (item: T) => React__default.ReactNode;
2940
+ className?: string;
2941
+ }
2942
+ declare const EntityListView: <T>({ items, loading, keyExtractor, title, itemName, renderIcon, renderPrimary, renderSecondary, renderFooter, renderHeaderActions, renderDetails, onItemClick, itemActions, actionsPosition, actionsStyle, createLabel, onCreateClick, headerLeft, headerRight, defaultViewMode, showViewToggle, emptyIcon, emptyTitle, emptyDescription, renderEmpty, renderGridItem, renderListItem, className, }: EntityListViewProps<T>) => React__default.ReactElement;
2943
+
2791
2944
  /**
2792
2945
  * Axiom Theme Design Tokens
2793
2946
  *
@@ -3292,4 +3445,4 @@ type IframeMessage = {
3292
3445
  };
3293
3446
  declare function generateIframeSrcdoc(): string;
3294
3447
 
3295
- 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, 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, 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 };