@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
package/styles.css CHANGED
@@ -1,30 +1,38 @@
1
1
  @import "tailwindcss";
2
+
2
3
  @source "./";
3
4
  @source "../dist/ui/";
4
5
 
6
+ /*
7
+ * AssemblyAI design system ("website refresh") tokens.
8
+ * - font-aai: Monument Grotesk when the host page loads it, warm system
9
+ * grotesque otherwise (the package ships no font binaries).
10
+ * - font-aai-serif: editorial serif for headings (Source Serif 4 stand-in,
11
+ * graceful Georgia-class fallbacks).
12
+ * - font-aai-mono: JetBrains Mono stand-in for code/tool rows.
13
+ * - radius-aai: the refresh's squared-off 4px control radius.
14
+ * - color-aai-*: the five `ClientTheme` fields, so a Tailwind class can see
15
+ * them. `ThemeProvider` writes `--aai-bg` … `--aai-primary` onto `:root`
16
+ * from `client({ theme })`; these map them into Tailwind's `--color-*`
17
+ * namespace, which is what makes `bg-aai-surface`, `text-aai-text`,
18
+ * `border-aai-border` and `text-aai-primary` real utilities. The fallbacks
19
+ * ARE the default theme, so the classes work on a page that mounts no
20
+ * provider at all (a static page, a Storybook frame) instead of collapsing
21
+ * to transparent — and they must be kept in step with `DEFAULT_THEME` in
22
+ * `context.ts`, which `theme-css-vars.test.ts` asserts.
23
+ */
5
24
  @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;
25
+ --color-aai-bg: var(--aai-bg, #fbf8f2);
26
+ --color-aai-surface: var(--aai-surface, #ffffff);
27
+ --color-aai-text: var(--aai-text, #1b1a18);
28
+ --color-aai-border: var(--aai-border, #dcd7cc);
29
+ --color-aai-primary: var(--aai-primary, #3f2bc1);
30
+ --font-aai:
31
+ "Monument Grotesk", "ABC Monument Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
32
+ --font-aai-serif:
33
+ "Source Serif 4", "Source Serif Pro", Charter, "Iowan Old Style", Georgia, serif;
34
+ --font-aai-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
35
+ --radius-aai: 4px;
28
36
  }
29
37
 
30
38
  @layer base {
@@ -32,7 +40,18 @@
32
40
  body {
33
41
  margin: 0;
34
42
  padding: 0;
35
- background: var(--color-aai-bg);
43
+ }
44
+ }
45
+
46
+ @keyframes aai-pulse {
47
+ 0%,
48
+ 100% {
49
+ opacity: 1;
50
+ transform: scale(1);
51
+ }
52
+ 50% {
53
+ opacity: 0.45;
54
+ transform: scale(0.82);
36
55
  }
37
56
  }
38
57
 
@@ -59,15 +78,118 @@
59
78
  }
60
79
 
61
80
  .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
- );
81
+ background: linear-gradient(90deg, currentColor 25%, transparent 50%, currentColor 75%);
68
82
  background-size: 200% 100%;
69
83
  -webkit-background-clip: text;
70
84
  background-clip: text;
71
85
  -webkit-text-fill-color: transparent;
72
- animation: aai-shimmer 2s ease-in-out infinite;
86
+ animation: aai-shimmer 2s infinite;
87
+ }
88
+
89
+ /*
90
+ * Reduced motion is honoured HERE, once, for everything this stylesheet reaches.
91
+ *
92
+ * Roughly nineteen INFINITE animations ship in an aai app and, until this block,
93
+ * not one of them asked: `prefers-reduced-motion` appeared zero times in the
94
+ * repository. `aai-pulse` on the console shell's live dot, `aai-bounce` on the
95
+ * thinking dots, `aai-shimmer` on every streaming tool row, Tailwind's
96
+ * `animate-pulse` on an indeterminate upload bar — all of them running for as
97
+ * long as the page is open. For a reader with a vestibular disorder that is not
98
+ * decoration, it is the reason they close the tab.
99
+ *
100
+ * **The universal selector is the leverage point, and it is the only thing that
101
+ * reaches the TEMPLATES.** Every template's `client.tsx` opens with
102
+ * `import "@alexkroman1/aai-ui/styles.css"`, and several then declare keyframes
103
+ * of their own in an inline `<style>` block: `dc-pulse`/`dc-slide-in`
104
+ * (emergency-dispatch-agent), `rt-pulse`/`rt-slide-in` (retail), `crisisPulse`
105
+ * (tabletop-rpg-agent), and `ic-flicker`/`ic-scanline`/`ic-pulse` (text-adventure-agent,
106
+ * which flickers the whole viewport's opacity and sweeps a scanline across the
107
+ * page — the worst thing in the repo for a motion-sensitive reader). Nothing in
108
+ * this package knows those names, and no per-component fix could: it would have
109
+ * to be written again in every template, by every author who copies one, and
110
+ * the author who forgets leaves no trace in a diff. A universal selector does
111
+ * not need to know the name of the animation it is stopping. That is also what
112
+ * makes this the right FILE rather than merely a convenient one — the published
113
+ * sheet is the single artifact every client already imports, so a template opts
114
+ * in by existing, and one written next year opts in before it is written.
115
+ *
116
+ * Four properties, because motion arrives four ways:
117
+ *
118
+ * - `animation-duration` and `animation-iteration-count` — the keyframe half.
119
+ * The count carries its own weight: cut the duration alone and an `infinite`
120
+ * animation is still infinite, merely very fast, which is worse than what it
121
+ * replaced.
122
+ * - `transition-duration` — the property-change half, which no search for
123
+ * `@keyframes` would ever turn up.
124
+ * - `scroll-behavior` — the CSS half of scrolling: a host page or template
125
+ * declaring `scroll-behavior: smooth`, and any `scrollIntoView()` /
126
+ * `scrollTo()` that left the behaviour to CSS. Note what it does NOT reach.
127
+ * `AutoScroll`'s `resize: "smooth"` default is a requestAnimationFrame SPRING
128
+ * inside `use-stick-to-bottom` (which reads no media query of its own, and
129
+ * sets `scroll-behavior: auto` inline while it writes `scrollTop` anyway), so
130
+ * silencing that one is a change in `components/auto-scroll.tsx` and is still
131
+ * owed. Recording the gap beats letting the next reader assume it is covered.
132
+ *
133
+ * `0.01ms` rather than `0s` on both durations is deliberate: a zero-duration
134
+ * animation or transition fires no `animationend`/`transitionend`, so anything
135
+ * awaiting one — ours or a consumer's — waits forever. Effectively instant, and
136
+ * still an event.
137
+ *
138
+ * `!important`, and no `@layer`, is what lets this outrank the three ways motion
139
+ * is actually declared here: a Tailwind utility (`animate-pulse`), a template's
140
+ * own `<style>` block, and the inline `style={{ animation: … }}` that
141
+ * `ConsoleShell` and `MessageList` write — an author `!important` beats a normal
142
+ * inline declaration, which is the only reason those last two are covered. A
143
+ * reader who asked their OS for less motion outranks all three.
144
+ *
145
+ * Biome's `noImportantStyles` warns on all four declarations and the warnings
146
+ * STAY. The rule's argument — that `!important` reverses the cascade — is the
147
+ * property being used on purpose here, this block existing precisely to outrank
148
+ * a declaration written closer to the element. It is not suppressed either: a
149
+ * lint suppression is a counted escape hatch (`pnpm check:hatches`), so
150
+ * silencing a warning that is really a design note would spend four of them, and
151
+ * `biome check .` exits 0 on warnings, so nothing is gated on it.
152
+ *
153
+ * `src/styles-motion.test.ts` asserts this block against the stylesheet SOURCE,
154
+ * a spec having no way to render CSS.
155
+ */
156
+ @media (prefers-reduced-motion: reduce) {
157
+ *,
158
+ *::before,
159
+ *::after {
160
+ animation-duration: 0.01ms !important;
161
+ animation-iteration-count: 1 !important;
162
+ transition-duration: 0.01ms !important;
163
+ scroll-behavior: auto !important;
164
+ }
165
+ }
166
+
167
+ /*
168
+ * `.aai-scroll` — the thin, quiet scrollbar every custom chrome had drawn.
169
+ *
170
+ * Four template clients each carried the same three `::-webkit-scrollbar`
171
+ * rules under their own class name, differing only in the thumb colour — which
172
+ * is this package's business to make a variable and not to choose. The thumb
173
+ * defaults to the theme's border token and the track to transparent; a chrome
174
+ * with its own scrollbar palette sets `--aai-scrollbar-thumb` and
175
+ * `--aai-scrollbar-track` on the element or an ancestor (in its own `<style>`
176
+ * block, or as an inline custom property) and keeps the six lines out of its
177
+ * file. `scrollbar-width`/`scrollbar-color` are the standard half and cover
178
+ * Firefox; the `::-webkit-` pseudo-elements are the half Chromium and WebKit
179
+ * still read.
180
+ */
181
+ .aai-scroll {
182
+ scrollbar-width: thin;
183
+ scrollbar-color: var(--aai-scrollbar-thumb, var(--aai-border, #dcd7cc))
184
+ var(--aai-scrollbar-track, transparent);
185
+ }
186
+ .aai-scroll::-webkit-scrollbar {
187
+ width: 6px;
188
+ }
189
+ .aai-scroll::-webkit-scrollbar-track {
190
+ background: var(--aai-scrollbar-track, transparent);
191
+ }
192
+ .aai-scroll::-webkit-scrollbar-thumb {
193
+ background: var(--aai-scrollbar-thumb, var(--aai-border, #dcd7cc));
194
+ border-radius: 3px;
73
195
  }
@@ -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,50 +0,0 @@
1
- import type * as preact from "preact";
2
- /**
3
- * Visual style of a {@link Button}.
4
- *
5
- * - `"default"` — Primary filled button (accent background).
6
- * - `"secondary"` — Muted surface background with border.
7
- * - `"ghost"` — Transparent background with border.
8
- *
9
- * @public
10
- */
11
- export type ButtonVariant = "default" | "secondary" | "ghost";
12
- /**
13
- * Size preset for a {@link Button}.
14
- *
15
- * - `"default"` — Compact (height 2rem / 32 px).
16
- * - `"lg"` — Large with generous padding, suitable for primary CTAs.
17
- *
18
- * @public
19
- */
20
- export type ButtonSize = "default" | "lg";
21
- /**
22
- * A styled button with variant and size presets.
23
- *
24
- * Accepts all standard `<button>` HTML attributes in addition to the props
25
- * listed below.
26
- *
27
- * @example
28
- * ```tsx
29
- * <Button variant="secondary" onClick={handleClick}>
30
- * Stop
31
- * </Button>
32
- *
33
- * <Button size="lg" className="w-full">
34
- * Start Conversation
35
- * </Button>
36
- * ```
37
- *
38
- * @param variant - Visual style (`"default"` | `"secondary"` | `"ghost"`). Defaults to `"default"`.
39
- * @param size - Size preset (`"default"` | `"lg"`). Defaults to `"default"`.
40
- * @param className - Additional CSS class names.
41
- * @param children - Button label / content.
42
- *
43
- * @public
44
- */
45
- export declare function Button({ variant, size, className, children, ...rest }: {
46
- variant?: ButtonVariant;
47
- size?: ButtonSize;
48
- className?: string;
49
- children?: preact.ComponentChildren;
50
- } & Omit<preact.JSX.HTMLAttributes<HTMLButtonElement>, "className">): preact.JSX.Element;
@@ -1,46 +0,0 @@
1
- import clsx from "clsx";
2
- import { jsx } from "preact/jsx-runtime";
3
- //#region _components/button.tsx
4
- const LG_STYLE = {
5
- display: "grid",
6
- placeItems: "center",
7
- appearance: "none",
8
- margin: 0,
9
- padding: "12px 32px",
10
- lineHeight: 1
11
- };
12
- /**
13
- * A styled button with variant and size presets.
14
- *
15
- * Accepts all standard `<button>` HTML attributes in addition to the props
16
- * listed below.
17
- *
18
- * @example
19
- * ```tsx
20
- * <Button variant="secondary" onClick={handleClick}>
21
- * Stop
22
- * </Button>
23
- *
24
- * <Button size="lg" className="w-full">
25
- * Start Conversation
26
- * </Button>
27
- * ```
28
- *
29
- * @param variant - Visual style (`"default"` | `"secondary"` | `"ghost"`). Defaults to `"default"`.
30
- * @param size - Size preset (`"default"` | `"lg"`). Defaults to `"default"`.
31
- * @param className - Additional CSS class names.
32
- * @param children - Button label / content.
33
- *
34
- * @public
35
- */
36
- function Button({ variant = "default", size = "default", className, children, ...rest }) {
37
- return /* @__PURE__ */ jsx("button", {
38
- type: "button",
39
- style: size === "lg" ? LG_STYLE : void 0,
40
- class: clsx(size !== "lg" && "flex items-center justify-center appearance-none m-0 h-8 px-3 py-1.5 w-fit leading-none", "rounded-aai text-sm font-medium cursor-pointer border outline-none", variant === "secondary" && "bg-aai-surface-hover text-aai-text-secondary border-aai-border", variant === "ghost" && "bg-transparent text-aai-text-secondary border-aai-border", variant === "default" && "bg-aai-primary text-white border-transparent", className),
41
- ...rest,
42
- children
43
- });
44
- }
45
- //#endregion
46
- export { Button };
@@ -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,18 +0,0 @@
1
- /**
2
- * Session control buttons: **Stop / Resume** and **New Conversation**.
3
- *
4
- * Reads session state from {@link useSession}. Must be rendered inside a
5
- * {@link SessionProvider}.
6
- *
7
- * @example
8
- * ```tsx
9
- * <Controls className="justify-end" />
10
- * ```
11
- *
12
- * @param className - Additional CSS class names applied to the container.
13
- *
14
- * @public
15
- */
16
- export declare function Controls({ className }: {
17
- className?: string;
18
- }): import("preact").JSX.Element;
@@ -1,37 +0,0 @@
1
- import { useSession } from "../signals.js";
2
- import { Button } from "./button.js";
3
- import clsx from "clsx";
4
- import { jsx, jsxs } from "preact/jsx-runtime";
5
- //#region _components/controls.tsx
6
- /**
7
- * Session control buttons: **Stop / Resume** and **New Conversation**.
8
- *
9
- * Reads session state from {@link useSession}. Must be rendered inside a
10
- * {@link SessionProvider}.
11
- *
12
- * @example
13
- * ```tsx
14
- * <Controls className="justify-end" />
15
- * ```
16
- *
17
- * @param className - Additional CSS class names applied to the container.
18
- *
19
- * @public
20
- */
21
- function Controls({ className }) {
22
- const { running, toggle, reset } = useSession();
23
- return /* @__PURE__ */ jsxs("div", {
24
- class: clsx("flex gap-2 px-4 py-3 border-t border-aai-border shrink-0", className),
25
- children: [/* @__PURE__ */ jsx(Button, {
26
- variant: "secondary",
27
- onClick: toggle,
28
- children: running.value ? "Stop" : "Resume"
29
- }), /* @__PURE__ */ jsx(Button, {
30
- variant: "ghost",
31
- onClick: reset,
32
- children: "New Conversation"
33
- })]
34
- });
35
- }
36
- //#endregion
37
- export { Controls };
@@ -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,21 +0,0 @@
1
- /**
2
- * Scrollable list of all chat messages, tool-call blocks, live transcript,
3
- * streaming agent utterance, and a thinking indicator.
4
- *
5
- * Messages and tool calls are interleaved in the correct order. The list
6
- * auto-scrolls to the latest content via {@link useAutoScroll}.
7
- *
8
- * Must be rendered inside a {@link SessionProvider}.
9
- *
10
- * @example
11
- * ```tsx
12
- * <MessageList className="flex-1" />
13
- * ```
14
- *
15
- * @param className - Additional CSS class names applied to the scroll container.
16
- *
17
- * @public
18
- */
19
- export declare function MessageList({ className }: {
20
- className?: string;
21
- }): import("preact").JSX.Element;