@cuadra-ai/uikit 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/chatModelAdapter.d.ts +14 -0
- package/dist/adapters/chatModelAdapter.d.ts.map +1 -0
- package/dist/adapters/messageConverter.d.ts +16 -0
- package/dist/adapters/messageConverter.d.ts.map +1 -0
- package/dist/adapters/threadListAdapter.d.ts +15 -0
- package/dist/adapters/threadListAdapter.d.ts.map +1 -0
- package/dist/components/CuadraChat.d.ts +32 -0
- package/dist/components/CuadraChat.d.ts.map +1 -0
- package/dist/components/CuadraRuntimeProvider.d.ts +25 -0
- package/dist/components/CuadraRuntimeProvider.d.ts.map +1 -0
- package/dist/components/FakeReasoningLoader.d.ts +4 -0
- package/dist/components/FakeReasoningLoader.d.ts.map +1 -0
- package/dist/components/MarkdownText.d.ts +7 -0
- package/dist/components/MarkdownText.d.ts.map +1 -0
- package/dist/components/SimpleThread.d.ts +20 -0
- package/dist/components/SimpleThread.d.ts.map +1 -0
- package/dist/components/SimpleThreadList.d.ts +8 -0
- package/dist/components/SimpleThreadList.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/cuadraChatClient.d.ts +81 -0
- package/dist/lib/cuadraChatClient.d.ts.map +1 -0
- package/dist/types/cuadra.d.ts +113 -0
- package/dist/types/cuadra.d.ts.map +1 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/injectStyles.d.ts +14 -0
- package/dist/utils/injectStyles.d.ts.map +1 -0
- package/dist/utils/uikitStyles.d.ts +9 -0
- package/dist/utils/uikitStyles.d.ts.map +1 -0
- package/dist/utils/useInjectStyles.d.ts +10 -0
- package/dist/utils/useInjectStyles.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChatModelAdapter } from '@assistant-ui/react';
|
|
2
|
+
import { CuadraChatClient } from '../lib/cuadraChatClient';
|
|
3
|
+
export interface ChatModelAdapterOptions {
|
|
4
|
+
modelId?: string | null;
|
|
5
|
+
systemPrompt?: string;
|
|
6
|
+
ephemeral?: boolean;
|
|
7
|
+
onChatCreated?: (chatId: string) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a ChatModelAdapter for LocalRuntime that connects to Cuadra API
|
|
11
|
+
* Handles streaming responses and converts between assistant-ui and API formats
|
|
12
|
+
*/
|
|
13
|
+
export declare function createChatModelAdapter(client: CuadraChatClient, options: ChatModelAdapterOptions): ChatModelAdapter;
|
|
14
|
+
//# sourceMappingURL=chatModelAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatModelAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/chatModelAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAuB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAiC,MAAM,yBAAyB,CAAC;AAG1F,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,gBAAgB,CA0GlB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ThreadMessage } from '@assistant-ui/react';
|
|
2
|
+
import type { MessageCreate } from '../types/cuadra';
|
|
3
|
+
/**
|
|
4
|
+
* Convert assistant-ui ThreadMessage to Cuadra API MessageCreate format
|
|
5
|
+
*/
|
|
6
|
+
export declare function convertToCuadraMessages(messages: readonly ThreadMessage[]): MessageCreate[];
|
|
7
|
+
/**
|
|
8
|
+
* Convert Cuadra API MessageOut to assistant-ui ThreadMessage format
|
|
9
|
+
*/
|
|
10
|
+
export declare function convertFromCuadraMessage(msg: {
|
|
11
|
+
role: string;
|
|
12
|
+
content: string;
|
|
13
|
+
id: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
}): ThreadMessage;
|
|
16
|
+
//# sourceMappingURL=messageConverter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageConverter.d.ts","sourceRoot":"","sources":["../../src/adapters/messageConverter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,SAAS,aAAa,EAAE,GACjC,aAAa,EAAE,CAwBjB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE;IACH,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB,GACA,aAAa,CA+Bf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { unstable_RemoteThreadListAdapter as RemoteThreadListAdapter } from '@assistant-ui/react';
|
|
2
|
+
import { CuadraChatClient } from '../lib/cuadraChatClient';
|
|
3
|
+
/**
|
|
4
|
+
* Store mapping of local thread IDs to server chat IDs
|
|
5
|
+
* This is used to update remoteId when server chat ID is received
|
|
6
|
+
*/
|
|
7
|
+
export declare const localToRemoteIdMap: Map<string, string>;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a RemoteThreadListAdapter for LocalRuntime that connects to Cuadra API
|
|
10
|
+
* Maps API chat format to assistant-ui thread format
|
|
11
|
+
*/
|
|
12
|
+
export declare function createThreadListAdapter(client: CuadraChatClient, onChatIdReceived?: (localThreadId: string, serverChatId: string) => void): RemoteThreadListAdapter & {
|
|
13
|
+
updateRemoteId: (localThreadId: string, serverChatId: string) => void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=threadListAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threadListAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/threadListAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,IAAI,uBAAuB,EAE5D,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,kBAAkB,qBAA4B,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,gBAAgB,EACxB,gBAAgB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,GACvE,uBAAuB,GAAG;IAC3B,cAAc,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACvE,CA8GA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CuadraRuntimeProviderProps } from './CuadraRuntimeProvider';
|
|
2
|
+
export interface CuadraChatProps extends Omit<CuadraRuntimeProviderProps, 'children' | 'isProxyMode'> {
|
|
3
|
+
/** Proxy URL for backend-handled authentication (e.g., '/api/chat' or 'http://localhost:3000') */
|
|
4
|
+
proxyUrl?: string;
|
|
5
|
+
/** Container className for styling */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Show theme toggle button */
|
|
8
|
+
showThemeToggle?: boolean;
|
|
9
|
+
/** Initial theme ('light' | 'dark' | 'system') */
|
|
10
|
+
theme?: 'light' | 'dark' | 'system';
|
|
11
|
+
/** Language/locale for i18n (e.g., 'en', 'es', 'fr') */
|
|
12
|
+
language?: string;
|
|
13
|
+
/** Welcome screen title */
|
|
14
|
+
welcomeTitle?: string;
|
|
15
|
+
/** Welcome screen subtitle */
|
|
16
|
+
welcomeSubtitle?: string;
|
|
17
|
+
/** Extra top padding for thread viewport (e.g., '1rem', '2rem') */
|
|
18
|
+
extraTopPadding?: string;
|
|
19
|
+
/** Suggestions to show in welcome screen */
|
|
20
|
+
suggestions?: Array<{
|
|
21
|
+
/** Suggestion prompt text */
|
|
22
|
+
prompt: string;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* All-in-one Cuadra Chat component
|
|
27
|
+
*
|
|
28
|
+
* This component uses the widget implementation internally, ensuring
|
|
29
|
+
* consistent styling and behavior with the widget version.
|
|
30
|
+
*/
|
|
31
|
+
export declare function CuadraChat(props: CuadraChatProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
//# sourceMappingURL=CuadraChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CuadraChat.d.ts","sourceRoot":"","sources":["../../src/components/CuadraChat.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAG1E,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,0BAA0B,EAAE,UAAU,GAAG,aAAa,CAAC;IACnG,kGAAkG;IAClG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IACpC,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,6BAA6B;QAC7B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA2BhD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CuadraRuntimeProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
sessionToken?: string | null;
|
|
6
|
+
isProxyMode?: boolean;
|
|
7
|
+
tenantId?: string;
|
|
8
|
+
mode?: 'singleChat' | 'multiChat';
|
|
9
|
+
modelMode?: 'selector' | 'fixed';
|
|
10
|
+
modelId?: string;
|
|
11
|
+
onModelChange?: (modelId: string) => void;
|
|
12
|
+
ephemeral?: boolean;
|
|
13
|
+
systemPrompt?: string;
|
|
14
|
+
initialThreadId?: string;
|
|
15
|
+
onError?: (error: Error) => void;
|
|
16
|
+
onChatCreated?: (chatId: string) => void;
|
|
17
|
+
onThreadIdUpdate?: (oldThreadId: string, newThreadId: string) => void;
|
|
18
|
+
onChatsLoaded?: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Main provider component that sets up assistant-ui runtime with Cuadra API
|
|
22
|
+
* Supports single/multi chat modes, fixed/selector model modes, and ephemeral chats
|
|
23
|
+
*/
|
|
24
|
+
export declare function CuadraRuntimeProvider({ children, baseUrl, sessionToken, isProxyMode, tenantId, mode, modelId, onModelChange: _onModelChange, ephemeral, systemPrompt, initialThreadId, onError, onChatCreated, onThreadIdUpdate, onChatsLoaded, }: CuadraRuntimeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=CuadraRuntimeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CuadraRuntimeProvider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asoningLoader.d.ts","sourceRoot":"","sources":["../../src/components/FakeReasoningLoader.tsx"],"names":[],"mappings":"AAUA,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,kDA0BlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownText.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownText.tsx"],"names":[],"mappings":"AAEA,OAAO,6CAA6C,CAAC;AAarD,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAaD,eAAO,MAAM,YAAY,yDAAyB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import '@assistant-ui/react-markdown/styles/dot.css';
|
|
2
|
+
export interface SimpleThreadProps {
|
|
3
|
+
/** Welcome screen title */
|
|
4
|
+
welcomeTitle?: string;
|
|
5
|
+
/** Welcome screen subtitle */
|
|
6
|
+
welcomeSubtitle?: string;
|
|
7
|
+
/** Extra top padding for thread viewport (e.g., '1rem', '2rem') */
|
|
8
|
+
extraTopPadding?: string;
|
|
9
|
+
/** Suggestions to show in welcome screen */
|
|
10
|
+
suggestions?: Array<{
|
|
11
|
+
/** Suggestion prompt text */
|
|
12
|
+
prompt: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Simple Thread component wrapper
|
|
17
|
+
* Provides a basic chat interface using assistant-ui primitives
|
|
18
|
+
*/
|
|
19
|
+
export declare function SimpleThread({ welcomeTitle, welcomeSubtitle, extraTopPadding, suggestions, }?: SimpleThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=SimpleThread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleThread.d.ts","sourceRoot":"","sources":["../../src/components/SimpleThread.tsx"],"names":[],"mappings":"AAKA,OAAO,6CAA6C,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,6BAA6B;QAC7B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,YAA8C,EAC9C,eAAiF,EACjF,eAAe,EACf,WAAW,GACZ,GAAE,iBAAsB,2CAuKxB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple ThreadList component wrapper
|
|
3
|
+
* Provides a basic thread list interface using assistant-ui primitives
|
|
4
|
+
*/
|
|
5
|
+
export declare function SimpleThreadList({ onThreadSelect }: {
|
|
6
|
+
onThreadSelect?: () => void;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=SimpleThreadList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleThreadList.d.ts","sourceRoot":"","sources":["../../src/components/SimpleThreadList.tsx"],"names":[],"mappings":"AA6KA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,cAAc,EAAE,EAAE;IAAE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,2CA+BnF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cuadra AI UI Kit - Main Entry Point
|
|
3
|
+
*
|
|
4
|
+
* This package provides React components for building AI chat experiences
|
|
5
|
+
* with the Cuadra AI API using assistant-ui.
|
|
6
|
+
*/
|
|
7
|
+
import './index.css';
|
|
8
|
+
export { CuadraChat } from './components/CuadraChat';
|
|
9
|
+
export type { CuadraChatProps } from './components/CuadraChat';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ChatOut, ChatRequest, ChatSummaryPage, ChatUpdate, ListChatsParams, ListModelsParams, ModelOut, ModelPage } from '../types/cuadra';
|
|
2
|
+
/**
|
|
3
|
+
* SSE Chunk types for streaming responses
|
|
4
|
+
*/
|
|
5
|
+
export interface SSEChunk {
|
|
6
|
+
type?: string;
|
|
7
|
+
content?: string;
|
|
8
|
+
chatId?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
delta?: string;
|
|
11
|
+
finished?: boolean;
|
|
12
|
+
message?: {
|
|
13
|
+
role: string;
|
|
14
|
+
content: string;
|
|
15
|
+
};
|
|
16
|
+
usage?: {
|
|
17
|
+
inputTokens: number;
|
|
18
|
+
outputTokens: number;
|
|
19
|
+
totalTokens: number;
|
|
20
|
+
cost?: number | null;
|
|
21
|
+
};
|
|
22
|
+
done?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* CuadraChatClient - API client for Cuadra AI REST API
|
|
26
|
+
* Handles authentication, HTTP requests, and SSE streaming
|
|
27
|
+
*/
|
|
28
|
+
export declare class CuadraChatClient {
|
|
29
|
+
private baseUrl;
|
|
30
|
+
private sessionToken;
|
|
31
|
+
private isProxyMode;
|
|
32
|
+
private tenantId;
|
|
33
|
+
constructor(baseUrl: string, sessionToken?: string, isProxyMode?: boolean, tenantId?: string);
|
|
34
|
+
/**
|
|
35
|
+
* Set or update the session token
|
|
36
|
+
*/
|
|
37
|
+
setSessionToken(token: string | null): void;
|
|
38
|
+
/**
|
|
39
|
+
* Set or update the tenant ID
|
|
40
|
+
*/
|
|
41
|
+
setTenantId(tenantId: string | null): void;
|
|
42
|
+
/**
|
|
43
|
+
* Create or continue a chat with streaming support
|
|
44
|
+
* Returns a ReadableStream for SSE parsing
|
|
45
|
+
*/
|
|
46
|
+
private getUrl;
|
|
47
|
+
createOrContinueChat(request: ChatRequest, abortSignal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
48
|
+
/**
|
|
49
|
+
* Get a specific chat by ID
|
|
50
|
+
*/
|
|
51
|
+
getChat(chatId: string): Promise<ChatOut>;
|
|
52
|
+
/**
|
|
53
|
+
* List chats with pagination
|
|
54
|
+
*/
|
|
55
|
+
listChats(params?: ListChatsParams): Promise<ChatSummaryPage>;
|
|
56
|
+
/**
|
|
57
|
+
* Generate a UUID v4 idempotency key
|
|
58
|
+
*/
|
|
59
|
+
private generateIdempotencyKey;
|
|
60
|
+
/**
|
|
61
|
+
* Update a chat
|
|
62
|
+
*/
|
|
63
|
+
updateChat(chatId: string, update: ChatUpdate): Promise<ChatOut>;
|
|
64
|
+
/**
|
|
65
|
+
* Delete a chat
|
|
66
|
+
*/
|
|
67
|
+
deleteChat(chatId: string): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* List available models
|
|
70
|
+
*/
|
|
71
|
+
listModels(params?: ListModelsParams): Promise<ModelPage>;
|
|
72
|
+
/**
|
|
73
|
+
* Get a specific model by ID
|
|
74
|
+
*/
|
|
75
|
+
getModel(modelId: string): Promise<ModelOut>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Parse SSE stream into chunks
|
|
79
|
+
*/
|
|
80
|
+
export declare function parseSSEStream(stream: ReadableStream<Uint8Array>, abortSignal?: AbortSignal): AsyncGenerator<SSEChunk>;
|
|
81
|
+
//# sourceMappingURL=cuadraChatClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cuadraChatClient.d.ts","sourceRoot":"","sources":["../../src/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WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAgDtC;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA+B/C;;OAEG;IACG,SAAS,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAgDnE;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAmB9B;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IA+DtE;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwC/C;;OAEG;IACG,UAAU,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAgD/D;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CA8BnD;AAED;;GAEG;AACH,wBAAuB,cAAc,CACnC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,WAAW,CAAC,EAAE,WAAW,GACxB,cAAc,CAAC,QAAQ,CAAC,CAsC1B"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Cuadra AI API
|
|
3
|
+
* These types are based on the generated-api.ts schema
|
|
4
|
+
*/
|
|
5
|
+
export interface MessageCreate {
|
|
6
|
+
role: 'user' | 'assistant' | 'system';
|
|
7
|
+
content: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ChatRequest {
|
|
10
|
+
messages: MessageCreate[];
|
|
11
|
+
chatId?: string | null;
|
|
12
|
+
modelId?: string | null;
|
|
13
|
+
systemPrompt?: string | null;
|
|
14
|
+
ephemeral?: boolean;
|
|
15
|
+
stream?: boolean;
|
|
16
|
+
maxTokens?: number | null;
|
|
17
|
+
temperature?: number | null;
|
|
18
|
+
responseFormat?: Record<string, unknown> | null;
|
|
19
|
+
}
|
|
20
|
+
export interface ChatResponse {
|
|
21
|
+
id: string;
|
|
22
|
+
message: MessageOut;
|
|
23
|
+
usage?: TokenUsage | null;
|
|
24
|
+
}
|
|
25
|
+
export interface MessageOut {
|
|
26
|
+
role: 'user' | 'assistant' | 'system';
|
|
27
|
+
content: string;
|
|
28
|
+
id: string;
|
|
29
|
+
chatId: string;
|
|
30
|
+
tokenCount?: number | null;
|
|
31
|
+
cost?: string | null;
|
|
32
|
+
responseTimeMs?: number | null;
|
|
33
|
+
metadata?: Record<string, unknown> | null;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface TokenUsage {
|
|
37
|
+
inputTokens: number;
|
|
38
|
+
outputTokens: number;
|
|
39
|
+
totalTokens: number;
|
|
40
|
+
cost?: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface ChatOut {
|
|
43
|
+
createdAt: string;
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
organizationId: string;
|
|
46
|
+
title?: string | null;
|
|
47
|
+
systemPrompt?: string | null;
|
|
48
|
+
metadata?: Record<string, unknown> | null;
|
|
49
|
+
id: string;
|
|
50
|
+
modelId: string;
|
|
51
|
+
messages?: MessageOut[];
|
|
52
|
+
documentsCount?: number;
|
|
53
|
+
createdBy: string;
|
|
54
|
+
visibility?: 'private' | 'organization' | 'shared';
|
|
55
|
+
sharedWith?: string[] | null;
|
|
56
|
+
deletedAt?: string | null;
|
|
57
|
+
deletedBy?: string | null;
|
|
58
|
+
}
|
|
59
|
+
export interface ChatSummaryOut {
|
|
60
|
+
createdAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
organizationId: string;
|
|
63
|
+
id: string;
|
|
64
|
+
title?: string | null;
|
|
65
|
+
modelId: string;
|
|
66
|
+
status?: string | null;
|
|
67
|
+
deletedAt?: string | null;
|
|
68
|
+
}
|
|
69
|
+
export interface ChatSummaryPage {
|
|
70
|
+
items: ChatSummaryOut[];
|
|
71
|
+
nextCursor?: string | null;
|
|
72
|
+
hasMore?: boolean;
|
|
73
|
+
totalCount?: number | null;
|
|
74
|
+
}
|
|
75
|
+
export interface ChatUpdate {
|
|
76
|
+
title?: string | null;
|
|
77
|
+
systemPrompt?: string | null;
|
|
78
|
+
metadata?: Record<string, unknown> | null;
|
|
79
|
+
}
|
|
80
|
+
export interface ModelOut {
|
|
81
|
+
id: string;
|
|
82
|
+
displayName: string;
|
|
83
|
+
description?: string | null;
|
|
84
|
+
provider?: string | null;
|
|
85
|
+
modelName?: string | null;
|
|
86
|
+
contextWindow: number;
|
|
87
|
+
maxTokensPerRequest?: number | null;
|
|
88
|
+
supportsStreaming: boolean;
|
|
89
|
+
enabled: boolean;
|
|
90
|
+
isSystemModel: boolean;
|
|
91
|
+
creditMultiplier?: number | null;
|
|
92
|
+
metadata?: Record<string, unknown> | null;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
updatedAt: string;
|
|
95
|
+
parentModelId?: string | null;
|
|
96
|
+
profileId?: string | null;
|
|
97
|
+
}
|
|
98
|
+
export interface ModelPage {
|
|
99
|
+
items: ModelOut[];
|
|
100
|
+
nextCursor?: string | null;
|
|
101
|
+
hasMore: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface ListChatsParams {
|
|
104
|
+
limit?: number;
|
|
105
|
+
cursor?: string | null;
|
|
106
|
+
'expand[]'?: string[] | null;
|
|
107
|
+
}
|
|
108
|
+
export interface ListModelsParams {
|
|
109
|
+
limit?: number;
|
|
110
|
+
cursor?: string | null;
|
|
111
|
+
'expand[]'?: string[] | null;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=cuadra.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cuadra.d.ts","sourceRoot":"","sources":["../../src/types/cuadra.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,WA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,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,wBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,CAE/E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility to inject CSS styles into Shadow DOM or regular DOM
|
|
3
|
+
* This ensures styles are loaded when the package is consumed
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Inject CSS into Shadow DOM
|
|
7
|
+
*/
|
|
8
|
+
export declare function injectStylesIntoShadowDOM(shadowRoot: ShadowRoot): void;
|
|
9
|
+
/**
|
|
10
|
+
* Inject CSS into regular DOM (for React components)
|
|
11
|
+
* This ensures styles are loaded when components are used
|
|
12
|
+
*/
|
|
13
|
+
export declare function injectStylesIntoDOM(): void;
|
|
14
|
+
//# sourceMappingURL=injectStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectStyles.d.ts","sourceRoot":"","sources":["../../src/utils/injectStyles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgCH;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAwBtE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAqB1C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline CSS content for uikit
|
|
3
|
+
* This file will be populated at build time with the compiled CSS
|
|
4
|
+
*
|
|
5
|
+
* To update: Run `npm run build:css` and copy the content here
|
|
6
|
+
* Or use a build script to automate this
|
|
7
|
+
*/
|
|
8
|
+
export declare const uikitCSS = "\n/* Cuadra UI Kit Styles */\n/* CSS is loaded via import - this is a fallback */\n";
|
|
9
|
+
//# sourceMappingURL=uikitStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uikitStyles.d.ts","sourceRoot":"","sources":["../../src/utils/uikitStyles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,eAAO,MAAM,QAAQ,wFAGpB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to inject uikit CSS styles into the DOM
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: For the CSS to work, consumers must import it:
|
|
5
|
+
* import '@cuadra-ai/uikit/styles';
|
|
6
|
+
*
|
|
7
|
+
* This hook provides a fallback that tries to inject styles if they're not already loaded.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useInjectStyles(): void;
|
|
10
|
+
//# sourceMappingURL=useInjectStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInjectStyles.d.ts","sourceRoot":"","sources":["../../src/utils/useInjectStyles.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAmDtC"}
|