@iota-uz/sdk 0.4.23 → 0.4.25

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.
@@ -38,21 +38,18 @@ interface SessionStore {
38
38
  deletedMessages: number;
39
39
  deletedArtifacts: number;
40
40
  }>;
41
- compactSessionHistory(sessionId: string): Promise<{
42
- success: boolean;
43
- summary: string;
44
- deletedMessages: number;
45
- deletedArtifacts: number;
46
- }>;
41
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
47
42
  }
48
43
  interface MessageTransport {
49
44
  sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
50
45
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
51
46
  success: boolean;
47
+ data?: AsyncRunAccepted;
52
48
  error?: string;
53
49
  }>;
54
50
  rejectPendingQuestion(sessionId: string): Promise<{
55
51
  success: boolean;
52
+ data?: AsyncRunAccepted;
56
53
  error?: string;
57
54
  }>;
58
55
  }
@@ -72,19 +69,21 @@ interface ArtifactStore {
72
69
  deleteSessionArtifact(artifactId: string): Promise<void>;
73
70
  }
74
71
  interface AdminStore {
75
- listUsers(): Promise<SessionUser[]>;
72
+ listUsers(): Promise<SessionUser$1[]>;
76
73
  listAllSessions(options?: {
77
74
  limit?: number;
78
75
  offset?: number;
79
76
  includeArchived?: boolean;
80
77
  userId?: string | null;
81
78
  }): Promise<{
82
- sessions: Array<Session$1 & {
83
- owner: SessionUser;
84
- }>;
79
+ sessions: Session$1[];
85
80
  total: number;
86
81
  hasMore: boolean;
87
82
  }>;
83
+ listSessionMembers(sessionId: string): Promise<SessionMember$1[]>;
84
+ addSessionMember(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
85
+ updateSessionMemberRole(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
86
+ removeSessionMember(sessionId: string, userId: string): Promise<void>;
88
87
  }
89
88
 
90
89
  /**
@@ -97,6 +96,17 @@ interface Session$1 {
97
96
  pinned: boolean;
98
97
  createdAt: string;
99
98
  updatedAt: string;
99
+ owner?: SessionUser$1;
100
+ isGroup?: boolean;
101
+ memberCount?: number;
102
+ access?: SessionAccess$1;
103
+ }
104
+ interface SessionAccess$1 {
105
+ role: 'owner' | 'editor' | 'viewer' | 'read_all' | 'none';
106
+ source: 'owner' | 'member' | 'permission' | 'none';
107
+ canRead: boolean;
108
+ canWrite: boolean;
109
+ canManageMembers: boolean;
100
110
  }
101
111
  /**
102
112
  * A conversation turn groups a user message with its assistant response.
@@ -116,6 +126,7 @@ interface UserTurn$1 {
116
126
  id: string;
117
127
  content: string;
118
128
  attachments: Attachment$1[];
129
+ author?: SessionUser$1;
119
130
  createdAt: string;
120
131
  }
121
132
  /**
@@ -379,6 +390,13 @@ interface StreamStatus {
379
390
  snapshot?: StreamSnapshotPayload;
380
391
  startedAt?: number;
381
392
  }
393
+ interface AsyncRunAccepted {
394
+ accepted: true;
395
+ operation: 'question_submit' | 'question_reject' | 'session_compact';
396
+ sessionId: string;
397
+ runId: string;
398
+ startedAt: number;
399
+ }
382
400
  /**
383
401
  * @deprecated Use `StreamEvent` instead. `StreamChunk` is kept for backwards
384
402
  * compatibility but the flat all-optional shape is unsound.
@@ -434,16 +452,16 @@ interface DebugTrace$1 {
434
452
  generationMs?: number;
435
453
  usage?: DebugUsage$1;
436
454
  tools: StreamToolPayload[];
437
- attempts?: DebugGeneration[];
438
- spans?: DebugSpan[];
439
- events?: DebugEvent[];
455
+ attempts?: DebugGeneration$1[];
456
+ spans?: DebugSpan$1[];
457
+ events?: DebugEvent$1[];
440
458
  traceId?: string;
441
459
  traceUrl?: string;
442
460
  sessionId?: string;
443
461
  thinking?: string;
444
462
  observationReason?: string;
445
463
  }
446
- interface DebugGeneration {
464
+ interface DebugGeneration$1 {
447
465
  id?: string;
448
466
  requestId?: string;
449
467
  model?: string;
@@ -463,7 +481,7 @@ interface DebugGeneration {
463
481
  completedAt?: string;
464
482
  toolCalls?: StreamToolPayload[];
465
483
  }
466
- interface DebugSpan {
484
+ interface DebugSpan$1 {
467
485
  id?: string;
468
486
  parentId?: string;
469
487
  generationId?: string;
@@ -481,7 +499,7 @@ interface DebugSpan {
481
499
  completedAt?: string;
482
500
  attributes?: Record<string, unknown>;
483
501
  }
484
- interface DebugEvent {
502
+ interface DebugEvent$1 {
485
503
  id?: string;
486
504
  name?: string;
487
505
  type?: string;
@@ -517,12 +535,18 @@ interface SessionListResult$1 {
517
535
  total: number;
518
536
  hasMore: boolean;
519
537
  }
520
- interface SessionUser {
538
+ interface SessionUser$1 {
521
539
  id: string;
522
540
  firstName: string;
523
541
  lastName: string;
524
542
  initials: string;
525
543
  }
544
+ interface SessionMember$1 {
545
+ user: SessionUser$1;
546
+ role: 'owner' | 'editor' | 'viewer';
547
+ createdAt: string;
548
+ updatedAt: string;
549
+ }
526
550
  interface SessionGroup {
527
551
  name: string;
528
552
  sessions: Session$1[];
@@ -564,23 +588,15 @@ interface ChatDataSource {
564
588
  deletedMessages: number;
565
589
  deletedArtifacts: number;
566
590
  }>;
567
- compactSessionHistory(sessionId: string): Promise<{
568
- success: boolean;
569
- summary: string;
570
- deletedMessages: number;
571
- deletedArtifacts: number;
572
- }>;
591
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
573
592
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
574
593
  success: boolean;
594
+ data?: AsyncRunAccepted;
575
595
  error?: string;
576
- data?: {
577
- session: Session$1;
578
- turns: ConversationTurn$1[];
579
- pendingQuestion?: PendingQuestion$1 | null;
580
- };
581
596
  }>;
582
597
  rejectPendingQuestion(sessionId: string): Promise<{
583
598
  success: boolean;
599
+ data?: AsyncRunAccepted;
584
600
  error?: string;
585
601
  }>;
586
602
  /**
@@ -599,12 +615,6 @@ interface ChatDataSource {
599
615
  * Optional; if absent, resume is not supported.
600
616
  */
601
617
  resumeStream?(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
602
- /**
603
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` instead.
604
- * This method couples navigation to the data source, causing component
605
- * remounts during active streams.
606
- */
607
- navigateToSession?(sessionId: string): void;
608
618
  listSessions(options?: {
609
619
  limit?: number;
610
620
  offset?: number;
@@ -617,19 +627,21 @@ interface ChatDataSource {
617
627
  deleteSession(sessionId: string): Promise<void>;
618
628
  renameSession(sessionId: string, title: string): Promise<Session$1>;
619
629
  regenerateSessionTitle(sessionId: string): Promise<Session$1>;
620
- listUsers?(): Promise<SessionUser[]>;
630
+ listUsers?(): Promise<SessionUser$1[]>;
621
631
  listAllSessions?(options?: {
622
632
  limit?: number;
623
633
  offset?: number;
624
634
  includeArchived?: boolean;
625
635
  userId?: string | null;
626
636
  }): Promise<{
627
- sessions: Array<Session$1 & {
628
- owner: SessionUser;
629
- }>;
637
+ sessions: Session$1[];
630
638
  total: number;
631
639
  hasMore: boolean;
632
640
  }>;
641
+ listSessionMembers?(sessionId: string): Promise<SessionMember$1[]>;
642
+ addSessionMember?(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
643
+ updateSessionMemberRole?(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
644
+ removeSessionMember?(sessionId: string, userId: string): Promise<void>;
633
645
  }
634
646
  interface ChatSessionStateValue {
635
647
  session: Session$1 | null;
@@ -736,8 +748,6 @@ interface ChatSessionProps {
736
748
  /**
737
749
  * Called when a new session is created (e.g. on first message in a "new
738
750
  * chat"). Use this to navigate your SPA router to the new session URL.
739
- *
740
- * Replaces the deprecated `dataSource.navigateToSession`.
741
751
  */
742
752
  onSessionCreated?: (sessionId: string) => void;
743
753
  /** Alias for isReadOnly (preferred) */
@@ -802,8 +812,16 @@ interface ChatHeaderProps {
802
812
  logoSlot?: ReactNode;
803
813
  /** Custom action buttons */
804
814
  actionsSlot?: ReactNode;
815
+ /** Members to display in avatar stack for group chats */
816
+ members?: Array<{
817
+ firstName: string;
818
+ lastName: string;
819
+ initials?: string;
820
+ }>;
821
+ /** Callback when avatar stack is clicked (to open members modal) */
822
+ onMembersClick?: () => void;
805
823
  }
806
- declare function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
824
+ declare function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot, members, onMembersClick }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
807
825
 
808
826
  interface MessageListProps {
809
827
  renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
@@ -876,6 +894,8 @@ interface UserMessageProps {
876
894
  turnId?: string;
877
895
  /** User initials for avatar */
878
896
  initials?: string;
897
+ /** Optional sender name for shared/group chats */
898
+ authorName?: string;
879
899
  /** Slot overrides */
880
900
  slots?: UserMessageSlots;
881
901
  /** Class name overrides */
@@ -893,7 +913,7 @@ interface UserMessageProps {
893
913
  /** Whether edit action should be available */
894
914
  allowEdit?: boolean;
895
915
  }
896
- declare function UserMessage({ turn, turnId, initials, slots, classNames: classNameOverrides, onCopy, onEdit, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserMessageProps): react_jsx_runtime.JSX.Element;
916
+ declare function UserMessage({ turn, turnId, initials, authorName, slots, classNames: classNameOverrides, onCopy, onEdit, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserMessageProps): react_jsx_runtime.JSX.Element;
897
917
 
898
918
  interface UserTurnViewProps {
899
919
  /** The conversation turn containing the user message */
@@ -912,8 +932,10 @@ interface UserTurnViewProps {
912
932
  hideTimestamp?: boolean;
913
933
  /** Whether edit action should be available */
914
934
  allowEdit?: boolean;
935
+ /** Show sender identity label above the message bubble */
936
+ showAuthorName?: boolean;
915
937
  }
916
- declare function UserTurnView({ turn, slots, classNames, initials, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
938
+ declare function UserTurnView({ turn, slots, classNames, initials, hideAvatar, hideActions, hideTimestamp, allowEdit, showAuthorName, }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
917
939
 
918
940
  interface AssistantMessageAvatarSlotProps {
919
941
  /** Default text */
@@ -1655,13 +1677,45 @@ interface UserAvatarProps {
1655
1677
  /** Override initials (defaults to first letters of first and last name) */
1656
1678
  initials?: string;
1657
1679
  /** Avatar size */
1658
- size?: 'sm' | 'md' | 'lg';
1680
+ size?: 'xs' | 'sm' | 'md' | 'lg';
1659
1681
  /** Additional CSS classes */
1660
1682
  className?: string;
1661
1683
  }
1662
1684
  declare function UserAvatar({ firstName, lastName, initials: providedInitials, size, className, }: UserAvatarProps): react_jsx_runtime.JSX.Element;
1663
1685
  declare const MemoizedUserAvatar: react.MemoExoticComponent<typeof UserAvatar>;
1664
1686
 
1687
+ /**
1688
+ * AvatarStack Component
1689
+ * Displays overlapping user avatars with an overflow "+N" indicator.
1690
+ * Used in ChatHeader and SessionItem for group chat visualization.
1691
+ */
1692
+ interface AvatarStackProps {
1693
+ /** List of users to display */
1694
+ users: Array<{
1695
+ firstName: string;
1696
+ lastName: string;
1697
+ initials?: string;
1698
+ }>;
1699
+ /** Maximum avatars to show before "+N" (default: 3) */
1700
+ max?: number;
1701
+ /** Avatar size */
1702
+ size?: 'xs' | 'sm';
1703
+ /** Click handler — makes the stack interactive */
1704
+ onClick?: () => void;
1705
+ /** Additional CSS classes */
1706
+ className?: string;
1707
+ }
1708
+ declare function AvatarStackInner({ users, max, size, onClick, className, }: AvatarStackProps): react_jsx_runtime.JSX.Element;
1709
+ declare const AvatarStack: react.MemoExoticComponent<typeof AvatarStackInner>;
1710
+
1711
+ interface SessionMembersModalProps {
1712
+ isOpen: boolean;
1713
+ sessionId?: string;
1714
+ dataSource: ChatDataSource;
1715
+ onClose: () => void;
1716
+ }
1717
+ declare function SessionMembersModal({ isOpen, sessionId, dataSource, onClose }: SessionMembersModalProps): react_jsx_runtime.JSX.Element;
1718
+
1665
1719
  interface PermissionGuardProps {
1666
1720
  /** Permission names to check */
1667
1721
  permissions: string[];
@@ -1797,9 +1851,9 @@ interface AllChatsListProps {
1797
1851
  declare function AllChatsList({ dataSource, onSessionSelect, activeSessionId }: AllChatsListProps): react_jsx_runtime.JSX.Element;
1798
1852
 
1799
1853
  interface UserFilterProps {
1800
- users: SessionUser[];
1801
- selectedUser: SessionUser | null;
1802
- onUserChange: (user: SessionUser | null) => void;
1854
+ users: SessionUser$1[];
1855
+ selectedUser: SessionUser$1 | null;
1856
+ onUserChange: (user: SessionUser$1 | null) => void;
1803
1857
  loading?: boolean;
1804
1858
  }
1805
1859
  declare function UserFilter({ users, selectedUser, onUserChange, loading }: UserFilterProps): react_jsx_runtime.JSX.Element;
@@ -2627,672 +2681,127 @@ interface LongPressResult {
2627
2681
  }
2628
2682
  declare function useLongPress(options: LongPressOptions): LongPressResult;
2629
2683
 
2630
- /**
2631
- * Framer Motion animation variants for BiChat UI
2632
- * Subtle, professional animations for enterprise applications
2633
- *
2634
- * Reduced-motion handling: Framer Motion's built-in `<MotionConfig reducedMotion="user">`
2635
- * or the `useReducedMotion()` hook handle OS-level accessibility preferences reactively.
2636
- * Variant objects declare their intended durations; Framer suppresses them automatically.
2637
- */
2638
- /**
2639
- * Fade in animation
2640
- */
2641
- declare const fadeInVariants: {
2642
- initial: {
2643
- opacity: number;
2684
+ type BichatRPC = {
2685
+ "bichat.artifact.delete": {
2686
+ params: ArtifactIDParams;
2687
+ result: OkResult;
2644
2688
  };
2645
- animate: {
2646
- opacity: number;
2647
- transition: {
2648
- duration: number;
2649
- };
2689
+ "bichat.artifact.update": {
2690
+ params: ArtifactUpdateParams;
2691
+ result: ArtifactResult;
2650
2692
  };
2651
- exit: {
2652
- opacity: number;
2653
- transition: {
2654
- duration: number;
2655
- };
2693
+ "bichat.ping": {
2694
+ params: PingParams;
2695
+ result: PingResult;
2656
2696
  };
2657
- };
2658
- /**
2659
- * Fade in with subtle slide up
2660
- */
2661
- declare const fadeInUpVariants: {
2662
- initial: {
2663
- opacity: number;
2664
- y: number;
2697
+ "bichat.question.reject": {
2698
+ params: QuestionCancelParams;
2699
+ result: AsyncRunAcceptedResult;
2665
2700
  };
2666
- animate: {
2667
- opacity: number;
2668
- y: number;
2669
- transition: {
2670
- duration: number;
2671
- ease: number[];
2672
- };
2701
+ "bichat.question.submit": {
2702
+ params: QuestionSubmitParams;
2703
+ result: AsyncRunAcceptedResult;
2673
2704
  };
2674
- exit: {
2675
- opacity: number;
2676
- y: number;
2677
- transition: {
2678
- duration: number;
2679
- };
2705
+ "bichat.session.archive": {
2706
+ params: SessionIDParams;
2707
+ result: SessionCreateResult;
2680
2708
  };
2681
- };
2682
- /**
2683
- * Scale fade for modals and popups
2684
- */
2685
- declare const scaleFadeVariants: {
2686
- initial: {
2687
- opacity: number;
2688
- scale: number;
2709
+ "bichat.session.artifacts": {
2710
+ params: SessionArtifactsParams;
2711
+ result: SessionArtifactsResult;
2689
2712
  };
2690
- animate: {
2691
- opacity: number;
2692
- scale: number;
2693
- transition: {
2694
- duration: number;
2695
- };
2713
+ "bichat.session.clear": {
2714
+ params: SessionIDParams;
2715
+ result: SessionClearResult;
2696
2716
  };
2697
- exit: {
2698
- opacity: number;
2699
- scale: number;
2700
- transition: {
2701
- duration: number;
2702
- };
2717
+ "bichat.session.compact": {
2718
+ params: SessionIDParams;
2719
+ result: AsyncRunAcceptedResult;
2703
2720
  };
2704
- };
2705
- /**
2706
- * Modal backdrop
2707
- */
2708
- declare const backdropVariants: {
2709
- initial: {
2710
- opacity: number;
2721
+ "bichat.session.create": {
2722
+ params: SessionCreateParams;
2723
+ result: SessionCreateResult;
2711
2724
  };
2712
- animate: {
2713
- opacity: number;
2714
- transition: {
2715
- duration: number;
2716
- };
2725
+ "bichat.session.delete": {
2726
+ params: SessionIDParams;
2727
+ result: OkResult;
2717
2728
  };
2718
- exit: {
2719
- opacity: number;
2720
- transition: {
2721
- duration: number;
2722
- };
2729
+ "bichat.session.get": {
2730
+ params: SessionGetParams;
2731
+ result: SessionGetResult;
2723
2732
  };
2724
- };
2725
- /**
2726
- * Button press feedback
2727
- */
2728
- declare const buttonVariants: {
2729
- tap: {
2730
- scale: number;
2733
+ "bichat.session.list": {
2734
+ params: SessionListParams;
2735
+ result: SessionListResult;
2731
2736
  };
2732
- };
2733
- /**
2734
- * Stagger container for lists
2735
- */
2736
- declare const staggerContainerVariants: {
2737
- hidden: {
2738
- opacity: number;
2737
+ "bichat.session.listAll": {
2738
+ params: SessionListAllParams;
2739
+ result: SessionListAllResult;
2739
2740
  };
2740
- visible: {
2741
- opacity: number;
2742
- transition: {
2743
- staggerChildren: number;
2744
- delayChildren: number;
2745
- };
2741
+ "bichat.session.members.add": {
2742
+ params: SessionMembersUpsertParams;
2743
+ result: OkResult;
2746
2744
  };
2747
- };
2748
- /**
2749
- * List item animation
2750
- */
2751
- declare const listItemVariants: {
2752
- initial: {
2753
- opacity: number;
2754
- x: number;
2745
+ "bichat.session.members.list": {
2746
+ params: SessionMembersListParams;
2747
+ result: SessionMembersListResult;
2755
2748
  };
2756
- animate: {
2757
- opacity: number;
2758
- x: number;
2759
- transition: {
2760
- duration: number;
2761
- };
2749
+ "bichat.session.members.remove": {
2750
+ params: SessionMembersRemoveParams;
2751
+ result: OkResult;
2762
2752
  };
2763
- exit: {
2764
- opacity: number;
2765
- x: number;
2766
- transition: {
2767
- duration: number;
2768
- };
2753
+ "bichat.session.members.updateRole": {
2754
+ params: SessionMembersUpsertParams;
2755
+ result: OkResult;
2769
2756
  };
2770
- };
2771
- /**
2772
- * Message entrance animation
2773
- */
2774
- declare const messageVariants: {
2775
- initial: {
2776
- opacity: number;
2777
- y: number;
2757
+ "bichat.session.pin": {
2758
+ params: SessionIDParams;
2759
+ result: SessionCreateResult;
2778
2760
  };
2779
- animate: {
2780
- opacity: number;
2781
- y: number;
2782
- transition: {
2783
- duration: number;
2784
- ease: number[];
2785
- };
2761
+ "bichat.session.regenerateTitle": {
2762
+ params: SessionIDParams;
2763
+ result: SessionCreateResult;
2786
2764
  };
2787
- exit: {
2788
- opacity: number;
2789
- transition: {
2790
- duration: number;
2791
- };
2765
+ "bichat.session.unarchive": {
2766
+ params: SessionIDParams;
2767
+ result: SessionCreateResult;
2792
2768
  };
2793
- };
2794
- /**
2795
- * Container for staggered messages
2796
- */
2797
- declare const messageContainerVariants: {
2798
- initial: {
2799
- opacity: number;
2769
+ "bichat.session.unpin": {
2770
+ params: SessionIDParams;
2771
+ result: SessionCreateResult;
2800
2772
  };
2801
- animate: {
2802
- opacity: number;
2803
- transition: {
2804
- staggerChildren: number;
2805
- delayChildren: number;
2806
- };
2773
+ "bichat.session.updateTitle": {
2774
+ params: SessionUpdateTitleParams;
2775
+ result: SessionCreateResult;
2807
2776
  };
2808
- };
2809
- /**
2810
- * Typing indicator dots
2811
- */
2812
- declare const typingDotVariants: {
2813
- initial: {
2814
- opacity: number;
2815
- };
2816
- animate: {
2817
- opacity: number[];
2818
- transition: {
2819
- duration: number;
2820
- repeat: number;
2821
- ease: string;
2822
- };
2823
- };
2824
- };
2825
- /**
2826
- * Verb transition for typing indicator
2827
- * Smooth slide-up animation for rotating text
2828
- */
2829
- declare const verbTransitionVariants: {
2830
- initial: {
2831
- y: number;
2832
- opacity: number;
2833
- };
2834
- animate: {
2835
- y: number;
2836
- opacity: number;
2837
- transition: {
2838
- duration: number;
2839
- ease: string;
2840
- };
2841
- };
2842
- exit: {
2843
- y: number;
2844
- opacity: number;
2845
- transition: {
2846
- duration: number;
2847
- };
2848
- };
2849
- };
2850
- /**
2851
- * Floating button (scroll to bottom, etc.)
2852
- */
2853
- declare const floatingButtonVariants: {
2854
- initial: {
2855
- opacity: number;
2856
- scale: number;
2857
- };
2858
- animate: {
2859
- opacity: number;
2860
- scale: number;
2861
- transition: {
2862
- duration: number;
2863
- };
2864
- };
2865
- exit: {
2866
- opacity: number;
2867
- scale: number;
2868
- transition: {
2869
- duration: number;
2870
- };
2871
- };
2872
- };
2873
- /**
2874
- * Dropdown menu
2875
- */
2876
- declare const dropdownVariants: {
2877
- initial: {
2878
- opacity: number;
2879
- y: number;
2880
- };
2881
- animate: {
2882
- opacity: number;
2883
- y: number;
2884
- transition: {
2885
- duration: number;
2886
- };
2887
- };
2888
- exit: {
2889
- opacity: number;
2890
- y: number;
2891
- transition: {
2892
- duration: number;
2893
- };
2894
- };
2895
- };
2896
- /**
2897
- * Session item with subtle slide-right on hover
2898
- */
2899
- declare const sessionItemVariants: {
2900
- initial: {
2901
- opacity: number;
2902
- x: number;
2903
- };
2904
- animate: {
2905
- opacity: number;
2906
- x: number;
2907
- transition: {
2908
- duration: number;
2909
- };
2910
- };
2911
- hover: {
2912
- x: number;
2913
- transition: {
2914
- duration: number;
2915
- };
2916
- };
2917
- exit: {
2918
- opacity: number;
2919
- x: number;
2920
- transition: {
2921
- duration: number;
2922
- };
2923
- };
2924
- };
2925
- /**
2926
- * Error/alert message slide-in
2927
- */
2928
- declare const errorMessageVariants: {
2929
- initial: {
2930
- opacity: number;
2931
- y: number;
2932
- height: number;
2933
- };
2934
- animate: {
2935
- opacity: number;
2936
- y: number;
2937
- height: string;
2938
- transition: {
2939
- duration: number;
2940
- ease: number[];
2941
- };
2777
+ "bichat.session.uploadArtifacts": {
2778
+ params: SessionUploadArtifactsParams;
2779
+ result: SessionUploadArtifactsResult;
2942
2780
  };
2943
- exit: {
2944
- opacity: number;
2945
- y: number;
2946
- height: number;
2947
- transition: {
2948
- duration: number;
2949
- };
2781
+ "bichat.user.list": {
2782
+ params: UserListParams;
2783
+ result: UserListResult;
2950
2784
  };
2951
2785
  };
2952
-
2953
- interface ChatSessionProviderProps {
2954
- dataSource: ChatDataSource;
2955
- sessionId?: string;
2956
- /**
2957
- * External rate limiter instance. Captured once at mount — changing this prop
2958
- * after initial render has no effect. For most cases, use `rateLimitConfig`
2959
- * instead and let the provider create the limiter internally.
2960
- */
2961
- rateLimiter?: RateLimiter;
2962
- /**
2963
- * Configuration for the built-in rate limiter (ignored when `rateLimiter` is
2964
- * provided). Captured once at mount — changing after initial render has no effect.
2965
- */
2966
- rateLimitConfig?: RateLimiterConfig;
2967
- /**
2968
- * Called when the machine creates a new session (e.g. on first message in a
2969
- * "new chat"). Use this to navigate your SPA router to the new session URL.
2970
- *
2971
- * Replaces the deprecated `dataSource.navigateToSession`.
2972
- */
2973
- onSessionCreated?: (sessionId: string) => void;
2974
- children: ReactNode;
2786
+ interface Artifact {
2787
+ id: string;
2788
+ sessionId: string;
2789
+ messageId?: string;
2790
+ uploadId?: number | null;
2791
+ type: string;
2792
+ name: string;
2793
+ description?: string;
2794
+ mimeType?: string;
2795
+ url?: string;
2796
+ sizeBytes: number;
2797
+ metadata?: Record<string, unknown>;
2798
+ createdAt: string;
2975
2799
  }
2976
- declare function ChatSessionProvider({ dataSource, sessionId, rateLimiter: externalRateLimiter, rateLimitConfig, onSessionCreated, children, }: ChatSessionProviderProps): react_jsx_runtime.JSX.Element;
2977
- declare function useChatSession(): ChatSessionStateValue;
2978
- declare function useChatMessaging(): ChatMessagingStateValue;
2979
- /** Returns messaging context or null when outside ChatSessionProvider. */
2980
- declare function useOptionalChatMessaging(): ChatMessagingStateValue | null;
2981
- declare function useChatInput(): ChatInputStateValue;
2982
-
2983
- /**
2984
- * BiChat context types layered on top of canonical applet-core context contracts.
2985
- */
2986
-
2987
- type UserContext = UserContext$1;
2988
- type TenantContext = TenantContext$1;
2989
- type LocaleContext = LocaleContext$1;
2990
- type AppConfig = AppConfig$1 & {
2991
- streamEndpoint: string;
2992
- basePath: string;
2993
- assetsBasePath: string;
2994
- rpcUIEndpoint: string;
2995
- };
2996
- interface Extensions {
2997
- branding?: {
2998
- appName?: string;
2999
- logoUrl?: string;
3000
- theme?: {
3001
- primary?: string;
3002
- secondary?: string;
3003
- accent?: string;
3004
- };
3005
- welcome?: {
3006
- title?: string;
3007
- description?: string;
3008
- examplePrompts?: Array<{
3009
- category: string;
3010
- text: string;
3011
- icon: string;
3012
- }>;
3013
- };
3014
- colors?: {
3015
- primary?: string;
3016
- secondary?: string;
3017
- accent?: string;
3018
- };
3019
- logo?: {
3020
- src?: string;
3021
- alt?: string;
3022
- };
3023
- };
3024
- features?: {
3025
- vision?: boolean;
3026
- webSearch?: boolean;
3027
- codeInterpreter?: boolean;
3028
- multiAgent?: boolean;
3029
- };
3030
- llm?: {
3031
- provider?: string;
3032
- apiKeyConfigured?: boolean;
3033
- };
3034
- debug?: {
3035
- limits?: {
3036
- policyMaxTokens: number;
3037
- modelMaxTokens: number;
3038
- effectiveMaxTokens: number;
3039
- completionReserveTokens: number;
3040
- };
3041
- };
2800
+ interface ArtifactIDParams {
2801
+ id: string;
3042
2802
  }
3043
- type IotaContext = Omit<InitialContext, 'config' | 'extensions'> & {
3044
- config: AppConfig;
3045
- extensions?: Extensions;
3046
- };
3047
- declare global {
3048
- interface Window {
3049
- __APPLET_CONTEXT__: IotaContext;
3050
- __CSRF_TOKEN__: string;
3051
- }
3052
- }
3053
-
3054
- interface IotaContextProviderProps {
3055
- /**
3056
- * Explicit context object. When provided, the window global is not read.
3057
- * Useful for tests, Storybook, or apps that manage their own context.
3058
- */
3059
- context?: IotaContext;
3060
- children: ReactNode;
3061
- }
3062
- declare function IotaContextProvider({ context, children }: IotaContextProviderProps): react_jsx_runtime.JSX.Element;
3063
- declare function useIotaContext(): IotaContext;
3064
- /**
3065
- * Check if user has a specific permission
3066
- */
3067
- declare function hasPermission(permission: string): boolean;
3068
-
3069
- /** @deprecated Use `IotaContextProvider` with its `context` prop instead. */
3070
- interface BiChatConfig {
3071
- user: {
3072
- id: string;
3073
- email: string;
3074
- firstName: string;
3075
- lastName: string;
3076
- permissions: string[];
3077
- };
3078
- tenant: {
3079
- id: string;
3080
- name: string;
3081
- };
3082
- locale: {
3083
- language: string;
3084
- translations: Record<string, string>;
3085
- };
3086
- endpoints: {
3087
- rpc: string;
3088
- stream: string;
3089
- };
3090
- csrfToken?: string;
3091
- }
3092
- interface ConfigProviderProps {
3093
- config?: BiChatConfig;
3094
- useGlobalConfig?: boolean;
3095
- children: ReactNode;
3096
- }
3097
- /**
3098
- * @deprecated Use `IotaContextProvider` with its `context` prop instead.
3099
- *
3100
- * ConfigProvider component — provides configuration to the BiChat library.
3101
- *
3102
- * @param config - Configuration object (preferred method)
3103
- * @param useGlobalConfig - If true, falls back to window.__APPLET_CONTEXT__ when config is not provided
3104
- * @param children - React children
3105
- */
3106
- declare function ConfigProvider({ config, useGlobalConfig, children }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
3107
- /**
3108
- * Hook to access BiChat configuration
3109
- * Returns null if no configuration is available
3110
- */
3111
- declare function useConfig(): BiChatConfig | null;
3112
- /**
3113
- * Hook to access BiChat configuration (required)
3114
- * Throws an error if configuration is not available
3115
- */
3116
- declare function useRequiredConfig(): BiChatConfig;
3117
-
3118
- /**
3119
- * Theme system type definitions
3120
- */
3121
- interface Theme {
3122
- name: string;
3123
- colors: ThemeColors;
3124
- spacing: ThemeSpacing;
3125
- borderRadius: ThemeBorderRadius;
3126
- }
3127
- interface ThemeColors {
3128
- background: string;
3129
- surface: string;
3130
- primary: string;
3131
- secondary: string;
3132
- text: string;
3133
- textMuted: string;
3134
- border: string;
3135
- error: string;
3136
- success: string;
3137
- warning: string;
3138
- userBubble: string;
3139
- assistantBubble: string;
3140
- userText: string;
3141
- assistantText: string;
3142
- }
3143
- interface ThemeSpacing {
3144
- xs: string;
3145
- sm: string;
3146
- md: string;
3147
- lg: string;
3148
- xl: string;
3149
- }
3150
- interface ThemeBorderRadius {
3151
- sm: string;
3152
- md: string;
3153
- lg: string;
3154
- full: string;
3155
- }
3156
-
3157
- interface ThemeProviderProps {
3158
- theme?: Theme | 'light' | 'dark' | 'system';
3159
- children: ReactNode;
3160
- }
3161
- /**
3162
- * Theme provider component
3163
- * Wraps the application and provides theme context
3164
- */
3165
- declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
3166
- /**
3167
- * Hook to access current theme
3168
- */
3169
- declare function useTheme(): Theme;
3170
-
3171
- /**
3172
- * Predefined theme configurations
3173
- */
3174
-
3175
- declare const lightTheme: Theme;
3176
- declare const darkTheme: Theme;
3177
-
3178
- /**
3179
- * CSRF token management for API requests
3180
- */
3181
- /**
3182
- * Get CSRF token from window object
3183
- * @returns CSRF token string
3184
- */
3185
- declare function getCSRFToken(): string;
3186
- /**
3187
- * Add CSRF token to request headers
3188
- * @param headers - Headers object to modify
3189
- * @returns Modified headers object
3190
- */
3191
- declare function addCSRFHeader(headers: Headers): Headers;
3192
- /**
3193
- * Create headers with CSRF token
3194
- * @param init - Optional initial headers
3195
- * @returns Headers object with CSRF token
3196
- */
3197
- declare function createHeadersWithCSRF(init?: HeadersInit): Headers;
3198
-
3199
- type BichatRPC = {
3200
- "bichat.artifact.delete": {
3201
- params: ArtifactIDParams;
3202
- result: OkResult;
3203
- };
3204
- "bichat.artifact.update": {
3205
- params: ArtifactUpdateParams;
3206
- result: ArtifactResult;
3207
- };
3208
- "bichat.ping": {
3209
- params: PingParams;
3210
- result: PingResult;
3211
- };
3212
- "bichat.question.reject": {
3213
- params: QuestionCancelParams;
3214
- result: SessionGetResult;
3215
- };
3216
- "bichat.question.submit": {
3217
- params: QuestionSubmitParams;
3218
- result: SessionGetResult;
3219
- };
3220
- "bichat.session.archive": {
3221
- params: SessionIDParams;
3222
- result: SessionCreateResult;
3223
- };
3224
- "bichat.session.artifacts": {
3225
- params: SessionArtifactsParams;
3226
- result: SessionArtifactsResult;
3227
- };
3228
- "bichat.session.clear": {
3229
- params: SessionIDParams;
3230
- result: SessionClearResult;
3231
- };
3232
- "bichat.session.compact": {
3233
- params: SessionIDParams;
3234
- result: SessionCompactResult;
3235
- };
3236
- "bichat.session.create": {
3237
- params: SessionCreateParams;
3238
- result: SessionCreateResult;
3239
- };
3240
- "bichat.session.delete": {
3241
- params: SessionIDParams;
3242
- result: OkResult;
3243
- };
3244
- "bichat.session.get": {
3245
- params: SessionGetParams;
3246
- result: SessionGetResult;
3247
- };
3248
- "bichat.session.list": {
3249
- params: SessionListParams;
3250
- result: SessionListResult;
3251
- };
3252
- "bichat.session.pin": {
3253
- params: SessionIDParams;
3254
- result: SessionCreateResult;
3255
- };
3256
- "bichat.session.regenerateTitle": {
3257
- params: SessionIDParams;
3258
- result: SessionCreateResult;
3259
- };
3260
- "bichat.session.unarchive": {
3261
- params: SessionIDParams;
3262
- result: SessionCreateResult;
3263
- };
3264
- "bichat.session.unpin": {
3265
- params: SessionIDParams;
3266
- result: SessionCreateResult;
3267
- };
3268
- "bichat.session.updateTitle": {
3269
- params: SessionUpdateTitleParams;
3270
- result: SessionCreateResult;
3271
- };
3272
- "bichat.session.uploadArtifacts": {
3273
- params: SessionUploadArtifactsParams;
3274
- result: SessionUploadArtifactsResult;
3275
- };
3276
- };
3277
- interface Artifact {
3278
- id: string;
3279
- sessionId: string;
3280
- messageId?: string;
3281
- uploadId?: number;
3282
- type: string;
3283
- name: string;
3284
- description?: string;
3285
- mimeType?: string;
3286
- url?: string;
3287
- sizeBytes: number;
3288
- metadata?: Record<string, unknown>;
3289
- createdAt: string;
3290
- }
3291
- interface ArtifactIDParams {
3292
- id: string;
3293
- }
3294
- interface ArtifactResult {
3295
- artifact: Artifact;
2803
+ interface ArtifactResult {
2804
+ artifact: Artifact;
3296
2805
  }
3297
2806
  interface ArtifactUpdateParams {
3298
2807
  id: string;
@@ -3311,12 +2820,19 @@ interface AssistantTurn {
3311
2820
  codeOutputs: CodeOutput[];
3312
2821
  createdAt: string;
3313
2822
  }
2823
+ interface AsyncRunAcceptedResult {
2824
+ accepted: boolean;
2825
+ operation: string;
2826
+ sessionId: string;
2827
+ runId: string;
2828
+ startedAt: number;
2829
+ }
3314
2830
  interface Attachment {
3315
- id?: string;
3316
- uploadId?: number;
3317
- filename?: string;
3318
- mimeType?: string;
3319
- sizeBytes?: number;
2831
+ id: string;
2832
+ uploadId?: number | null;
2833
+ filename: string;
2834
+ mimeType: string;
2835
+ sizeBytes: number;
3320
2836
  url?: string;
3321
2837
  }
3322
2838
  interface Citation {
@@ -3327,6 +2843,7 @@ interface Citation {
3327
2843
  startIndex: number;
3328
2844
  endIndex: number;
3329
2845
  excerpt?: string;
2846
+ source?: string;
3330
2847
  }
3331
2848
  interface CodeOutput {
3332
2849
  type: string;
@@ -3342,7 +2859,57 @@ interface ConversationTurn {
3342
2859
  assistantTurn?: AssistantTurn | null;
3343
2860
  createdAt: string;
3344
2861
  }
3345
- interface DebugToolCall {
2862
+ interface DebugEvent {
2863
+ id?: string;
2864
+ name?: string;
2865
+ type?: string;
2866
+ level?: string;
2867
+ message?: string;
2868
+ reason?: string;
2869
+ spanId?: string;
2870
+ generationId?: string;
2871
+ timestamp?: string;
2872
+ attributes?: Record<string, unknown>;
2873
+ }
2874
+ interface DebugGeneration {
2875
+ id?: string;
2876
+ requestId?: string;
2877
+ model?: string;
2878
+ provider?: string;
2879
+ finishReason?: string;
2880
+ promptTokens?: number;
2881
+ completionTokens?: number;
2882
+ totalTokens?: number;
2883
+ cachedTokens?: number;
2884
+ cost?: number;
2885
+ latencyMs?: number;
2886
+ input?: string;
2887
+ output?: string;
2888
+ thinking?: string;
2889
+ observationReason?: string;
2890
+ startedAt?: string;
2891
+ completedAt?: string;
2892
+ toolCalls?: DebugToolCall[];
2893
+ }
2894
+ interface DebugSpan {
2895
+ id?: string;
2896
+ parentId?: string;
2897
+ generationId?: string;
2898
+ name?: string;
2899
+ type?: string;
2900
+ status?: string;
2901
+ level?: string;
2902
+ callId?: string;
2903
+ toolName?: string;
2904
+ input?: string;
2905
+ output?: string;
2906
+ error?: string;
2907
+ durationMs?: number;
2908
+ startedAt?: string;
2909
+ completedAt?: string;
2910
+ attributes?: Record<string, unknown>;
2911
+ }
2912
+ interface DebugToolCall {
3346
2913
  callId?: string;
3347
2914
  name?: string;
3348
2915
  arguments?: string;
@@ -3351,11 +2918,20 @@ interface DebugToolCall {
3351
2918
  durationMs?: number;
3352
2919
  }
3353
2920
  interface DebugTrace {
2921
+ schemaVersion?: string;
2922
+ startedAt?: string;
2923
+ completedAt?: string;
3354
2924
  usage?: DebugUsage | null;
3355
2925
  generationMs?: number;
3356
2926
  tools?: DebugToolCall[];
2927
+ attempts?: DebugGeneration[];
2928
+ spans?: DebugSpan[];
2929
+ events?: DebugEvent[];
3357
2930
  traceId?: string;
3358
2931
  traceUrl?: string;
2932
+ sessionId?: string;
2933
+ thinking?: string;
2934
+ observationReason?: string;
3359
2935
  }
3360
2936
  interface DebugUsage {
3361
2937
  promptTokens: number;
@@ -3403,6 +2979,17 @@ interface Session {
3403
2979
  pinned: boolean;
3404
2980
  createdAt: string;
3405
2981
  updatedAt: string;
2982
+ owner?: SessionUser | null;
2983
+ isGroup?: boolean;
2984
+ memberCount?: number;
2985
+ access?: SessionAccess | null;
2986
+ }
2987
+ interface SessionAccess {
2988
+ role: string;
2989
+ source: string;
2990
+ canRead: boolean;
2991
+ canWrite: boolean;
2992
+ canManageMembers: boolean;
3406
2993
  }
3407
2994
  interface SessionArtifactsParams {
3408
2995
  sessionId: string;
@@ -3419,12 +3006,6 @@ interface SessionClearResult {
3419
3006
  deletedMessages: number;
3420
3007
  deletedArtifacts: number;
3421
3008
  }
3422
- interface SessionCompactResult {
3423
- success: boolean;
3424
- summary: string;
3425
- deletedMessages: number;
3426
- deletedArtifacts: number;
3427
- }
3428
3009
  interface SessionCreateParams {
3429
3010
  title: string;
3430
3011
  }
@@ -3439,162 +3020,825 @@ interface SessionGetResult {
3439
3020
  turns: ConversationTurn[];
3440
3021
  pendingQuestion?: PendingQuestion | null;
3441
3022
  }
3442
- interface SessionIDParams {
3443
- id: string;
3023
+ interface SessionIDParams {
3024
+ id: string;
3025
+ }
3026
+ interface SessionListAllParams {
3027
+ limit: number;
3028
+ offset: number;
3029
+ includeArchived: boolean;
3030
+ userId?: string | null;
3031
+ }
3032
+ interface SessionListAllResult {
3033
+ sessions: Session[];
3034
+ total?: number;
3035
+ hasMore: boolean;
3036
+ }
3037
+ interface SessionListParams {
3038
+ limit: number;
3039
+ offset: number;
3040
+ includeArchived: boolean;
3041
+ }
3042
+ interface SessionListResult {
3043
+ sessions: Session[];
3044
+ total?: number;
3045
+ hasMore: boolean;
3046
+ }
3047
+ interface SessionMember {
3048
+ user: SessionUser;
3049
+ role: string;
3050
+ createdAt: string;
3051
+ updatedAt: string;
3052
+ }
3053
+ interface SessionMembersListParams {
3054
+ sessionId: string;
3055
+ }
3056
+ interface SessionMembersListResult {
3057
+ members: SessionMember[];
3058
+ }
3059
+ interface SessionMembersRemoveParams {
3060
+ sessionId: string;
3061
+ userId: string;
3062
+ }
3063
+ interface SessionMembersUpsertParams {
3064
+ sessionId: string;
3065
+ userId: string;
3066
+ role: string;
3067
+ }
3068
+ interface SessionUpdateTitleParams {
3069
+ id: string;
3070
+ title: string;
3071
+ }
3072
+ interface SessionUploadArtifactsParams {
3073
+ sessionId: string;
3074
+ attachments: Attachment[];
3075
+ }
3076
+ interface SessionUploadArtifactsResult {
3077
+ artifacts: Artifact[];
3078
+ }
3079
+ interface SessionUser {
3080
+ id: string;
3081
+ firstName: string;
3082
+ lastName: string;
3083
+ initials: string;
3084
+ }
3085
+ interface ToolCall {
3086
+ id: string;
3087
+ name: string;
3088
+ arguments: string;
3089
+ result?: string;
3090
+ error?: string;
3091
+ durationMs?: number;
3092
+ }
3093
+ type UserListParams = Record<string, never>;
3094
+ interface UserListResult {
3095
+ users: SessionUser[];
3096
+ }
3097
+ interface UserTurn {
3098
+ id: string;
3099
+ content: string;
3100
+ attachments: Attachment[];
3101
+ author?: SessionUser | null;
3102
+ createdAt: string;
3103
+ }
3104
+
3105
+ /**
3106
+ * Session lifecycle management: create, list, get, delete, archive, pin, rename.
3107
+ *
3108
+ * @internal — Not part of the public API. Consumed by HttpDataSource.
3109
+ */
3110
+
3111
+ interface SessionState {
3112
+ session: Session$1;
3113
+ turns: ConversationTurn$1[];
3114
+ pendingQuestion?: PendingQuestion$1 | null;
3115
+ }
3116
+
3117
+ /**
3118
+ * Built-in HTTP data source with SSE streaming and AbortController
3119
+ * Implements ChatDataSource interface with real HTTP/RPC calls
3120
+ *
3121
+ * Uses turn-based architecture - fetches ConversationTurns instead of flat messages.
3122
+ *
3123
+ * This file is a thin facade that delegates to focused internal modules:
3124
+ * - SessionManager.ts — session CRUD (create, list, get, delete, archive, pin)
3125
+ * - MessageTransport.ts — send messages, stream responses, HITL questions
3126
+ * - ArtifactManager.ts — artifact fetch, upload, rename, delete
3127
+ * - AttachmentUploader.ts — file decode, normalize, upload
3128
+ * - mappers.ts — RPC-to-domain type mapping and sanitization
3129
+ */
3130
+
3131
+ interface HttpDataSourceConfig {
3132
+ baseUrl: string;
3133
+ rpcEndpoint: string;
3134
+ streamEndpoint?: string;
3135
+ uploadEndpoint?: string;
3136
+ csrfToken?: string | (() => string);
3137
+ headers?: Record<string, string>;
3138
+ rpcTimeoutMs?: number;
3139
+ streamConnectTimeoutMs?: number;
3140
+ }
3141
+ declare class HttpDataSource implements ChatDataSource {
3142
+ private config;
3143
+ private abortController;
3144
+ private rpc;
3145
+ constructor(config: HttpDataSourceConfig);
3146
+ private getCSRFToken;
3147
+ private createHeaders;
3148
+ private createUploadHeaders;
3149
+ private callRPC;
3150
+ private boundCallRPC;
3151
+ private boundUploadFile;
3152
+ createSession(): Promise<Session$1>;
3153
+ fetchSession(id: string): Promise<SessionState | null>;
3154
+ listSessions(options?: {
3155
+ limit?: number;
3156
+ offset?: number;
3157
+ includeArchived?: boolean;
3158
+ }): Promise<SessionListResult$1>;
3159
+ archiveSession(sessionId: string): Promise<Session$1>;
3160
+ unarchiveSession(sessionId: string): Promise<Session$1>;
3161
+ pinSession(sessionId: string): Promise<Session$1>;
3162
+ unpinSession(sessionId: string): Promise<Session$1>;
3163
+ deleteSession(sessionId: string): Promise<void>;
3164
+ renameSession(sessionId: string, title: string): Promise<Session$1>;
3165
+ regenerateSessionTitle(sessionId: string): Promise<Session$1>;
3166
+ clearSessionHistory(sessionId: string): Promise<{
3167
+ success: boolean;
3168
+ deletedMessages: number;
3169
+ deletedArtifacts: number;
3170
+ }>;
3171
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
3172
+ listUsers(): Promise<SessionUser$1[]>;
3173
+ listAllSessions(options?: {
3174
+ limit?: number;
3175
+ offset?: number;
3176
+ includeArchived?: boolean;
3177
+ userId?: string | null;
3178
+ }): Promise<{
3179
+ sessions: Session$1[];
3180
+ total: number;
3181
+ hasMore: boolean;
3182
+ }>;
3183
+ listSessionMembers(sessionId: string): Promise<SessionMember$1[]>;
3184
+ addSessionMember(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
3185
+ updateSessionMemberRole(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
3186
+ removeSessionMember(sessionId: string, userId: string): Promise<void>;
3187
+ stopGeneration(sessionId: string): Promise<void>;
3188
+ getStreamStatus(sessionId: string): Promise<StreamStatus | null>;
3189
+ resumeStream(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
3190
+ sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
3191
+ cancelStream(): void;
3192
+ submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
3193
+ success: boolean;
3194
+ data?: AsyncRunAccepted;
3195
+ error?: string;
3196
+ }>;
3197
+ rejectPendingQuestion(sessionId: string): Promise<{
3198
+ success: boolean;
3199
+ data?: AsyncRunAccepted;
3200
+ error?: string;
3201
+ }>;
3202
+ fetchSessionArtifacts(sessionId: string, options?: {
3203
+ limit?: number;
3204
+ offset?: number;
3205
+ }): Promise<{
3206
+ artifacts: SessionArtifact[];
3207
+ hasMore?: boolean;
3208
+ nextOffset?: number;
3209
+ }>;
3210
+ uploadSessionArtifacts(sessionId: string, files: File[]): Promise<{
3211
+ artifacts: SessionArtifact[];
3212
+ }>;
3213
+ renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
3214
+ deleteSessionArtifact(artifactId: string): Promise<void>;
3215
+ }
3216
+ /**
3217
+ * Factory function to create HttpDataSource
3218
+ */
3219
+ declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSource;
3220
+
3221
+ /**
3222
+ * Builds HttpDataSourceConfig from window.__APPLET_CONTEXT__.
3223
+ * For use with createHttpDataSource when the app is embedded via the applet framework.
3224
+ *
3225
+ * Expects the host to inject context with:
3226
+ * - config.rpcUIEndpoint, config.streamEndpoint
3227
+ * - session.csrfToken (or window.__CSRF_TOKEN__)
3228
+ */
3229
+
3230
+ /**
3231
+ * Returns HttpDataSourceConfig derived from window.__APPLET_CONTEXT__.
3232
+ * Use with createHttpDataSource() for RPC and SSE endpoints.
3233
+ *
3234
+ * @throws Error if window.__APPLET_CONTEXT__ is not available
3235
+ */
3236
+ declare function useHttpDataSourceConfigFromApplet(options?: {
3237
+ rpcTimeoutMs?: number;
3238
+ streamConnectTimeoutMs?: number;
3239
+ }): HttpDataSourceConfig;
3240
+
3241
+ /**
3242
+ * Router adapter for BiChat sidebar and archived list.
3243
+ * Consumes a navigate function and location (pathname) and returns
3244
+ * activeSessionId plus callbacks for use with SDK Sidebar and ArchivedChatList.
3245
+ *
3246
+ * Router-agnostic: pass useNavigate()/useLocation() from react-router-dom
3247
+ * or equivalent from your router.
3248
+ */
3249
+ interface UseBichatRouterParams {
3250
+ /** Navigate to a path (e.g. from useNavigate()) */
3251
+ navigate: (path: string) => void;
3252
+ /** Current pathname (e.g. location.pathname from useLocation()) */
3253
+ pathname: string;
3254
+ /** Optional: close mobile sidebar after navigation (e.g. closeMobile from useSidebarState) */
3255
+ onNavigate?: () => void;
3256
+ }
3257
+ interface UseBichatRouterReturn {
3258
+ /** Session ID extracted from pathname (e.g. /session/:id -> id) */
3259
+ activeSessionId: string | undefined;
3260
+ /** Navigate to session or home when sessionId is empty */
3261
+ onSessionSelect: (sessionId: string) => void;
3262
+ /** Navigate to new chat (home) */
3263
+ onNewChat: () => void;
3264
+ /** Navigate to archived list */
3265
+ onArchivedView: () => void;
3266
+ /** Navigate back (e.g. to home) */
3267
+ onBack: () => void;
3268
+ }
3269
+ /**
3270
+ * Derives BiChat navigation callbacks and activeSessionId from router state.
3271
+ * Use with SDK Sidebar (onSessionSelect, onNewChat, onArchivedView, activeSessionId)
3272
+ * and ArchivedChatList (onBack, onSessionSelect).
3273
+ */
3274
+ declare function useBichatRouter({ navigate, pathname, onNavigate, }: UseBichatRouterParams): UseBichatRouterReturn;
3275
+
3276
+ /**
3277
+ * Framer Motion animation variants for BiChat UI
3278
+ * Subtle, professional animations for enterprise applications
3279
+ *
3280
+ * Reduced-motion handling: Framer Motion's built-in `<MotionConfig reducedMotion="user">`
3281
+ * or the `useReducedMotion()` hook handle OS-level accessibility preferences reactively.
3282
+ * Variant objects declare their intended durations; Framer suppresses them automatically.
3283
+ */
3284
+ /**
3285
+ * Fade in animation
3286
+ */
3287
+ declare const fadeInVariants: {
3288
+ initial: {
3289
+ opacity: number;
3290
+ };
3291
+ animate: {
3292
+ opacity: number;
3293
+ transition: {
3294
+ duration: number;
3295
+ };
3296
+ };
3297
+ exit: {
3298
+ opacity: number;
3299
+ transition: {
3300
+ duration: number;
3301
+ };
3302
+ };
3303
+ };
3304
+ /**
3305
+ * Fade in with subtle slide up
3306
+ */
3307
+ declare const fadeInUpVariants: {
3308
+ initial: {
3309
+ opacity: number;
3310
+ y: number;
3311
+ };
3312
+ animate: {
3313
+ opacity: number;
3314
+ y: number;
3315
+ transition: {
3316
+ duration: number;
3317
+ ease: number[];
3318
+ };
3319
+ };
3320
+ exit: {
3321
+ opacity: number;
3322
+ y: number;
3323
+ transition: {
3324
+ duration: number;
3325
+ };
3326
+ };
3327
+ };
3328
+ /**
3329
+ * Scale fade for modals and popups
3330
+ */
3331
+ declare const scaleFadeVariants: {
3332
+ initial: {
3333
+ opacity: number;
3334
+ scale: number;
3335
+ };
3336
+ animate: {
3337
+ opacity: number;
3338
+ scale: number;
3339
+ transition: {
3340
+ duration: number;
3341
+ };
3342
+ };
3343
+ exit: {
3344
+ opacity: number;
3345
+ scale: number;
3346
+ transition: {
3347
+ duration: number;
3348
+ };
3349
+ };
3350
+ };
3351
+ /**
3352
+ * Modal backdrop
3353
+ */
3354
+ declare const backdropVariants: {
3355
+ initial: {
3356
+ opacity: number;
3357
+ };
3358
+ animate: {
3359
+ opacity: number;
3360
+ transition: {
3361
+ duration: number;
3362
+ };
3363
+ };
3364
+ exit: {
3365
+ opacity: number;
3366
+ transition: {
3367
+ duration: number;
3368
+ };
3369
+ };
3370
+ };
3371
+ /**
3372
+ * Button press feedback
3373
+ */
3374
+ declare const buttonVariants: {
3375
+ tap: {
3376
+ scale: number;
3377
+ };
3378
+ };
3379
+ /**
3380
+ * Stagger container for lists
3381
+ */
3382
+ declare const staggerContainerVariants: {
3383
+ hidden: {
3384
+ opacity: number;
3385
+ };
3386
+ visible: {
3387
+ opacity: number;
3388
+ transition: {
3389
+ staggerChildren: number;
3390
+ delayChildren: number;
3391
+ };
3392
+ };
3393
+ };
3394
+ /**
3395
+ * List item animation
3396
+ */
3397
+ declare const listItemVariants: {
3398
+ initial: {
3399
+ opacity: number;
3400
+ x: number;
3401
+ };
3402
+ animate: {
3403
+ opacity: number;
3404
+ x: number;
3405
+ transition: {
3406
+ duration: number;
3407
+ };
3408
+ };
3409
+ exit: {
3410
+ opacity: number;
3411
+ x: number;
3412
+ transition: {
3413
+ duration: number;
3414
+ };
3415
+ };
3416
+ };
3417
+ /**
3418
+ * Message entrance animation
3419
+ */
3420
+ declare const messageVariants: {
3421
+ initial: {
3422
+ opacity: number;
3423
+ y: number;
3424
+ };
3425
+ animate: {
3426
+ opacity: number;
3427
+ y: number;
3428
+ transition: {
3429
+ duration: number;
3430
+ ease: number[];
3431
+ };
3432
+ };
3433
+ exit: {
3434
+ opacity: number;
3435
+ transition: {
3436
+ duration: number;
3437
+ };
3438
+ };
3439
+ };
3440
+ /**
3441
+ * Container for staggered messages
3442
+ */
3443
+ declare const messageContainerVariants: {
3444
+ initial: {
3445
+ opacity: number;
3446
+ };
3447
+ animate: {
3448
+ opacity: number;
3449
+ transition: {
3450
+ staggerChildren: number;
3451
+ delayChildren: number;
3452
+ };
3453
+ };
3454
+ };
3455
+ /**
3456
+ * Typing indicator dots
3457
+ */
3458
+ declare const typingDotVariants: {
3459
+ initial: {
3460
+ opacity: number;
3461
+ };
3462
+ animate: {
3463
+ opacity: number[];
3464
+ transition: {
3465
+ duration: number;
3466
+ repeat: number;
3467
+ ease: string;
3468
+ };
3469
+ };
3470
+ };
3471
+ /**
3472
+ * Verb transition for typing indicator
3473
+ * Smooth slide-up animation for rotating text
3474
+ */
3475
+ declare const verbTransitionVariants: {
3476
+ initial: {
3477
+ y: number;
3478
+ opacity: number;
3479
+ };
3480
+ animate: {
3481
+ y: number;
3482
+ opacity: number;
3483
+ transition: {
3484
+ duration: number;
3485
+ ease: string;
3486
+ };
3487
+ };
3488
+ exit: {
3489
+ y: number;
3490
+ opacity: number;
3491
+ transition: {
3492
+ duration: number;
3493
+ };
3494
+ };
3495
+ };
3496
+ /**
3497
+ * Floating button (scroll to bottom, etc.)
3498
+ */
3499
+ declare const floatingButtonVariants: {
3500
+ initial: {
3501
+ opacity: number;
3502
+ scale: number;
3503
+ };
3504
+ animate: {
3505
+ opacity: number;
3506
+ scale: number;
3507
+ transition: {
3508
+ duration: number;
3509
+ };
3510
+ };
3511
+ exit: {
3512
+ opacity: number;
3513
+ scale: number;
3514
+ transition: {
3515
+ duration: number;
3516
+ };
3517
+ };
3518
+ };
3519
+ /**
3520
+ * Dropdown menu
3521
+ */
3522
+ declare const dropdownVariants: {
3523
+ initial: {
3524
+ opacity: number;
3525
+ y: number;
3526
+ };
3527
+ animate: {
3528
+ opacity: number;
3529
+ y: number;
3530
+ transition: {
3531
+ duration: number;
3532
+ };
3533
+ };
3534
+ exit: {
3535
+ opacity: number;
3536
+ y: number;
3537
+ transition: {
3538
+ duration: number;
3539
+ };
3540
+ };
3541
+ };
3542
+ /**
3543
+ * Session item with subtle slide-right on hover
3544
+ */
3545
+ declare const sessionItemVariants: {
3546
+ initial: {
3547
+ opacity: number;
3548
+ x: number;
3549
+ };
3550
+ animate: {
3551
+ opacity: number;
3552
+ x: number;
3553
+ transition: {
3554
+ duration: number;
3555
+ };
3556
+ };
3557
+ hover: {
3558
+ x: number;
3559
+ transition: {
3560
+ duration: number;
3561
+ };
3562
+ };
3563
+ exit: {
3564
+ opacity: number;
3565
+ x: number;
3566
+ transition: {
3567
+ duration: number;
3568
+ };
3569
+ };
3570
+ };
3571
+ /**
3572
+ * Error/alert message slide-in
3573
+ */
3574
+ declare const errorMessageVariants: {
3575
+ initial: {
3576
+ opacity: number;
3577
+ y: number;
3578
+ height: number;
3579
+ };
3580
+ animate: {
3581
+ opacity: number;
3582
+ y: number;
3583
+ height: string;
3584
+ transition: {
3585
+ duration: number;
3586
+ ease: number[];
3587
+ };
3588
+ };
3589
+ exit: {
3590
+ opacity: number;
3591
+ y: number;
3592
+ height: number;
3593
+ transition: {
3594
+ duration: number;
3595
+ };
3596
+ };
3597
+ };
3598
+
3599
+ interface ChatSessionProviderProps {
3600
+ dataSource: ChatDataSource;
3601
+ sessionId?: string;
3602
+ /**
3603
+ * External rate limiter instance. Captured once at mount — changing this prop
3604
+ * after initial render has no effect. For most cases, use `rateLimitConfig`
3605
+ * instead and let the provider create the limiter internally.
3606
+ */
3607
+ rateLimiter?: RateLimiter;
3608
+ /**
3609
+ * Configuration for the built-in rate limiter (ignored when `rateLimiter` is
3610
+ * provided). Captured once at mount — changing after initial render has no effect.
3611
+ */
3612
+ rateLimitConfig?: RateLimiterConfig;
3613
+ /**
3614
+ * Called when the machine creates a new session (e.g. on first message in a
3615
+ * "new chat"). Use this to navigate your SPA router to the new session URL.
3616
+ */
3617
+ onSessionCreated?: (sessionId: string) => void;
3618
+ children: ReactNode;
3619
+ }
3620
+ declare function ChatSessionProvider({ dataSource, sessionId, rateLimiter: externalRateLimiter, rateLimitConfig, onSessionCreated, children, }: ChatSessionProviderProps): react_jsx_runtime.JSX.Element;
3621
+ declare function useChatSession(): ChatSessionStateValue;
3622
+ declare function useChatMessaging(): ChatMessagingStateValue;
3623
+ /** Returns messaging context or null when outside ChatSessionProvider. */
3624
+ declare function useOptionalChatMessaging(): ChatMessagingStateValue | null;
3625
+ declare function useChatInput(): ChatInputStateValue;
3626
+
3627
+ /**
3628
+ * BiChat context types layered on top of canonical applet-core context contracts.
3629
+ */
3630
+
3631
+ type UserContext = UserContext$1;
3632
+ type TenantContext = TenantContext$1;
3633
+ type LocaleContext = LocaleContext$1;
3634
+ type AppConfig = AppConfig$1 & {
3635
+ streamEndpoint: string;
3636
+ basePath: string;
3637
+ assetsBasePath: string;
3638
+ rpcUIEndpoint: string;
3639
+ };
3640
+ interface Extensions {
3641
+ branding?: {
3642
+ appName?: string;
3643
+ logoUrl?: string;
3644
+ theme?: {
3645
+ primary?: string;
3646
+ secondary?: string;
3647
+ accent?: string;
3648
+ };
3649
+ welcome?: {
3650
+ title?: string;
3651
+ description?: string;
3652
+ examplePrompts?: Array<{
3653
+ category: string;
3654
+ text: string;
3655
+ icon: string;
3656
+ }>;
3657
+ };
3658
+ colors?: {
3659
+ primary?: string;
3660
+ secondary?: string;
3661
+ accent?: string;
3662
+ };
3663
+ logo?: {
3664
+ src?: string;
3665
+ alt?: string;
3666
+ };
3667
+ };
3668
+ features?: {
3669
+ vision?: boolean;
3670
+ webSearch?: boolean;
3671
+ codeInterpreter?: boolean;
3672
+ multiAgent?: boolean;
3673
+ };
3674
+ llm?: {
3675
+ provider?: string;
3676
+ apiKeyConfigured?: boolean;
3677
+ };
3678
+ debug?: {
3679
+ limits?: {
3680
+ policyMaxTokens: number;
3681
+ modelMaxTokens: number;
3682
+ effectiveMaxTokens: number;
3683
+ completionReserveTokens: number;
3684
+ };
3685
+ };
3686
+ }
3687
+ type IotaContext = Omit<InitialContext, 'config' | 'extensions'> & {
3688
+ config: AppConfig;
3689
+ extensions?: Extensions;
3690
+ };
3691
+ declare global {
3692
+ interface Window {
3693
+ __APPLET_CONTEXT__: IotaContext;
3694
+ __CSRF_TOKEN__: string;
3695
+ }
3696
+ }
3697
+
3698
+ interface IotaContextProviderProps {
3699
+ /**
3700
+ * Explicit context object. When provided, the window global is not read.
3701
+ * Useful for tests, Storybook, or apps that manage their own context.
3702
+ */
3703
+ context?: IotaContext;
3704
+ children: ReactNode;
3444
3705
  }
3445
- interface SessionListParams {
3446
- limit: number;
3447
- offset: number;
3448
- includeArchived: boolean;
3706
+ declare function IotaContextProvider({ context, children }: IotaContextProviderProps): react_jsx_runtime.JSX.Element;
3707
+ declare function useIotaContext(): IotaContext;
3708
+ /**
3709
+ * Check if user has a specific permission
3710
+ */
3711
+ declare function hasPermission(permission: string): boolean;
3712
+
3713
+ /** @deprecated Use `IotaContextProvider` with its `context` prop instead. */
3714
+ interface BiChatConfig {
3715
+ user: {
3716
+ id: string;
3717
+ email: string;
3718
+ firstName: string;
3719
+ lastName: string;
3720
+ permissions: string[];
3721
+ };
3722
+ tenant: {
3723
+ id: string;
3724
+ name: string;
3725
+ };
3726
+ locale: {
3727
+ language: string;
3728
+ translations: Record<string, string>;
3729
+ };
3730
+ endpoints: {
3731
+ rpc: string;
3732
+ stream: string;
3733
+ };
3734
+ csrfToken?: string;
3449
3735
  }
3450
- interface SessionListResult {
3451
- sessions: Session[];
3452
- total?: number;
3453
- hasMore: boolean;
3736
+ interface ConfigProviderProps {
3737
+ config?: BiChatConfig;
3738
+ useGlobalConfig?: boolean;
3739
+ children: ReactNode;
3454
3740
  }
3455
- interface SessionUpdateTitleParams {
3456
- id: string;
3457
- title: string;
3741
+ /**
3742
+ * @deprecated Use `IotaContextProvider` with its `context` prop instead.
3743
+ *
3744
+ * ConfigProvider component — provides configuration to the BiChat library.
3745
+ *
3746
+ * @param config - Configuration object (preferred method)
3747
+ * @param useGlobalConfig - If true, falls back to window.__APPLET_CONTEXT__ when config is not provided
3748
+ * @param children - React children
3749
+ */
3750
+ declare function ConfigProvider({ config, useGlobalConfig, children }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
3751
+ /**
3752
+ * Hook to access BiChat configuration
3753
+ * Returns null if no configuration is available
3754
+ */
3755
+ declare function useConfig(): BiChatConfig | null;
3756
+ /**
3757
+ * Hook to access BiChat configuration (required)
3758
+ * Throws an error if configuration is not available
3759
+ */
3760
+ declare function useRequiredConfig(): BiChatConfig;
3761
+
3762
+ /**
3763
+ * Theme system type definitions
3764
+ */
3765
+ interface Theme {
3766
+ name: string;
3767
+ colors: ThemeColors;
3768
+ spacing: ThemeSpacing;
3769
+ borderRadius: ThemeBorderRadius;
3458
3770
  }
3459
- interface SessionUploadArtifactsParams {
3460
- sessionId: string;
3461
- attachments: Attachment[];
3771
+ interface ThemeColors {
3772
+ background: string;
3773
+ surface: string;
3774
+ primary: string;
3775
+ secondary: string;
3776
+ text: string;
3777
+ textMuted: string;
3778
+ border: string;
3779
+ error: string;
3780
+ success: string;
3781
+ warning: string;
3782
+ userBubble: string;
3783
+ assistantBubble: string;
3784
+ userText: string;
3785
+ assistantText: string;
3462
3786
  }
3463
- interface SessionUploadArtifactsResult {
3464
- artifacts: Artifact[];
3787
+ interface ThemeSpacing {
3788
+ xs: string;
3789
+ sm: string;
3790
+ md: string;
3791
+ lg: string;
3792
+ xl: string;
3465
3793
  }
3466
- interface ToolCall {
3467
- id: string;
3468
- name: string;
3469
- arguments: string;
3470
- result?: string;
3471
- error?: string;
3472
- durationMs?: number;
3794
+ interface ThemeBorderRadius {
3795
+ sm: string;
3796
+ md: string;
3797
+ lg: string;
3798
+ full: string;
3473
3799
  }
3474
- interface UserTurn {
3475
- id: string;
3476
- content: string;
3477
- attachments: Attachment[];
3478
- createdAt: string;
3800
+
3801
+ interface ThemeProviderProps {
3802
+ theme?: Theme | 'light' | 'dark' | 'system';
3803
+ children: ReactNode;
3479
3804
  }
3805
+ /**
3806
+ * Theme provider component
3807
+ * Wraps the application and provides theme context
3808
+ */
3809
+ declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
3810
+ /**
3811
+ * Hook to access current theme
3812
+ */
3813
+ declare function useTheme(): Theme;
3480
3814
 
3481
3815
  /**
3482
- * Session lifecycle management: create, list, get, delete, archive, pin, rename.
3483
- *
3484
- * @internal — Not part of the public API. Consumed by HttpDataSource.
3816
+ * Predefined theme configurations
3485
3817
  */
3486
3818
 
3487
- interface SessionState {
3488
- session: Session$1;
3489
- turns: ConversationTurn$1[];
3490
- pendingQuestion?: PendingQuestion$1 | null;
3491
- }
3819
+ declare const lightTheme: Theme;
3820
+ declare const darkTheme: Theme;
3492
3821
 
3493
3822
  /**
3494
- * Built-in HTTP data source with SSE streaming and AbortController
3495
- * Implements ChatDataSource interface with real HTTP/RPC calls
3496
- *
3497
- * Uses turn-based architecture - fetches ConversationTurns instead of flat messages.
3498
- *
3499
- * This file is a thin facade that delegates to focused internal modules:
3500
- * - SessionManager.ts — session CRUD (create, list, get, delete, archive, pin)
3501
- * - MessageTransport.ts — send messages, stream responses, HITL questions
3502
- * - ArtifactManager.ts — artifact fetch, upload, rename, delete
3503
- * - AttachmentUploader.ts — file decode, normalize, upload
3504
- * - mappers.ts — RPC-to-domain type mapping and sanitization
3823
+ * CSRF token management for API requests
3505
3824
  */
3506
-
3507
- interface HttpDataSourceConfig {
3508
- baseUrl: string;
3509
- rpcEndpoint: string;
3510
- streamEndpoint?: string;
3511
- uploadEndpoint?: string;
3512
- csrfToken?: string | (() => string);
3513
- headers?: Record<string, string>;
3514
- timeout?: number;
3515
- /**
3516
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` or
3517
- * `ChatSession` instead. Coupling navigation to the data source causes
3518
- * component remounts during active streams.
3519
- */
3520
- navigateToSession?: (sessionId: string) => void;
3521
- }
3522
- declare class HttpDataSource implements ChatDataSource {
3523
- private config;
3524
- private abortController;
3525
- private rpc;
3526
- constructor(config: HttpDataSourceConfig);
3527
- private getCSRFToken;
3528
- private createHeaders;
3529
- private createUploadHeaders;
3530
- private callRPC;
3531
- private boundCallRPC;
3532
- private boundUploadFile;
3533
- createSession(): Promise<Session$1>;
3534
- fetchSession(id: string): Promise<SessionState | null>;
3535
- listSessions(options?: {
3536
- limit?: number;
3537
- offset?: number;
3538
- includeArchived?: boolean;
3539
- }): Promise<SessionListResult$1>;
3540
- archiveSession(sessionId: string): Promise<Session$1>;
3541
- unarchiveSession(sessionId: string): Promise<Session$1>;
3542
- pinSession(sessionId: string): Promise<Session$1>;
3543
- unpinSession(sessionId: string): Promise<Session$1>;
3544
- deleteSession(sessionId: string): Promise<void>;
3545
- renameSession(sessionId: string, title: string): Promise<Session$1>;
3546
- regenerateSessionTitle(sessionId: string): Promise<Session$1>;
3547
- clearSessionHistory(sessionId: string): Promise<{
3548
- success: boolean;
3549
- deletedMessages: number;
3550
- deletedArtifacts: number;
3551
- }>;
3552
- compactSessionHistory(sessionId: string): Promise<{
3553
- success: boolean;
3554
- summary: string;
3555
- deletedMessages: number;
3556
- deletedArtifacts: number;
3557
- }>;
3558
- stopGeneration(sessionId: string): Promise<void>;
3559
- getStreamStatus(sessionId: string): Promise<StreamStatus | null>;
3560
- resumeStream(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
3561
- sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
3562
- cancelStream(): void;
3563
- submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
3564
- success: boolean;
3565
- error?: string;
3566
- data?: {
3567
- session: Session$1;
3568
- turns: ConversationTurn$1[];
3569
- pendingQuestion?: PendingQuestion$1 | null;
3570
- };
3571
- }>;
3572
- rejectPendingQuestion(sessionId: string): Promise<{
3573
- success: boolean;
3574
- error?: string;
3575
- }>;
3576
- fetchSessionArtifacts(sessionId: string, options?: {
3577
- limit?: number;
3578
- offset?: number;
3579
- }): Promise<{
3580
- artifacts: SessionArtifact[];
3581
- hasMore?: boolean;
3582
- nextOffset?: number;
3583
- }>;
3584
- uploadSessionArtifacts(sessionId: string, files: File[]): Promise<{
3585
- artifacts: SessionArtifact[];
3586
- }>;
3587
- renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
3588
- deleteSessionArtifact(artifactId: string): Promise<void>;
3589
- /**
3590
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` instead.
3591
- */
3592
- navigateToSession?(sessionId: string): void;
3593
- }
3594
3825
  /**
3595
- * Factory function to create HttpDataSource
3826
+ * Get CSRF token from window object
3827
+ * @returns CSRF token string
3596
3828
  */
3597
- declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSource;
3829
+ declare function getCSRFToken(): string;
3830
+ /**
3831
+ * Add CSRF token to request headers
3832
+ * @param headers - Headers object to modify
3833
+ * @returns Modified headers object
3834
+ */
3835
+ declare function addCSRFHeader(headers: Headers): Headers;
3836
+ /**
3837
+ * Create headers with CSRF token
3838
+ * @param init - Optional initial headers
3839
+ * @returns Headers object with CSRF token
3840
+ */
3841
+ declare function createHeadersWithCSRF(init?: HeadersInit): Headers;
3598
3842
 
3599
3843
  /**
3600
3844
  * Internal types for the ChatMachine.
@@ -3782,6 +4026,7 @@ declare class ChatMachine {
3782
4026
  private _stopPassivePolling;
3783
4027
  private _startPassivePolling;
3784
4028
  private _runResumeStream;
4029
+ private _resumeAcceptedRunOrPoll;
3785
4030
  private _setError;
3786
4031
  private _retryFetchSession;
3787
4032
  private _clearStreamError;
@@ -3972,4 +4217,4 @@ declare function isPermissionDeniedError(error: unknown): boolean;
3972
4217
  */
3973
4218
  declare function toErrorDisplay(error: unknown, fallbackTitle: string): RPCErrorDisplay;
3974
4219
 
3975
- export { ATTACHMENT_ACCEPT_ATTRIBUTE, ActionButton, type ActionButtonIconProps, type ActionButtonLabelProps, type ActionButtonRootProps, type ActionButtonTooltipProps, type ActivityStep, ActivityTrace, type ActivityTraceProps, type AdminStore, _default$1 as Alert, AllChatsList, type AppConfig, _default as ArchiveBanner, ArchivedChatList, type Artifact$1 as Artifact, type ArtifactStore, type AsChildProps, AssistantMessage, type AssistantMessageActionsSlotProps, type AssistantMessageArtifactsSlotProps, type AssistantMessageAvatarSlotProps, type AssistantMessageChartsSlotProps, type AssistantMessageClassNames, type AssistantMessageCodeOutputsSlotProps, type AssistantMessageContentSlotProps, type AssistantMessageExplanationSlotProps, type AssistantMessageProps, type AssistantMessageSlots, type AssistantMessageSourcesSlotProps, type AssistantMessageTablesSlotProps, type AssistantTurn$1 as AssistantTurn, AssistantTurnView, type AssistantTurnViewProps, type Attachment$1 as Attachment, MemoizedAttachmentGrid as AttachmentGrid, AttachmentPreview, AttachmentUpload, Avatar, type AvatarFallbackProps, type AvatarImageProps, type AvatarRootProps, type BiChatConfig, BiChatLayout, type BiChatLayoutProps, type BichatRPC, Bubble, type BubbleContentProps, type BubbleFooterProps, type BubbleHeaderProps, type BubbleMetadataProps, type BubbleRootProps, type BubbleVariant, CHART_VISUAL, ChartCard, type ChartCardHost, type ChartData, type ChartSeries, type ChatDataSource, ChatHeader, type ChatInputStateValue, ChatMachine, type ChatMachineConfig, type ChatMessagingStateValue, ChatSession, type ChatSessionContextValue, ChatSessionProvider, type ChatSessionProviderProps, type ChatSessionStateValue, type Citation$1 as Citation, MemoizedCodeBlock as CodeBlock, type CodeOutput$1 as CodeOutput, CodeOutputsPanel, type ColumnMeta, type ColumnStats, type ColumnType, CompactionDoodle, ConfigProvider, ConfirmModal, type ConfirmModalProps, ConfirmationStep, type ConversationTurn$1 as ConversationTurn, type DataTableOptions, DateGroupHeader, DebugPanel, type DebugPanelProps, DefaultErrorContent, DownloadCard, MemoizedEditableText as EditableText, type EditableTextProps, type EditableTextRef, MemoizedEmptyState as EmptyState, type EmptyStateProps, ErrorBoundary, type FileValidationError, type FileVisual, type FormattedCell, HttpDataSource, type HttpDataSourceConfig, type ImageAttachment, type ImageLoadingStatus, ImageModal, InlineQuestionForm, InteractiveTableCard, type IotaContext, IotaContextProvider, ListItemSkeleton, MemoizedLoadingSpinner as LoadingSpinner, type LocaleContext, MemoizedMarkdownRenderer as MarkdownRenderer, MessageActions, MessageInput, type MessageInputProps, type MessageInputRef, MessageList, MessageRole, type MessageTransport, type PendingQuestion$1 as PendingQuestion, PermissionGuard, type PermissionGuardProps, type Question, type QuestionAnswerData, type QuestionAnswers, QuestionForm, type QuestionOption, QuestionStep, type QueuedMessage, type RPCErrorDisplay, RateLimiter, type RateLimiterConfig, type RenderTableData, type RenderTableExport, RetryActionArea, ScreenReaderAnnouncer, ScrollToBottomButton, MemoizedSearchInput as SearchInput, type SearchInputProps, type Session$1 as Session, type SessionArtifact, SessionArtifactList, SessionArtifactPreview, SessionArtifactsPanel, type SessionGroup, SessionItem, type SessionListResult$1 as SessionListResult, SessionSkeleton, type SessionStore, type SessionUser, type ShortcutConfig, Sidebar, type SidebarDrawerProps, type SidebarProps, MemoizedSkeleton as Skeleton, SkeletonAvatar, SkeletonCard, SkeletonGroup, type SkeletonGroupProps, type SkeletonProps, SkeletonText, SkipLink, Slot, type SlotProps, type SortState, SourcesPanel, type StreamChunk, StreamError, type StreamEvent, StreamingCursor, SystemMessage, TabbedChartGroup, type TabbedChartGroupProps, TabbedTableGroup, type TabbedTableGroupProps, type TableCardHost, TableExportButton, TableWithExport, type TenantContext, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeSpacing, Toast, type ToastAction, ToastContainer, type ToastItem, type ToastProps, type ToastType, type ToolCall$1 as ToolCall, TouchContextMenu, Turn, type TurnActionsProps, type TurnAssistantProps, TurnBubble, type TurnBubbleClassNames, type TurnBubbleProps, type TurnRootProps, type TurnTimestampProps, type TurnUserProps, MemoizedTypingIndicator as TypingIndicator, type TypingIndicatorProps, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseAutoScrollOptions, type UseAutoScrollReturn, type UseDataTableReturn, type UseImageGalleryOptions, type UseImageGalleryReturn, type UseMarkdownCopyOptions, type UseMarkdownCopyReturn, type UseMessageActionsOptions, type UseMessageActionsReturn, type UseSidebarStateReturn, type UseToastReturn, MemoizedUserAvatar as UserAvatar, type UserAvatarProps, type UserContext, MemoizedUserFilter as UserFilter, UserMessage, type UserMessageActionsSlotProps, type UserMessageAttachmentsSlotProps, type UserMessageAvatarSlotProps, type UserMessageClassNames, type UserMessageContentSlotProps, type UserMessageProps, type UserMessageSlots, type UserTurn$1 as UserTurn, UserTurnView, type UserTurnViewProps, WelcomeContent, addCSRFHeader, backdropVariants, buttonVariants, convertToBase64, createDataUrl, createHeadersWithCSRF, createHttpDataSource, darkTheme, dropdownVariants, errorMessageVariants, fadeInUpVariants, fadeInVariants, floatingButtonVariants, formatFileSize, getCSRFToken, getFileVisual, getToolLabel, getValidChildren, groupSessionsByDate, groupSteps, hasPermission, isImageMimeType, isPermissionDeniedError, lightTheme, listItemVariants, messageContainerVariants, messageVariants, parseBichatStream, parseBichatStreamEvents, parseSSEStream, scaleFadeVariants, sessionItemVariants, staggerContainerVariants, toErrorDisplay, typingDotVariants, useActionButtonContext, useAttachments, useAutoScroll, useAvatarContext, useBubbleContext, useChatInput, useChatMessaging, useChatSession, useConfig, useDataTable, useFocusTrap, useImageGallery, useIotaContext, useKeyboardShortcuts, useLongPress, useMarkdownCopy, useMessageActions, useModalLock, useOptionalChatMessaging, useRequiredConfig, useScrollToBottom, useSidebarState, useStreaming, useTheme, useToast, useTranslation, useTurnContext, validateAttachmentFile, validateFileCount, validateImageFile, verbTransitionVariants };
4220
+ export { ATTACHMENT_ACCEPT_ATTRIBUTE, ActionButton, type ActionButtonIconProps, type ActionButtonLabelProps, type ActionButtonRootProps, type ActionButtonTooltipProps, type ActivityStep, ActivityTrace, type ActivityTraceProps, type AdminStore, _default$1 as Alert, AllChatsList, type AppConfig, _default as ArchiveBanner, ArchivedChatList, type Artifact$1 as Artifact, type ArtifactStore, type AsChildProps, AssistantMessage, type AssistantMessageActionsSlotProps, type AssistantMessageArtifactsSlotProps, type AssistantMessageAvatarSlotProps, type AssistantMessageChartsSlotProps, type AssistantMessageClassNames, type AssistantMessageCodeOutputsSlotProps, type AssistantMessageContentSlotProps, type AssistantMessageExplanationSlotProps, type AssistantMessageProps, type AssistantMessageSlots, type AssistantMessageSourcesSlotProps, type AssistantMessageTablesSlotProps, type AssistantTurn$1 as AssistantTurn, AssistantTurnView, type AssistantTurnViewProps, type Attachment$1 as Attachment, MemoizedAttachmentGrid as AttachmentGrid, AttachmentPreview, AttachmentUpload, Avatar, type AvatarFallbackProps, type AvatarImageProps, type AvatarRootProps, AvatarStack, type AvatarStackProps, type BiChatConfig, BiChatLayout, type BiChatLayoutProps, type BichatRPC, Bubble, type BubbleContentProps, type BubbleFooterProps, type BubbleHeaderProps, type BubbleMetadataProps, type BubbleRootProps, type BubbleVariant, CHART_VISUAL, ChartCard, type ChartCardHost, type ChartData, type ChartSeries, type ChatDataSource, ChatHeader, type ChatInputStateValue, ChatMachine, type ChatMachineConfig, type ChatMessagingStateValue, ChatSession, type ChatSessionContextValue, ChatSessionProvider, type ChatSessionProviderProps, type ChatSessionStateValue, type Citation$1 as Citation, MemoizedCodeBlock as CodeBlock, type CodeOutput$1 as CodeOutput, CodeOutputsPanel, type ColumnMeta, type ColumnStats, type ColumnType, CompactionDoodle, ConfigProvider, ConfirmModal, type ConfirmModalProps, ConfirmationStep, type ConversationTurn$1 as ConversationTurn, type DataTableOptions, DateGroupHeader, DebugPanel, type DebugPanelProps, DefaultErrorContent, DownloadCard, MemoizedEditableText as EditableText, type EditableTextProps, type EditableTextRef, MemoizedEmptyState as EmptyState, type EmptyStateProps, ErrorBoundary, type FileValidationError, type FileVisual, type FormattedCell, HttpDataSource, type HttpDataSourceConfig, type ImageAttachment, type ImageLoadingStatus, ImageModal, InlineQuestionForm, InteractiveTableCard, type IotaContext, IotaContextProvider, ListItemSkeleton, MemoizedLoadingSpinner as LoadingSpinner, type LocaleContext, MemoizedMarkdownRenderer as MarkdownRenderer, MessageActions, MessageInput, type MessageInputProps, type MessageInputRef, MessageList, MessageRole, type MessageTransport, type PendingQuestion$1 as PendingQuestion, PermissionGuard, type PermissionGuardProps, type Question, type QuestionAnswerData, type QuestionAnswers, QuestionForm, type QuestionOption, QuestionStep, type QueuedMessage, type RPCErrorDisplay, RateLimiter, type RateLimiterConfig, type RenderTableData, type RenderTableExport, RetryActionArea, ScreenReaderAnnouncer, ScrollToBottomButton, MemoizedSearchInput as SearchInput, type SearchInputProps, type Session$1 as Session, type SessionAccess$1 as SessionAccess, type SessionArtifact, SessionArtifactList, SessionArtifactPreview, SessionArtifactsPanel, type SessionGroup, SessionItem, type SessionListResult$1 as SessionListResult, type SessionMember$1 as SessionMember, SessionMembersModal, type SessionMembersModalProps, SessionSkeleton, type SessionStore, type SessionUser$1 as SessionUser, type ShortcutConfig, Sidebar, type SidebarDrawerProps, type SidebarProps, MemoizedSkeleton as Skeleton, SkeletonAvatar, SkeletonCard, SkeletonGroup, type SkeletonGroupProps, type SkeletonProps, SkeletonText, SkipLink, Slot, type SlotProps, type SortState, SourcesPanel, type StreamChunk, StreamError, type StreamEvent, StreamingCursor, SystemMessage, TabbedChartGroup, type TabbedChartGroupProps, TabbedTableGroup, type TabbedTableGroupProps, type TableCardHost, TableExportButton, TableWithExport, type TenantContext, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeSpacing, Toast, type ToastAction, ToastContainer, type ToastItem, type ToastProps, type ToastType, type ToolCall$1 as ToolCall, TouchContextMenu, Turn, type TurnActionsProps, type TurnAssistantProps, TurnBubble, type TurnBubbleClassNames, type TurnBubbleProps, type TurnRootProps, type TurnTimestampProps, type TurnUserProps, MemoizedTypingIndicator as TypingIndicator, type TypingIndicatorProps, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseAutoScrollOptions, type UseAutoScrollReturn, type UseBichatRouterParams, type UseBichatRouterReturn, type UseDataTableReturn, type UseImageGalleryOptions, type UseImageGalleryReturn, type UseMarkdownCopyOptions, type UseMarkdownCopyReturn, type UseMessageActionsOptions, type UseMessageActionsReturn, type UseSidebarStateReturn, type UseToastReturn, MemoizedUserAvatar as UserAvatar, type UserAvatarProps, type UserContext, MemoizedUserFilter as UserFilter, UserMessage, type UserMessageActionsSlotProps, type UserMessageAttachmentsSlotProps, type UserMessageAvatarSlotProps, type UserMessageClassNames, type UserMessageContentSlotProps, type UserMessageProps, type UserMessageSlots, type UserTurn$1 as UserTurn, UserTurnView, type UserTurnViewProps, WelcomeContent, addCSRFHeader, backdropVariants, buttonVariants, convertToBase64, createDataUrl, createHeadersWithCSRF, createHttpDataSource, darkTheme, dropdownVariants, errorMessageVariants, fadeInUpVariants, fadeInVariants, floatingButtonVariants, formatFileSize, getCSRFToken, getFileVisual, getToolLabel, getValidChildren, groupSessionsByDate, groupSteps, hasPermission, isImageMimeType, isPermissionDeniedError, lightTheme, listItemVariants, messageContainerVariants, messageVariants, parseBichatStream, parseBichatStreamEvents, parseSSEStream, scaleFadeVariants, sessionItemVariants, staggerContainerVariants, toErrorDisplay, typingDotVariants, useActionButtonContext, useAttachments, useAutoScroll, useAvatarContext, useBichatRouter, useBubbleContext, useChatInput, useChatMessaging, useChatSession, useConfig, useDataTable, useFocusTrap, useHttpDataSourceConfigFromApplet, useImageGallery, useIotaContext, useKeyboardShortcuts, useLongPress, useMarkdownCopy, useMessageActions, useModalLock, useOptionalChatMessaging, useRequiredConfig, useScrollToBottom, useSidebarState, useStreaming, useTheme, useToast, useTranslation, useTurnContext, validateAttachmentFile, validateFileCount, validateImageFile, verbTransitionVariants };