@alquimia-ai/ui 2.0.0 → 2.2.2
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/{alert-dialog-CP71C4vl.d.mts → alert-dialog-HrXEPlTh.d.mts} +1 -1
- package/dist/{alert-dialog-CP71C4vl.d.ts → alert-dialog-HrXEPlTh.d.ts} +1 -1
- package/dist/components/atoms/index.d.mts +48 -3
- package/dist/components/atoms/index.d.ts +48 -3
- package/dist/components/atoms/index.js +239 -0
- package/dist/components/atoms/index.js.map +1 -1
- package/dist/components/atoms/index.mjs +207 -1
- package/dist/components/atoms/index.mjs.map +1 -1
- package/dist/components/genui/index.d.mts +79 -0
- package/dist/components/genui/index.d.ts +79 -0
- package/dist/components/genui/index.js +4693 -0
- package/dist/components/genui/index.js.map +1 -0
- package/dist/components/genui/index.mjs +4622 -0
- package/dist/components/genui/index.mjs.map +1 -0
- package/dist/components/hooks/index.d.mts +1 -1
- package/dist/components/hooks/index.d.ts +1 -1
- package/dist/components/molecules/documents/index.js +283 -58
- package/dist/components/molecules/documents/index.js.map +1 -1
- package/dist/components/molecules/documents/index.mjs +281 -58
- package/dist/components/molecules/documents/index.mjs.map +1 -1
- package/dist/components/molecules/index.d.mts +2 -2
- package/dist/components/molecules/index.d.ts +2 -2
- package/dist/components/molecules/index.js +335 -156
- package/dist/components/molecules/index.js.map +1 -1
- package/dist/components/molecules/index.mjs +331 -152
- package/dist/components/molecules/index.mjs.map +1 -1
- package/dist/components/molecules/viewers/index.js +182 -3
- package/dist/components/molecules/viewers/index.js.map +1 -1
- package/dist/components/molecules/viewers/index.mjs +182 -3
- package/dist/components/molecules/viewers/index.mjs.map +1 -1
- package/dist/components/organisms/index.d.mts +15 -2
- package/dist/components/organisms/index.d.ts +15 -2
- package/dist/components/organisms/index.js +434 -247
- package/dist/components/organisms/index.js.map +1 -1
- package/dist/components/organisms/index.mjs +431 -244
- package/dist/components/organisms/index.mjs.map +1 -1
- package/dist/components/templates/index.js +210 -31
- package/dist/components/templates/index.js.map +1 -1
- package/dist/components/templates/index.mjs +210 -31
- package/dist/components/templates/index.mjs.map +1 -1
- package/dist/index.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +554 -307
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +524 -310
- package/dist/index.mjs.map +1 -1
- package/dist/{toast-2xT7L1tJ.d.mts → toast-DEc6eGUE.d.mts} +1 -1
- package/dist/{toast-2xT7L1tJ.d.ts → toast-DEc6eGUE.d.ts} +1 -1
- package/package.json +22 -3
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { A2uiComponent, SurfaceAction, A2uiSurface, UIAction } from '@alquimia-ai/tools/genui';
|
|
4
|
+
|
|
5
|
+
/** Props every A2UI component receives from the renderer. */
|
|
6
|
+
interface A2uiNodeProps {
|
|
7
|
+
node: A2uiComponent;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
onChange?: (value: unknown) => void;
|
|
10
|
+
onAction?: (action: SurfaceAction) => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** The default catalog registry: catalog component name -> React component. */
|
|
14
|
+
declare const coreUiRegistry: Record<string, React.ComponentType<A2uiNodeProps>>;
|
|
15
|
+
|
|
16
|
+
interface A2uiRendererProps {
|
|
17
|
+
surface: A2uiSurface;
|
|
18
|
+
registry: Record<string, React.ComponentType<A2uiNodeProps>>;
|
|
19
|
+
onAgentAction: (action: UIAction) => void;
|
|
20
|
+
onLocalAction?: (action: UIAction) => void;
|
|
21
|
+
}
|
|
22
|
+
declare function A2uiRenderer({ surface, registry, onAgentAction, onLocalAction }: A2uiRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
23
|
+
|
|
24
|
+
type ChatMessage = {
|
|
25
|
+
id?: string;
|
|
26
|
+
role?: string;
|
|
27
|
+
content?: string;
|
|
28
|
+
};
|
|
29
|
+
/** The subset of the `useAlquimia` return that AssistantChat consumes. */
|
|
30
|
+
interface GenuiChatController {
|
|
31
|
+
messages: ChatMessage[];
|
|
32
|
+
input: string;
|
|
33
|
+
handleInputChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
34
|
+
handleSubmit: (event: React.FormEvent<HTMLFormElement>, traceParentId?: string, sessionId?: string) => Promise<void> | void;
|
|
35
|
+
handleLoadingCancel?: () => void;
|
|
36
|
+
isLoading?: boolean;
|
|
37
|
+
isMessageStreaming?: boolean;
|
|
38
|
+
streamingMessageId?: string | null;
|
|
39
|
+
genui?: {
|
|
40
|
+
surfaces: Array<{
|
|
41
|
+
controlId: string;
|
|
42
|
+
surface: A2uiSurface;
|
|
43
|
+
afterCount: number;
|
|
44
|
+
submitted?: boolean;
|
|
45
|
+
dismissedWith?: string;
|
|
46
|
+
}>;
|
|
47
|
+
onAgentAction: (controlId: string) => (action: UIAction) => void;
|
|
48
|
+
awaitingUser: boolean;
|
|
49
|
+
dismiss?: (userMessage?: string) => void;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
interface AssistantChatProps {
|
|
53
|
+
/** The value returned by `useAlquimia({ genui: {...} })`. */
|
|
54
|
+
alquimia: GenuiChatController;
|
|
55
|
+
/** Catalog component name -> React component. Defaults to the built-in catalog; pass your own to swap component libraries. */
|
|
56
|
+
registry?: Record<string, React.ComponentType<A2uiNodeProps>>;
|
|
57
|
+
/** Conversation id passed to `handleSubmit`. Optional if the SDK already has one. */
|
|
58
|
+
conversationId?: string | null;
|
|
59
|
+
placeholder?: string;
|
|
60
|
+
suggestions?: string[];
|
|
61
|
+
className?: string;
|
|
62
|
+
/** Override the typing indicator shown while the agent is working. Defaults to animated dots. */
|
|
63
|
+
thinkIndicator?: React.ReactNode;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Batteries-included GenUI chat. A thin composition of the SDK's existing organisms
|
|
67
|
+
* (`AssistantMessageArea` + `AssistantInput`) — it does NOT reimplement message
|
|
68
|
+
* rendering, so it inherits markdown, error rendering, timestamps, and streaming for
|
|
69
|
+
* free. Its only job is to (a) turn `genui.surfaces` into an `interleave` callback the
|
|
70
|
+
* message area renders in place, and (b) gate the typing indicator while a surface
|
|
71
|
+
* awaits the user. All orchestration lives in `useAlquimia({ genui })`.
|
|
72
|
+
*
|
|
73
|
+
* To use a different component library, swap `registry` (and pass your own catalog to
|
|
74
|
+
* the hook). To customize the shell, compose the organisms directly instead of using
|
|
75
|
+
* this wrapper.
|
|
76
|
+
*/
|
|
77
|
+
declare function AssistantChat({ alquimia, registry, conversationId, placeholder, suggestions, className, thinkIndicator, }: AssistantChatProps): react_jsx_runtime.JSX.Element;
|
|
78
|
+
|
|
79
|
+
export { type A2uiNodeProps, A2uiRenderer, type A2uiRendererProps, AssistantChat, type AssistantChatProps, type GenuiChatController, coreUiRegistry };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { A2uiComponent, SurfaceAction, A2uiSurface, UIAction } from '@alquimia-ai/tools/genui';
|
|
4
|
+
|
|
5
|
+
/** Props every A2UI component receives from the renderer. */
|
|
6
|
+
interface A2uiNodeProps {
|
|
7
|
+
node: A2uiComponent;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
onChange?: (value: unknown) => void;
|
|
10
|
+
onAction?: (action: SurfaceAction) => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** The default catalog registry: catalog component name -> React component. */
|
|
14
|
+
declare const coreUiRegistry: Record<string, React.ComponentType<A2uiNodeProps>>;
|
|
15
|
+
|
|
16
|
+
interface A2uiRendererProps {
|
|
17
|
+
surface: A2uiSurface;
|
|
18
|
+
registry: Record<string, React.ComponentType<A2uiNodeProps>>;
|
|
19
|
+
onAgentAction: (action: UIAction) => void;
|
|
20
|
+
onLocalAction?: (action: UIAction) => void;
|
|
21
|
+
}
|
|
22
|
+
declare function A2uiRenderer({ surface, registry, onAgentAction, onLocalAction }: A2uiRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
23
|
+
|
|
24
|
+
type ChatMessage = {
|
|
25
|
+
id?: string;
|
|
26
|
+
role?: string;
|
|
27
|
+
content?: string;
|
|
28
|
+
};
|
|
29
|
+
/** The subset of the `useAlquimia` return that AssistantChat consumes. */
|
|
30
|
+
interface GenuiChatController {
|
|
31
|
+
messages: ChatMessage[];
|
|
32
|
+
input: string;
|
|
33
|
+
handleInputChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
34
|
+
handleSubmit: (event: React.FormEvent<HTMLFormElement>, traceParentId?: string, sessionId?: string) => Promise<void> | void;
|
|
35
|
+
handleLoadingCancel?: () => void;
|
|
36
|
+
isLoading?: boolean;
|
|
37
|
+
isMessageStreaming?: boolean;
|
|
38
|
+
streamingMessageId?: string | null;
|
|
39
|
+
genui?: {
|
|
40
|
+
surfaces: Array<{
|
|
41
|
+
controlId: string;
|
|
42
|
+
surface: A2uiSurface;
|
|
43
|
+
afterCount: number;
|
|
44
|
+
submitted?: boolean;
|
|
45
|
+
dismissedWith?: string;
|
|
46
|
+
}>;
|
|
47
|
+
onAgentAction: (controlId: string) => (action: UIAction) => void;
|
|
48
|
+
awaitingUser: boolean;
|
|
49
|
+
dismiss?: (userMessage?: string) => void;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
interface AssistantChatProps {
|
|
53
|
+
/** The value returned by `useAlquimia({ genui: {...} })`. */
|
|
54
|
+
alquimia: GenuiChatController;
|
|
55
|
+
/** Catalog component name -> React component. Defaults to the built-in catalog; pass your own to swap component libraries. */
|
|
56
|
+
registry?: Record<string, React.ComponentType<A2uiNodeProps>>;
|
|
57
|
+
/** Conversation id passed to `handleSubmit`. Optional if the SDK already has one. */
|
|
58
|
+
conversationId?: string | null;
|
|
59
|
+
placeholder?: string;
|
|
60
|
+
suggestions?: string[];
|
|
61
|
+
className?: string;
|
|
62
|
+
/** Override the typing indicator shown while the agent is working. Defaults to animated dots. */
|
|
63
|
+
thinkIndicator?: React.ReactNode;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Batteries-included GenUI chat. A thin composition of the SDK's existing organisms
|
|
67
|
+
* (`AssistantMessageArea` + `AssistantInput`) — it does NOT reimplement message
|
|
68
|
+
* rendering, so it inherits markdown, error rendering, timestamps, and streaming for
|
|
69
|
+
* free. Its only job is to (a) turn `genui.surfaces` into an `interleave` callback the
|
|
70
|
+
* message area renders in place, and (b) gate the typing indicator while a surface
|
|
71
|
+
* awaits the user. All orchestration lives in `useAlquimia({ genui })`.
|
|
72
|
+
*
|
|
73
|
+
* To use a different component library, swap `registry` (and pass your own catalog to
|
|
74
|
+
* the hook). To customize the shell, compose the organisms directly instead of using
|
|
75
|
+
* this wrapper.
|
|
76
|
+
*/
|
|
77
|
+
declare function AssistantChat({ alquimia, registry, conversationId, placeholder, suggestions, className, thinkIndicator, }: AssistantChatProps): react_jsx_runtime.JSX.Element;
|
|
78
|
+
|
|
79
|
+
export { type A2uiNodeProps, A2uiRenderer, type A2uiRendererProps, AssistantChat, type AssistantChatProps, type GenuiChatController, coreUiRegistry };
|