@timbal-ai/timbal-react 0.1.0

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.
@@ -0,0 +1,120 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import React__default, { ReactNode, FC, ComponentPropsWithRef, ElementType } from 'react';
4
+ import { ToolCallMessagePartComponent } from '@assistant-ui/react';
5
+ import * as class_variance_authority_types from 'class-variance-authority/types';
6
+ import { VariantProps } from 'class-variance-authority';
7
+ import { SyntaxHighlighterProps } from '@assistant-ui/react-markdown';
8
+ import { Session } from '@timbal-ai/timbal-sdk';
9
+ import { Tooltip as Tooltip$1, Avatar as Avatar$1, Dialog as Dialog$1 } from 'radix-ui';
10
+ import { ClassValue } from 'clsx';
11
+
12
+ type FetchFn = (url: string, options?: RequestInit) => Promise<Response>;
13
+ interface TimbalRuntimeProviderProps {
14
+ workforceId: string;
15
+ children: ReactNode;
16
+ /**
17
+ * Base URL for API calls. Defaults to `/api`.
18
+ * The provider will POST to `{baseUrl}/workforce/{workforceId}/stream`.
19
+ */
20
+ baseUrl?: string;
21
+ /**
22
+ * Custom fetch function for API calls. Defaults to `authFetch` which
23
+ * attaches Bearer tokens from localStorage and auto-refreshes on 401.
24
+ */
25
+ fetch?: FetchFn;
26
+ /** Enable fake streaming for development/testing. Default: false */
27
+ devFakeStream?: boolean;
28
+ /** Token delay in ms for fake streaming. Default: 75 */
29
+ devFakeStreamDelayMs?: number;
30
+ }
31
+ declare function TimbalRuntimeProvider({ workforceId, children, baseUrl, fetch: fetchFn, devFakeStream, devFakeStreamDelayMs, }: TimbalRuntimeProviderProps): react_jsx_runtime.JSX.Element;
32
+
33
+ declare const Thread: FC;
34
+
35
+ declare const MarkdownText: React.MemoExoticComponent<() => react_jsx_runtime.JSX.Element>;
36
+
37
+ declare const ToolFallback: ToolCallMessagePartComponent;
38
+
39
+ declare const UserMessageAttachments: FC;
40
+ declare const ComposerAttachments: FC;
41
+ declare const ComposerAddAttachment: FC;
42
+
43
+ declare const buttonVariants: (props?: ({
44
+ variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
45
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
46
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
47
+ declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
48
+ asChild?: boolean;
49
+ }): react_jsx_runtime.JSX.Element;
50
+
51
+ type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
52
+ tooltip: string;
53
+ side?: "top" | "bottom" | "left" | "right";
54
+ };
55
+ declare const TooltipIconButton: React.ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
56
+
57
+ declare const ShikiSyntaxHighlighter: FC<SyntaxHighlighterProps>;
58
+
59
+ interface SessionContextType {
60
+ user: Session | null;
61
+ loading: boolean;
62
+ isAuthenticated: boolean;
63
+ logout: () => void;
64
+ }
65
+ declare const useSession: () => SessionContextType;
66
+ interface SessionProviderProps {
67
+ children: React__default.ReactNode;
68
+ /** When false, session is always null and loading is false. Default: true */
69
+ enabled?: boolean;
70
+ }
71
+ declare const SessionProvider: React__default.FC<SessionProviderProps>;
72
+
73
+ interface AuthGuardProps {
74
+ children: React__default.ReactNode;
75
+ requireAuth?: boolean;
76
+ /** When false, renders children unconditionally. Default: true */
77
+ enabled?: boolean;
78
+ }
79
+ declare const AuthGuard: React__default.FC<AuthGuardProps>;
80
+
81
+ declare const getAccessToken: () => string | null;
82
+ declare const getRefreshToken: () => string | null;
83
+ declare const clearTokens: () => void;
84
+ declare const refreshAccessToken: () => Promise<boolean>;
85
+ declare const authFetch: (url: string, options?: RequestInit) => Promise<Response>;
86
+ declare const fetchCurrentUser: () => Promise<Session | null>;
87
+
88
+ declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof Tooltip$1.Provider>): react_jsx_runtime.JSX.Element;
89
+ declare function Tooltip({ ...props }: React.ComponentProps<typeof Tooltip$1.Root>): react_jsx_runtime.JSX.Element;
90
+ declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof Tooltip$1.Trigger>): react_jsx_runtime.JSX.Element;
91
+ declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof Tooltip$1.Content>): react_jsx_runtime.JSX.Element;
92
+
93
+ declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
94
+ size?: "default" | "sm" | "lg";
95
+ }): react_jsx_runtime.JSX.Element;
96
+ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>): react_jsx_runtime.JSX.Element;
97
+ declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>): react_jsx_runtime.JSX.Element;
98
+
99
+ declare function Dialog({ ...props }: React.ComponentProps<typeof Dialog$1.Root>): react_jsx_runtime.JSX.Element;
100
+ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof Dialog$1.Trigger>): react_jsx_runtime.JSX.Element;
101
+ declare function DialogPortal({ ...props }: React.ComponentProps<typeof Dialog$1.Portal>): react_jsx_runtime.JSX.Element;
102
+ declare function DialogClose({ ...props }: React.ComponentProps<typeof Dialog$1.Close>): react_jsx_runtime.JSX.Element;
103
+ declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Dialog$1.Overlay>): react_jsx_runtime.JSX.Element;
104
+ declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof Dialog$1.Content> & {
105
+ showCloseButton?: boolean;
106
+ }): react_jsx_runtime.JSX.Element;
107
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog$1.Title>): react_jsx_runtime.JSX.Element;
108
+
109
+ interface TextShimmerProps {
110
+ children: string;
111
+ as?: ElementType;
112
+ className?: string;
113
+ duration?: number;
114
+ spread?: number;
115
+ }
116
+ declare const Shimmer: React.MemoExoticComponent<({ children, as: Component, className, duration, spread, }: TextShimmerProps) => react_jsx_runtime.JSX.Element>;
117
+
118
+ declare function cn(...inputs: ClassValue[]): string;
119
+
120
+ export { AuthGuard, Avatar, AvatarFallback, AvatarImage, Button, ComposerAddAttachment, ComposerAttachments, Dialog, DialogClose, DialogContent, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, MarkdownText, SessionProvider, Shimmer, ShikiSyntaxHighlighter as SyntaxHighlighter, type TextShimmerProps, Thread, TimbalRuntimeProvider, type TimbalRuntimeProviderProps, ToolFallback, Tooltip, TooltipContent, TooltipIconButton, type TooltipIconButtonProps, TooltipProvider, TooltipTrigger, UserMessageAttachments, authFetch, buttonVariants, clearTokens, cn, fetchCurrentUser, getAccessToken, getRefreshToken, refreshAccessToken, useSession };
@@ -0,0 +1,120 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import React__default, { ReactNode, FC, ComponentPropsWithRef, ElementType } from 'react';
4
+ import { ToolCallMessagePartComponent } from '@assistant-ui/react';
5
+ import * as class_variance_authority_types from 'class-variance-authority/types';
6
+ import { VariantProps } from 'class-variance-authority';
7
+ import { SyntaxHighlighterProps } from '@assistant-ui/react-markdown';
8
+ import { Session } from '@timbal-ai/timbal-sdk';
9
+ import { Tooltip as Tooltip$1, Avatar as Avatar$1, Dialog as Dialog$1 } from 'radix-ui';
10
+ import { ClassValue } from 'clsx';
11
+
12
+ type FetchFn = (url: string, options?: RequestInit) => Promise<Response>;
13
+ interface TimbalRuntimeProviderProps {
14
+ workforceId: string;
15
+ children: ReactNode;
16
+ /**
17
+ * Base URL for API calls. Defaults to `/api`.
18
+ * The provider will POST to `{baseUrl}/workforce/{workforceId}/stream`.
19
+ */
20
+ baseUrl?: string;
21
+ /**
22
+ * Custom fetch function for API calls. Defaults to `authFetch` which
23
+ * attaches Bearer tokens from localStorage and auto-refreshes on 401.
24
+ */
25
+ fetch?: FetchFn;
26
+ /** Enable fake streaming for development/testing. Default: false */
27
+ devFakeStream?: boolean;
28
+ /** Token delay in ms for fake streaming. Default: 75 */
29
+ devFakeStreamDelayMs?: number;
30
+ }
31
+ declare function TimbalRuntimeProvider({ workforceId, children, baseUrl, fetch: fetchFn, devFakeStream, devFakeStreamDelayMs, }: TimbalRuntimeProviderProps): react_jsx_runtime.JSX.Element;
32
+
33
+ declare const Thread: FC;
34
+
35
+ declare const MarkdownText: React.MemoExoticComponent<() => react_jsx_runtime.JSX.Element>;
36
+
37
+ declare const ToolFallback: ToolCallMessagePartComponent;
38
+
39
+ declare const UserMessageAttachments: FC;
40
+ declare const ComposerAttachments: FC;
41
+ declare const ComposerAddAttachment: FC;
42
+
43
+ declare const buttonVariants: (props?: ({
44
+ variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
45
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
46
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
47
+ declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
48
+ asChild?: boolean;
49
+ }): react_jsx_runtime.JSX.Element;
50
+
51
+ type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
52
+ tooltip: string;
53
+ side?: "top" | "bottom" | "left" | "right";
54
+ };
55
+ declare const TooltipIconButton: React.ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
56
+
57
+ declare const ShikiSyntaxHighlighter: FC<SyntaxHighlighterProps>;
58
+
59
+ interface SessionContextType {
60
+ user: Session | null;
61
+ loading: boolean;
62
+ isAuthenticated: boolean;
63
+ logout: () => void;
64
+ }
65
+ declare const useSession: () => SessionContextType;
66
+ interface SessionProviderProps {
67
+ children: React__default.ReactNode;
68
+ /** When false, session is always null and loading is false. Default: true */
69
+ enabled?: boolean;
70
+ }
71
+ declare const SessionProvider: React__default.FC<SessionProviderProps>;
72
+
73
+ interface AuthGuardProps {
74
+ children: React__default.ReactNode;
75
+ requireAuth?: boolean;
76
+ /** When false, renders children unconditionally. Default: true */
77
+ enabled?: boolean;
78
+ }
79
+ declare const AuthGuard: React__default.FC<AuthGuardProps>;
80
+
81
+ declare const getAccessToken: () => string | null;
82
+ declare const getRefreshToken: () => string | null;
83
+ declare const clearTokens: () => void;
84
+ declare const refreshAccessToken: () => Promise<boolean>;
85
+ declare const authFetch: (url: string, options?: RequestInit) => Promise<Response>;
86
+ declare const fetchCurrentUser: () => Promise<Session | null>;
87
+
88
+ declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof Tooltip$1.Provider>): react_jsx_runtime.JSX.Element;
89
+ declare function Tooltip({ ...props }: React.ComponentProps<typeof Tooltip$1.Root>): react_jsx_runtime.JSX.Element;
90
+ declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof Tooltip$1.Trigger>): react_jsx_runtime.JSX.Element;
91
+ declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof Tooltip$1.Content>): react_jsx_runtime.JSX.Element;
92
+
93
+ declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
94
+ size?: "default" | "sm" | "lg";
95
+ }): react_jsx_runtime.JSX.Element;
96
+ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>): react_jsx_runtime.JSX.Element;
97
+ declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>): react_jsx_runtime.JSX.Element;
98
+
99
+ declare function Dialog({ ...props }: React.ComponentProps<typeof Dialog$1.Root>): react_jsx_runtime.JSX.Element;
100
+ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof Dialog$1.Trigger>): react_jsx_runtime.JSX.Element;
101
+ declare function DialogPortal({ ...props }: React.ComponentProps<typeof Dialog$1.Portal>): react_jsx_runtime.JSX.Element;
102
+ declare function DialogClose({ ...props }: React.ComponentProps<typeof Dialog$1.Close>): react_jsx_runtime.JSX.Element;
103
+ declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Dialog$1.Overlay>): react_jsx_runtime.JSX.Element;
104
+ declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof Dialog$1.Content> & {
105
+ showCloseButton?: boolean;
106
+ }): react_jsx_runtime.JSX.Element;
107
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog$1.Title>): react_jsx_runtime.JSX.Element;
108
+
109
+ interface TextShimmerProps {
110
+ children: string;
111
+ as?: ElementType;
112
+ className?: string;
113
+ duration?: number;
114
+ spread?: number;
115
+ }
116
+ declare const Shimmer: React.MemoExoticComponent<({ children, as: Component, className, duration, spread, }: TextShimmerProps) => react_jsx_runtime.JSX.Element>;
117
+
118
+ declare function cn(...inputs: ClassValue[]): string;
119
+
120
+ export { AuthGuard, Avatar, AvatarFallback, AvatarImage, Button, ComposerAddAttachment, ComposerAttachments, Dialog, DialogClose, DialogContent, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, MarkdownText, SessionProvider, Shimmer, ShikiSyntaxHighlighter as SyntaxHighlighter, type TextShimmerProps, Thread, TimbalRuntimeProvider, type TimbalRuntimeProviderProps, ToolFallback, Tooltip, TooltipContent, TooltipIconButton, type TooltipIconButtonProps, TooltipProvider, TooltipTrigger, UserMessageAttachments, authFetch, buttonVariants, clearTokens, cn, fetchCurrentUser, getAccessToken, getRefreshToken, refreshAccessToken, useSession };