@alexkroman1/aai-ui 0.12.2 → 0.13.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.
Files changed (215) hide show
  1. package/README.md +257 -0
  2. package/dist/_colors-CpZO-88A.js +78 -0
  3. package/dist/_module-url-C13kAJ87.js +15 -0
  4. package/dist/_page-shell.d.ts +11 -0
  5. package/dist/_recover-run.d.ts +79 -0
  6. package/dist/_repeat-until.d.ts +30 -0
  7. package/dist/_run-controls.d.ts +33 -0
  8. package/dist/_submission-state.d.ts +92 -0
  9. package/dist/_tap-to-talk-state.d.ts +88 -0
  10. package/dist/_utils-Mi-SCFA1.js +47 -0
  11. package/dist/_utils.d.ts +26 -0
  12. package/dist/_web-storage.d.ts +43 -0
  13. package/dist/_workflow-api-ref.d.ts +37 -0
  14. package/dist/_workflow-files.d.ts +34 -0
  15. package/dist/_workflow-test-defs.d.ts +38 -0
  16. package/dist/aai-logo-D8pMVn9_.js +85 -0
  17. package/dist/agent-state-labels.d.ts +65 -0
  18. package/dist/agent-state.d.ts +108 -0
  19. package/dist/audio/capture.d.ts +44 -0
  20. package/dist/audio/index.d.ts +18 -0
  21. package/dist/audio/index.js +431 -0
  22. package/dist/audio/preconnect.d.ts +87 -0
  23. package/dist/audio/voice-io.d.ts +112 -0
  24. package/dist/build-default-client.d.ts +1 -0
  25. package/dist/chat-view-BCbI7gD4.js +396 -0
  26. package/dist/client-config-C7fQrioM.js +139 -0
  27. package/dist/client-config.d.ts +119 -0
  28. package/dist/client-dir.d.ts +44 -0
  29. package/dist/client-dir.js +58 -0
  30. package/dist/client-identity.d.ts +131 -0
  31. package/dist/client-tool.d.ts +51 -0
  32. package/dist/components/_colors.d.ts +73 -0
  33. package/dist/components/_form-readiness.d.ts +56 -0
  34. package/dist/components/_form-values.d.ts +19 -0
  35. package/dist/components/aai-logo.d.ts +12 -0
  36. package/dist/components/audio-result.d.ts +94 -0
  37. package/dist/components/auto-scroll.d.ts +74 -0
  38. package/dist/components/bullet-list.d.ts +74 -0
  39. package/dist/components/button.d.ts +58 -0
  40. package/dist/components/button.js +85 -0
  41. package/dist/components/chat-view.d.ts +35 -0
  42. package/dist/components/chat-view.js +3 -0
  43. package/dist/components/console-shell.d.ts +85 -0
  44. package/dist/components/controls.d.ts +33 -0
  45. package/dist/components/controls.js +49 -0
  46. package/dist/components/conversation-view.d.ts +130 -0
  47. package/dist/components/eyebrow.d.ts +12 -0
  48. package/dist/components/facts.d.ts +81 -0
  49. package/dist/components/form-fields.d.ts +142 -0
  50. package/dist/components/form-types.d.ts +73 -0
  51. package/dist/components/form.d.ts +96 -0
  52. package/dist/components/markdown.d.ts +57 -0
  53. package/dist/components/message-list.d.ts +48 -0
  54. package/dist/components/message-list.js +3 -0
  55. package/dist/components/session-controls.d.ts +125 -0
  56. package/dist/components/session-error-banner.d.ts +69 -0
  57. package/dist/components/session-state-dot.d.ts +111 -0
  58. package/dist/components/sidebar-layout.d.ts +42 -0
  59. package/dist/components/sidebar-layout.js +56 -0
  60. package/dist/components/start-screen.d.ts +37 -0
  61. package/dist/components/start-screen.js +71 -0
  62. package/dist/components/tool-call-block.d.ts +28 -0
  63. package/dist/components/tool-call-block.js +3 -0
  64. package/dist/components/tool-call-row.d.ts +75 -0
  65. package/dist/components/tool-config-context.d.ts +22 -0
  66. package/dist/components/upload-progress.d.ts +76 -0
  67. package/dist/components/url-chips.d.ts +29 -0
  68. package/dist/components/workflow-fields.d.ts +46 -0
  69. package/dist/components/workflow-pending-note.d.ts +81 -0
  70. package/dist/components/workflow-progress.d.ts +81 -0
  71. package/dist/components/workflow-run-error.d.ts +48 -0
  72. package/dist/components/workflow-run-panel.d.ts +79 -0
  73. package/dist/context.d.ts +288 -0
  74. package/dist/context.js +382 -0
  75. package/dist/conversation-log.d.ts +88 -0
  76. package/dist/default-client/assets/_module-url-BX0RuRU2.js +1 -0
  77. package/dist/default-client/assets/audio-cGFGID-2.js +1 -0
  78. package/dist/default-client/assets/capture-processor-BUABoo3_.js +90 -0
  79. package/dist/default-client/assets/index-8ihb1Urm.css +2 -0
  80. package/dist/default-client/assets/index-BQURVARl.js +126 -0
  81. package/dist/default-client/assets/playback-processor-ABOa11j0.js +314 -0
  82. package/dist/default-client/favicon.ico +0 -0
  83. package/dist/default-client/index.html +15 -0
  84. package/dist/default-client.d.ts +23 -0
  85. package/dist/define-client.d.ts +162 -26
  86. package/dist/define-client.js +201 -55
  87. package/dist/eyebrow-UfmSz9yy.js +27 -0
  88. package/dist/hooks-DN4gHYsj.js +182 -0
  89. package/dist/hooks.d.ts +172 -0
  90. package/dist/hooks.js +3 -0
  91. package/dist/hooks.test-d.d.ts +14 -0
  92. package/dist/inbox-protocol.d.ts +128 -0
  93. package/dist/inbox.d.ts +132 -0
  94. package/dist/index.d.ts +129 -32
  95. package/dist/index.js +5503 -18
  96. package/dist/internal.d.ts +43 -0
  97. package/dist/internal.js +8 -0
  98. package/dist/linked-client.d.ts +70 -0
  99. package/dist/message-list-DHZcLhRA.js +682 -0
  100. package/dist/notice-player.d.ts +70 -0
  101. package/dist/page.d.ts +114 -0
  102. package/dist/phone.d.ts +50 -0
  103. package/dist/route-fetch.d.ts +79 -0
  104. package/dist/session/audio-effects.d.ts +31 -0
  105. package/dist/session/audio-setup.d.ts +57 -0
  106. package/dist/session/audio-state.d.ts +157 -0
  107. package/dist/session/browser-session.d.ts +30 -0
  108. package/dist/session/close.d.ts +26 -0
  109. package/dist/session/dial.d.ts +65 -0
  110. package/dist/session/handshake.d.ts +60 -0
  111. package/dist/session/index.d.ts +17 -0
  112. package/dist/session/index.js +2 -0
  113. package/dist/session/messages.d.ts +63 -0
  114. package/dist/session/mic.d.ts +64 -0
  115. package/dist/session/preconnect.d.ts +48 -0
  116. package/dist/session/reconnect.d.ts +25 -0
  117. package/dist/session/resume-store.d.ts +57 -0
  118. package/dist/session/state.d.ts +146 -0
  119. package/dist/session/ticket.d.ts +44 -0
  120. package/dist/session/types.d.ts +476 -0
  121. package/dist/session/url.d.ts +17 -0
  122. package/dist/session/user-turn.d.ts +55 -0
  123. package/dist/session-CE0Ipsb3.js +2129 -0
  124. package/dist/stored-value.d.ts +103 -0
  125. package/dist/tool-call-block-uXtMOUWN.js +204 -0
  126. package/dist/tool-config-context-Es4YUzV2.js +19 -0
  127. package/dist/types.d.ts +272 -34
  128. package/dist/types.js +35 -4
  129. package/dist/upload/files.d.ts +83 -0
  130. package/dist/upload/index.d.ts +15 -0
  131. package/dist/upload/pause.d.ts +31 -0
  132. package/dist/upload/recall.d.ts +67 -0
  133. package/dist/upload/report.d.ts +26 -0
  134. package/dist/upload/session.d.ts +99 -0
  135. package/dist/url-chips-oyy_Eiqh.js +239 -0
  136. package/dist/use-client-runs.d.ts +87 -0
  137. package/dist/use-conversation-log.d.ts +86 -0
  138. package/dist/use-conversation.d.ts +131 -0
  139. package/dist/use-copy.d.ts +74 -0
  140. package/dist/use-download-url.d.ts +84 -0
  141. package/dist/use-flash.d.ts +61 -0
  142. package/dist/use-inbox.d.ts +101 -0
  143. package/dist/use-push-to-talk.d.ts +105 -0
  144. package/dist/use-route-mutation.d.ts +113 -0
  145. package/dist/use-route.d.ts +82 -0
  146. package/dist/use-run-key.d.ts +133 -0
  147. package/dist/use-session-controls.d.ts +69 -0
  148. package/dist/use-session-id.d.ts +57 -0
  149. package/dist/use-tap-to-talk.d.ts +138 -0
  150. package/dist/use-user-transcript-uyHhzy4d.js +73 -0
  151. package/dist/use-user-transcript.d.ts +75 -0
  152. package/dist/use-workflow-form.d.ts +285 -0
  153. package/dist/use-workflow-progress.d.ts +137 -0
  154. package/dist/use-workflow-run-DdhWmbx-.js +697 -0
  155. package/dist/use-workflow-run.d.ts +100 -0
  156. package/dist/use-workflow-runs.d.ts +71 -0
  157. package/dist/use-workflow-stream.d.ts +154 -0
  158. package/dist/use-workflows.d.ts +77 -0
  159. package/dist/workflow-client.d.ts +136 -0
  160. package/dist/workflow-def-types.d.ts +31 -0
  161. package/dist/workflow-events.d.ts +39 -0
  162. package/dist/workflow-field-kind.d.ts +95 -0
  163. package/dist/workflow-status-labels.d.ts +35 -0
  164. package/dist/worklets/_module-url.d.ts +10 -0
  165. package/dist/worklets/_playback-bench-harness.d.ts +181 -0
  166. package/dist/worklets/_playback-bench-host.d.ts +63 -0
  167. package/dist/worklets/_playback-bench-page.d.ts +65 -0
  168. package/dist/worklets/_tts-trace-harness.d.ts +142 -0
  169. package/dist/worklets/_worklet-test-utils.d.ts +27 -0
  170. package/dist/worklets/capture-processor.d.ts +4 -2
  171. package/dist/worklets/capture-processor.js +73 -33
  172. package/dist/worklets/playback-processor.d.ts +4 -2
  173. package/dist/worklets/playback-processor.js +258 -42
  174. package/package.json +58 -31
  175. package/styles.css +152 -30
  176. package/dist/_components/app.d.ts +0 -23
  177. package/dist/_components/app.js +0 -41
  178. package/dist/_components/button.d.ts +0 -50
  179. package/dist/_components/button.js +0 -46
  180. package/dist/_components/chat-view.d.ts +0 -29
  181. package/dist/_components/chat-view.js +0 -61
  182. package/dist/_components/controls.d.ts +0 -18
  183. package/dist/_components/controls.js +0 -37
  184. package/dist/_components/error-banner.d.ts +0 -21
  185. package/dist/_components/error-banner.js +0 -27
  186. package/dist/_components/message-bubble.d.ts +0 -23
  187. package/dist/_components/message-bubble.js +0 -35
  188. package/dist/_components/message-list.d.ts +0 -21
  189. package/dist/_components/message-list.js +0 -76
  190. package/dist/_components/sidebar-layout.d.ts +0 -21
  191. package/dist/_components/sidebar-layout.js +0 -36
  192. package/dist/_components/start-screen.d.ts +0 -26
  193. package/dist/_components/start-screen.js +0 -51
  194. package/dist/_components/state-indicator.d.ts +0 -29
  195. package/dist/_components/state-indicator.js +0 -37
  196. package/dist/_components/thinking-indicator.d.ts +0 -16
  197. package/dist/_components/thinking-indicator.js +0 -34
  198. package/dist/_components/tool-call-block.d.ts +0 -27
  199. package/dist/_components/tool-call-block.js +0 -118
  200. package/dist/_components/tool-icons.d.ts +0 -17
  201. package/dist/_components/tool-icons.js +0 -128
  202. package/dist/_components/transcript.d.ts +0 -25
  203. package/dist/_components/transcript.js +0 -35
  204. package/dist/audio.d.ts +0 -45
  205. package/dist/audio.js +0 -121
  206. package/dist/client-context.d.ts +0 -33
  207. package/dist/client-context.js +0 -15
  208. package/dist/client-handler.d.ts +0 -43
  209. package/dist/session-CWB7vmqz.js +0 -429
  210. package/dist/session.d.ts +0 -69
  211. package/dist/session.js +0 -2
  212. package/dist/signals.d.ts +0 -120
  213. package/dist/signals.js +0 -161
  214. package/dist/tsdown.config.d.ts +0 -2
  215. package/dist/types.test-d.d.ts +0 -7
@@ -0,0 +1,111 @@
1
+ import type { ReactNode } from "react";
2
+ import type { AgentState } from "../types.ts";
3
+ /**
4
+ * The dot itself: a coloured circle, pulsing or still.
5
+ *
6
+ * Shared by {@link SessionStateDot} and `ConsoleShell`, which computes its
7
+ * colour from the theme rather than from a palette prop and decides for itself
8
+ * when to pulse. Not on the package barrel — the public component is the one
9
+ * that reads the session.
10
+ *
11
+ * The colour is written to `background` AND `color`, so a caller can extend
12
+ * the dot with a `currentColor` utility (`shadow-[0_0_6px_currentColor]` for a
13
+ * glow) without restating the palette.
14
+ *
15
+ * @internal
16
+ */
17
+ export declare function StateDot({ color, pulseMs, className, title, }: {
18
+ /** The dot's colour. */
19
+ color: string;
20
+ /** Length of one pulse cycle, or `null` for a still dot. */
21
+ pulseMs: number | null;
22
+ /** Size and any extras; the shape classes are the dot's own. */
23
+ className?: string | undefined;
24
+ /** Tooltip text, typically the raw state. */
25
+ title?: string | undefined;
26
+ }): ReactNode;
27
+ /**
28
+ * Props of {@link SessionStateDot}.
29
+ *
30
+ * @public
31
+ */
32
+ export type SessionStateDotProps = {
33
+ /**
34
+ * The dot's colour per {@link AgentState} — the chrome's own palette. A
35
+ * complete record, so a state added upstream is a compile error here rather
36
+ * than a silently unpainted dot; `satisfies Record<AgentState, string>` on the
37
+ * caller's literal is the shape to write it in.
38
+ */
39
+ colors: Readonly<Record<AgentState, string>>;
40
+ /**
41
+ * The words this chrome has a better term for. Anything not named falls back
42
+ * to {@link AGENT_STATE_LABELS}, so a page overrides one member (`speaking:
43
+ * "Narrating"`) without restating the union.
44
+ */
45
+ labels?: Partial<Readonly<Record<AgentState, string>>> | undefined;
46
+ /**
47
+ * Whether the dot pulses while `listening` (slowly) and `thinking` (faster).
48
+ * Defaults to `true`; a chrome whose dot glows rather than beats passes
49
+ * `false`.
50
+ */
51
+ pulse?: boolean | undefined;
52
+ /** Additional CSS class names for the wrapping `<span>`, appended to its own. */
53
+ className?: string | undefined;
54
+ /**
55
+ * REPLACES the dot's default size (`w-2 h-2`) rather than adding to it —
56
+ * there is no `tailwind-merge` in this package, so two conflicting width
57
+ * utilities would not have a reliable winner. The dot's shape classes stay.
58
+ */
59
+ dotClassName?: string | undefined;
60
+ /** Additional CSS class names for the label `<span>`. */
61
+ labelClassName?: string | undefined;
62
+ };
63
+ /**
64
+ * The live session state as a coloured dot and a word, on its own narrow
65
+ * subscription.
66
+ *
67
+ * Three custom chromes had each written this: a `satisfies Record<AgentState,
68
+ * string>` palette (kept — it is the prop), a `STATE_LABELS` spread over
69
+ * {@link AGENT_STATE_LABELS} (kept — it is `labels`), and then the same
70
+ * fourteen lines of markup around them, including the same two-arm ternary
71
+ * deciding which states pulse and how fast. `agent-state-labels.ts` argued
72
+ * against a dot component on the grounds that it would take the shared part
73
+ * (the words) hostage to the part that is not (the palette); this takes the
74
+ * palette as a prop precisely so it does not. What is shared is the structure
75
+ * — the exhaustive colour lookup, the label fallback, the pulse rule, the
76
+ * `useSessionStatus()` subscription that keeps the rest of the header from
77
+ * re-rendering at STT-partial rate.
78
+ *
79
+ * Must be rendered inside the providers `mountClient()` installs.
80
+ *
81
+ * @example A dispatch board's readout: its own colours, three of its own words
82
+ * ```tsx
83
+ * import type { AgentState } from "@alexkroman1/aai-ui";
84
+ * import { SessionStateDot } from "@alexkroman1/aai-ui";
85
+ *
86
+ * const STATE_COLORS = {
87
+ * disconnected: "#6b7280",
88
+ * connecting: "#6b7280",
89
+ * ready: "#22c55e",
90
+ * listening: "#22c55e",
91
+ * thinking: "#eab308",
92
+ * speaking: "#3b82f6",
93
+ * error: "#6b7280",
94
+ * } satisfies Record<AgentState, string>;
95
+ *
96
+ * function StatusReadout() {
97
+ * return (
98
+ * <SessionStateDot
99
+ * colors={STATE_COLORS}
100
+ * labels={{ listening: "LISTENING", thinking: "PROCESSING", speaking: "TRANSMITTING" }}
101
+ * labelClassName="text-[11px] uppercase"
102
+ * />
103
+ * );
104
+ * }
105
+ * ```
106
+ *
107
+ * @param props - See {@link SessionStateDotProps}.
108
+ *
109
+ * @public
110
+ */
111
+ export declare function SessionStateDot({ colors, labels, pulse, className, dotClassName, labelClassName, }: SessionStateDotProps): ReactNode;
@@ -0,0 +1,42 @@
1
+ import type { ReactNode } from "react";
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
+ * import { ChatView, SidebarLayout } from "@alexkroman1/aai-ui";
9
+ *
10
+ * function OrderPanel() {
11
+ * return <div>Cart</div>;
12
+ * }
13
+ *
14
+ * function App() {
15
+ * return (
16
+ * <SidebarLayout sidebar={<OrderPanel />}>
17
+ * <ChatView />
18
+ * </SidebarLayout>
19
+ * );
20
+ * }
21
+ * ```
22
+ *
23
+ * @param props - Layout props.
24
+ *
25
+ * @public
26
+ */
27
+ export declare function SidebarLayout({ sidebar, children, sidebarWidth, sidebarPosition, className, }: {
28
+ /** The sidebar pane — a cart, a dashboard, a run history. */
29
+ sidebar: ReactNode;
30
+ /** The main pane, normally a `<ChatView />`. */
31
+ children: ReactNode;
32
+ /**
33
+ * Width of the sidebar as a CSS length. Defaults to `"18rem"`, and applies
34
+ * from the `md` breakpoint up: below it the two panes stack, because a fixed
35
+ * width that never shrinks leaves a phone-width main pane unreadable.
36
+ */
37
+ sidebarWidth?: string | undefined;
38
+ /** Which side the sidebar sits on. Defaults to `"left"`. */
39
+ sidebarPosition?: "left" | "right" | undefined;
40
+ /** Additional CSS class names for the root element, appended to its own. */
41
+ className?: string;
42
+ }): import("react").JSX.Element;
@@ -0,0 +1,56 @@
1
+ import { useTheme } from "../context.js";
2
+ import clsx from "clsx";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/components/sidebar-layout.tsx
5
+ /** @jsxImportSource react */
6
+ /**
7
+ * A two-column layout with a fixed-width sidebar and a flexible main area.
8
+ * Commonly used to pair a custom sidebar (cart, dashboard) with `<ChatView />`.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { ChatView, SidebarLayout } from "@alexkroman1/aai-ui";
13
+ *
14
+ * function OrderPanel() {
15
+ * return <div>Cart</div>;
16
+ * }
17
+ *
18
+ * function App() {
19
+ * return (
20
+ * <SidebarLayout sidebar={<OrderPanel />}>
21
+ * <ChatView />
22
+ * </SidebarLayout>
23
+ * );
24
+ * }
25
+ * ```
26
+ *
27
+ * @param props - Layout props.
28
+ *
29
+ * @public
30
+ */
31
+ function SidebarLayout({ sidebar, children, sidebarWidth = "18rem", sidebarPosition = "left", className }) {
32
+ const theme = useTheme();
33
+ const sidebarEl = /* @__PURE__ */ jsx("div", {
34
+ className: clsx("shrink-0 flex flex-col overflow-y-auto", "w-full max-h-[40vh] md:w-(--aai-sidebar-w) md:max-h-none", sidebarPosition === "left" ? "border-b md:border-b-0 md:border-r" : "border-t md:border-t-0 md:border-l order-last md:order-none"),
35
+ style: { borderColor: theme.border },
36
+ children: sidebar
37
+ });
38
+ const vars = {
39
+ background: theme.bg,
40
+ "--aai-sidebar-w": sidebarWidth
41
+ };
42
+ return /* @__PURE__ */ jsxs("div", {
43
+ className: clsx("flex flex-col md:flex-row min-h-screen md:h-screen", className),
44
+ style: vars,
45
+ children: [
46
+ sidebarPosition === "left" && sidebarEl,
47
+ /* @__PURE__ */ jsx("div", {
48
+ className: "flex-1 min-w-0 min-h-0",
49
+ children
50
+ }),
51
+ sidebarPosition === "right" && sidebarEl
52
+ ]
53
+ });
54
+ }
55
+ //#endregion
56
+ export { SidebarLayout };
@@ -0,0 +1,37 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * A centered start screen: a white card on the cream page with the logo, an
4
+ * eyebrow label, a serif title, subtitle, and the start CTA. Renders
5
+ * `children` (the main app) once the session has started.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { ChatView, StartScreen } from "@alexkroman1/aai-ui";
10
+ *
11
+ * function MyAgent() {
12
+ * return (
13
+ * <StartScreen icon="🍕" title="Pizza Palace" subtitle="Voice-powered ordering">
14
+ * <ChatView />
15
+ * </StartScreen>
16
+ * );
17
+ * }
18
+ * ```
19
+ *
20
+ * @param props - Start-screen props.
21
+ *
22
+ * @public
23
+ */
24
+ export declare function StartScreen({ children, icon, title, subtitle, buttonText, className, }: {
25
+ /** The app, rendered once the session has started. */
26
+ children: ReactNode;
27
+ /** Element rendered in place of the logo on the card. */
28
+ icon?: ReactNode | undefined;
29
+ /** The card's serif title. Defaults to the agent's declared name. */
30
+ title?: string | undefined;
31
+ /** A line under the title. */
32
+ subtitle?: string | undefined;
33
+ /** Label of the start CTA. Defaults to `"Start Conversation"`. */
34
+ buttonText?: string | undefined;
35
+ /** Additional CSS class names for the root element, appended to its own. */
36
+ className?: string | undefined;
37
+ }): ReactNode;
@@ -0,0 +1,71 @@
1
+ import { useSessionCore, useSessionSelector, useTheme } from "../context.js";
2
+ import { a as inkTint } from "../_colors-CpZO-88A.js";
3
+ import { Button } from "./button.js";
4
+ import { t as AaiLogo } from "../aai-logo-D8pMVn9_.js";
5
+ import { t as Eyebrow } from "../eyebrow-UfmSz9yy.js";
6
+ import clsx from "clsx";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/start-screen.tsx
9
+ /** @jsxImportSource react */
10
+ /**
11
+ * A centered start screen: a white card on the cream page with the logo, an
12
+ * eyebrow label, a serif title, subtitle, and the start CTA. Renders
13
+ * `children` (the main app) once the session has started.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * import { ChatView, StartScreen } from "@alexkroman1/aai-ui";
18
+ *
19
+ * function MyAgent() {
20
+ * return (
21
+ * <StartScreen icon="🍕" title="Pizza Palace" subtitle="Voice-powered ordering">
22
+ * <ChatView />
23
+ * </StartScreen>
24
+ * );
25
+ * }
26
+ * ```
27
+ *
28
+ * @param props - Start-screen props.
29
+ *
30
+ * @public
31
+ */
32
+ function StartScreen({ children, icon, title, subtitle, buttonText = "Start Conversation", className }) {
33
+ const started = useSessionSelector((s) => s.started);
34
+ const { start } = useSessionCore();
35
+ const theme = useTheme();
36
+ if (started) return children;
37
+ return /* @__PURE__ */ jsx("div", {
38
+ className: clsx("flex items-center justify-center h-screen font-aai", className),
39
+ style: { background: theme.bg },
40
+ children: /* @__PURE__ */ jsxs("div", {
41
+ className: "flex flex-col items-center gap-5 border rounded-xl px-10 py-12 sm:px-16 sm:py-14 max-w-105 text-center",
42
+ style: {
43
+ background: theme.surface,
44
+ borderColor: theme.border,
45
+ boxShadow: "0 4px 12px -2px rgb(20 18 12 / 0.08)"
46
+ },
47
+ children: [
48
+ icon ?? /* @__PURE__ */ jsx(AaiLogo, { size: 24 }),
49
+ /* @__PURE__ */ jsx(Eyebrow, { children: "Voice Agent" }),
50
+ title && /* @__PURE__ */ jsx("h1", {
51
+ className: "font-aai-serif font-normal text-[32px] leading-[1.15] tracking-[-0.2px] m-0 text-balance",
52
+ style: { color: theme.text },
53
+ children: title
54
+ }),
55
+ subtitle && /* @__PURE__ */ jsx("p", {
56
+ className: "text-[15px] leading-[22px] m-0 max-w-75",
57
+ style: { color: inkTint(theme.text, theme.surface, 75) },
58
+ children: subtitle
59
+ }),
60
+ /* @__PURE__ */ jsx(Button, {
61
+ size: "lg",
62
+ className: "mt-2",
63
+ onClick: start,
64
+ children: buttonText
65
+ })
66
+ ]
67
+ })
68
+ });
69
+ }
70
+ //#endregion
71
+ export { StartScreen };
@@ -0,0 +1,28 @@
1
+ /** @jsxImportSource react */
2
+ import { type ReactNode } from "react";
3
+ import type { ToolCallInfo } from "../types.ts";
4
+ /**
5
+ * Renders a tool invocation as the design system's console row (see
6
+ * `ToolCallRow`): a small outlined "TOOL" chip (or the tool's configured
7
+ * icon), the tool name in mono, a truncated args preview, and a rotating
8
+ * chevron that expands the formatted result.
9
+ *
10
+ * Tool display is configured via `ToolConfigContext`. If no config is found
11
+ * for a tool name, the raw tool name is shown as the title.
12
+ *
13
+ * While the tool call is pending a shimmer animation is shown. Once
14
+ * complete, clicking the row expands the formatted JSON result.
15
+ *
16
+ * Memoized: tool-call objects are referentially stable across session
17
+ * snapshots and rows are keyed on the stable `callId`, so a list update only
18
+ * re-renders the rows whose tool call actually changed.
19
+ *
20
+ * @param toolCall - The tool call to render (see {@link ToolCallInfo}).
21
+ * @param className - Additional CSS class names.
22
+ *
23
+ * @internal Not exported from the package — rendered by `MessageList`.
24
+ */
25
+ export declare const ToolCallBlock: import("react").MemoExoticComponent<({ toolCall, className, }: {
26
+ toolCall: ToolCallInfo;
27
+ className?: string;
28
+ }) => ReactNode>;
@@ -0,0 +1,3 @@
1
+ import "../context.js";
2
+ import { t as ToolCallBlock } from "../tool-call-block-uXtMOUWN.js";
3
+ export { ToolCallBlock };
@@ -0,0 +1,75 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * Size preset for {@link ToolCallRow}: `"default"` is the deployed agent
4
+ * UI's scale, `"compact"` the studio transcript's denser one.
5
+ *
6
+ * @public
7
+ */
8
+ export type ToolCallRowVariant = "default" | "compact";
9
+ /**
10
+ * Props for {@link ToolCallRow}.
11
+ *
12
+ * @public
13
+ */
14
+ export interface ToolCallRowProps {
15
+ /** Tool title, rendered in mono (shimmers while `pending`). */
16
+ title: ReactNode;
17
+ /** One-line detail (typically an args preview), truncated to the row. */
18
+ detail?: ReactNode | undefined;
19
+ /** True while the call is in flight — animates the title with a shimmer. */
20
+ pending?: boolean | undefined;
21
+ /** Optional icon rendered in place of the outlined "TOOL" chip. */
22
+ icon?: ReactNode | undefined;
23
+ /** Size preset; defaults to `"default"`. */
24
+ variant?: ToolCallRowVariant | undefined;
25
+ /** Additional CSS class names for the outer container. */
26
+ className?: string | undefined;
27
+ /**
28
+ * Expanded panel content. When present the row is expandable: a chevron is
29
+ * shown and clicking toggles the panel. When absent the row is inert (the
30
+ * button is disabled). Content provides its own padding and typography;
31
+ * the panel supplies the top border, surface background, and a max height.
32
+ */
33
+ children?: ReactNode;
34
+ }
35
+ /**
36
+ * The design system's console row for one tool invocation: a small outlined
37
+ * "TOOL" chip (or a custom `icon`), the tool title in mono, a truncated
38
+ * detail preview, and a rotating chevron that expands to the panel content.
39
+ *
40
+ * Purely presentational — callers own the mapping from their tool-call data
41
+ * to `title`/`detail`/`pending` and the expanded panel. The deployed agent
42
+ * UI's message list renders it via its tool-call block, and the studio's
43
+ * chat transcript renders it with `variant="compact"`, so the two surfaces
44
+ * read as one component.
45
+ *
46
+ * Colors come from the nearest theme context (see {@link useTheme}); without
47
+ * a provider the default AssemblyAI theme applies.
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * import { ToolCallRow, useSession } from "@alexkroman1/aai-ui";
52
+ *
53
+ * // A custom chrome's tool log, from the snapshot's own `toolCalls`.
54
+ * function ToolLog() {
55
+ * const { toolCalls } = useSession();
56
+ * return (
57
+ * <div>
58
+ * {toolCalls.map((call) => (
59
+ * <ToolCallRow
60
+ * key={call.callId}
61
+ * title={call.name}
62
+ * detail={call.result}
63
+ * pending={call.status === "pending"}
64
+ * />
65
+ * ))}
66
+ * </div>
67
+ * );
68
+ * }
69
+ * ```
70
+ *
71
+ * @param props - See {@link ToolCallRowProps}.
72
+ *
73
+ * @public
74
+ */
75
+ export declare function ToolCallRow({ title, detail, pending, icon, variant, className, children, }: ToolCallRowProps): ReactNode;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Display configuration for a tool call in the UI.
3
+ *
4
+ * @public
5
+ */
6
+ export type ToolDisplayConfig = Record<string, {
7
+ icon?: string;
8
+ label?: string;
9
+ }>;
10
+ /**
11
+ * Context for tool display configuration. Installed by `mountClient()` from
12
+ * `ClientConfig.tools`; the built-in components read it via `useToolConfig`.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare const ToolConfigContext: import("react").Context<ToolDisplayConfig>;
17
+ /**
18
+ * Read tool display configuration from the nearest `ToolConfigContext.Provider`.
19
+ *
20
+ * @internal
21
+ */
22
+ export declare function useToolConfig(): ToolDisplayConfig;
@@ -0,0 +1,76 @@
1
+ import { type ReactNode } from "react";
2
+ import type { UploadStatus } from "../use-workflow-form.ts";
3
+ /**
4
+ * How far a form's files have got, rendered as a bar.
5
+ *
6
+ * The wait this covers is the one a run cannot describe: a workflow run does not
7
+ * EXIST until its input is stored, so from the moment a form is submitted until
8
+ * the last byte lands there is no run id, no status, and nothing for
9
+ * `<WorkflowProgress>` to read — which for a 200 MB recording is minutes of a
10
+ * page that looks stuck. `useWorkflowSubmit` reports the bytes as they go and
11
+ * this is what draws them.
12
+ *
13
+ * Three things it decides, so a page does not:
14
+ *
15
+ * - **It renders nothing when there is nothing to describe.** `upload` is
16
+ * undefined before the first byte and again from the moment the last one
17
+ * lands, so `<UploadProgressBar upload={upload} />` is correct unguarded and a
18
+ * form with no files never shows a bar at all.
19
+ * - **An unknown total is INDETERMINATE, not zero.** A body whose length the
20
+ * transport cannot state up front (see `UploadProgress.total`) has no honest
21
+ * width, and a bar pinned at 0% reads as an upload that is not moving.
22
+ * - **The file is NAMED, and counted when there is more than one.** Files are
23
+ * sent one after another, so a single bar otherwise appears to restart from
24
+ * zero partway through with nothing to say why.
25
+ * - **A paused upload SAYS SO, rather than being a bar that stopped.** Those look
26
+ * identical, which is the whole reason `UploadStatus.paused` exists, and the
27
+ * fill stops animating so the difference is visible without reading.
28
+ *
29
+ * The pause control appears only when a handler for it is passed. That is not
30
+ * politeness about props: a button whose press does nothing is worse than no
31
+ * button, and a page holding an `upload` it did not produce (a saved status, a
32
+ * parent's state) has nothing to pause.
33
+ *
34
+ * @example
35
+ * ```tsx no-check
36
+ * import { Form, SubmitButton, UploadProgressBar, useWorkflowSubmit, WorkflowFields } from "@alexkroman1/aai-ui";
37
+ * import type { transcribe } from "./agent.ts";
38
+ *
39
+ * function TranscribeForm() {
40
+ * const { submitForm, upload, pending, error } = useWorkflowSubmit<typeof transcribe>("transcribe");
41
+ * return (
42
+ * <Form onSubmit={submitForm} error={error}>
43
+ * <WorkflowFields workflow="transcribe" />
44
+ * <UploadProgressBar upload={upload} />
45
+ * <SubmitButton pending={pending}>Transcribe</SubmitButton>
46
+ * </Form>
47
+ * );
48
+ * }
49
+ * ```
50
+ *
51
+ * @param props - Progress-bar props.
52
+ *
53
+ * @public
54
+ */
55
+ export declare function UploadProgressBar({ upload, onPause, onResume, className, }: {
56
+ /**
57
+ * What `useWorkflowSubmit` / `useWorkflowStream` report as `upload`.
58
+ * `undefined` renders nothing, so a page may pass its state straight through
59
+ * and never guard the element.
60
+ */
61
+ upload?: UploadStatus | undefined;
62
+ /**
63
+ * The hook's `pauseUpload`. **Pass it together with `onResume`** to get the
64
+ * pause control; pass neither for a bar that only reports. One without the
65
+ * other is a one-way door drawn as a toggle, so the control is hidden unless
66
+ * both are present.
67
+ */
68
+ onPause?: (() => void) | undefined;
69
+ /** The hook's `resumeUpload`. See `onPause` — the two travel together. */
70
+ onResume?: (() => void) | undefined;
71
+ /**
72
+ * **Replaces** the default classes rather than extending them, so a custom
73
+ * chrome is not fighting a default it did not ask for.
74
+ */
75
+ className?: string | undefined;
76
+ }): ReactNode;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The session's shareable UI URL — the page this UI is served from, what
3
+ * you'd send someone to talk to the agent.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare function UiUrlChip({ className }: {
8
+ className?: string | undefined;
9
+ }): import("react").JSX.Element;
10
+ /**
11
+ * The session's programmatic WebSocket endpoint — the URL a script or backend
12
+ * can connect to directly instead of using this UI.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare function ApiUrlChip({ className }: {
17
+ className?: string | undefined;
18
+ }): import("react").JSX.Element;
19
+ /**
20
+ * The UI and API URLs side by side. They answer the same question — "how do I
21
+ * reach this agent?" — so they belong together and each needs its label to be
22
+ * told apart. Rendered by the default shell in every session mode (S2S,
23
+ * pipeline).
24
+ *
25
+ * @internal
26
+ */
27
+ export declare function SessionUrlChips({ className }: {
28
+ className?: string | undefined;
29
+ }): import("react").JSX.Element;
@@ -0,0 +1,46 @@
1
+ import type { WorkflowSummary } from "@alexkroman1/aai/workflow-api";
2
+ /**
3
+ * Render one field per scalar property of a workflow's input schema.
4
+ *
5
+ * Pass the workflow's NAME and the schema is fetched here; pass a
6
+ * {@link WorkflowSummary} you already hold and nothing is fetched. The name form
7
+ * is the one a page usually wants — it is the same string the submit hook takes,
8
+ * and the alternative is three lines (`useWorkflows()`, a `.find()` by name, and
9
+ * folding that lookup's error into the form's) whose only product is this
10
+ * component's argument.
11
+ *
12
+ * Renders nothing when the workflow declared no schema — a workflow with no
13
+ * declared input takes anything, and a form for "anything" is not a form — and
14
+ * nothing while a named lookup is still in flight, so the hand-written fields
15
+ * beside it are not reordered when the schema lands.
16
+ *
17
+ * @example
18
+ * ```tsx no-check
19
+ * import { Form, SubmitButton, WorkflowFields, useWorkflowSubmit }
20
+ * from "@alexkroman1/aai-ui";
21
+ * import type { transcribe } from "./agent.ts";
22
+ *
23
+ * function StartRun() {
24
+ * const { submitForm, pending, error } = useWorkflowSubmit<typeof transcribe>("transcribe");
25
+ * return (
26
+ * <Form onSubmit={submitForm} error={error}>
27
+ * <WorkflowFields workflow="transcribe" />
28
+ * <SubmitButton pending={pending}>Transcribe</SubmitButton>
29
+ * </Form>
30
+ * );
31
+ * }
32
+ * ```
33
+ *
34
+ * @param props - Field-set props.
35
+ *
36
+ * @public
37
+ */
38
+ export declare function WorkflowFields({ workflow, }: {
39
+ /**
40
+ * The workflow whose input schema to render. A NAME is looked up here (one
41
+ * `GET workflows`); a {@link WorkflowSummary} the page already holds fetches
42
+ * nothing. `undefined` renders nothing, so a page may pass a selection
43
+ * straight through before one is made.
44
+ */
45
+ workflow?: WorkflowSummary | string | undefined;
46
+ }): import("react").JSX.Element | null;