@alexkroman1/aai-ui 0.12.2 → 1.0.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.
Files changed (68) hide show
  1. package/dist/_react-test-utils.d.ts +86 -0
  2. package/dist/audio.js +4 -5
  3. package/dist/build-default-client.d.ts +1 -0
  4. package/dist/{_components → components}/button.d.ts +4 -4
  5. package/dist/{_components → components}/button.js +28 -5
  6. package/dist/components/chat-view.d.ts +38 -0
  7. package/dist/components/chat-view.js +102 -0
  8. package/dist/{_components → components}/controls.d.ts +1 -1
  9. package/dist/{_components → components}/controls.js +8 -5
  10. package/dist/{_components → components}/message-list.d.ts +2 -2
  11. package/dist/components/message-list.js +149 -0
  12. package/dist/components/sidebar-layout.d.ts +21 -0
  13. package/dist/components/sidebar-layout.js +43 -0
  14. package/dist/{_components → components}/start-screen.d.ts +4 -4
  15. package/dist/{_components → components}/start-screen.js +17 -8
  16. package/dist/{_components → components}/tool-call-block.d.ts +5 -6
  17. package/dist/components/tool-call-block.js +3 -0
  18. package/dist/components/tool-config-context.d.ts +22 -0
  19. package/dist/context.d.ts +23 -0
  20. package/dist/context.js +39 -0
  21. package/dist/default-client/assets/audio-DH9LpexG.js +1 -0
  22. package/dist/default-client/assets/capture-processor-C26lSiVr.js +53 -0
  23. package/dist/default-client/assets/default-client-AeJhjHfj.js +49 -0
  24. package/dist/default-client/assets/default-client-BK1ItCvw.css +2 -0
  25. package/dist/default-client/assets/playback-processor-dSA8Im99.js +101 -0
  26. package/dist/default-client/default-client.html +15 -0
  27. package/dist/default-client.d.ts +2 -0
  28. package/dist/define-client.d.ts +72 -24
  29. package/dist/define-client.js +71 -45
  30. package/dist/hooks.d.ts +5 -0
  31. package/dist/hooks.js +55 -0
  32. package/dist/index.d.ts +15 -37
  33. package/dist/index.js +11 -18
  34. package/dist/session-core.d.ts +70 -0
  35. package/dist/session-core.js +437 -0
  36. package/dist/tool-call-block-CCuChsFm.js +131 -0
  37. package/dist/types.d.ts +19 -22
  38. package/package.json +24 -18
  39. package/styles.css +3 -33
  40. package/dist/_components/app.d.ts +0 -23
  41. package/dist/_components/app.js +0 -41
  42. package/dist/_components/chat-view.d.ts +0 -29
  43. package/dist/_components/chat-view.js +0 -61
  44. package/dist/_components/error-banner.d.ts +0 -21
  45. package/dist/_components/error-banner.js +0 -27
  46. package/dist/_components/message-bubble.d.ts +0 -23
  47. package/dist/_components/message-bubble.js +0 -35
  48. package/dist/_components/message-list.js +0 -76
  49. package/dist/_components/sidebar-layout.d.ts +0 -21
  50. package/dist/_components/sidebar-layout.js +0 -36
  51. package/dist/_components/state-indicator.d.ts +0 -29
  52. package/dist/_components/state-indicator.js +0 -37
  53. package/dist/_components/thinking-indicator.d.ts +0 -16
  54. package/dist/_components/thinking-indicator.js +0 -34
  55. package/dist/_components/tool-call-block.js +0 -118
  56. package/dist/_components/tool-icons.d.ts +0 -17
  57. package/dist/_components/tool-icons.js +0 -128
  58. package/dist/_components/transcript.d.ts +0 -25
  59. package/dist/_components/transcript.js +0 -35
  60. package/dist/client-context.d.ts +0 -33
  61. package/dist/client-context.js +0 -15
  62. package/dist/client-handler.d.ts +0 -43
  63. package/dist/session-CWB7vmqz.js +0 -429
  64. package/dist/session.d.ts +0 -69
  65. package/dist/session.js +0 -2
  66. package/dist/signals.d.ts +0 -120
  67. package/dist/signals.js +0 -161
  68. package/dist/types.test-d.d.ts +0 -7
package/styles.css CHANGED
@@ -1,38 +1,13 @@
1
1
  @import "tailwindcss";
2
+
2
3
  @source "./";
3
4
  @source "../dist/ui/";
4
5
 
5
- @theme {
6
- --color-aai-bg: #101010;
7
- --color-aai-surface: #151515;
8
- --color-aai-surface-faint: rgba(255, 255, 255, 0.031);
9
- --color-aai-surface-hover: rgba(255, 255, 255, 0.059);
10
- --color-aai-border: #282828;
11
- --color-aai-primary: #fab283;
12
- --color-aai-text: rgba(255, 255, 255, 0.936);
13
- --color-aai-text-secondary: rgba(255, 255, 255, 0.618);
14
- --color-aai-text-muted: rgba(255, 255, 255, 0.284);
15
- --color-aai-text-dim: rgba(255, 255, 255, 0.422);
16
- --color-aai-error: #e06c75;
17
- --color-aai-ring: #56b6c2;
18
- --color-aai-state-disconnected: rgba(255, 255, 255, 0.422);
19
- --color-aai-state-connecting: rgba(255, 255, 255, 0.422);
20
- --color-aai-state-ready: #7fd88f;
21
- --color-aai-state-listening: #56b6c2;
22
- --color-aai-state-thinking: #f5a742;
23
- --color-aai-state-speaking: #e06c75;
24
- --color-aai-state-error: #e06c75;
25
- --radius-aai: 6px;
26
- --font-aai: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
27
- --font-aai-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
28
- }
29
-
30
6
  @layer base {
31
7
  html,
32
8
  body {
33
9
  margin: 0;
34
10
  padding: 0;
35
- background: var(--color-aai-bg);
36
11
  }
37
12
  }
38
13
 
@@ -59,15 +34,10 @@
59
34
  }
60
35
 
61
36
  .tool-shimmer {
62
- background: linear-gradient(
63
- 90deg,
64
- var(--color-aai-text) 25%,
65
- var(--color-aai-text-dim) 50%,
66
- var(--color-aai-text) 75%
67
- );
37
+ background: linear-gradient(90deg, currentColor 25%, transparent 50%, currentColor 75%);
68
38
  background-size: 200% 100%;
69
39
  -webkit-background-clip: text;
70
40
  background-clip: text;
71
41
  -webkit-text-fill-color: transparent;
72
- animation: aai-shimmer 2s ease-in-out infinite;
42
+ animation: aai-shimmer 2s infinite;
73
43
  }
@@ -1,23 +0,0 @@
1
- import type * as preact from "preact";
2
- /**
3
- * The default top-level UI component for an AAI voice agent.
4
- * Renders a {@link StartScreen} (with the AAI logo or a custom title from
5
- * {@link useClientConfig}) followed by a {@link ChatView} once the session starts.
6
- *
7
- * This is the component rendered by {@link defineClient} when no custom component is
8
- * provided.
9
- *
10
- * @example
11
- * ```tsx
12
- * import { App, defineClient } from "@aai/ui";
13
- *
14
- * defineClient(App, { target: "#app", title: "My Agent" });
15
- * ```
16
- *
17
- * @param className - Additional CSS class names applied to the root element.
18
- *
19
- * @public
20
- */
21
- export declare function App({ className }: {
22
- className?: string;
23
- }): preact.JSX.Element;
@@ -1,41 +0,0 @@
1
- import { useClientConfig } from "../client-context.js";
2
- import { ChatView } from "./chat-view.js";
3
- import { StartScreen } from "./start-screen.js";
4
- import { jsx } from "preact/jsx-runtime";
5
- //#region _components/app.tsx
6
- function AnsiLogo() {
7
- return /* @__PURE__ */ jsx("pre", {
8
- class: "font-aai-mono text-lg leading-[1.1] font-bold text-aai-primary m-0",
9
- children: "▄▀█ ▄▀█ █\n█▀█ █▀█ █"
10
- });
11
- }
12
- /**
13
- * The default top-level UI component for an AAI voice agent.
14
- * Renders a {@link StartScreen} (with the AAI logo or a custom title from
15
- * {@link useClientConfig}) followed by a {@link ChatView} once the session starts.
16
- *
17
- * This is the component rendered by {@link defineClient} when no custom component is
18
- * provided.
19
- *
20
- * @example
21
- * ```tsx
22
- * import { App, defineClient } from "@aai/ui";
23
- *
24
- * defineClient(App, { target: "#app", title: "My Agent" });
25
- * ```
26
- *
27
- * @param className - Additional CSS class names applied to the root element.
28
- *
29
- * @public
30
- */
31
- function App({ className }) {
32
- const { title } = useClientConfig();
33
- return /* @__PURE__ */ jsx(StartScreen, {
34
- icon: title ? void 0 : /* @__PURE__ */ jsx(AnsiLogo, {}),
35
- title,
36
- className,
37
- children: /* @__PURE__ */ jsx(ChatView, {})
38
- });
39
- }
40
- //#endregion
41
- export { App };
@@ -1,29 +0,0 @@
1
- import type * as preact from "preact";
2
- /**
3
- * The main chat interface for a voice agent session.
4
- * Displays a header (with title and {@link StateIndicator}), an
5
- * {@link ErrorBanner}, the {@link MessageList}, and session {@link Controls}.
6
- *
7
- * Must be rendered inside a {@link SessionProvider}.
8
- *
9
- * @example
10
- * ```tsx
11
- * <StartScreen icon="🍕" title="Pizza Palace">
12
- * <ChatView />
13
- * </StartScreen>
14
- * ```
15
- *
16
- * @example Pair with a sidebar
17
- * ```tsx
18
- * <SidebarLayout sidebar={<RecipeCard />}>
19
- * <ChatView className="border-l" />
20
- * </SidebarLayout>
21
- * ```
22
- *
23
- * @param className - Additional CSS class names applied to the root element.
24
- *
25
- * @public
26
- */
27
- export declare function ChatView({ className }: {
28
- className?: string;
29
- }): preact.JSX.Element;
@@ -1,61 +0,0 @@
1
- import { useClientConfig } from "../client-context.js";
2
- import { useSession } from "../signals.js";
3
- import { Controls } from "./controls.js";
4
- import { ErrorBanner } from "./error-banner.js";
5
- import { MessageList } from "./message-list.js";
6
- import { StateIndicator } from "./state-indicator.js";
7
- import clsx from "clsx";
8
- import { jsx, jsxs } from "preact/jsx-runtime";
9
- //#region _components/chat-view.tsx
10
- /**
11
- * The main chat interface for a voice agent session.
12
- * Displays a header (with title and {@link StateIndicator}), an
13
- * {@link ErrorBanner}, the {@link MessageList}, and session {@link Controls}.
14
- *
15
- * Must be rendered inside a {@link SessionProvider}.
16
- *
17
- * @example
18
- * ```tsx
19
- * <StartScreen icon="🍕" title="Pizza Palace">
20
- * <ChatView />
21
- * </StartScreen>
22
- * ```
23
- *
24
- * @example Pair with a sidebar
25
- * ```tsx
26
- * <SidebarLayout sidebar={<RecipeCard />}>
27
- * <ChatView className="border-l" />
28
- * </SidebarLayout>
29
- * ```
30
- *
31
- * @param className - Additional CSS class names applied to the root element.
32
- *
33
- * @public
34
- */
35
- function ChatView({ className }) {
36
- const { session } = useSession();
37
- const { title } = useClientConfig();
38
- return /* @__PURE__ */ jsxs("div", {
39
- class: clsx("flex flex-col h-screen max-w-130 mx-auto bg-aai-bg text-aai-text font-aai text-sm", className),
40
- children: [
41
- /* @__PURE__ */ jsxs("div", {
42
- class: "flex items-center gap-3 px-4 py-3 border-b border-aai-border shrink-0",
43
- children: [title ? /* @__PURE__ */ jsx("span", {
44
- class: "text-sm font-semibold text-aai-primary",
45
- children: title
46
- }) : /* @__PURE__ */ jsx("pre", {
47
- class: "font-aai-mono text-[10px] leading-[1.1] font-bold text-aai-primary m-0",
48
- children: "▄▀█ ▄▀█ █\n█▀█ █▀█ █"
49
- }), /* @__PURE__ */ jsx("div", {
50
- class: "ml-auto",
51
- children: /* @__PURE__ */ jsx(StateIndicator, { state: session.state })
52
- })]
53
- }),
54
- /* @__PURE__ */ jsx(ErrorBanner, { error: session.error }),
55
- /* @__PURE__ */ jsx(MessageList, {}),
56
- /* @__PURE__ */ jsx(Controls, {})
57
- ]
58
- });
59
- }
60
- //#endregion
61
- export { ChatView };
@@ -1,21 +0,0 @@
1
- import type * as preact from "preact";
2
- import type { Reactive, SessionError } from "../types.ts";
3
- /**
4
- * Displays a session error as a styled inline banner.
5
- * Returns `null` when there is no active error.
6
- *
7
- * @example
8
- * ```tsx
9
- * const { session } = useSession();
10
- * <ErrorBanner error={session.error} />
11
- * ```
12
- *
13
- * @param error - A reactive {@link SessionError} (or `null`).
14
- * @param className - Additional CSS class names.
15
- *
16
- * @public
17
- */
18
- export declare function ErrorBanner({ error, className, }: {
19
- error: Reactive<SessionError | null>;
20
- className?: string;
21
- }): preact.JSX.Element | null;
@@ -1,27 +0,0 @@
1
- import clsx from "clsx";
2
- import { jsx } from "preact/jsx-runtime";
3
- //#region _components/error-banner.tsx
4
- /**
5
- * Displays a session error as a styled inline banner.
6
- * Returns `null` when there is no active error.
7
- *
8
- * @example
9
- * ```tsx
10
- * const { session } = useSession();
11
- * <ErrorBanner error={session.error} />
12
- * ```
13
- *
14
- * @param error - A reactive {@link SessionError} (or `null`).
15
- * @param className - Additional CSS class names.
16
- *
17
- * @public
18
- */
19
- function ErrorBanner({ error, className }) {
20
- if (!error.value) return null;
21
- return /* @__PURE__ */ jsx("div", {
22
- class: clsx("mx-4 mt-3 px-3 py-2 rounded-aai border border-aai-error/40 bg-aai-error/8 text-[13px] leading-[130%] text-aai-error", className),
23
- children: error.value.message
24
- });
25
- }
26
- //#endregion
27
- export { ErrorBanner };
@@ -1,23 +0,0 @@
1
- import type * as preact from "preact";
2
- import type { ChatMessage } from "../types.ts";
3
- /**
4
- * Renders a single chat message as a styled bubble.
5
- *
6
- * - **User** messages appear right-aligned with a faint surface background.
7
- * - **Assistant** messages appear left-aligned as plain text.
8
- *
9
- * @example
10
- * ```tsx
11
- * <MessageBubble message={{ role: "user", content: "Hello!" }} />
12
- * <MessageBubble message={{ role: "assistant", content: "Hi there!" }} />
13
- * ```
14
- *
15
- * @param message - The chat message to display (see {@link ChatMessage}).
16
- * @param className - Additional CSS class names applied to the root element.
17
- *
18
- * @public
19
- */
20
- export declare function MessageBubble({ message, className, }: {
21
- message: ChatMessage;
22
- className?: string;
23
- }): preact.JSX.Element;
@@ -1,35 +0,0 @@
1
- import clsx from "clsx";
2
- import { jsx } from "preact/jsx-runtime";
3
- //#region _components/message-bubble.tsx
4
- /**
5
- * Renders a single chat message as a styled bubble.
6
- *
7
- * - **User** messages appear right-aligned with a faint surface background.
8
- * - **Assistant** messages appear left-aligned as plain text.
9
- *
10
- * @example
11
- * ```tsx
12
- * <MessageBubble message={{ role: "user", content: "Hello!" }} />
13
- * <MessageBubble message={{ role: "assistant", content: "Hi there!" }} />
14
- * ```
15
- *
16
- * @param message - The chat message to display (see {@link ChatMessage}).
17
- * @param className - Additional CSS class names applied to the root element.
18
- *
19
- * @public
20
- */
21
- function MessageBubble({ message, className }) {
22
- if (message.role === "user") return /* @__PURE__ */ jsx("div", {
23
- class: clsx("flex flex-col w-full items-end", className),
24
- children: /* @__PURE__ */ jsx("div", {
25
- class: "max-w-[min(82%,64ch)] bg-aai-surface-faint border border-aai-border px-3 py-2 rounded-aai whitespace-pre-wrap wrap-break-word text-sm font-normal leading-[150%] text-aai-text",
26
- children: message.content
27
- })
28
- });
29
- return /* @__PURE__ */ jsx("div", {
30
- class: clsx("whitespace-pre-wrap wrap-break-word text-sm font-normal leading-[150%] text-aai-text", className),
31
- children: message.content
32
- });
33
- }
34
- //#endregion
35
- export { MessageBubble };
@@ -1,76 +0,0 @@
1
- import { useAutoScroll, useSession } from "../signals.js";
2
- import { MessageBubble } from "./message-bubble.js";
3
- import { ThinkingIndicator } from "./thinking-indicator.js";
4
- import { ToolCallBlock } from "./tool-call-block.js";
5
- import { Transcript } from "./transcript.js";
6
- import clsx from "clsx";
7
- import { useComputed } from "@preact/signals";
8
- import { jsx, jsxs } from "preact/jsx-runtime";
9
- //#region _components/message-list.tsx
10
- /**
11
- * Scrollable list of all chat messages, tool-call blocks, live transcript,
12
- * streaming agent utterance, and a thinking indicator.
13
- *
14
- * Messages and tool calls are interleaved in the correct order. The list
15
- * auto-scrolls to the latest content via {@link useAutoScroll}.
16
- *
17
- * Must be rendered inside a {@link SessionProvider}.
18
- *
19
- * @example
20
- * ```tsx
21
- * <MessageList className="flex-1" />
22
- * ```
23
- *
24
- * @param className - Additional CSS class names applied to the scroll container.
25
- *
26
- * @public
27
- */
28
- function MessageList({ className }) {
29
- const { session } = useSession();
30
- const scrollRef = useAutoScroll();
31
- const showThinking = useComputed(() => {
32
- if (session.state.value !== "thinking") return false;
33
- const last = session.toolCalls.value.at(-1);
34
- if (last?.status === "pending") return false;
35
- const lastMsg = session.messages.value.at(-1);
36
- return !lastMsg || lastMsg.role === "user" || Boolean(last);
37
- });
38
- const messages = session.messages.value;
39
- const toolCalls = session.toolCalls.value;
40
- const items = [];
41
- let tci = 0;
42
- for (const [i, msg] of messages.entries()) {
43
- items.push(/* @__PURE__ */ jsx(MessageBubble, { message: msg }, `msg-${i}`));
44
- let tc = toolCalls[tci];
45
- while (tc && tc.afterMessageIndex <= i) {
46
- items.push(/* @__PURE__ */ jsx(ToolCallBlock, { toolCall: tc }, tc.toolCallId));
47
- tci++;
48
- tc = toolCalls[tci];
49
- }
50
- }
51
- let tc = toolCalls[tci];
52
- while (tc) {
53
- items.push(/* @__PURE__ */ jsx(ToolCallBlock, { toolCall: tc }, tc.toolCallId));
54
- tci++;
55
- tc = toolCalls[tci];
56
- }
57
- return /* @__PURE__ */ jsx("div", {
58
- role: "log",
59
- class: clsx("flex-1 overflow-y-auto [scrollbar-width:none] bg-aai-surface", className),
60
- children: /* @__PURE__ */ jsxs("div", {
61
- class: "flex flex-col gap-4.5 p-4",
62
- children: [
63
- items,
64
- session.agentUtterance.value && /* @__PURE__ */ jsx(MessageBubble, { message: {
65
- role: "assistant",
66
- content: session.agentUtterance.value
67
- } }),
68
- /* @__PURE__ */ jsx(Transcript, { userUtterance: session.userUtterance }),
69
- showThinking.value && /* @__PURE__ */ jsx(ThinkingIndicator, {}),
70
- /* @__PURE__ */ jsx("div", { ref: scrollRef })
71
- ]
72
- })
73
- });
74
- }
75
- //#endregion
76
- export { MessageList };
@@ -1,21 +0,0 @@
1
- import type { ComponentChildren } from "preact";
2
- /**
3
- * A two-column layout with a fixed-width sidebar and a flexible main area.
4
- * Commonly used to pair a custom sidebar (cart, dashboard) with `<ChatView />`.
5
- *
6
- * @example
7
- * ```tsx
8
- * <SidebarLayout sidebar={<OrderPanel />}>
9
- * <ChatView />
10
- * </SidebarLayout>
11
- * ```
12
- *
13
- * @public
14
- */
15
- export declare function SidebarLayout({ sidebar, children, width, side, className, }: {
16
- sidebar: ComponentChildren;
17
- children: ComponentChildren;
18
- width?: string | undefined;
19
- side?: "left" | "right" | undefined;
20
- className?: string;
21
- }): import("preact").JSX.Element;
@@ -1,36 +0,0 @@
1
- import clsx from "clsx";
2
- import { jsx, jsxs } from "preact/jsx-runtime";
3
- //#region _components/sidebar-layout.tsx
4
- /**
5
- * A two-column layout with a fixed-width sidebar and a flexible main area.
6
- * Commonly used to pair a custom sidebar (cart, dashboard) with `<ChatView />`.
7
- *
8
- * @example
9
- * ```tsx
10
- * <SidebarLayout sidebar={<OrderPanel />}>
11
- * <ChatView />
12
- * </SidebarLayout>
13
- * ```
14
- *
15
- * @public
16
- */
17
- function SidebarLayout({ sidebar, children, width = "20rem", side = "left", className }) {
18
- const sidebarEl = /* @__PURE__ */ jsx("div", {
19
- class: clsx("flex-shrink-0 flex flex-col overflow-y-auto", side === "left" ? "border-r border-aai-border" : "border-l border-aai-border"),
20
- style: { width },
21
- children: sidebar
22
- });
23
- return /* @__PURE__ */ jsxs("div", {
24
- class: clsx("flex h-screen bg-aai-bg", className),
25
- children: [
26
- side === "left" && sidebarEl,
27
- /* @__PURE__ */ jsx("div", {
28
- class: "flex-1 min-w-0",
29
- children
30
- }),
31
- side === "right" && sidebarEl
32
- ]
33
- });
34
- }
35
- //#endregion
36
- export { SidebarLayout };
@@ -1,29 +0,0 @@
1
- import type * as preact from "preact";
2
- import type { AgentState, Reactive } from "../types.ts";
3
- /**
4
- * Colored dot + label showing the current {@link AgentState}.
5
- *
6
- * State-to-color mapping:
7
- * - `disconnected` — gray
8
- * - `connecting` — yellow
9
- * - `ready` — green
10
- * - `listening` — blue
11
- * - `thinking` — purple
12
- * - `speaking` — red
13
- * - `error` — red
14
- *
15
- * @example
16
- * ```tsx
17
- * const { session } = useSession();
18
- * <StateIndicator state={session.state} />
19
- * ```
20
- *
21
- * @param state - A reactive {@link AgentState} value.
22
- * @param className - Additional CSS class names.
23
- *
24
- * @public
25
- */
26
- export declare function StateIndicator({ state, className, }: {
27
- state: Reactive<AgentState>;
28
- className?: string;
29
- }): preact.JSX.Element;
@@ -1,37 +0,0 @@
1
- import clsx from "clsx";
2
- import { jsx, jsxs } from "preact/jsx-runtime";
3
- //#region _components/state-indicator.tsx
4
- /**
5
- * Colored dot + label showing the current {@link AgentState}.
6
- *
7
- * State-to-color mapping:
8
- * - `disconnected` — gray
9
- * - `connecting` — yellow
10
- * - `ready` — green
11
- * - `listening` — blue
12
- * - `thinking` — purple
13
- * - `speaking` — red
14
- * - `error` — red
15
- *
16
- * @example
17
- * ```tsx
18
- * const { session } = useSession();
19
- * <StateIndicator state={session.state} />
20
- * ```
21
- *
22
- * @param state - A reactive {@link AgentState} value.
23
- * @param className - Additional CSS class names.
24
- *
25
- * @public
26
- */
27
- function StateIndicator({ state, className }) {
28
- return /* @__PURE__ */ jsxs("div", {
29
- class: clsx("inline-flex items-center justify-center gap-1.5 text-[13px] font-medium leading-[130%] text-aai-text-muted capitalize", className),
30
- children: [/* @__PURE__ */ jsx("div", {
31
- "data-state": state.value,
32
- class: "w-2 h-2 rounded-full data-[state=disconnected]:bg-aai-state-disconnected data-[state=connecting]:bg-aai-state-connecting data-[state=ready]:bg-aai-state-ready data-[state=listening]:bg-aai-state-listening data-[state=thinking]:bg-aai-state-thinking data-[state=speaking]:bg-aai-state-speaking data-[state=error]:bg-aai-state-error"
33
- }), state.value]
34
- });
35
- }
36
- //#endregion
37
- export { StateIndicator };
@@ -1,16 +0,0 @@
1
- import type * as preact from "preact";
2
- /**
3
- * Animated three-dot "thinking" indicator shown while the agent is processing.
4
- *
5
- * @example
6
- * ```tsx
7
- * {isThinking && <ThinkingIndicator />}
8
- * ```
9
- *
10
- * @param className - Additional CSS class names.
11
- *
12
- * @public
13
- */
14
- export declare function ThinkingIndicator({ className }: {
15
- className?: string;
16
- }): preact.JSX.Element;
@@ -1,34 +0,0 @@
1
- import clsx from "clsx";
2
- import { jsx } from "preact/jsx-runtime";
3
- //#region _components/thinking-indicator.tsx
4
- const DOT_STYLES = [
5
- 0,
6
- .16,
7
- .32
8
- ].map((delay) => ({
9
- animation: "aai-bounce 1.4s infinite ease-in-out both",
10
- animationDelay: `${delay}s`
11
- }));
12
- /**
13
- * Animated three-dot "thinking" indicator shown while the agent is processing.
14
- *
15
- * @example
16
- * ```tsx
17
- * {isThinking && <ThinkingIndicator />}
18
- * ```
19
- *
20
- * @param className - Additional CSS class names.
21
- *
22
- * @public
23
- */
24
- function ThinkingIndicator({ className }) {
25
- return /* @__PURE__ */ jsx("div", {
26
- class: clsx("flex items-center gap-2 text-aai-text-dim text-sm font-medium min-h-5", className),
27
- children: DOT_STYLES.map((style, i) => /* @__PURE__ */ jsx("div", {
28
- class: "w-1.5 h-1.5 rounded-full bg-aai-text-dim",
29
- style
30
- }, i))
31
- });
32
- }
33
- //#endregion
34
- export { ThinkingIndicator };