@axiom-lattice/react-sdk 2.1.11 → 2.1.12

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
@@ -1,9 +1,9 @@
1
- import { Message, MessageChunk, InterruptMessage } from '@axiom-lattice/protocols';
1
+ import { Message, InterruptMessage } from '@axiom-lattice/protocols';
2
2
  export * from '@axiom-lattice/protocols';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { Client } from '@axiom-lattice/client-sdk';
6
+ import { Client, Assistant, CreateAssistantOptions, UpdateAssistantOptions } from '@axiom-lattice/client-sdk';
7
7
  import { Prompts } from '@ant-design/x';
8
8
  import { GetProp } from 'antd';
9
9
 
@@ -92,10 +92,6 @@ interface ChatState {
92
92
  * Error that occurred during sending a message
93
93
  */
94
94
  error: Error | null;
95
- /**
96
- * Current streaming message (if any)
97
- */
98
- streamingMessage: MessageChunk | null;
99
95
  /**
100
96
  * Interrupt data when agent requires user intervention
101
97
  */
@@ -316,29 +312,12 @@ declare function useAgentChat<T extends UseChatOptions>(options?: T): ChatStateW
316
312
  streaming?: boolean;
317
313
  }) => Promise<void>;
318
314
  stopStreaming: () => void;
315
+ resumeStream: (messageId?: string) => () => void;
319
316
  loadMessages: (limit?: number) => Promise<void>;
320
317
  clearMessages: () => void;
321
318
  clearError: () => void;
322
319
  };
323
320
 
324
- /**
325
- * Interface for thread creation options
326
- */
327
- interface CreateThreadOptions {
328
- metadata?: Record<string, any>;
329
- }
330
- /**
331
- * Hook for managing threads
332
- * @returns Thread state and operations
333
- */
334
- declare function useThread(): ThreadState & {
335
- createThread: (options?: CreateThreadOptions) => Promise<string>;
336
- getThread: (threadId: string) => Promise<Thread>;
337
- listThreads: (limit?: number, offset?: number) => Promise<void>;
338
- deleteThread: (threadId: string) => Promise<void>;
339
- selectThread: (threadId: string) => Promise<void>;
340
- };
341
-
342
321
  /**
343
322
  * Hook for monitoring agent state
344
323
  * @param threadId - Thread ID to monitor
@@ -407,6 +386,7 @@ interface AgentThreadContextValue<T extends UseChatOptions> {
407
386
  streaming?: boolean;
408
387
  }) => Promise<void>;
409
388
  stopStreaming: () => void;
389
+ resumeStream: (messageId?: string) => () => void;
410
390
  loadMessages: (limit?: number) => Promise<void>;
411
391
  clearMessages: () => void;
412
392
  clearError: () => void;
@@ -452,8 +432,9 @@ interface ChatingProps {
452
432
  declare const Chating: React__default.FC<ChatingProps>;
453
433
 
454
434
  type AgentChatProps = {
455
- thread_id: string;
435
+ thread_id?: string;
456
436
  assistant_id: string;
437
+ menu?: React__default.ReactNode;
457
438
  } & ChatingProps;
458
439
  declare const LatticeChat: React__default.FC<AgentChatProps>;
459
440
 
@@ -521,6 +502,8 @@ declare const ChatUIContext: React$1.Context<{
521
502
  message?: string;
522
503
  }) => void;
523
504
  closeSideApp: () => void;
505
+ menuCollapsed: boolean;
506
+ setMenuCollapsed: (collapsed: boolean) => void;
524
507
  }>;
525
508
  declare const ChatUIContextProvider: ({ children, }: {
526
509
  children: React.ReactNode;
@@ -546,8 +529,278 @@ declare const useChatUIContext: () => {
546
529
  message?: string;
547
530
  }) => void;
548
531
  closeSideApp: () => void;
532
+ menuCollapsed: boolean;
533
+ setMenuCollapsed: (collapsed: boolean) => void;
549
534
  };
550
535
 
536
+ /**
537
+ * Thread information for a conversation
538
+ */
539
+ interface ConversationThread {
540
+ id: string;
541
+ label: string;
542
+ }
543
+ /**
544
+ * Conversation context value
545
+ */
546
+ interface ConversationContextValue {
547
+ /**
548
+ * Current assistant ID
549
+ */
550
+ assistantId: string | null;
551
+ /**
552
+ * Current thread for the assistant
553
+ */
554
+ thread: ConversationThread | null;
555
+ /**
556
+ * Current thread ID
557
+ */
558
+ threadId: string | null;
559
+ /**
560
+ * List of threads for the current assistant
561
+ */
562
+ threads: ConversationThread[];
563
+ /**
564
+ * Whether threads are being loaded
565
+ */
566
+ isLoading: boolean;
567
+ /**
568
+ * Error message if any
569
+ */
570
+ error: Error | null;
571
+ /**
572
+ * Set the current thread
573
+ */
574
+ setThread: (thread: ConversationThread | null) => void;
575
+ /**
576
+ * Select a thread by ID
577
+ */
578
+ selectThread: (threadId: string) => void;
579
+ /**
580
+ * Create a new thread for the current assistant
581
+ */
582
+ createThread: (label?: string) => Promise<ConversationThread>;
583
+ /**
584
+ * List all threads for the current assistant
585
+ */
586
+ listThreads: () => Promise<ConversationThread[]>;
587
+ /**
588
+ * Update thread for the current assistant
589
+ */
590
+ updateThread: (thread: ConversationThread) => Promise<void>;
591
+ /**
592
+ * Get thread by ID
593
+ */
594
+ getThreadById: (threadId: string) => ConversationThread | null;
595
+ /**
596
+ * Delete a thread by ID
597
+ */
598
+ deleteThread: (threadId: string) => Promise<void>;
599
+ /**
600
+ * Clear the current thread
601
+ */
602
+ clearThread: () => void;
603
+ /**
604
+ * Refresh threads for the current assistant
605
+ */
606
+ refresh: () => Promise<void>;
607
+ }
608
+ /**
609
+ * Conversation context
610
+ */
611
+ declare const ConversationContext: React$1.Context<ConversationContextValue>;
612
+ /**
613
+ * Props for ConversationContextProvider
614
+ */
615
+ interface ConversationContextProviderProps {
616
+ children: React.ReactNode;
617
+ }
618
+ /**
619
+ * Provider component for ConversationContext
620
+ * Manages conversation thread state for assistants
621
+ */
622
+ declare const ConversationContextProvider: ({ children, }: ConversationContextProviderProps) => react_jsx_runtime.JSX.Element;
623
+ /**
624
+ * Hook to access ConversationContext
625
+ * @returns Conversation context value
626
+ * @throws Error if used outside of ConversationContextProvider
627
+ */
628
+ declare const useConversationContext: () => ConversationContextValue;
629
+
630
+ /**
631
+ * Assistant state interface
632
+ */
633
+ interface AssistantState {
634
+ /**
635
+ * List of all assistants
636
+ */
637
+ assistants: Assistant[];
638
+ /**
639
+ * Currently selected assistant
640
+ */
641
+ currentAssistant: Assistant | null;
642
+ /**
643
+ * Whether data is being loaded
644
+ */
645
+ isLoading: boolean;
646
+ /**
647
+ * Error message if any
648
+ */
649
+ error: Error | null;
650
+ }
651
+ /**
652
+ * Assistant context value interface
653
+ */
654
+ interface AssistantContextValue extends AssistantState {
655
+ /**
656
+ * List all assistants
657
+ */
658
+ listAssistants: () => Promise<void>;
659
+ /**
660
+ * Get a single assistant by ID
661
+ */
662
+ getAssistant: (id: string) => Promise<Assistant>;
663
+ /**
664
+ * Create a new assistant
665
+ */
666
+ createAssistant: (options: CreateAssistantOptions) => Promise<Assistant>;
667
+ /**
668
+ * Update an existing assistant
669
+ */
670
+ updateAssistant: (id: string, options: UpdateAssistantOptions) => Promise<Assistant>;
671
+ /**
672
+ * Delete an assistant
673
+ */
674
+ deleteAssistant: (id: string) => Promise<void>;
675
+ /**
676
+ * Select an assistant as current
677
+ */
678
+ selectAssistant: (id: string) => Promise<void>;
679
+ /**
680
+ * Clear the current assistant selection
681
+ */
682
+ clearCurrentAssistant: () => void;
683
+ /**
684
+ * Refresh the assistant list
685
+ */
686
+ refresh: () => Promise<void>;
687
+ }
688
+ /**
689
+ * Assistant context
690
+ */
691
+ declare const AssistantContext: React$1.Context<AssistantContextValue>;
692
+ /**
693
+ * Props for AssistantContextProvider
694
+ */
695
+ interface AssistantContextProviderProps {
696
+ /**
697
+ * Children components
698
+ */
699
+ children: React.ReactNode;
700
+ /**
701
+ * Whether to automatically load assistants on mount
702
+ */
703
+ autoLoad?: boolean;
704
+ /**
705
+ * Initial assistant ID to select
706
+ */
707
+ initialAssistantId?: string | null;
708
+ }
709
+ /**
710
+ * Provider component for AssistantContext
711
+ * Manages assistant state and operations
712
+ */
713
+ declare const AssistantContextProvider: ({ children, autoLoad, initialAssistantId, }: AssistantContextProviderProps) => react_jsx_runtime.JSX.Element;
714
+ /**
715
+ * Hook to access AssistantContext
716
+ * @returns Assistant context value
717
+ * @throws Error if used outside of AssistantContextProvider
718
+ */
719
+ declare const useAssistantContext: () => AssistantContextValue;
720
+
721
+ /**
722
+ * Lattice Chat Shell configuration interface
723
+ */
724
+ interface LatticeChatShellConfig {
725
+ /**
726
+ * Base URL for the API
727
+ */
728
+ baseURL: string;
729
+ /**
730
+ * API key for authentication (optional)
731
+ */
732
+ apiKey?: string;
733
+ /**
734
+ * Transport method (Server-Sent Events or WebSocket)
735
+ */
736
+ transport?: "sse" | "ws";
737
+ /**
738
+ * Request timeout in milliseconds (optional)
739
+ */
740
+ timeout?: number;
741
+ /**
742
+ * Additional headers to include in requests (optional)
743
+ */
744
+ headers?: Record<string, string>;
745
+ }
746
+ /**
747
+ * Lattice Chat Shell context value interface
748
+ */
749
+ interface LatticeChatShellContextValue {
750
+ /**
751
+ * Current configuration
752
+ */
753
+ config: LatticeChatShellConfig;
754
+ /**
755
+ * Update the entire configuration
756
+ */
757
+ updateConfig: (config: Partial<LatticeChatShellConfig>) => void;
758
+ /**
759
+ * Update a specific configuration value
760
+ */
761
+ updateConfigValue: <K extends keyof LatticeChatShellConfig>(key: K, value: LatticeChatShellConfig[K]) => void;
762
+ /**
763
+ * Reset configuration to defaults
764
+ */
765
+ resetConfig: () => void;
766
+ }
767
+ /**
768
+ * Lattice Chat Shell context
769
+ */
770
+ declare const LatticeChatShellContext: React$1.Context<LatticeChatShellContextValue>;
771
+ /**
772
+ * Props for LatticeChatShellContextProvider
773
+ */
774
+ interface LatticeChatShellContextProviderProps {
775
+ /**
776
+ * Children components
777
+ */
778
+ children: ReactNode;
779
+ /**
780
+ * Initial configuration (optional)
781
+ */
782
+ initialConfig?: Partial<LatticeChatShellConfig>;
783
+ /**
784
+ * Whether to persist configuration to localStorage (optional, default: false)
785
+ */
786
+ persistToLocalStorage?: boolean;
787
+ /**
788
+ * LocalStorage key for persisting configuration (optional, default: "lattice_chat_shell_config")
789
+ */
790
+ localStorageKey?: string;
791
+ }
792
+ /**
793
+ * Provider component for LatticeChatShellContext
794
+ * Manages Lattice Chat Shell configuration
795
+ */
796
+ declare const LatticeChatShellContextProvider: ({ children, initialConfig, persistToLocalStorage, localStorageKey, }: LatticeChatShellContextProviderProps) => react_jsx_runtime.JSX.Element;
797
+ /**
798
+ * Hook to access LatticeChatShellContext
799
+ * @returns Lattice Chat Shell context value
800
+ * @throws Error if used outside of LatticeChatShellContextProvider
801
+ */
802
+ declare const useLatticeChatShellContext: () => LatticeChatShellContextValue;
803
+
551
804
  interface UIMessage {
552
805
  id: string;
553
806
  run_id?: string;
@@ -568,8 +821,10 @@ interface AttachFile {
568
821
  }
569
822
 
570
823
  interface ColumnLayoutProps {
824
+ menu?: React__default.ReactNode;
571
825
  left: React__default.ReactNode;
572
826
  right: React__default.ReactNode;
827
+ logo?: React__default.ReactNode;
573
828
  }
574
829
  declare const ColumnLayout: React__default.FC<ColumnLayoutProps>;
575
830
 
@@ -588,4 +843,14 @@ interface FileExplorerProps {
588
843
  }
589
844
  declare const FileExplorer: React__default.FC<ElementProps>;
590
845
 
591
- export { type AgentChatProps, type AgentState, AgentThreadProvider, type AgentThreadProviderProps, type AttachFile, AxiomLatticeProvider, type AxiomLatticeProviderProps, type ChatResponse, type ChatState, type ChatStateWithAgent, ChatUIContext, ChatUIContextProvider, Chating, type ChatingProps, type ClientConfig, ColumnLayout, type ColumnLayoutProps, type ElementMeta, type ElementProps, type ExplorerFile, FileExplorer, type FileExplorerProps, LatticeChat, MDMermaid, MDResponse, MDViewFormItem, SideAppViewBrowser, type StreamEventHandlerOptions, type Thread, type ThreadState, type ToolCallData, type UIMessage, type UseAgentStateOptions, type UseAgentStateReturn, type UseAxiomLatticeOptions, type UseChatOptions, getElement, regsiterElement, useAgentChat, useAgentGraph, useAgentState, useAgentThreadContext, useAxiomLattice, useChat, useChatUIContext, useThread };
846
+ declare const AgentConversations: React__default.FC;
847
+
848
+ type LatticeChatShellProps = Omit<LatticeChatShellContextProviderProps, "children">;
849
+ /**
850
+ * Lattice Chat Shell component
851
+ * Provides a complete chat interface with conversation management
852
+ * Uses LatticeChatShellContext for configuration (baseURL, etc.)
853
+ */
854
+ declare const LatticeChatShell: React__default.FC<LatticeChatShellProps>;
855
+
856
+ export { type AgentChatProps, AgentConversations, type AgentState, AgentThreadProvider, type AgentThreadProviderProps, AssistantContext, AssistantContextProvider, type AssistantContextProviderProps, type AssistantContextValue, type AssistantState, type AttachFile, AxiomLatticeProvider, type AxiomLatticeProviderProps, type ChatResponse, type ChatState, type ChatStateWithAgent, ChatUIContext, ChatUIContextProvider, Chating, type ChatingProps, type ClientConfig, ColumnLayout, type ColumnLayoutProps, ConversationContext, ConversationContextProvider, type ConversationContextProviderProps, type ConversationContextValue, type ConversationThread, type ElementMeta, type ElementProps, type ExplorerFile, FileExplorer, type FileExplorerProps, LatticeChat, LatticeChatShell, type LatticeChatShellConfig, LatticeChatShellContext, LatticeChatShellContextProvider, type LatticeChatShellContextProviderProps, type LatticeChatShellContextValue, type LatticeChatShellProps, MDMermaid, MDResponse, MDViewFormItem, SideAppViewBrowser, type StreamEventHandlerOptions, type Thread, type ThreadState, type ToolCallData, type UIMessage, type UseAgentStateOptions, type UseAgentStateReturn, type UseAxiomLatticeOptions, type UseChatOptions, getElement, regsiterElement, useAgentChat, useAgentGraph, useAgentState, useAgentThreadContext, useAssistantContext, useAxiomLattice, useChat, useChatUIContext, useConversationContext, useLatticeChatShellContext };