@iota-uz/sdk 0.4.22 → 0.4.24

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.
@@ -72,19 +72,21 @@ interface ArtifactStore {
72
72
  deleteSessionArtifact(artifactId: string): Promise<void>;
73
73
  }
74
74
  interface AdminStore {
75
- listUsers(): Promise<SessionUser[]>;
75
+ listUsers(): Promise<SessionUser$1[]>;
76
76
  listAllSessions(options?: {
77
77
  limit?: number;
78
78
  offset?: number;
79
79
  includeArchived?: boolean;
80
80
  userId?: string | null;
81
81
  }): Promise<{
82
- sessions: Array<Session$1 & {
83
- owner: SessionUser;
84
- }>;
82
+ sessions: Session$1[];
85
83
  total: number;
86
84
  hasMore: boolean;
87
85
  }>;
86
+ listSessionMembers(sessionId: string): Promise<SessionMember$1[]>;
87
+ addSessionMember(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
88
+ updateSessionMemberRole(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
89
+ removeSessionMember(sessionId: string, userId: string): Promise<void>;
88
90
  }
89
91
 
90
92
  /**
@@ -97,6 +99,17 @@ interface Session$1 {
97
99
  pinned: boolean;
98
100
  createdAt: string;
99
101
  updatedAt: string;
102
+ owner?: SessionUser$1;
103
+ isGroup?: boolean;
104
+ memberCount?: number;
105
+ access?: SessionAccess$1;
106
+ }
107
+ interface SessionAccess$1 {
108
+ role: 'owner' | 'editor' | 'viewer' | 'read_all' | 'none';
109
+ source: 'owner' | 'member' | 'permission' | 'none';
110
+ canRead: boolean;
111
+ canWrite: boolean;
112
+ canManageMembers: boolean;
100
113
  }
101
114
  /**
102
115
  * A conversation turn groups a user message with its assistant response.
@@ -116,6 +129,7 @@ interface UserTurn$1 {
116
129
  id: string;
117
130
  content: string;
118
131
  attachments: Attachment$1[];
132
+ author?: SessionUser$1;
119
133
  createdAt: string;
120
134
  }
121
135
  /**
@@ -308,7 +322,7 @@ interface QuestionOption {
308
322
  * Answer data for a single question, including predefined options and custom "Other" text.
309
323
  */
310
324
  interface QuestionAnswerData {
311
- /** Selected predefined options (labels) */
325
+ /** Selected predefined options (option IDs) */
312
326
  options: string[];
313
327
  /** Custom text entered when user selects "Other" option */
314
328
  customText?: string;
@@ -434,16 +448,16 @@ interface DebugTrace$1 {
434
448
  generationMs?: number;
435
449
  usage?: DebugUsage$1;
436
450
  tools: StreamToolPayload[];
437
- attempts?: DebugGeneration[];
438
- spans?: DebugSpan[];
439
- events?: DebugEvent[];
451
+ attempts?: DebugGeneration$1[];
452
+ spans?: DebugSpan$1[];
453
+ events?: DebugEvent$1[];
440
454
  traceId?: string;
441
455
  traceUrl?: string;
442
456
  sessionId?: string;
443
457
  thinking?: string;
444
458
  observationReason?: string;
445
459
  }
446
- interface DebugGeneration {
460
+ interface DebugGeneration$1 {
447
461
  id?: string;
448
462
  requestId?: string;
449
463
  model?: string;
@@ -463,7 +477,7 @@ interface DebugGeneration {
463
477
  completedAt?: string;
464
478
  toolCalls?: StreamToolPayload[];
465
479
  }
466
- interface DebugSpan {
480
+ interface DebugSpan$1 {
467
481
  id?: string;
468
482
  parentId?: string;
469
483
  generationId?: string;
@@ -481,7 +495,7 @@ interface DebugSpan {
481
495
  completedAt?: string;
482
496
  attributes?: Record<string, unknown>;
483
497
  }
484
- interface DebugEvent {
498
+ interface DebugEvent$1 {
485
499
  id?: string;
486
500
  name?: string;
487
501
  type?: string;
@@ -517,12 +531,18 @@ interface SessionListResult$1 {
517
531
  total: number;
518
532
  hasMore: boolean;
519
533
  }
520
- interface SessionUser {
534
+ interface SessionUser$1 {
521
535
  id: string;
522
536
  firstName: string;
523
537
  lastName: string;
524
538
  initials: string;
525
539
  }
540
+ interface SessionMember$1 {
541
+ user: SessionUser$1;
542
+ role: 'owner' | 'editor' | 'viewer';
543
+ createdAt: string;
544
+ updatedAt: string;
545
+ }
526
546
  interface SessionGroup {
527
547
  name: string;
528
548
  sessions: Session$1[];
@@ -573,6 +593,11 @@ interface ChatDataSource {
573
593
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
574
594
  success: boolean;
575
595
  error?: string;
596
+ data?: {
597
+ session: Session$1;
598
+ turns: ConversationTurn$1[];
599
+ pendingQuestion?: PendingQuestion$1 | null;
600
+ };
576
601
  }>;
577
602
  rejectPendingQuestion(sessionId: string): Promise<{
578
603
  success: boolean;
@@ -612,19 +637,21 @@ interface ChatDataSource {
612
637
  deleteSession(sessionId: string): Promise<void>;
613
638
  renameSession(sessionId: string, title: string): Promise<Session$1>;
614
639
  regenerateSessionTitle(sessionId: string): Promise<Session$1>;
615
- listUsers?(): Promise<SessionUser[]>;
640
+ listUsers?(): Promise<SessionUser$1[]>;
616
641
  listAllSessions?(options?: {
617
642
  limit?: number;
618
643
  offset?: number;
619
644
  includeArchived?: boolean;
620
645
  userId?: string | null;
621
646
  }): Promise<{
622
- sessions: Array<Session$1 & {
623
- owner: SessionUser;
624
- }>;
647
+ sessions: Session$1[];
625
648
  total: number;
626
649
  hasMore: boolean;
627
650
  }>;
651
+ listSessionMembers?(sessionId: string): Promise<SessionMember$1[]>;
652
+ addSessionMember?(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
653
+ updateSessionMemberRole?(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
654
+ removeSessionMember?(sessionId: string, userId: string): Promise<void>;
628
655
  }
629
656
  interface ChatSessionStateValue {
630
657
  session: Session$1 | null;
@@ -797,8 +824,16 @@ interface ChatHeaderProps {
797
824
  logoSlot?: ReactNode;
798
825
  /** Custom action buttons */
799
826
  actionsSlot?: ReactNode;
827
+ /** Members to display in avatar stack for group chats */
828
+ members?: Array<{
829
+ firstName: string;
830
+ lastName: string;
831
+ initials?: string;
832
+ }>;
833
+ /** Callback when avatar stack is clicked (to open members modal) */
834
+ onMembersClick?: () => void;
800
835
  }
801
- declare function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
836
+ declare function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot, members, onMembersClick }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
802
837
 
803
838
  interface MessageListProps {
804
839
  renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
@@ -871,6 +906,8 @@ interface UserMessageProps {
871
906
  turnId?: string;
872
907
  /** User initials for avatar */
873
908
  initials?: string;
909
+ /** Optional sender name for shared/group chats */
910
+ authorName?: string;
874
911
  /** Slot overrides */
875
912
  slots?: UserMessageSlots;
876
913
  /** Class name overrides */
@@ -888,7 +925,7 @@ interface UserMessageProps {
888
925
  /** Whether edit action should be available */
889
926
  allowEdit?: boolean;
890
927
  }
891
- declare function UserMessage({ turn, turnId, initials, slots, classNames: classNameOverrides, onCopy, onEdit, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserMessageProps): react_jsx_runtime.JSX.Element;
928
+ declare function UserMessage({ turn, turnId, initials, authorName, slots, classNames: classNameOverrides, onCopy, onEdit, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserMessageProps): react_jsx_runtime.JSX.Element;
892
929
 
893
930
  interface UserTurnViewProps {
894
931
  /** The conversation turn containing the user message */
@@ -907,8 +944,10 @@ interface UserTurnViewProps {
907
944
  hideTimestamp?: boolean;
908
945
  /** Whether edit action should be available */
909
946
  allowEdit?: boolean;
947
+ /** Show sender identity label above the message bubble */
948
+ showAuthorName?: boolean;
910
949
  }
911
- declare function UserTurnView({ turn, slots, classNames, initials, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
950
+ declare function UserTurnView({ turn, slots, classNames, initials, hideAvatar, hideActions, hideTimestamp, allowEdit, showAuthorName, }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
912
951
 
913
952
  interface AssistantMessageAvatarSlotProps {
914
953
  /** Default text */
@@ -1650,13 +1689,45 @@ interface UserAvatarProps {
1650
1689
  /** Override initials (defaults to first letters of first and last name) */
1651
1690
  initials?: string;
1652
1691
  /** Avatar size */
1653
- size?: 'sm' | 'md' | 'lg';
1692
+ size?: 'xs' | 'sm' | 'md' | 'lg';
1654
1693
  /** Additional CSS classes */
1655
1694
  className?: string;
1656
1695
  }
1657
1696
  declare function UserAvatar({ firstName, lastName, initials: providedInitials, size, className, }: UserAvatarProps): react_jsx_runtime.JSX.Element;
1658
1697
  declare const MemoizedUserAvatar: react.MemoExoticComponent<typeof UserAvatar>;
1659
1698
 
1699
+ /**
1700
+ * AvatarStack Component
1701
+ * Displays overlapping user avatars with an overflow "+N" indicator.
1702
+ * Used in ChatHeader and SessionItem for group chat visualization.
1703
+ */
1704
+ interface AvatarStackProps {
1705
+ /** List of users to display */
1706
+ users: Array<{
1707
+ firstName: string;
1708
+ lastName: string;
1709
+ initials?: string;
1710
+ }>;
1711
+ /** Maximum avatars to show before "+N" (default: 3) */
1712
+ max?: number;
1713
+ /** Avatar size */
1714
+ size?: 'xs' | 'sm';
1715
+ /** Click handler — makes the stack interactive */
1716
+ onClick?: () => void;
1717
+ /** Additional CSS classes */
1718
+ className?: string;
1719
+ }
1720
+ declare function AvatarStackInner({ users, max, size, onClick, className, }: AvatarStackProps): react_jsx_runtime.JSX.Element;
1721
+ declare const AvatarStack: react.MemoExoticComponent<typeof AvatarStackInner>;
1722
+
1723
+ interface SessionMembersModalProps {
1724
+ isOpen: boolean;
1725
+ sessionId?: string;
1726
+ dataSource: ChatDataSource;
1727
+ onClose: () => void;
1728
+ }
1729
+ declare function SessionMembersModal({ isOpen, sessionId, dataSource, onClose }: SessionMembersModalProps): react_jsx_runtime.JSX.Element;
1730
+
1660
1731
  interface PermissionGuardProps {
1661
1732
  /** Permission names to check */
1662
1733
  permissions: string[];
@@ -1792,9 +1863,9 @@ interface AllChatsListProps {
1792
1863
  declare function AllChatsList({ dataSource, onSessionSelect, activeSessionId }: AllChatsListProps): react_jsx_runtime.JSX.Element;
1793
1864
 
1794
1865
  interface UserFilterProps {
1795
- users: SessionUser[];
1796
- selectedUser: SessionUser | null;
1797
- onUserChange: (user: SessionUser | null) => void;
1866
+ users: SessionUser$1[];
1867
+ selectedUser: SessionUser$1 | null;
1868
+ onUserChange: (user: SessionUser$1 | null) => void;
1798
1869
  loading?: boolean;
1799
1870
  }
1800
1871
  declare function UserFilter({ users, selectedUser, onUserChange, loading }: UserFilterProps): react_jsx_runtime.JSX.Element;
@@ -2622,253 +2693,644 @@ interface LongPressResult {
2622
2693
  }
2623
2694
  declare function useLongPress(options: LongPressOptions): LongPressResult;
2624
2695
 
2625
- /**
2626
- * Framer Motion animation variants for BiChat UI
2627
- * Subtle, professional animations for enterprise applications
2628
- *
2629
- * Reduced-motion handling: Framer Motion's built-in `<MotionConfig reducedMotion="user">`
2630
- * or the `useReducedMotion()` hook handle OS-level accessibility preferences reactively.
2631
- * Variant objects declare their intended durations; Framer suppresses them automatically.
2632
- */
2633
- /**
2634
- * Fade in animation
2635
- */
2636
- declare const fadeInVariants: {
2637
- initial: {
2638
- opacity: number;
2696
+ type BichatRPC = {
2697
+ "bichat.artifact.delete": {
2698
+ params: ArtifactIDParams;
2699
+ result: OkResult;
2639
2700
  };
2640
- animate: {
2641
- opacity: number;
2642
- transition: {
2643
- duration: number;
2644
- };
2701
+ "bichat.artifact.update": {
2702
+ params: ArtifactUpdateParams;
2703
+ result: ArtifactResult;
2645
2704
  };
2646
- exit: {
2647
- opacity: number;
2648
- transition: {
2649
- duration: number;
2650
- };
2705
+ "bichat.ping": {
2706
+ params: PingParams;
2707
+ result: PingResult;
2651
2708
  };
2652
- };
2653
- /**
2654
- * Fade in with subtle slide up
2655
- */
2656
- declare const fadeInUpVariants: {
2657
- initial: {
2658
- opacity: number;
2659
- y: number;
2709
+ "bichat.question.reject": {
2710
+ params: QuestionCancelParams;
2711
+ result: SessionGetResult;
2660
2712
  };
2661
- animate: {
2662
- opacity: number;
2663
- y: number;
2664
- transition: {
2665
- duration: number;
2666
- ease: number[];
2667
- };
2713
+ "bichat.question.submit": {
2714
+ params: QuestionSubmitParams;
2715
+ result: SessionGetResult;
2668
2716
  };
2669
- exit: {
2670
- opacity: number;
2671
- y: number;
2672
- transition: {
2673
- duration: number;
2674
- };
2717
+ "bichat.session.archive": {
2718
+ params: SessionIDParams;
2719
+ result: SessionCreateResult;
2675
2720
  };
2676
- };
2677
- /**
2678
- * Scale fade for modals and popups
2679
- */
2680
- declare const scaleFadeVariants: {
2681
- initial: {
2682
- opacity: number;
2683
- scale: number;
2721
+ "bichat.session.artifacts": {
2722
+ params: SessionArtifactsParams;
2723
+ result: SessionArtifactsResult;
2684
2724
  };
2685
- animate: {
2686
- opacity: number;
2687
- scale: number;
2688
- transition: {
2689
- duration: number;
2690
- };
2725
+ "bichat.session.clear": {
2726
+ params: SessionIDParams;
2727
+ result: SessionClearResult;
2691
2728
  };
2692
- exit: {
2693
- opacity: number;
2694
- scale: number;
2695
- transition: {
2696
- duration: number;
2697
- };
2729
+ "bichat.session.compact": {
2730
+ params: SessionIDParams;
2731
+ result: SessionCompactResult;
2698
2732
  };
2699
- };
2700
- /**
2701
- * Modal backdrop
2702
- */
2703
- declare const backdropVariants: {
2704
- initial: {
2705
- opacity: number;
2733
+ "bichat.session.create": {
2734
+ params: SessionCreateParams;
2735
+ result: SessionCreateResult;
2706
2736
  };
2707
- animate: {
2708
- opacity: number;
2709
- transition: {
2710
- duration: number;
2711
- };
2737
+ "bichat.session.delete": {
2738
+ params: SessionIDParams;
2739
+ result: OkResult;
2712
2740
  };
2713
- exit: {
2714
- opacity: number;
2715
- transition: {
2716
- duration: number;
2717
- };
2741
+ "bichat.session.get": {
2742
+ params: SessionGetParams;
2743
+ result: SessionGetResult;
2718
2744
  };
2719
- };
2720
- /**
2721
- * Button press feedback
2722
- */
2723
- declare const buttonVariants: {
2724
- tap: {
2725
- scale: number;
2745
+ "bichat.session.list": {
2746
+ params: SessionListParams;
2747
+ result: SessionListResult;
2726
2748
  };
2727
- };
2728
- /**
2729
- * Stagger container for lists
2730
- */
2731
- declare const staggerContainerVariants: {
2732
- hidden: {
2733
- opacity: number;
2749
+ "bichat.session.listAll": {
2750
+ params: SessionListAllParams;
2751
+ result: SessionListAllResult;
2734
2752
  };
2735
- visible: {
2736
- opacity: number;
2737
- transition: {
2738
- staggerChildren: number;
2739
- delayChildren: number;
2740
- };
2753
+ "bichat.session.members.add": {
2754
+ params: SessionMembersUpsertParams;
2755
+ result: OkResult;
2741
2756
  };
2742
- };
2743
- /**
2744
- * List item animation
2745
- */
2746
- declare const listItemVariants: {
2747
- initial: {
2748
- opacity: number;
2749
- x: number;
2757
+ "bichat.session.members.list": {
2758
+ params: SessionMembersListParams;
2759
+ result: SessionMembersListResult;
2750
2760
  };
2751
- animate: {
2752
- opacity: number;
2753
- x: number;
2754
- transition: {
2755
- duration: number;
2756
- };
2761
+ "bichat.session.members.remove": {
2762
+ params: SessionMembersRemoveParams;
2763
+ result: OkResult;
2757
2764
  };
2758
- exit: {
2759
- opacity: number;
2760
- x: number;
2761
- transition: {
2762
- duration: number;
2763
- };
2765
+ "bichat.session.members.updateRole": {
2766
+ params: SessionMembersUpsertParams;
2767
+ result: OkResult;
2764
2768
  };
2765
- };
2766
- /**
2767
- * Message entrance animation
2768
- */
2769
- declare const messageVariants: {
2770
- initial: {
2771
- opacity: number;
2772
- y: number;
2769
+ "bichat.session.pin": {
2770
+ params: SessionIDParams;
2771
+ result: SessionCreateResult;
2773
2772
  };
2774
- animate: {
2775
- opacity: number;
2776
- y: number;
2777
- transition: {
2778
- duration: number;
2779
- ease: number[];
2780
- };
2773
+ "bichat.session.regenerateTitle": {
2774
+ params: SessionIDParams;
2775
+ result: SessionCreateResult;
2781
2776
  };
2782
- exit: {
2783
- opacity: number;
2784
- transition: {
2785
- duration: number;
2786
- };
2777
+ "bichat.session.unarchive": {
2778
+ params: SessionIDParams;
2779
+ result: SessionCreateResult;
2787
2780
  };
2788
- };
2789
- /**
2790
- * Container for staggered messages
2791
- */
2792
- declare const messageContainerVariants: {
2793
- initial: {
2794
- opacity: number;
2781
+ "bichat.session.unpin": {
2782
+ params: SessionIDParams;
2783
+ result: SessionCreateResult;
2795
2784
  };
2796
- animate: {
2797
- opacity: number;
2798
- transition: {
2799
- staggerChildren: number;
2800
- delayChildren: number;
2801
- };
2785
+ "bichat.session.updateTitle": {
2786
+ params: SessionUpdateTitleParams;
2787
+ result: SessionCreateResult;
2802
2788
  };
2803
- };
2804
- /**
2805
- * Typing indicator dots
2806
- */
2807
- declare const typingDotVariants: {
2808
- initial: {
2809
- opacity: number;
2789
+ "bichat.session.uploadArtifacts": {
2790
+ params: SessionUploadArtifactsParams;
2791
+ result: SessionUploadArtifactsResult;
2810
2792
  };
2811
- animate: {
2812
- opacity: number[];
2813
- transition: {
2814
- duration: number;
2815
- repeat: number;
2816
- ease: string;
2817
- };
2793
+ "bichat.user.list": {
2794
+ params: PingParams;
2795
+ result: UserListResult;
2818
2796
  };
2819
2797
  };
2798
+ interface Artifact {
2799
+ id: string;
2800
+ sessionId: string;
2801
+ messageId?: string;
2802
+ uploadId?: number | null;
2803
+ type: string;
2804
+ name: string;
2805
+ description?: string;
2806
+ mimeType?: string;
2807
+ url?: string;
2808
+ sizeBytes: number;
2809
+ metadata?: Record<string, unknown>;
2810
+ createdAt: string;
2811
+ }
2812
+ interface ArtifactIDParams {
2813
+ id: string;
2814
+ }
2815
+ interface ArtifactResult {
2816
+ artifact: Artifact;
2817
+ }
2818
+ interface ArtifactUpdateParams {
2819
+ id: string;
2820
+ name: string;
2821
+ description?: string;
2822
+ }
2823
+ interface AssistantTurn {
2824
+ id: string;
2825
+ role?: string;
2826
+ content: string;
2827
+ explanation?: string;
2828
+ citations: Citation[];
2829
+ toolCalls?: ToolCall[];
2830
+ debug?: DebugTrace | null;
2831
+ artifacts: unknown[];
2832
+ codeOutputs: CodeOutput[];
2833
+ createdAt: string;
2834
+ }
2835
+ interface Attachment {
2836
+ id: string;
2837
+ uploadId?: number | null;
2838
+ filename: string;
2839
+ mimeType: string;
2840
+ sizeBytes: number;
2841
+ url?: string;
2842
+ }
2843
+ interface Citation {
2844
+ id: string;
2845
+ type: string;
2846
+ title: string;
2847
+ url: string;
2848
+ startIndex: number;
2849
+ endIndex: number;
2850
+ excerpt?: string;
2851
+ source?: string;
2852
+ }
2853
+ interface CodeOutput {
2854
+ type: string;
2855
+ content: string;
2856
+ filename?: string;
2857
+ mimeType?: string;
2858
+ sizeBytes?: number;
2859
+ }
2860
+ interface ConversationTurn {
2861
+ id: string;
2862
+ sessionId: string;
2863
+ userTurn: UserTurn;
2864
+ assistantTurn?: AssistantTurn | null;
2865
+ createdAt: string;
2866
+ }
2867
+ interface DebugEvent {
2868
+ id?: string;
2869
+ name?: string;
2870
+ type?: string;
2871
+ level?: string;
2872
+ message?: string;
2873
+ reason?: string;
2874
+ spanId?: string;
2875
+ generationId?: string;
2876
+ timestamp?: string;
2877
+ attributes?: Record<string, unknown>;
2878
+ }
2879
+ interface DebugGeneration {
2880
+ id?: string;
2881
+ requestId?: string;
2882
+ model?: string;
2883
+ provider?: string;
2884
+ finishReason?: string;
2885
+ promptTokens?: number;
2886
+ completionTokens?: number;
2887
+ totalTokens?: number;
2888
+ cachedTokens?: number;
2889
+ cost?: number;
2890
+ latencyMs?: number;
2891
+ input?: string;
2892
+ output?: string;
2893
+ thinking?: string;
2894
+ observationReason?: string;
2895
+ startedAt?: string;
2896
+ completedAt?: string;
2897
+ toolCalls?: DebugToolCall[];
2898
+ }
2899
+ interface DebugSpan {
2900
+ id?: string;
2901
+ parentId?: string;
2902
+ generationId?: string;
2903
+ name?: string;
2904
+ type?: string;
2905
+ status?: string;
2906
+ level?: string;
2907
+ callId?: string;
2908
+ toolName?: string;
2909
+ input?: string;
2910
+ output?: string;
2911
+ error?: string;
2912
+ durationMs?: number;
2913
+ startedAt?: string;
2914
+ completedAt?: string;
2915
+ attributes?: Record<string, unknown>;
2916
+ }
2917
+ interface DebugToolCall {
2918
+ callId?: string;
2919
+ name?: string;
2920
+ arguments?: string;
2921
+ result?: string;
2922
+ error?: string;
2923
+ durationMs?: number;
2924
+ }
2925
+ interface DebugTrace {
2926
+ schemaVersion?: string;
2927
+ startedAt?: string;
2928
+ completedAt?: string;
2929
+ usage?: DebugUsage | null;
2930
+ generationMs?: number;
2931
+ tools?: DebugToolCall[];
2932
+ attempts?: DebugGeneration[];
2933
+ spans?: DebugSpan[];
2934
+ events?: DebugEvent[];
2935
+ traceId?: string;
2936
+ traceUrl?: string;
2937
+ sessionId?: string;
2938
+ thinking?: string;
2939
+ observationReason?: string;
2940
+ }
2941
+ interface DebugUsage {
2942
+ promptTokens: number;
2943
+ completionTokens: number;
2944
+ totalTokens: number;
2945
+ cachedTokens: number;
2946
+ cost: number;
2947
+ }
2948
+ interface OkResult {
2949
+ ok: boolean;
2950
+ }
2951
+ interface PendingQuestion {
2952
+ checkpointId: string;
2953
+ agentName?: string;
2954
+ turnId: string;
2955
+ questions: PendingQuestionItem[];
2956
+ }
2957
+ interface PendingQuestionItem {
2958
+ id: string;
2959
+ text: string;
2960
+ type: string;
2961
+ options: PendingQuestionOption[];
2962
+ }
2963
+ interface PendingQuestionOption {
2964
+ id: string;
2965
+ label: string;
2966
+ }
2967
+ type PingParams = Record<string, never>;
2968
+ interface PingResult {
2969
+ ok: boolean;
2970
+ tenantId: string;
2971
+ }
2972
+ interface QuestionCancelParams {
2973
+ sessionId: string;
2974
+ }
2975
+ interface QuestionSubmitParams {
2976
+ sessionId: string;
2977
+ checkpointId: string;
2978
+ answers: Record<string, string>;
2979
+ }
2980
+ interface Session {
2981
+ id: string;
2982
+ title: string;
2983
+ status: string;
2984
+ pinned: boolean;
2985
+ createdAt: string;
2986
+ updatedAt: string;
2987
+ owner?: SessionUser | null;
2988
+ isGroup?: boolean;
2989
+ memberCount?: number;
2990
+ access?: SessionAccess | null;
2991
+ }
2992
+ interface SessionAccess {
2993
+ role: string;
2994
+ source: string;
2995
+ canRead: boolean;
2996
+ canWrite: boolean;
2997
+ canManageMembers: boolean;
2998
+ }
2999
+ interface SessionArtifactsParams {
3000
+ sessionId: string;
3001
+ limit: number;
3002
+ offset: number;
3003
+ }
3004
+ interface SessionArtifactsResult {
3005
+ artifacts: Artifact[];
3006
+ hasMore: boolean;
3007
+ nextOffset: number;
3008
+ }
3009
+ interface SessionClearResult {
3010
+ success: boolean;
3011
+ deletedMessages: number;
3012
+ deletedArtifacts: number;
3013
+ }
3014
+ interface SessionCompactResult {
3015
+ success: boolean;
3016
+ summary: string;
3017
+ deletedMessages: number;
3018
+ deletedArtifacts: number;
3019
+ }
3020
+ interface SessionCreateParams {
3021
+ title: string;
3022
+ }
3023
+ interface SessionCreateResult {
3024
+ session: Session;
3025
+ }
3026
+ interface SessionGetParams {
3027
+ id: string;
3028
+ }
3029
+ interface SessionGetResult {
3030
+ session: Session;
3031
+ turns: ConversationTurn[];
3032
+ pendingQuestion?: PendingQuestion | null;
3033
+ }
3034
+ interface SessionIDParams {
3035
+ id: string;
3036
+ }
3037
+ interface SessionListAllParams {
3038
+ limit: number;
3039
+ offset: number;
3040
+ includeArchived: boolean;
3041
+ userId?: string | null;
3042
+ }
3043
+ interface SessionListAllResult {
3044
+ sessions: Session[];
3045
+ total?: number;
3046
+ hasMore: boolean;
3047
+ }
3048
+ interface SessionListParams {
3049
+ limit: number;
3050
+ offset: number;
3051
+ includeArchived: boolean;
3052
+ }
3053
+ interface SessionListResult {
3054
+ sessions: Session[];
3055
+ total?: number;
3056
+ hasMore: boolean;
3057
+ }
3058
+ interface SessionMember {
3059
+ user: SessionUser;
3060
+ role: string;
3061
+ createdAt: string;
3062
+ updatedAt: string;
3063
+ }
3064
+ interface SessionMembersListParams {
3065
+ sessionId: string;
3066
+ }
3067
+ interface SessionMembersListResult {
3068
+ members: SessionMember[];
3069
+ }
3070
+ interface SessionMembersRemoveParams {
3071
+ sessionId: string;
3072
+ userId: string;
3073
+ }
3074
+ interface SessionMembersUpsertParams {
3075
+ sessionId: string;
3076
+ userId: string;
3077
+ role: string;
3078
+ }
3079
+ interface SessionUpdateTitleParams {
3080
+ id: string;
3081
+ title: string;
3082
+ }
3083
+ interface SessionUploadArtifactsParams {
3084
+ sessionId: string;
3085
+ attachments: Attachment[];
3086
+ }
3087
+ interface SessionUploadArtifactsResult {
3088
+ artifacts: Artifact[];
3089
+ }
3090
+ interface SessionUser {
3091
+ id: string;
3092
+ firstName: string;
3093
+ lastName: string;
3094
+ initials: string;
3095
+ }
3096
+ interface ToolCall {
3097
+ id: string;
3098
+ name: string;
3099
+ arguments: string;
3100
+ result?: string;
3101
+ error?: string;
3102
+ durationMs?: number;
3103
+ }
3104
+ interface UserListResult {
3105
+ users: SessionUser[];
3106
+ }
3107
+ interface UserTurn {
3108
+ id: string;
3109
+ content: string;
3110
+ attachments: Attachment[];
3111
+ author?: SessionUser | null;
3112
+ createdAt: string;
3113
+ }
3114
+
2820
3115
  /**
2821
- * Verb transition for typing indicator
2822
- * Smooth slide-up animation for rotating text
3116
+ * Session lifecycle management: create, list, get, delete, archive, pin, rename.
3117
+ *
3118
+ * @internal — Not part of the public API. Consumed by HttpDataSource.
2823
3119
  */
2824
- declare const verbTransitionVariants: {
2825
- initial: {
2826
- y: number;
2827
- opacity: number;
2828
- };
2829
- animate: {
2830
- y: number;
2831
- opacity: number;
2832
- transition: {
2833
- duration: number;
2834
- ease: string;
2835
- };
2836
- };
2837
- exit: {
2838
- y: number;
2839
- opacity: number;
2840
- transition: {
2841
- duration: number;
3120
+
3121
+ interface SessionState {
3122
+ session: Session$1;
3123
+ turns: ConversationTurn$1[];
3124
+ pendingQuestion?: PendingQuestion$1 | null;
3125
+ }
3126
+
3127
+ /**
3128
+ * Built-in HTTP data source with SSE streaming and AbortController
3129
+ * Implements ChatDataSource interface with real HTTP/RPC calls
3130
+ *
3131
+ * Uses turn-based architecture - fetches ConversationTurns instead of flat messages.
3132
+ *
3133
+ * This file is a thin facade that delegates to focused internal modules:
3134
+ * - SessionManager.ts — session CRUD (create, list, get, delete, archive, pin)
3135
+ * - MessageTransport.ts — send messages, stream responses, HITL questions
3136
+ * - ArtifactManager.ts — artifact fetch, upload, rename, delete
3137
+ * - AttachmentUploader.ts — file decode, normalize, upload
3138
+ * - mappers.ts — RPC-to-domain type mapping and sanitization
3139
+ */
3140
+
3141
+ interface HttpDataSourceConfig {
3142
+ baseUrl: string;
3143
+ rpcEndpoint: string;
3144
+ streamEndpoint?: string;
3145
+ uploadEndpoint?: string;
3146
+ csrfToken?: string | (() => string);
3147
+ headers?: Record<string, string>;
3148
+ timeout?: number;
3149
+ /**
3150
+ * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` or
3151
+ * `ChatSession` instead. Coupling navigation to the data source causes
3152
+ * component remounts during active streams.
3153
+ */
3154
+ navigateToSession?: (sessionId: string) => void;
3155
+ }
3156
+ declare class HttpDataSource implements ChatDataSource {
3157
+ private config;
3158
+ private abortController;
3159
+ private rpc;
3160
+ constructor(config: HttpDataSourceConfig);
3161
+ private getCSRFToken;
3162
+ private createHeaders;
3163
+ private createUploadHeaders;
3164
+ private callRPC;
3165
+ private boundCallRPC;
3166
+ private boundUploadFile;
3167
+ createSession(): Promise<Session$1>;
3168
+ fetchSession(id: string): Promise<SessionState | null>;
3169
+ listSessions(options?: {
3170
+ limit?: number;
3171
+ offset?: number;
3172
+ includeArchived?: boolean;
3173
+ }): Promise<SessionListResult$1>;
3174
+ archiveSession(sessionId: string): Promise<Session$1>;
3175
+ unarchiveSession(sessionId: string): Promise<Session$1>;
3176
+ pinSession(sessionId: string): Promise<Session$1>;
3177
+ unpinSession(sessionId: string): Promise<Session$1>;
3178
+ deleteSession(sessionId: string): Promise<void>;
3179
+ renameSession(sessionId: string, title: string): Promise<Session$1>;
3180
+ regenerateSessionTitle(sessionId: string): Promise<Session$1>;
3181
+ clearSessionHistory(sessionId: string): Promise<{
3182
+ success: boolean;
3183
+ deletedMessages: number;
3184
+ deletedArtifacts: number;
3185
+ }>;
3186
+ compactSessionHistory(sessionId: string): Promise<{
3187
+ success: boolean;
3188
+ summary: string;
3189
+ deletedMessages: number;
3190
+ deletedArtifacts: number;
3191
+ }>;
3192
+ listUsers(): Promise<SessionUser$1[]>;
3193
+ listAllSessions(options?: {
3194
+ limit?: number;
3195
+ offset?: number;
3196
+ includeArchived?: boolean;
3197
+ userId?: string | null;
3198
+ }): Promise<{
3199
+ sessions: Session$1[];
3200
+ total: number;
3201
+ hasMore: boolean;
3202
+ }>;
3203
+ listSessionMembers(sessionId: string): Promise<SessionMember$1[]>;
3204
+ addSessionMember(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
3205
+ updateSessionMemberRole(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
3206
+ removeSessionMember(sessionId: string, userId: string): Promise<void>;
3207
+ stopGeneration(sessionId: string): Promise<void>;
3208
+ getStreamStatus(sessionId: string): Promise<StreamStatus | null>;
3209
+ resumeStream(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
3210
+ sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
3211
+ cancelStream(): void;
3212
+ submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
3213
+ success: boolean;
3214
+ error?: string;
3215
+ data?: {
3216
+ session: Session$1;
3217
+ turns: ConversationTurn$1[];
3218
+ pendingQuestion?: PendingQuestion$1 | null;
2842
3219
  };
2843
- };
2844
- };
3220
+ }>;
3221
+ rejectPendingQuestion(sessionId: string): Promise<{
3222
+ success: boolean;
3223
+ error?: string;
3224
+ }>;
3225
+ fetchSessionArtifacts(sessionId: string, options?: {
3226
+ limit?: number;
3227
+ offset?: number;
3228
+ }): Promise<{
3229
+ artifacts: SessionArtifact[];
3230
+ hasMore?: boolean;
3231
+ nextOffset?: number;
3232
+ }>;
3233
+ uploadSessionArtifacts(sessionId: string, files: File[]): Promise<{
3234
+ artifacts: SessionArtifact[];
3235
+ }>;
3236
+ renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
3237
+ deleteSessionArtifact(artifactId: string): Promise<void>;
3238
+ /**
3239
+ * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` instead.
3240
+ */
3241
+ navigateToSession?(sessionId: string): void;
3242
+ }
2845
3243
  /**
2846
- * Floating button (scroll to bottom, etc.)
3244
+ * Factory function to create HttpDataSource
2847
3245
  */
2848
- declare const floatingButtonVariants: {
3246
+ declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSource;
3247
+
3248
+ /**
3249
+ * Builds HttpDataSourceConfig from window.__APPLET_CONTEXT__.
3250
+ * For use with createHttpDataSource when the app is embedded via the applet framework.
3251
+ *
3252
+ * Expects the host to inject context with:
3253
+ * - config.rpcUIEndpoint, config.streamEndpoint
3254
+ * - session.csrfToken (or window.__CSRF_TOKEN__)
3255
+ */
3256
+
3257
+ /**
3258
+ * Returns HttpDataSourceConfig derived from window.__APPLET_CONTEXT__.
3259
+ * Use with createHttpDataSource() for RPC and SSE endpoints.
3260
+ *
3261
+ * @throws Error if window.__APPLET_CONTEXT__ is not available
3262
+ */
3263
+ declare function useHttpDataSourceConfigFromApplet(options?: {
3264
+ timeout?: number;
3265
+ }): HttpDataSourceConfig;
3266
+
3267
+ /**
3268
+ * Router adapter for BiChat sidebar and archived list.
3269
+ * Consumes a navigate function and location (pathname) and returns
3270
+ * activeSessionId plus callbacks for use with SDK Sidebar and ArchivedChatList.
3271
+ *
3272
+ * Router-agnostic: pass useNavigate()/useLocation() from react-router-dom
3273
+ * or equivalent from your router.
3274
+ */
3275
+ interface UseBichatRouterParams {
3276
+ /** Navigate to a path (e.g. from useNavigate()) */
3277
+ navigate: (path: string) => void;
3278
+ /** Current pathname (e.g. location.pathname from useLocation()) */
3279
+ pathname: string;
3280
+ /** Optional: close mobile sidebar after navigation (e.g. closeMobile from useSidebarState) */
3281
+ onNavigate?: () => void;
3282
+ }
3283
+ interface UseBichatRouterReturn {
3284
+ /** Session ID extracted from pathname (e.g. /session/:id -> id) */
3285
+ activeSessionId: string | undefined;
3286
+ /** Navigate to session or home when sessionId is empty */
3287
+ onSessionSelect: (sessionId: string) => void;
3288
+ /** Navigate to new chat (home) */
3289
+ onNewChat: () => void;
3290
+ /** Navigate to archived list */
3291
+ onArchivedView: () => void;
3292
+ /** Navigate back (e.g. to home) */
3293
+ onBack: () => void;
3294
+ }
3295
+ /**
3296
+ * Derives BiChat navigation callbacks and activeSessionId from router state.
3297
+ * Use with SDK Sidebar (onSessionSelect, onNewChat, onArchivedView, activeSessionId)
3298
+ * and ArchivedChatList (onBack, onSessionSelect).
3299
+ */
3300
+ declare function useBichatRouter({ navigate, pathname, onNavigate, }: UseBichatRouterParams): UseBichatRouterReturn;
3301
+
3302
+ /**
3303
+ * Framer Motion animation variants for BiChat UI
3304
+ * Subtle, professional animations for enterprise applications
3305
+ *
3306
+ * Reduced-motion handling: Framer Motion's built-in `<MotionConfig reducedMotion="user">`
3307
+ * or the `useReducedMotion()` hook handle OS-level accessibility preferences reactively.
3308
+ * Variant objects declare their intended durations; Framer suppresses them automatically.
3309
+ */
3310
+ /**
3311
+ * Fade in animation
3312
+ */
3313
+ declare const fadeInVariants: {
2849
3314
  initial: {
2850
3315
  opacity: number;
2851
- scale: number;
2852
3316
  };
2853
3317
  animate: {
2854
3318
  opacity: number;
2855
- scale: number;
2856
3319
  transition: {
2857
3320
  duration: number;
2858
3321
  };
2859
3322
  };
2860
3323
  exit: {
2861
3324
  opacity: number;
2862
- scale: number;
2863
3325
  transition: {
2864
3326
  duration: number;
2865
3327
  };
2866
3328
  };
2867
3329
  };
2868
3330
  /**
2869
- * Dropdown menu
3331
+ * Fade in with subtle slide up
2870
3332
  */
2871
- declare const dropdownVariants: {
3333
+ declare const fadeInUpVariants: {
2872
3334
  initial: {
2873
3335
  opacity: number;
2874
3336
  y: number;
@@ -2878,6 +3340,7 @@ declare const dropdownVariants: {
2878
3340
  y: number;
2879
3341
  transition: {
2880
3342
  duration: number;
3343
+ ease: number[];
2881
3344
  };
2882
3345
  };
2883
3346
  exit: {
@@ -2889,702 +3352,521 @@ declare const dropdownVariants: {
2889
3352
  };
2890
3353
  };
2891
3354
  /**
2892
- * Session item with subtle slide-right on hover
3355
+ * Scale fade for modals and popups
2893
3356
  */
2894
- declare const sessionItemVariants: {
3357
+ declare const scaleFadeVariants: {
2895
3358
  initial: {
2896
3359
  opacity: number;
2897
- x: number;
3360
+ scale: number;
2898
3361
  };
2899
3362
  animate: {
2900
3363
  opacity: number;
2901
- x: number;
2902
- transition: {
2903
- duration: number;
2904
- };
2905
- };
2906
- hover: {
2907
- x: number;
3364
+ scale: number;
2908
3365
  transition: {
2909
3366
  duration: number;
2910
3367
  };
2911
3368
  };
2912
3369
  exit: {
2913
3370
  opacity: number;
2914
- x: number;
3371
+ scale: number;
2915
3372
  transition: {
2916
3373
  duration: number;
2917
3374
  };
2918
3375
  };
2919
3376
  };
2920
3377
  /**
2921
- * Error/alert message slide-in
3378
+ * Modal backdrop
2922
3379
  */
2923
- declare const errorMessageVariants: {
3380
+ declare const backdropVariants: {
2924
3381
  initial: {
2925
3382
  opacity: number;
2926
- y: number;
2927
- height: number;
2928
3383
  };
2929
3384
  animate: {
2930
3385
  opacity: number;
2931
- y: number;
2932
- height: string;
2933
3386
  transition: {
2934
3387
  duration: number;
2935
- ease: number[];
2936
3388
  };
2937
3389
  };
2938
3390
  exit: {
2939
3391
  opacity: number;
2940
- y: number;
2941
- height: number;
2942
3392
  transition: {
2943
3393
  duration: number;
2944
3394
  };
2945
3395
  };
2946
3396
  };
2947
-
2948
- interface ChatSessionProviderProps {
2949
- dataSource: ChatDataSource;
2950
- sessionId?: string;
2951
- /**
2952
- * External rate limiter instance. Captured once at mount — changing this prop
2953
- * after initial render has no effect. For most cases, use `rateLimitConfig`
2954
- * instead and let the provider create the limiter internally.
2955
- */
2956
- rateLimiter?: RateLimiter;
2957
- /**
2958
- * Configuration for the built-in rate limiter (ignored when `rateLimiter` is
2959
- * provided). Captured once at mount — changing after initial render has no effect.
2960
- */
2961
- rateLimitConfig?: RateLimiterConfig;
2962
- /**
2963
- * Called when the machine creates a new session (e.g. on first message in a
2964
- * "new chat"). Use this to navigate your SPA router to the new session URL.
2965
- *
2966
- * Replaces the deprecated `dataSource.navigateToSession`.
2967
- */
2968
- onSessionCreated?: (sessionId: string) => void;
2969
- children: ReactNode;
2970
- }
2971
- declare function ChatSessionProvider({ dataSource, sessionId, rateLimiter: externalRateLimiter, rateLimitConfig, onSessionCreated, children, }: ChatSessionProviderProps): react_jsx_runtime.JSX.Element;
2972
- declare function useChatSession(): ChatSessionStateValue;
2973
- declare function useChatMessaging(): ChatMessagingStateValue;
2974
- /** Returns messaging context or null when outside ChatSessionProvider. */
2975
- declare function useOptionalChatMessaging(): ChatMessagingStateValue | null;
2976
- declare function useChatInput(): ChatInputStateValue;
2977
-
2978
3397
  /**
2979
- * BiChat context types layered on top of canonical applet-core context contracts.
3398
+ * Button press feedback
2980
3399
  */
2981
-
2982
- type UserContext = UserContext$1;
2983
- type TenantContext = TenantContext$1;
2984
- type LocaleContext = LocaleContext$1;
2985
- type AppConfig = AppConfig$1 & {
2986
- streamEndpoint: string;
2987
- basePath: string;
2988
- assetsBasePath: string;
2989
- rpcUIEndpoint: string;
2990
- };
2991
- interface Extensions {
2992
- branding?: {
2993
- appName?: string;
2994
- logoUrl?: string;
2995
- theme?: {
2996
- primary?: string;
2997
- secondary?: string;
2998
- accent?: string;
2999
- };
3000
- welcome?: {
3001
- title?: string;
3002
- description?: string;
3003
- examplePrompts?: Array<{
3004
- category: string;
3005
- text: string;
3006
- icon: string;
3007
- }>;
3008
- };
3009
- colors?: {
3010
- primary?: string;
3011
- secondary?: string;
3012
- accent?: string;
3013
- };
3014
- logo?: {
3015
- src?: string;
3016
- alt?: string;
3017
- };
3018
- };
3019
- features?: {
3020
- vision?: boolean;
3021
- webSearch?: boolean;
3022
- codeInterpreter?: boolean;
3023
- multiAgent?: boolean;
3024
- };
3025
- llm?: {
3026
- provider?: string;
3027
- apiKeyConfigured?: boolean;
3028
- };
3029
- debug?: {
3030
- limits?: {
3031
- policyMaxTokens: number;
3032
- modelMaxTokens: number;
3033
- effectiveMaxTokens: number;
3034
- completionReserveTokens: number;
3035
- };
3400
+ declare const buttonVariants: {
3401
+ tap: {
3402
+ scale: number;
3036
3403
  };
3037
- }
3038
- type IotaContext = Omit<InitialContext, 'config' | 'extensions'> & {
3039
- config: AppConfig;
3040
- extensions?: Extensions;
3041
3404
  };
3042
- declare global {
3043
- interface Window {
3044
- __APPLET_CONTEXT__: IotaContext;
3045
- __CSRF_TOKEN__: string;
3046
- }
3047
- }
3048
-
3049
- interface IotaContextProviderProps {
3050
- /**
3051
- * Explicit context object. When provided, the window global is not read.
3052
- * Useful for tests, Storybook, or apps that manage their own context.
3053
- */
3054
- context?: IotaContext;
3055
- children: ReactNode;
3056
- }
3057
- declare function IotaContextProvider({ context, children }: IotaContextProviderProps): react_jsx_runtime.JSX.Element;
3058
- declare function useIotaContext(): IotaContext;
3059
3405
  /**
3060
- * Check if user has a specific permission
3406
+ * Stagger container for lists
3061
3407
  */
3062
- declare function hasPermission(permission: string): boolean;
3063
-
3064
- /** @deprecated Use `IotaContextProvider` with its `context` prop instead. */
3065
- interface BiChatConfig {
3066
- user: {
3067
- id: string;
3068
- email: string;
3069
- firstName: string;
3070
- lastName: string;
3071
- permissions: string[];
3072
- };
3073
- tenant: {
3074
- id: string;
3075
- name: string;
3076
- };
3077
- locale: {
3078
- language: string;
3079
- translations: Record<string, string>;
3408
+ declare const staggerContainerVariants: {
3409
+ hidden: {
3410
+ opacity: number;
3080
3411
  };
3081
- endpoints: {
3082
- rpc: string;
3083
- stream: string;
3412
+ visible: {
3413
+ opacity: number;
3414
+ transition: {
3415
+ staggerChildren: number;
3416
+ delayChildren: number;
3417
+ };
3084
3418
  };
3085
- csrfToken?: string;
3086
- }
3087
- interface ConfigProviderProps {
3088
- config?: BiChatConfig;
3089
- useGlobalConfig?: boolean;
3090
- children: ReactNode;
3091
- }
3092
- /**
3093
- * @deprecated Use `IotaContextProvider` with its `context` prop instead.
3094
- *
3095
- * ConfigProvider component — provides configuration to the BiChat library.
3096
- *
3097
- * @param config - Configuration object (preferred method)
3098
- * @param useGlobalConfig - If true, falls back to window.__APPLET_CONTEXT__ when config is not provided
3099
- * @param children - React children
3100
- */
3101
- declare function ConfigProvider({ config, useGlobalConfig, children }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
3102
- /**
3103
- * Hook to access BiChat configuration
3104
- * Returns null if no configuration is available
3105
- */
3106
- declare function useConfig(): BiChatConfig | null;
3107
- /**
3108
- * Hook to access BiChat configuration (required)
3109
- * Throws an error if configuration is not available
3110
- */
3111
- declare function useRequiredConfig(): BiChatConfig;
3112
-
3113
- /**
3114
- * Theme system type definitions
3115
- */
3116
- interface Theme {
3117
- name: string;
3118
- colors: ThemeColors;
3119
- spacing: ThemeSpacing;
3120
- borderRadius: ThemeBorderRadius;
3121
- }
3122
- interface ThemeColors {
3123
- background: string;
3124
- surface: string;
3125
- primary: string;
3126
- secondary: string;
3127
- text: string;
3128
- textMuted: string;
3129
- border: string;
3130
- error: string;
3131
- success: string;
3132
- warning: string;
3133
- userBubble: string;
3134
- assistantBubble: string;
3135
- userText: string;
3136
- assistantText: string;
3137
- }
3138
- interface ThemeSpacing {
3139
- xs: string;
3140
- sm: string;
3141
- md: string;
3142
- lg: string;
3143
- xl: string;
3144
- }
3145
- interface ThemeBorderRadius {
3146
- sm: string;
3147
- md: string;
3148
- lg: string;
3149
- full: string;
3150
- }
3151
-
3152
- interface ThemeProviderProps {
3153
- theme?: Theme | 'light' | 'dark' | 'system';
3154
- children: ReactNode;
3155
- }
3156
- /**
3157
- * Theme provider component
3158
- * Wraps the application and provides theme context
3159
- */
3160
- declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
3161
- /**
3162
- * Hook to access current theme
3163
- */
3164
- declare function useTheme(): Theme;
3165
-
3419
+ };
3166
3420
  /**
3167
- * Predefined theme configurations
3421
+ * List item animation
3168
3422
  */
3169
-
3170
- declare const lightTheme: Theme;
3171
- declare const darkTheme: Theme;
3172
-
3423
+ declare const listItemVariants: {
3424
+ initial: {
3425
+ opacity: number;
3426
+ x: number;
3427
+ };
3428
+ animate: {
3429
+ opacity: number;
3430
+ x: number;
3431
+ transition: {
3432
+ duration: number;
3433
+ };
3434
+ };
3435
+ exit: {
3436
+ opacity: number;
3437
+ x: number;
3438
+ transition: {
3439
+ duration: number;
3440
+ };
3441
+ };
3442
+ };
3173
3443
  /**
3174
- * CSRF token management for API requests
3444
+ * Message entrance animation
3175
3445
  */
3446
+ declare const messageVariants: {
3447
+ initial: {
3448
+ opacity: number;
3449
+ y: number;
3450
+ };
3451
+ animate: {
3452
+ opacity: number;
3453
+ y: number;
3454
+ transition: {
3455
+ duration: number;
3456
+ ease: number[];
3457
+ };
3458
+ };
3459
+ exit: {
3460
+ opacity: number;
3461
+ transition: {
3462
+ duration: number;
3463
+ };
3464
+ };
3465
+ };
3176
3466
  /**
3177
- * Get CSRF token from window object
3178
- * @returns CSRF token string
3467
+ * Container for staggered messages
3179
3468
  */
3180
- declare function getCSRFToken(): string;
3469
+ declare const messageContainerVariants: {
3470
+ initial: {
3471
+ opacity: number;
3472
+ };
3473
+ animate: {
3474
+ opacity: number;
3475
+ transition: {
3476
+ staggerChildren: number;
3477
+ delayChildren: number;
3478
+ };
3479
+ };
3480
+ };
3181
3481
  /**
3182
- * Add CSRF token to request headers
3183
- * @param headers - Headers object to modify
3184
- * @returns Modified headers object
3482
+ * Typing indicator dots
3185
3483
  */
3186
- declare function addCSRFHeader(headers: Headers): Headers;
3484
+ declare const typingDotVariants: {
3485
+ initial: {
3486
+ opacity: number;
3487
+ };
3488
+ animate: {
3489
+ opacity: number[];
3490
+ transition: {
3491
+ duration: number;
3492
+ repeat: number;
3493
+ ease: string;
3494
+ };
3495
+ };
3496
+ };
3187
3497
  /**
3188
- * Create headers with CSRF token
3189
- * @param init - Optional initial headers
3190
- * @returns Headers object with CSRF token
3498
+ * Verb transition for typing indicator
3499
+ * Smooth slide-up animation for rotating text
3191
3500
  */
3192
- declare function createHeadersWithCSRF(init?: HeadersInit): Headers;
3193
-
3194
- type BichatRPC = {
3195
- "bichat.artifact.delete": {
3196
- params: ArtifactIDParams;
3197
- result: OkResult;
3501
+ declare const verbTransitionVariants: {
3502
+ initial: {
3503
+ y: number;
3504
+ opacity: number;
3198
3505
  };
3199
- "bichat.artifact.update": {
3200
- params: ArtifactUpdateParams;
3201
- result: ArtifactResult;
3506
+ animate: {
3507
+ y: number;
3508
+ opacity: number;
3509
+ transition: {
3510
+ duration: number;
3511
+ ease: string;
3512
+ };
3202
3513
  };
3203
- "bichat.ping": {
3204
- params: PingParams;
3205
- result: PingResult;
3514
+ exit: {
3515
+ y: number;
3516
+ opacity: number;
3517
+ transition: {
3518
+ duration: number;
3519
+ };
3206
3520
  };
3207
- "bichat.question.reject": {
3208
- params: QuestionCancelParams;
3209
- result: SessionGetResult;
3521
+ };
3522
+ /**
3523
+ * Floating button (scroll to bottom, etc.)
3524
+ */
3525
+ declare const floatingButtonVariants: {
3526
+ initial: {
3527
+ opacity: number;
3528
+ scale: number;
3210
3529
  };
3211
- "bichat.question.submit": {
3212
- params: QuestionSubmitParams;
3213
- result: SessionGetResult;
3530
+ animate: {
3531
+ opacity: number;
3532
+ scale: number;
3533
+ transition: {
3534
+ duration: number;
3535
+ };
3214
3536
  };
3215
- "bichat.session.archive": {
3216
- params: SessionIDParams;
3217
- result: SessionCreateResult;
3537
+ exit: {
3538
+ opacity: number;
3539
+ scale: number;
3540
+ transition: {
3541
+ duration: number;
3542
+ };
3218
3543
  };
3219
- "bichat.session.artifacts": {
3220
- params: SessionArtifactsParams;
3221
- result: SessionArtifactsResult;
3544
+ };
3545
+ /**
3546
+ * Dropdown menu
3547
+ */
3548
+ declare const dropdownVariants: {
3549
+ initial: {
3550
+ opacity: number;
3551
+ y: number;
3222
3552
  };
3223
- "bichat.session.clear": {
3224
- params: SessionIDParams;
3225
- result: SessionClearResult;
3553
+ animate: {
3554
+ opacity: number;
3555
+ y: number;
3556
+ transition: {
3557
+ duration: number;
3558
+ };
3226
3559
  };
3227
- "bichat.session.compact": {
3228
- params: SessionIDParams;
3229
- result: SessionCompactResult;
3560
+ exit: {
3561
+ opacity: number;
3562
+ y: number;
3563
+ transition: {
3564
+ duration: number;
3565
+ };
3230
3566
  };
3231
- "bichat.session.create": {
3232
- params: SessionCreateParams;
3233
- result: SessionCreateResult;
3567
+ };
3568
+ /**
3569
+ * Session item with subtle slide-right on hover
3570
+ */
3571
+ declare const sessionItemVariants: {
3572
+ initial: {
3573
+ opacity: number;
3574
+ x: number;
3234
3575
  };
3235
- "bichat.session.delete": {
3236
- params: SessionIDParams;
3237
- result: OkResult;
3576
+ animate: {
3577
+ opacity: number;
3578
+ x: number;
3579
+ transition: {
3580
+ duration: number;
3581
+ };
3238
3582
  };
3239
- "bichat.session.get": {
3240
- params: SessionGetParams;
3241
- result: SessionGetResult;
3583
+ hover: {
3584
+ x: number;
3585
+ transition: {
3586
+ duration: number;
3587
+ };
3242
3588
  };
3243
- "bichat.session.list": {
3244
- params: SessionListParams;
3245
- result: SessionListResult;
3589
+ exit: {
3590
+ opacity: number;
3591
+ x: number;
3592
+ transition: {
3593
+ duration: number;
3594
+ };
3246
3595
  };
3247
- "bichat.session.pin": {
3248
- params: SessionIDParams;
3249
- result: SessionCreateResult;
3596
+ };
3597
+ /**
3598
+ * Error/alert message slide-in
3599
+ */
3600
+ declare const errorMessageVariants: {
3601
+ initial: {
3602
+ opacity: number;
3603
+ y: number;
3604
+ height: number;
3250
3605
  };
3251
- "bichat.session.regenerateTitle": {
3252
- params: SessionIDParams;
3253
- result: SessionCreateResult;
3606
+ animate: {
3607
+ opacity: number;
3608
+ y: number;
3609
+ height: string;
3610
+ transition: {
3611
+ duration: number;
3612
+ ease: number[];
3613
+ };
3254
3614
  };
3255
- "bichat.session.unarchive": {
3256
- params: SessionIDParams;
3257
- result: SessionCreateResult;
3615
+ exit: {
3616
+ opacity: number;
3617
+ y: number;
3618
+ height: number;
3619
+ transition: {
3620
+ duration: number;
3621
+ };
3622
+ };
3623
+ };
3624
+
3625
+ interface ChatSessionProviderProps {
3626
+ dataSource: ChatDataSource;
3627
+ sessionId?: string;
3628
+ /**
3629
+ * External rate limiter instance. Captured once at mount — changing this prop
3630
+ * after initial render has no effect. For most cases, use `rateLimitConfig`
3631
+ * instead and let the provider create the limiter internally.
3632
+ */
3633
+ rateLimiter?: RateLimiter;
3634
+ /**
3635
+ * Configuration for the built-in rate limiter (ignored when `rateLimiter` is
3636
+ * provided). Captured once at mount — changing after initial render has no effect.
3637
+ */
3638
+ rateLimitConfig?: RateLimiterConfig;
3639
+ /**
3640
+ * Called when the machine creates a new session (e.g. on first message in a
3641
+ * "new chat"). Use this to navigate your SPA router to the new session URL.
3642
+ *
3643
+ * Replaces the deprecated `dataSource.navigateToSession`.
3644
+ */
3645
+ onSessionCreated?: (sessionId: string) => void;
3646
+ children: ReactNode;
3647
+ }
3648
+ declare function ChatSessionProvider({ dataSource, sessionId, rateLimiter: externalRateLimiter, rateLimitConfig, onSessionCreated, children, }: ChatSessionProviderProps): react_jsx_runtime.JSX.Element;
3649
+ declare function useChatSession(): ChatSessionStateValue;
3650
+ declare function useChatMessaging(): ChatMessagingStateValue;
3651
+ /** Returns messaging context or null when outside ChatSessionProvider. */
3652
+ declare function useOptionalChatMessaging(): ChatMessagingStateValue | null;
3653
+ declare function useChatInput(): ChatInputStateValue;
3654
+
3655
+ /**
3656
+ * BiChat context types layered on top of canonical applet-core context contracts.
3657
+ */
3658
+
3659
+ type UserContext = UserContext$1;
3660
+ type TenantContext = TenantContext$1;
3661
+ type LocaleContext = LocaleContext$1;
3662
+ type AppConfig = AppConfig$1 & {
3663
+ streamEndpoint: string;
3664
+ basePath: string;
3665
+ assetsBasePath: string;
3666
+ rpcUIEndpoint: string;
3667
+ };
3668
+ interface Extensions {
3669
+ branding?: {
3670
+ appName?: string;
3671
+ logoUrl?: string;
3672
+ theme?: {
3673
+ primary?: string;
3674
+ secondary?: string;
3675
+ accent?: string;
3676
+ };
3677
+ welcome?: {
3678
+ title?: string;
3679
+ description?: string;
3680
+ examplePrompts?: Array<{
3681
+ category: string;
3682
+ text: string;
3683
+ icon: string;
3684
+ }>;
3685
+ };
3686
+ colors?: {
3687
+ primary?: string;
3688
+ secondary?: string;
3689
+ accent?: string;
3690
+ };
3691
+ logo?: {
3692
+ src?: string;
3693
+ alt?: string;
3694
+ };
3258
3695
  };
3259
- "bichat.session.unpin": {
3260
- params: SessionIDParams;
3261
- result: SessionCreateResult;
3696
+ features?: {
3697
+ vision?: boolean;
3698
+ webSearch?: boolean;
3699
+ codeInterpreter?: boolean;
3700
+ multiAgent?: boolean;
3262
3701
  };
3263
- "bichat.session.updateTitle": {
3264
- params: SessionUpdateTitleParams;
3265
- result: SessionCreateResult;
3702
+ llm?: {
3703
+ provider?: string;
3704
+ apiKeyConfigured?: boolean;
3266
3705
  };
3267
- "bichat.session.uploadArtifacts": {
3268
- params: SessionUploadArtifactsParams;
3269
- result: SessionUploadArtifactsResult;
3706
+ debug?: {
3707
+ limits?: {
3708
+ policyMaxTokens: number;
3709
+ modelMaxTokens: number;
3710
+ effectiveMaxTokens: number;
3711
+ completionReserveTokens: number;
3712
+ };
3270
3713
  };
3271
- };
3272
- interface Artifact {
3273
- id: string;
3274
- sessionId: string;
3275
- messageId?: string;
3276
- uploadId?: number;
3277
- type: string;
3278
- name: string;
3279
- description?: string;
3280
- mimeType?: string;
3281
- url?: string;
3282
- sizeBytes: number;
3283
- metadata?: Record<string, unknown>;
3284
- createdAt: string;
3285
- }
3286
- interface ArtifactIDParams {
3287
- id: string;
3288
- }
3289
- interface ArtifactResult {
3290
- artifact: Artifact;
3291
- }
3292
- interface ArtifactUpdateParams {
3293
- id: string;
3294
- name: string;
3295
- description?: string;
3296
- }
3297
- interface AssistantTurn {
3298
- id: string;
3299
- role?: string;
3300
- content: string;
3301
- explanation?: string;
3302
- citations: Citation[];
3303
- toolCalls?: ToolCall[];
3304
- debug?: DebugTrace | null;
3305
- artifacts: unknown[];
3306
- codeOutputs: CodeOutput[];
3307
- createdAt: string;
3308
- }
3309
- interface Attachment {
3310
- id?: string;
3311
- uploadId?: number;
3312
- filename?: string;
3313
- mimeType?: string;
3314
- sizeBytes?: number;
3315
- url?: string;
3316
- }
3317
- interface Citation {
3318
- id: string;
3319
- type: string;
3320
- title: string;
3321
- url: string;
3322
- startIndex: number;
3323
- endIndex: number;
3324
- excerpt?: string;
3325
- }
3326
- interface CodeOutput {
3327
- type: string;
3328
- content: string;
3329
- filename?: string;
3330
- mimeType?: string;
3331
- sizeBytes?: number;
3332
- }
3333
- interface ConversationTurn {
3334
- id: string;
3335
- sessionId: string;
3336
- userTurn: UserTurn;
3337
- assistantTurn?: AssistantTurn | null;
3338
- createdAt: string;
3339
- }
3340
- interface DebugToolCall {
3341
- callId?: string;
3342
- name?: string;
3343
- arguments?: string;
3344
- result?: string;
3345
- error?: string;
3346
- durationMs?: number;
3347
- }
3348
- interface DebugTrace {
3349
- usage?: DebugUsage | null;
3350
- generationMs?: number;
3351
- tools?: DebugToolCall[];
3352
- traceId?: string;
3353
- traceUrl?: string;
3354
- }
3355
- interface DebugUsage {
3356
- promptTokens: number;
3357
- completionTokens: number;
3358
- totalTokens: number;
3359
- cachedTokens: number;
3360
- cost: number;
3361
- }
3362
- interface OkResult {
3363
- ok: boolean;
3364
- }
3365
- interface PendingQuestion {
3366
- checkpointId: string;
3367
- agentName?: string;
3368
- turnId: string;
3369
- questions: PendingQuestionItem[];
3370
- }
3371
- interface PendingQuestionItem {
3372
- id: string;
3373
- text: string;
3374
- type: string;
3375
- options: PendingQuestionOption[];
3376
- }
3377
- interface PendingQuestionOption {
3378
- id: string;
3379
- label: string;
3380
- }
3381
- type PingParams = Record<string, never>;
3382
- interface PingResult {
3383
- ok: boolean;
3384
- tenantId: string;
3385
- }
3386
- interface QuestionCancelParams {
3387
- sessionId: string;
3388
- }
3389
- interface QuestionSubmitParams {
3390
- sessionId: string;
3391
- checkpointId: string;
3392
- answers: Record<string, string>;
3393
- }
3394
- interface Session {
3395
- id: string;
3396
- title: string;
3397
- status: string;
3398
- pinned: boolean;
3399
- createdAt: string;
3400
- updatedAt: string;
3401
- }
3402
- interface SessionArtifactsParams {
3403
- sessionId: string;
3404
- limit: number;
3405
- offset: number;
3406
- }
3407
- interface SessionArtifactsResult {
3408
- artifacts: Artifact[];
3409
- hasMore: boolean;
3410
- nextOffset: number;
3411
- }
3412
- interface SessionClearResult {
3413
- success: boolean;
3414
- deletedMessages: number;
3415
- deletedArtifacts: number;
3416
- }
3417
- interface SessionCompactResult {
3418
- success: boolean;
3419
- summary: string;
3420
- deletedMessages: number;
3421
- deletedArtifacts: number;
3422
- }
3423
- interface SessionCreateParams {
3424
- title: string;
3425
- }
3426
- interface SessionCreateResult {
3427
- session: Session;
3428
- }
3429
- interface SessionGetParams {
3430
- id: string;
3431
3714
  }
3432
- interface SessionGetResult {
3433
- session: Session;
3434
- turns: ConversationTurn[];
3435
- pendingQuestion?: PendingQuestion | null;
3715
+ type IotaContext = Omit<InitialContext, 'config' | 'extensions'> & {
3716
+ config: AppConfig;
3717
+ extensions?: Extensions;
3718
+ };
3719
+ declare global {
3720
+ interface Window {
3721
+ __APPLET_CONTEXT__: IotaContext;
3722
+ __CSRF_TOKEN__: string;
3723
+ }
3436
3724
  }
3437
- interface SessionIDParams {
3438
- id: string;
3725
+
3726
+ interface IotaContextProviderProps {
3727
+ /**
3728
+ * Explicit context object. When provided, the window global is not read.
3729
+ * Useful for tests, Storybook, or apps that manage their own context.
3730
+ */
3731
+ context?: IotaContext;
3732
+ children: ReactNode;
3439
3733
  }
3440
- interface SessionListParams {
3441
- limit: number;
3442
- offset: number;
3443
- includeArchived: boolean;
3734
+ declare function IotaContextProvider({ context, children }: IotaContextProviderProps): react_jsx_runtime.JSX.Element;
3735
+ declare function useIotaContext(): IotaContext;
3736
+ /**
3737
+ * Check if user has a specific permission
3738
+ */
3739
+ declare function hasPermission(permission: string): boolean;
3740
+
3741
+ /** @deprecated Use `IotaContextProvider` with its `context` prop instead. */
3742
+ interface BiChatConfig {
3743
+ user: {
3744
+ id: string;
3745
+ email: string;
3746
+ firstName: string;
3747
+ lastName: string;
3748
+ permissions: string[];
3749
+ };
3750
+ tenant: {
3751
+ id: string;
3752
+ name: string;
3753
+ };
3754
+ locale: {
3755
+ language: string;
3756
+ translations: Record<string, string>;
3757
+ };
3758
+ endpoints: {
3759
+ rpc: string;
3760
+ stream: string;
3761
+ };
3762
+ csrfToken?: string;
3444
3763
  }
3445
- interface SessionListResult {
3446
- sessions: Session[];
3447
- total?: number;
3448
- hasMore: boolean;
3764
+ interface ConfigProviderProps {
3765
+ config?: BiChatConfig;
3766
+ useGlobalConfig?: boolean;
3767
+ children: ReactNode;
3449
3768
  }
3450
- interface SessionUpdateTitleParams {
3451
- id: string;
3452
- title: string;
3769
+ /**
3770
+ * @deprecated Use `IotaContextProvider` with its `context` prop instead.
3771
+ *
3772
+ * ConfigProvider component — provides configuration to the BiChat library.
3773
+ *
3774
+ * @param config - Configuration object (preferred method)
3775
+ * @param useGlobalConfig - If true, falls back to window.__APPLET_CONTEXT__ when config is not provided
3776
+ * @param children - React children
3777
+ */
3778
+ declare function ConfigProvider({ config, useGlobalConfig, children }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
3779
+ /**
3780
+ * Hook to access BiChat configuration
3781
+ * Returns null if no configuration is available
3782
+ */
3783
+ declare function useConfig(): BiChatConfig | null;
3784
+ /**
3785
+ * Hook to access BiChat configuration (required)
3786
+ * Throws an error if configuration is not available
3787
+ */
3788
+ declare function useRequiredConfig(): BiChatConfig;
3789
+
3790
+ /**
3791
+ * Theme system type definitions
3792
+ */
3793
+ interface Theme {
3794
+ name: string;
3795
+ colors: ThemeColors;
3796
+ spacing: ThemeSpacing;
3797
+ borderRadius: ThemeBorderRadius;
3453
3798
  }
3454
- interface SessionUploadArtifactsParams {
3455
- sessionId: string;
3456
- attachments: Attachment[];
3799
+ interface ThemeColors {
3800
+ background: string;
3801
+ surface: string;
3802
+ primary: string;
3803
+ secondary: string;
3804
+ text: string;
3805
+ textMuted: string;
3806
+ border: string;
3807
+ error: string;
3808
+ success: string;
3809
+ warning: string;
3810
+ userBubble: string;
3811
+ assistantBubble: string;
3812
+ userText: string;
3813
+ assistantText: string;
3457
3814
  }
3458
- interface SessionUploadArtifactsResult {
3459
- artifacts: Artifact[];
3815
+ interface ThemeSpacing {
3816
+ xs: string;
3817
+ sm: string;
3818
+ md: string;
3819
+ lg: string;
3820
+ xl: string;
3460
3821
  }
3461
- interface ToolCall {
3462
- id: string;
3463
- name: string;
3464
- arguments: string;
3465
- result?: string;
3466
- error?: string;
3467
- durationMs?: number;
3822
+ interface ThemeBorderRadius {
3823
+ sm: string;
3824
+ md: string;
3825
+ lg: string;
3826
+ full: string;
3468
3827
  }
3469
- interface UserTurn {
3470
- id: string;
3471
- content: string;
3472
- attachments: Attachment[];
3473
- createdAt: string;
3828
+
3829
+ interface ThemeProviderProps {
3830
+ theme?: Theme | 'light' | 'dark' | 'system';
3831
+ children: ReactNode;
3474
3832
  }
3833
+ /**
3834
+ * Theme provider component
3835
+ * Wraps the application and provides theme context
3836
+ */
3837
+ declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
3838
+ /**
3839
+ * Hook to access current theme
3840
+ */
3841
+ declare function useTheme(): Theme;
3475
3842
 
3476
3843
  /**
3477
- * Session lifecycle management: create, list, get, delete, archive, pin, rename.
3478
- *
3479
- * @internal — Not part of the public API. Consumed by HttpDataSource.
3844
+ * Predefined theme configurations
3480
3845
  */
3481
3846
 
3482
- interface SessionState {
3483
- session: Session$1;
3484
- turns: ConversationTurn$1[];
3485
- pendingQuestion?: PendingQuestion$1 | null;
3486
- }
3847
+ declare const lightTheme: Theme;
3848
+ declare const darkTheme: Theme;
3487
3849
 
3488
3850
  /**
3489
- * Built-in HTTP data source with SSE streaming and AbortController
3490
- * Implements ChatDataSource interface with real HTTP/RPC calls
3491
- *
3492
- * Uses turn-based architecture - fetches ConversationTurns instead of flat messages.
3493
- *
3494
- * This file is a thin facade that delegates to focused internal modules:
3495
- * - SessionManager.ts — session CRUD (create, list, get, delete, archive, pin)
3496
- * - MessageTransport.ts — send messages, stream responses, HITL questions
3497
- * - ArtifactManager.ts — artifact fetch, upload, rename, delete
3498
- * - AttachmentUploader.ts — file decode, normalize, upload
3499
- * - mappers.ts — RPC-to-domain type mapping and sanitization
3851
+ * CSRF token management for API requests
3500
3852
  */
3501
-
3502
- interface HttpDataSourceConfig {
3503
- baseUrl: string;
3504
- rpcEndpoint: string;
3505
- streamEndpoint?: string;
3506
- uploadEndpoint?: string;
3507
- csrfToken?: string | (() => string);
3508
- headers?: Record<string, string>;
3509
- timeout?: number;
3510
- /**
3511
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` or
3512
- * `ChatSession` instead. Coupling navigation to the data source causes
3513
- * component remounts during active streams.
3514
- */
3515
- navigateToSession?: (sessionId: string) => void;
3516
- }
3517
- declare class HttpDataSource implements ChatDataSource {
3518
- private config;
3519
- private abortController;
3520
- private rpc;
3521
- constructor(config: HttpDataSourceConfig);
3522
- private getCSRFToken;
3523
- private createHeaders;
3524
- private createUploadHeaders;
3525
- private callRPC;
3526
- private boundCallRPC;
3527
- private boundUploadFile;
3528
- createSession(): Promise<Session$1>;
3529
- fetchSession(id: string): Promise<SessionState | null>;
3530
- listSessions(options?: {
3531
- limit?: number;
3532
- offset?: number;
3533
- includeArchived?: boolean;
3534
- }): Promise<SessionListResult$1>;
3535
- archiveSession(sessionId: string): Promise<Session$1>;
3536
- unarchiveSession(sessionId: string): Promise<Session$1>;
3537
- pinSession(sessionId: string): Promise<Session$1>;
3538
- unpinSession(sessionId: string): Promise<Session$1>;
3539
- deleteSession(sessionId: string): Promise<void>;
3540
- renameSession(sessionId: string, title: string): Promise<Session$1>;
3541
- regenerateSessionTitle(sessionId: string): Promise<Session$1>;
3542
- clearSessionHistory(sessionId: string): Promise<{
3543
- success: boolean;
3544
- deletedMessages: number;
3545
- deletedArtifacts: number;
3546
- }>;
3547
- compactSessionHistory(sessionId: string): Promise<{
3548
- success: boolean;
3549
- summary: string;
3550
- deletedMessages: number;
3551
- deletedArtifacts: number;
3552
- }>;
3553
- stopGeneration(sessionId: string): Promise<void>;
3554
- getStreamStatus(sessionId: string): Promise<StreamStatus | null>;
3555
- resumeStream(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
3556
- sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
3557
- cancelStream(): void;
3558
- submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
3559
- success: boolean;
3560
- error?: string;
3561
- }>;
3562
- rejectPendingQuestion(sessionId: string): Promise<{
3563
- success: boolean;
3564
- error?: string;
3565
- }>;
3566
- fetchSessionArtifacts(sessionId: string, options?: {
3567
- limit?: number;
3568
- offset?: number;
3569
- }): Promise<{
3570
- artifacts: SessionArtifact[];
3571
- hasMore?: boolean;
3572
- nextOffset?: number;
3573
- }>;
3574
- uploadSessionArtifacts(sessionId: string, files: File[]): Promise<{
3575
- artifacts: SessionArtifact[];
3576
- }>;
3577
- renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
3578
- deleteSessionArtifact(artifactId: string): Promise<void>;
3579
- /**
3580
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` instead.
3581
- */
3582
- navigateToSession?(sessionId: string): void;
3583
- }
3584
3853
  /**
3585
- * Factory function to create HttpDataSource
3854
+ * Get CSRF token from window object
3855
+ * @returns CSRF token string
3586
3856
  */
3587
- declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSource;
3857
+ declare function getCSRFToken(): string;
3858
+ /**
3859
+ * Add CSRF token to request headers
3860
+ * @param headers - Headers object to modify
3861
+ * @returns Modified headers object
3862
+ */
3863
+ declare function addCSRFHeader(headers: Headers): Headers;
3864
+ /**
3865
+ * Create headers with CSRF token
3866
+ * @param init - Optional initial headers
3867
+ * @returns Headers object with CSRF token
3868
+ */
3869
+ declare function createHeadersWithCSRF(init?: HeadersInit): Headers;
3588
3870
 
3589
3871
  /**
3590
3872
  * Internal types for the ChatMachine.
@@ -3962,4 +4244,4 @@ declare function isPermissionDeniedError(error: unknown): boolean;
3962
4244
  */
3963
4245
  declare function toErrorDisplay(error: unknown, fallbackTitle: string): RPCErrorDisplay;
3964
4246
 
3965
- 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 };
4247
+ 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 };