@alexkroman1/aai-ui 0.12.3 → 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 (62) 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/button.d.ts +4 -4
  5. package/dist/components/button.js +27 -4
  6. package/dist/components/chat-view.d.ts +14 -5
  7. package/dist/components/chat-view.js +64 -23
  8. package/dist/components/controls.d.ts +1 -1
  9. package/dist/components/controls.js +7 -4
  10. package/dist/components/message-list.d.ts +2 -2
  11. package/dist/components/message-list.js +100 -27
  12. package/dist/components/sidebar-layout.d.ts +7 -7
  13. package/dist/components/sidebar-layout.js +15 -8
  14. package/dist/components/start-screen.d.ts +4 -4
  15. package/dist/components/start-screen.js +16 -7
  16. package/dist/components/tool-call-block.d.ts +5 -6
  17. package/dist/components/tool-call-block.js +2 -117
  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 +10 -32
  33. package/dist/index.js +7 -14
  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 +21 -17
  39. package/styles.css +3 -33
  40. package/dist/client-context.d.ts +0 -33
  41. package/dist/client-context.js +0 -15
  42. package/dist/client-handler.d.ts +0 -43
  43. package/dist/components/app.d.ts +0 -23
  44. package/dist/components/app.js +0 -41
  45. package/dist/components/error-banner.d.ts +0 -21
  46. package/dist/components/error-banner.js +0 -27
  47. package/dist/components/message-bubble.d.ts +0 -23
  48. package/dist/components/message-bubble.js +0 -35
  49. package/dist/components/state-indicator.d.ts +0 -29
  50. package/dist/components/state-indicator.js +0 -37
  51. package/dist/components/thinking-indicator.d.ts +0 -16
  52. package/dist/components/thinking-indicator.js +0 -34
  53. package/dist/components/tool-icons.d.ts +0 -17
  54. package/dist/components/tool-icons.js +0 -128
  55. package/dist/components/transcript.d.ts +0 -25
  56. package/dist/components/transcript.js +0 -35
  57. package/dist/session-CWB7vmqz.js +0 -429
  58. package/dist/session.d.ts +0 -69
  59. package/dist/session.js +0 -2
  60. package/dist/signals.d.ts +0 -120
  61. package/dist/signals.js +0 -161
  62. 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,33 +0,0 @@
1
- /**
2
- * Theme overrides for the default UI. Applied as CSS custom properties.
3
- *
4
- * @public
5
- */
6
- export type ClientTheme = {
7
- /** Background color. Default: `#101010`. */
8
- bg?: string;
9
- /** Primary accent color. Default: `#fab283`. */
10
- primary?: string;
11
- /** Main text color. */
12
- text?: string;
13
- /** Surface/card color. */
14
- surface?: string;
15
- /** Border color. */
16
- border?: string;
17
- };
18
- /**
19
- * Resolved client-level configuration available to default UI components.
20
- *
21
- * @public
22
- */
23
- export type ClientConfig = {
24
- title?: string | undefined;
25
- theme?: ClientTheme | undefined;
26
- };
27
- export declare const ClientConfigProvider: import("preact").Provider<ClientConfig>;
28
- /**
29
- * Read client config (title, theme) from the nearest provider.
30
- *
31
- * @public
32
- */
33
- export declare function useClientConfig(): ClientConfig;
@@ -1,15 +0,0 @@
1
- import { createContext } from "preact";
2
- import { useContext } from "preact/hooks";
3
- //#region client-context.ts
4
- const Ctx = createContext({});
5
- const ClientConfigProvider = Ctx.Provider;
6
- /**
7
- * Read client config (title, theme) from the nearest provider.
8
- *
9
- * @public
10
- */
11
- function useClientConfig() {
12
- return useContext(Ctx);
13
- }
14
- //#endregion
15
- export { ClientConfigProvider, useClientConfig };
@@ -1,43 +0,0 @@
1
- import type { ReadyConfig } from "@alexkroman1/aai/protocol";
2
- import type { VoiceIO } from "./audio.ts";
3
- import type { AgentState, ChatMessage, Reactive, SessionError, ToolCallInfo } from "./types.ts";
4
- type BatchFn = (fn: () => void) => void;
5
- /**
6
- * Handles server→client messages and updates reactive Preact signals
7
- * accordingly (state transitions, transcripts, messages, audio playback).
8
- *
9
- * @internal Exported for testing only.
10
- */
11
- export declare class ClientHandler {
12
- #private;
13
- constructor(opts: {
14
- state: Reactive<AgentState>;
15
- messages: Reactive<ChatMessage[]>;
16
- toolCalls: Reactive<ToolCallInfo[]>;
17
- userUtterance: Reactive<string | null>;
18
- agentUtterance: Reactive<string | null>;
19
- error: Reactive<SessionError | null>;
20
- voiceIO: () => VoiceIO | null;
21
- batch: BatchFn;
22
- });
23
- /** Single entry point for all server→client session events. */
24
- event(e: import("@alexkroman1/aai/protocol").ClientEvent): void;
25
- /** Enqueue a PCM16 audio chunk for playback. Transitions state to `"speaking"` on the first chunk. */
26
- playAudioChunk(chunk: Uint8Array): void;
27
- /**
28
- * Signal that the server has finished sending audio for this turn.
29
- * Waits for the audio queue to drain, then transitions state to `"listening"`.
30
- * Uses the `#generation` counter to discard stale completions from interrupted turns.
31
- */
32
- playAudioDone(): void;
33
- /**
34
- * Dispatch an incoming WebSocket message (text or binary).
35
- *
36
- * Returns the parsed config if the message is a `config` message,
37
- * otherwise `null`.
38
- */
39
- handleMessage(data: string | ArrayBuffer): (ReadyConfig & {
40
- sessionId?: string;
41
- }) | null;
42
- }
43
- export {};
@@ -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,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,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 };
@@ -1,17 +0,0 @@
1
- import type * as preact from "preact";
2
- type IconProps = {
3
- class?: string;
4
- };
5
- /** Magnifying glass icon for web_search. */
6
- export declare function SearchIcon(props: IconProps): preact.JSX.Element;
7
- /** External link icon for visit_webpage. */
8
- export declare function ExternalLinkIcon(props: IconProps): preact.JSX.Element;
9
- /** Terminal icon for run_code. */
10
- export declare function TerminalIcon(props: IconProps): preact.JSX.Element;
11
- /** Download icon for fetch_json. */
12
- export declare function DownloadIcon(props: IconProps): preact.JSX.Element;
13
- /** Chat bubble icon for user_input. */
14
- export declare function ChatBubbleIcon(props: IconProps): preact.JSX.Element;
15
- /** Bolt/lightning icon for default/unknown tools. */
16
- export declare function BoltIcon(props: IconProps): preact.JSX.Element;
17
- export {};
@@ -1,128 +0,0 @@
1
- import { jsx, jsxs } from "preact/jsx-runtime";
2
- //#region components/tool-icons.tsx
3
- /** Magnifying glass icon for web_search. */
4
- function SearchIcon(props) {
5
- return /* @__PURE__ */ jsxs("svg", {
6
- viewBox: "0 0 16 16",
7
- fill: "none",
8
- stroke: "currentColor",
9
- "stroke-width": "1.5",
10
- class: props.class,
11
- children: [/* @__PURE__ */ jsx("circle", {
12
- cx: "7",
13
- cy: "7",
14
- r: "4.5"
15
- }), /* @__PURE__ */ jsx("path", {
16
- d: "M10.5 10.5L14 14",
17
- "stroke-linecap": "round"
18
- })]
19
- });
20
- }
21
- /** External link icon for visit_webpage. */
22
- function ExternalLinkIcon(props) {
23
- return /* @__PURE__ */ jsxs("svg", {
24
- viewBox: "0 0 16 16",
25
- fill: "none",
26
- stroke: "currentColor",
27
- "stroke-width": "1.5",
28
- class: props.class,
29
- children: [
30
- /* @__PURE__ */ jsx("path", {
31
- d: "M6 2H3a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1v-3",
32
- "stroke-linecap": "round"
33
- }),
34
- /* @__PURE__ */ jsx("path", {
35
- d: "M9 2h5v5",
36
- "stroke-linecap": "round",
37
- "stroke-linejoin": "round"
38
- }),
39
- /* @__PURE__ */ jsx("path", {
40
- d: "M14 2L7 9",
41
- "stroke-linecap": "round"
42
- })
43
- ]
44
- });
45
- }
46
- /** Terminal icon for run_code. */
47
- function TerminalIcon(props) {
48
- return /* @__PURE__ */ jsxs("svg", {
49
- viewBox: "0 0 16 16",
50
- fill: "none",
51
- stroke: "currentColor",
52
- "stroke-width": "1.5",
53
- class: props.class,
54
- children: [
55
- /* @__PURE__ */ jsx("rect", {
56
- x: "1",
57
- y: "2",
58
- width: "14",
59
- height: "12",
60
- rx: "1.5"
61
- }),
62
- /* @__PURE__ */ jsx("path", {
63
- d: "M4 6l3 2.5L4 11",
64
- "stroke-linecap": "round",
65
- "stroke-linejoin": "round"
66
- }),
67
- /* @__PURE__ */ jsx("path", {
68
- d: "M9 11h3",
69
- "stroke-linecap": "round"
70
- })
71
- ]
72
- });
73
- }
74
- /** Download icon for fetch_json. */
75
- function DownloadIcon(props) {
76
- return /* @__PURE__ */ jsxs("svg", {
77
- viewBox: "0 0 16 16",
78
- fill: "none",
79
- stroke: "currentColor",
80
- "stroke-width": "1.5",
81
- class: props.class,
82
- children: [
83
- /* @__PURE__ */ jsx("path", {
84
- d: "M8 2v9",
85
- "stroke-linecap": "round"
86
- }),
87
- /* @__PURE__ */ jsx("path", {
88
- d: "M4.5 8L8 11.5 11.5 8",
89
- "stroke-linecap": "round",
90
- "stroke-linejoin": "round"
91
- }),
92
- /* @__PURE__ */ jsx("path", {
93
- d: "M2 13h12",
94
- "stroke-linecap": "round"
95
- })
96
- ]
97
- });
98
- }
99
- /** Chat bubble icon for user_input. */
100
- function ChatBubbleIcon(props) {
101
- return /* @__PURE__ */ jsx("svg", {
102
- viewBox: "0 0 16 16",
103
- fill: "none",
104
- stroke: "currentColor",
105
- "stroke-width": "1.5",
106
- class: props.class,
107
- children: /* @__PURE__ */ jsx("path", {
108
- d: "M2 3a1 1 0 011-1h10a1 1 0 011 1v7a1 1 0 01-1 1H5l-3 3V3z",
109
- "stroke-linejoin": "round"
110
- })
111
- });
112
- }
113
- /** Bolt/lightning icon for default/unknown tools. */
114
- function BoltIcon(props) {
115
- return /* @__PURE__ */ jsx("svg", {
116
- viewBox: "0 0 16 16",
117
- fill: "none",
118
- stroke: "currentColor",
119
- "stroke-width": "1.5",
120
- class: props.class,
121
- children: /* @__PURE__ */ jsx("path", {
122
- d: "M9 1L3 9h5l-1 6 6-8H8l1-6z",
123
- "stroke-linejoin": "round"
124
- })
125
- });
126
- }
127
- //#endregion
128
- export { BoltIcon, ChatBubbleIcon, DownloadIcon, ExternalLinkIcon, SearchIcon, TerminalIcon };
@@ -1,25 +0,0 @@
1
- import type * as preact from "preact";
2
- import type { Reactive } from "../types.ts";
3
- /**
4
- * Live speech-to-text transcript shown while the user is speaking.
5
- * Returns `null` when there is no active utterance.
6
- *
7
- * Displays a {@link ThinkingIndicator} while waiting for the first
8
- * transcription text (i.e., `userUtterance` is `""`).
9
- *
10
- * @example
11
- * ```tsx
12
- * const { session } = useSession();
13
- * <Transcript userUtterance={session.userUtterance} />
14
- * ```
15
- *
16
- * @param userUtterance - Reactive string (`null` when idle, `""` when
17
- * listening but no text yet, or the transcript text).
18
- * @param className - Additional CSS class names.
19
- *
20
- * @public
21
- */
22
- export declare function Transcript({ userUtterance, className, }: {
23
- userUtterance: Reactive<string | null>;
24
- className?: string;
25
- }): preact.JSX.Element | null;
@@ -1,35 +0,0 @@
1
- import { ThinkingIndicator } from "./thinking-indicator.js";
2
- import clsx from "clsx";
3
- import { jsx } from "preact/jsx-runtime";
4
- //#region components/transcript.tsx
5
- /**
6
- * Live speech-to-text transcript shown while the user is speaking.
7
- * Returns `null` when there is no active utterance.
8
- *
9
- * Displays a {@link ThinkingIndicator} while waiting for the first
10
- * transcription text (i.e., `userUtterance` is `""`).
11
- *
12
- * @example
13
- * ```tsx
14
- * const { session } = useSession();
15
- * <Transcript userUtterance={session.userUtterance} />
16
- * ```
17
- *
18
- * @param userUtterance - Reactive string (`null` when idle, `""` when
19
- * listening but no text yet, or the transcript text).
20
- * @param className - Additional CSS class names.
21
- *
22
- * @public
23
- */
24
- function Transcript({ userUtterance, className }) {
25
- if (userUtterance.value === null) return null;
26
- return /* @__PURE__ */ jsx("div", {
27
- class: clsx("flex flex-col items-end w-full", className),
28
- children: /* @__PURE__ */ jsx("div", {
29
- class: "max-w-[min(82%,64ch)] whitespace-pre-wrap wrap-break-word text-sm leading-[150%] text-aai-text-muted bg-aai-surface-faint border border-aai-border px-3 py-2 rounded-aai ml-auto",
30
- children: userUtterance.value || /* @__PURE__ */ jsx(ThinkingIndicator, {})
31
- })
32
- });
33
- }
34
- //#endregion
35
- export { Transcript };