@alexkroman1/aai-ui 0.12.3 → 0.14.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 (203) hide show
  1. package/README.md +253 -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 +34 -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 +29 -21
  40. package/dist/components/button.js +62 -23
  41. package/dist/components/chat-view.d.ts +24 -18
  42. package/dist/components/chat-view.js +2 -60
  43. package/dist/components/console-shell.d.ts +85 -0
  44. package/dist/components/controls.d.ts +21 -6
  45. package/dist/components/controls.js +31 -19
  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 +34 -7
  54. package/dist/components/message-list.js +2 -75
  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 +31 -10
  59. package/dist/components/sidebar-layout.js +32 -12
  60. package/dist/components/start-screen.d.ts +17 -6
  61. package/dist/components/start-screen.js +34 -14
  62. package/dist/components/tool-call-block.d.ts +15 -14
  63. package/dist/components/tool-call-block.js +2 -117
  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-mpgipo2Q.js +1 -0
  78. package/dist/default-client/assets/capture-processor-D0q7Qrdd.js +90 -0
  79. package/dist/default-client/assets/index-8ihb1Urm.css +2 -0
  80. package/dist/default-client/assets/index-DPfmSFmc.js +126 -0
  81. package/dist/default-client/assets/playback-processor-CjDbc9iH.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-entry.d.ts +6 -0
  85. package/dist/default-client.d.ts +19 -0
  86. package/dist/define-client.d.ts +169 -26
  87. package/dist/define-client.js +209 -55
  88. package/dist/eyebrow-UfmSz9yy.js +27 -0
  89. package/dist/hooks-DN4gHYsj.js +182 -0
  90. package/dist/hooks.d.ts +172 -0
  91. package/dist/hooks.js +3 -0
  92. package/dist/hooks.test-d.d.ts +14 -0
  93. package/dist/inbox-protocol.d.ts +128 -0
  94. package/dist/inbox.d.ts +132 -0
  95. package/dist/index.d.ts +126 -29
  96. package/dist/index.js +5500 -15
  97. package/dist/internal.d.ts +43 -0
  98. package/dist/internal.js +8 -0
  99. package/dist/linked-client.d.ts +70 -0
  100. package/dist/message-list-DHZcLhRA.js +682 -0
  101. package/dist/notice-player.d.ts +70 -0
  102. package/dist/page.d.ts +114 -0
  103. package/dist/phone.d.ts +50 -0
  104. package/dist/route-fetch.d.ts +79 -0
  105. package/dist/session/audio-effects.d.ts +37 -0
  106. package/dist/session/audio-setup.d.ts +57 -0
  107. package/dist/session/audio-state.d.ts +157 -0
  108. package/dist/session/browser-session.d.ts +39 -0
  109. package/dist/session/close.d.ts +26 -0
  110. package/dist/session/dial.d.ts +65 -0
  111. package/dist/session/handshake.d.ts +60 -0
  112. package/dist/session/index.d.ts +17 -0
  113. package/dist/session/index.js +2 -0
  114. package/dist/session/messages.d.ts +63 -0
  115. package/dist/session/mic.d.ts +64 -0
  116. package/dist/session/preconnect.d.ts +48 -0
  117. package/dist/session/reconnect.d.ts +25 -0
  118. package/dist/session/resume-store.d.ts +57 -0
  119. package/dist/session/state.d.ts +146 -0
  120. package/dist/session/ticket.d.ts +44 -0
  121. package/dist/session/types.d.ts +476 -0
  122. package/dist/session/url.d.ts +17 -0
  123. package/dist/session/user-turn.d.ts +55 -0
  124. package/dist/session-D9jM5-TF.js +2140 -0
  125. package/dist/stored-value.d.ts +103 -0
  126. package/dist/tool-call-block-uXtMOUWN.js +204 -0
  127. package/dist/tool-config-context-Es4YUzV2.js +19 -0
  128. package/dist/types.d.ts +272 -34
  129. package/dist/types.js +35 -4
  130. package/dist/upload/files.d.ts +83 -0
  131. package/dist/upload/index.d.ts +15 -0
  132. package/dist/upload/pause.d.ts +31 -0
  133. package/dist/upload/recall.d.ts +67 -0
  134. package/dist/upload/report.d.ts +26 -0
  135. package/dist/upload/session.d.ts +99 -0
  136. package/dist/url-chips-oyy_Eiqh.js +239 -0
  137. package/dist/use-client-runs.d.ts +87 -0
  138. package/dist/use-conversation-log.d.ts +86 -0
  139. package/dist/use-conversation.d.ts +131 -0
  140. package/dist/use-copy.d.ts +74 -0
  141. package/dist/use-download-url.d.ts +84 -0
  142. package/dist/use-flash.d.ts +61 -0
  143. package/dist/use-inbox.d.ts +101 -0
  144. package/dist/use-push-to-talk.d.ts +105 -0
  145. package/dist/use-route-mutation.d.ts +113 -0
  146. package/dist/use-route.d.ts +82 -0
  147. package/dist/use-run-key.d.ts +133 -0
  148. package/dist/use-session-controls.d.ts +69 -0
  149. package/dist/use-session-id.d.ts +57 -0
  150. package/dist/use-tap-to-talk.d.ts +138 -0
  151. package/dist/use-user-transcript-uyHhzy4d.js +73 -0
  152. package/dist/use-user-transcript.d.ts +75 -0
  153. package/dist/use-workflow-form.d.ts +285 -0
  154. package/dist/use-workflow-progress.d.ts +137 -0
  155. package/dist/use-workflow-run-DdhWmbx-.js +697 -0
  156. package/dist/use-workflow-run.d.ts +100 -0
  157. package/dist/use-workflow-runs.d.ts +71 -0
  158. package/dist/use-workflow-stream.d.ts +154 -0
  159. package/dist/use-workflows.d.ts +77 -0
  160. package/dist/workflow-client.d.ts +136 -0
  161. package/dist/workflow-def-types.d.ts +31 -0
  162. package/dist/workflow-events.d.ts +39 -0
  163. package/dist/workflow-field-kind.d.ts +95 -0
  164. package/dist/workflow-status-labels.d.ts +35 -0
  165. package/dist/worklets/_module-url.d.ts +10 -0
  166. package/dist/worklets/_playback-bench-harness.d.ts +181 -0
  167. package/dist/worklets/_playback-bench-host.d.ts +63 -0
  168. package/dist/worklets/_playback-bench-page.d.ts +65 -0
  169. package/dist/worklets/_tts-trace-harness.d.ts +142 -0
  170. package/dist/worklets/_worklet-test-utils.d.ts +27 -0
  171. package/dist/worklets/capture-processor.d.ts +4 -2
  172. package/dist/worklets/capture-processor.js +73 -33
  173. package/dist/worklets/playback-processor.d.ts +4 -2
  174. package/dist/worklets/playback-processor.js +258 -42
  175. package/package.json +59 -32
  176. package/styles.css +152 -30
  177. package/dist/_jsdom-setup.d.ts +0 -0
  178. package/dist/audio.d.ts +0 -45
  179. package/dist/audio.js +0 -121
  180. package/dist/client-context.d.ts +0 -33
  181. package/dist/client-context.js +0 -15
  182. package/dist/client-handler.d.ts +0 -43
  183. package/dist/components/app.d.ts +0 -23
  184. package/dist/components/app.js +0 -41
  185. package/dist/components/error-banner.d.ts +0 -21
  186. package/dist/components/error-banner.js +0 -27
  187. package/dist/components/message-bubble.d.ts +0 -23
  188. package/dist/components/message-bubble.js +0 -35
  189. package/dist/components/state-indicator.d.ts +0 -29
  190. package/dist/components/state-indicator.js +0 -37
  191. package/dist/components/thinking-indicator.d.ts +0 -16
  192. package/dist/components/thinking-indicator.js +0 -34
  193. package/dist/components/tool-icons.d.ts +0 -17
  194. package/dist/components/tool-icons.js +0 -128
  195. package/dist/components/transcript.d.ts +0 -25
  196. package/dist/components/transcript.js +0 -35
  197. package/dist/session-CWB7vmqz.js +0 -429
  198. package/dist/session.d.ts +0 -69
  199. package/dist/session.js +0 -2
  200. package/dist/signals.d.ts +0 -120
  201. package/dist/signals.js +0 -161
  202. package/dist/tsdown.config.d.ts +0 -2
  203. package/dist/types.test-d.d.ts +0 -7
@@ -0,0 +1,130 @@
1
+ /** @jsxImportSource react */
2
+ import type { CSSProperties, ReactNode } from "react";
3
+ import type { ConversationLogEntry } from "../conversation-log.ts";
4
+ import type { ChatMessage, ToolCallInfo } from "../types.ts";
5
+ import type { UseUserTranscriptResult } from "../use-user-transcript.ts";
6
+ /**
7
+ * Props of {@link ConversationView}.
8
+ *
9
+ * @public
10
+ */
11
+ export type ConversationViewProps = {
12
+ /** One finalized message, in this chrome's own markup. */
13
+ renderMessage: (message: ChatMessage) => ReactNode;
14
+ /**
15
+ * One tool invocation. Absent, a compact {@link ToolCallRow} naming the tool,
16
+ * shimmering while it is pending.
17
+ */
18
+ renderTool?: ((toolCall: ToolCallInfo) => ReactNode) | undefined;
19
+ /**
20
+ * The agent's reply as it arrives. Absent, `renderMessage` is called with a
21
+ * synthetic assistant message carrying the text so far (its `id` is `-1`,
22
+ * which no real message has) — every chrome so far rendered the two the same
23
+ * way, and this keeps them from drifting.
24
+ */
25
+ renderStreaming?: ((text: string) => ReactNode) | undefined;
26
+ /**
27
+ * The caller's in-progress turn. Rendered only while `transcript.speaking`,
28
+ * which is the `null`-vs-`""` distinction {@link useUserTranscript} makes
29
+ * (`""` is speech detected with no words yet — render on it, and read
30
+ * `transcript.text` for the placeholder). Absent, a muted italic line.
31
+ */
32
+ renderTranscript?: ((transcript: UseUserTranscriptResult) => ReactNode) | undefined;
33
+ /**
34
+ * Where the transcript row goes. `"inline"` (the default) is the last row
35
+ * inside the scroll region, as `MessageList` places it; `"below"` renders it
36
+ * after the scroll region as a sibling — the strip a two-pane board pins to
37
+ * the bottom of its conversation column, outside the scroll.
38
+ */
39
+ transcriptPosition?: "inline" | "below" | undefined;
40
+ /**
41
+ * A persisted transcript to render IN PLACE of the live session's items —
42
+ * `useConversationLog().entries`, whose newest session entry already is the
43
+ * live conversation. Session entries render through `renderMessage` /
44
+ * `renderTool`, each after `renderSessionHeader`; a `spoken` entry is
45
+ * `renderMessage` over an assistant message (id `-2`); a `note` is
46
+ * `renderNote`. The streaming reply, the transcript and the thinking row are
47
+ * rendered after it as usual.
48
+ */
49
+ log?: readonly ConversationLogEntry[] | undefined;
50
+ /** A log `note`. Absent, a small centred muted line. */
51
+ renderNote?: ((entry: Extract<ConversationLogEntry, {
52
+ kind: "note";
53
+ }>) => ReactNode) | undefined;
54
+ /**
55
+ * What goes above each log `session` entry — a timestamp, a "continue"
56
+ * button. Absent, nothing.
57
+ */
58
+ renderSessionHeader?: ((entry: Extract<ConversationLogEntry, {
59
+ kind: "session";
60
+ }>) => ReactNode) | undefined;
61
+ /** Rendered inside the scroll region while there is nothing to show at all. */
62
+ empty?: ReactNode | undefined;
63
+ /**
64
+ * The `aria-label` of the thinking row. Default `"Thinking"`. Say who: the
65
+ * dots are the only sign the agent is working, and to a screen reader they
66
+ * are punctuation.
67
+ */
68
+ thinkingLabel?: string | undefined;
69
+ /** What the thinking row shows. Default: three pulsing dots. */
70
+ thinkingIndicator?: ReactNode | undefined;
71
+ /** CSS class names for the thinking row itself (the `role="status"` element). */
72
+ thinkingClassName?: string | undefined;
73
+ /**
74
+ * Classes for the {@link AutoScroll} container. It must end up with a
75
+ * bounded height (`flex-1 min-h-0`, `h-full`) or nothing pins.
76
+ */
77
+ className?: string | undefined;
78
+ /** Classes for the scroll region's content element — padding, gap, direction. */
79
+ contentClassName?: string | undefined;
80
+ /** Classes for the scrolling element itself. See {@link AutoScroll}. */
81
+ scrollClassName?: string | undefined;
82
+ /** Inline styles for the scroll container. */
83
+ style?: CSSProperties | undefined;
84
+ };
85
+ /**
86
+ * The conversation's skeleton over {@link useConversation}, with every row a
87
+ * render slot: a pinned scroll region holding the empty state, the interleaved
88
+ * messages and tool calls, the streaming reply and the announced thinking row,
89
+ * plus the live transcript — inside the scroll or pinned beneath it.
90
+ *
91
+ * `useConversation()` already made the DATA one thing: the interleave, the
92
+ * streaming utterance, the `null`-vs-`""` transcript distinction and the
93
+ * thinking-suppression rule. What three custom chromes then each wrote around
94
+ * it was the same fifty lines of STRUCTURE: an `AutoScroll` with a bounded
95
+ * height, an empty-state guard on `items.length === 0 && streaming === null`,
96
+ * the map with its keys, the streaming row, the thinking row with its
97
+ * `role="status"` and `aria-label` (and the same comment about screen readers
98
+ * hearing punctuation), the transcript guarded on `speaking`. The bubbles are
99
+ * the part each template exists to show, so those are slots; the order and the
100
+ * accessibility contract are this component's.
101
+ *
102
+ * {@link MessageList} is this with the stock bubbles filled in.
103
+ *
104
+ * Must be rendered inside the providers `mountClient()` installs.
105
+ *
106
+ * @example A board's radio log: its own bubbles, the stock tool row, the transcript pinned below
107
+ * ```tsx
108
+ * import { ConversationView } from "@alexkroman1/aai-ui";
109
+ *
110
+ * function RadioLog() {
111
+ * return (
112
+ * <ConversationView
113
+ * contentClassName="p-4 flex flex-col gap-2"
114
+ * empty={<p className="text-center opacity-60">Standing by.</p>}
115
+ * renderMessage={({ role, content }) => (
116
+ * <div className={role === "assistant" ? "self-start" : "self-end"}>{content}</div>
117
+ * )}
118
+ * renderTranscript={({ text }) => <div className="px-4 py-2 italic">{text}</div>}
119
+ * transcriptPosition="below"
120
+ * thinkingLabel="Dispatch is thinking"
121
+ * />
122
+ * );
123
+ * }
124
+ * ```
125
+ *
126
+ * @param props - See {@link ConversationViewProps}.
127
+ *
128
+ * @public
129
+ */
130
+ export declare function ConversationView({ renderMessage, renderTool, renderStreaming, renderTranscript, transcriptPosition, log, renderNote, renderSessionHeader, empty, thinkingLabel, thinkingIndicator, thinkingClassName, className, contentClassName, scrollClassName, style, }: ConversationViewProps): ReactNode;
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * Eyebrow label — the design system's small outlined pill with ALL-CAPS,
4
+ * tracked text ("VOICE AGENT", "LISTENING", …). Used as a section label on
5
+ * the start screen and as the live status chip in the chat header.
6
+ *
7
+ * @internal
8
+ */
9
+ export declare function Eyebrow({ children, className, style, ...rest }: {
10
+ children: ReactNode;
11
+ className?: string | undefined;
12
+ } & Omit<React.HTMLAttributes<HTMLSpanElement>, "className">): ReactNode;
@@ -0,0 +1,81 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * Props for {@link Facts}.
4
+ *
5
+ * @public
6
+ */
7
+ export type FactsProps = {
8
+ /**
9
+ * The facts, in reading order. Anything `false`, `null`, `undefined` or the
10
+ * empty string is DROPPED, so a page writes `cond && \`${n} skipped\`` inline
11
+ * instead of splicing a separator into a conditional string.
12
+ *
13
+ * `0` is NOT dropped — it is a fact ("0 words"), and treating it as absent is
14
+ * the bug a plain truthiness filter would ship.
15
+ *
16
+ * They are TEXT rather than `ReactNode`: every one of the nine lines this
17
+ * replaced was a string, and taking strings is what lets this JOIN them (see
18
+ * the component doc) instead of interleaving keyed separator elements.
19
+ */
20
+ items: readonly (string | number | false | null | undefined)[];
21
+ /**
22
+ * Which of the two muted typographies the pages use. `"sm"` is
23
+ * `text-sm opacity-70`, `"xs"` is `text-xs opacity-60` — the size and the
24
+ * muting move together, because that is the pair every site had.
25
+ */
26
+ size?: "sm" | "xs" | undefined;
27
+ /**
28
+ * The element to render. `"p"` by default; `"span"` for a line that sits
29
+ * inside phrasing content, where a `<p>` is invalid nesting the browser will
30
+ * reparent out from under React.
31
+ */
32
+ as?: "p" | "span" | undefined;
33
+ /**
34
+ * ADDED to the base classes rather than replacing them — `tabular-nums`,
35
+ * `uppercase tracking-[1.2px]`. There is no `tailwind-merge` in this package,
36
+ * so a class that CONFLICTS with a base one is not reliably the winner.
37
+ */
38
+ className?: string | undefined;
39
+ };
40
+ /**
41
+ * A muted line of run facts, joined by `·` — "6 segments · 12:04 of audio ·
42
+ * 1,840 words".
43
+ *
44
+ * Nine pages had written this by hand under four different typographies for
45
+ * one role, two of them (`call-audit-workflow` and `spoken-summary-workflow`) byte-identical down
46
+ * to the payload. Three things it takes off the caller:
47
+ *
48
+ * - **The separator cannot be forgotten, and neither can the space around it.**
49
+ * Four of the nine carried a literal `{" "}` at the end of a line, because
50
+ * Prettier's wrap ate the space that made `· ` read as a separator rather
51
+ * than as punctuation glued to the next word. A line that is correct only
52
+ * because somebody remembered an invisible JSX expression is exactly the
53
+ * thing a component should own.
54
+ * - **A fact worth omitting is omitted, and by the caller's own condition.**
55
+ * The hand-written shape for a conditional fact was to splice the separator
56
+ * into the string — `{x ? \` · budget exhausted\` : ""}` — which puts the
57
+ * punctuation in two places and gets the leading separator wrong the moment
58
+ * the fact before it also disappears. Passing the condition and letting this
59
+ * drop it keeps the separator in one place.
60
+ * - **A line with nothing left to say renders NOTHING.** With every fact
61
+ * conditional, the alternative is a muted empty row, or a bare `·`.
62
+ *
63
+ * The facts are JOINED into one string rather than interleaved as elements, and
64
+ * that is why the prop is text: joined, there is no per-fact `key` to invent —
65
+ * the same reasoning `WorkflowProgress` gives for its log lines. A line that
66
+ * genuinely needs an element in it (a link) wants its own markup.
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * import { Facts } from "@alexkroman1/aai-ui";
71
+ *
72
+ * function RunFacts({ words, cut }: { words: number; cut: number }) {
73
+ * return <Facts size="xs" items={[`${words} words`, cut > 0 && `${cut} blind cuts`]} />;
74
+ * }
75
+ * ```
76
+ *
77
+ * @param props - Facts-line props.
78
+ *
79
+ * @public
80
+ */
81
+ export declare function Facts({ items, size, as, className }: FactsProps): ReactNode;
@@ -0,0 +1,142 @@
1
+ import type { InputHTMLAttributes, ReactNode, SelectHTMLAttributes, TextareaHTMLAttributes } from "react";
2
+ import type { FieldShell, FileReadMode } from "./form-types.ts";
3
+ /**
4
+ * Label + control + hint, in the layout every field here uses.
5
+ *
6
+ * Exported so a caller's own control gets the same shell rather than an
7
+ * approximation of it.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * import { Field, Form } from "@alexkroman1/aai-ui";
12
+ *
13
+ * function ColorForm() {
14
+ * return (
15
+ * <Form onSubmit={() => undefined}>
16
+ * <Field label="Accent" hint="Any CSS color." htmlFor="accent">
17
+ * <input id="accent" name="accent" type="color" />
18
+ * </Field>
19
+ * </Form>
20
+ * );
21
+ * }
22
+ * ```
23
+ *
24
+ * @param props - Field-shell props.
25
+ *
26
+ * @public
27
+ */
28
+ export declare function Field({ label, hint, htmlFor, className, children, }: {
29
+ /** Visible label. Omitted leaves the control unlabelled. */
30
+ label?: string | undefined;
31
+ /** One line of guidance under the control. */
32
+ hint?: string | undefined;
33
+ /** Id of the control this labels. */
34
+ htmlFor?: string | undefined;
35
+ /** Additional CSS class names for the wrapper, appended to its own. */
36
+ className?: string | undefined;
37
+ /** The control itself. */
38
+ children: ReactNode;
39
+ }): import("react").JSX.Element;
40
+ /**
41
+ * A single-line text input.
42
+ *
43
+ * Accepts every `<input>` attribute except `name` and `className`, which this
44
+ * component owns, plus the shared {@link FieldShell} props.
45
+ *
46
+ * @param props - {@link FieldShell} props plus `<input>` attributes.
47
+ *
48
+ * @public
49
+ */
50
+ export declare function TextField(props: FieldShell & Omit<InputHTMLAttributes<HTMLInputElement>, "name" | "className">): import("react").JSX.Element;
51
+ /**
52
+ * A number input. Contributes a NUMBER to {@link FormValues}, or nothing when
53
+ * left empty.
54
+ *
55
+ * Accepts every `<input>` attribute except `name`, `className` and `type`,
56
+ * plus the shared {@link FieldShell} props — so `min`, `max` and `step` are
57
+ * passed straight through.
58
+ *
59
+ * @param props - {@link FieldShell} props plus `<input>` attributes.
60
+ *
61
+ * @public
62
+ */
63
+ export declare function NumberField(props: FieldShell & Omit<InputHTMLAttributes<HTMLInputElement>, "name" | "className" | "type">): import("react").JSX.Element;
64
+ /**
65
+ * A multi-line text input.
66
+ *
67
+ * Accepts every `<textarea>` attribute except `name` and `className`, plus the
68
+ * shared {@link FieldShell} props. `rows` defaults to 4.
69
+ *
70
+ * @param props - {@link FieldShell} props plus `<textarea>` attributes.
71
+ *
72
+ * @public
73
+ */
74
+ export declare function TextAreaField({ name, label, hint, className, rows, ...rest }: FieldShell & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "name" | "className">): import("react").JSX.Element;
75
+ /**
76
+ * A dropdown.
77
+ *
78
+ * `options` is the short form — a list of strings, or of
79
+ * `{ value, label }` pairs when the two differ. Pass `children` instead for
80
+ * full control over the `<option>` elements; `children` wins when both are
81
+ * given.
82
+ *
83
+ * Otherwise accepts every `<select>` attribute except `name` and `className`,
84
+ * plus the shared {@link FieldShell} props. Note `multiple` works and
85
+ * contributes an ARRAY (`[]` when nothing is chosen).
86
+ *
87
+ * @param props - {@link FieldShell} props, `options`, and `<select>`
88
+ * attributes.
89
+ *
90
+ * @public
91
+ */
92
+ export declare function SelectField({ name, label, hint, className, options, children, ...rest }: FieldShell & {
93
+ options?: readonly (string | {
94
+ value: string;
95
+ label: string;
96
+ })[];
97
+ } & Omit<SelectHTMLAttributes<HTMLSelectElement>, "name" | "className">): import("react").JSX.Element;
98
+ /**
99
+ * A checkbox. Contributes a BOOLEAN to {@link FormValues}.
100
+ *
101
+ * Accepts every `<input>` attribute except `name`, `className` and `type`,
102
+ * plus the shared {@link FieldShell} props. The label renders beside the box
103
+ * rather than above it, so `hint` is the place for guidance.
104
+ *
105
+ * @param props - {@link FieldShell} props plus `<input>` attributes.
106
+ *
107
+ * @public
108
+ */
109
+ export declare function CheckboxField({ name, label, hint, className, ...rest }: FieldShell & Omit<InputHTMLAttributes<HTMLInputElement>, "name" | "className" | "type">): import("react").JSX.Element;
110
+ /**
111
+ * A file picker. Contributes a {@link FileValue} (or an array, with `multiple`)
112
+ * to {@link FormValues} — or nothing when no file was chosen.
113
+ *
114
+ * **`upload` is what a workflow input wants.** A run's input is serialized into
115
+ * the run record and replayed from it on every resume, so a file's BYTES cannot
116
+ * travel in it. With `upload` the field contributes the `File` itself,
117
+ * `useWorkflowSubmit` stores it through `POST /workflows/uploads` before
118
+ * starting the run, and the input carries the upload id — which a step reads
119
+ * windows of with `stepReadUpload`. Declaring the property in the workflow's
120
+ * `uploads` list makes `<WorkflowFields>` render exactly this, so a declared
121
+ * form needs no file markup at all.
122
+ *
123
+ * **Without it the field describes the file and does not read it.** `read`
124
+ * exists for the cases where the bytes really are small and really are the
125
+ * input — a CSV of ids, a config — and the size is the author's to check. See
126
+ * {@link FileReadMode} for the four values; `upload` is shorthand for
127
+ * `read="upload"`.
128
+ *
129
+ * Otherwise accepts every `<input>` attribute except `name`, `className` and
130
+ * `type`, plus the shared {@link FieldShell} props — so `accept` and
131
+ * `multiple` are passed straight through.
132
+ *
133
+ * @param props - {@link FieldShell} props, `read`/`upload`, and `<input>`
134
+ * attributes.
135
+ *
136
+ * @public
137
+ */
138
+ export declare function FileField({ name, label, hint, className, read, upload, ...rest }: FieldShell & {
139
+ read?: FileReadMode;
140
+ /** Shorthand for `read="upload"` — see above. */
141
+ upload?: boolean;
142
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "name" | "className" | "type">): import("react").JSX.Element;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * What a form's controls CONTRIBUTE — the three types both halves of the form
3
+ * code share.
4
+ *
5
+ * Their own module because `form.tsx` (the components) and `_form-values.ts`
6
+ * (the DOM read) both need them, and a type living in one of those would make
7
+ * the pair import each other.
8
+ */
9
+ /**
10
+ * One submitted form, as a plain object keyed by field name.
11
+ *
12
+ * `unknown` values rather than `string`: see the module doc — a number field
13
+ * yields a number and a file field yields a {@link FileValue}.
14
+ *
15
+ * @public
16
+ */
17
+ export type FormValues = Record<string, unknown>;
18
+ /**
19
+ * What a {@link FileField} contributes to {@link FormValues}.
20
+ *
21
+ * @public
22
+ */
23
+ export type FileValue = {
24
+ name: string;
25
+ /** Size in bytes. */
26
+ size: number;
27
+ /** MIME type the browser reported, or `""` when it could not tell. */
28
+ type: string;
29
+ /** Last modified, as epoch ms. */
30
+ lastModified: number;
31
+ /**
32
+ * The file's contents, present only when the field asked for them — see
33
+ * {@link FileField}'s `read` prop. A `data:` URL for `"dataUrl"`, decoded text
34
+ * for `"text"`.
35
+ */
36
+ content?: string;
37
+ };
38
+ /**
39
+ * How much of a chosen file a {@link FileField} reads.
40
+ *
41
+ * `"upload"` is the odd one and the one a workflow input wants: the field
42
+ * contributes the `File` ITSELF rather than a description of it, and
43
+ * `useWorkflowSubmit` then stores it through `POST /workflows/uploads` and puts
44
+ * the id in the run input. Bytes cannot travel in a run input — see
45
+ * {@link FileField} — so this is how a form takes a file at all.
46
+ *
47
+ * @public
48
+ */
49
+ export type FileReadMode = "none" | "text" | "dataUrl" | "upload";
50
+ /**
51
+ * The props every field in `form.tsx` shares.
52
+ *
53
+ * Public because it is part of each field's own signature — a type reachable
54
+ * from a documented one has to be reachable from the entry point too, which the
55
+ * docs build enforces.
56
+ *
57
+ * @public
58
+ */
59
+ export type FieldShell = {
60
+ /** Key this field contributes to {@link FormValues}. */
61
+ name: string;
62
+ /** Visible label. Omitted leaves the control unlabelled — pass `aria-label` instead. */
63
+ label?: string | undefined;
64
+ /** One line of guidance under the control. */
65
+ hint?: string | undefined;
66
+ /**
67
+ * Additional CSS class names for the field's WRAPPER (label + control +
68
+ * hint), appended to its own layout classes. The control itself takes the
69
+ * shared field styling; pass `style` or a `data-` hook through the native
70
+ * attributes to reach it.
71
+ */
72
+ className?: string | undefined;
73
+ };
@@ -0,0 +1,96 @@
1
+ import type { ButtonHTMLAttributes, FormHTMLAttributes, ReactNode } from "react";
2
+ import { type ButtonSize, type ButtonVariant } from "./button.tsx";
3
+ import type { FormValues } from "./form-types.ts";
4
+ export { CheckboxField, Field, FileField, NumberField, SelectField, TextAreaField, TextField, } from "./form-fields.tsx";
5
+ export type { FieldShell, FileReadMode, FileValue, FormValues } from "./form-types.ts";
6
+ /** Props of {@link Form}. */
7
+ export type FormProps = {
8
+ /**
9
+ * Called with the collected values. May be async — the form stays disabled
10
+ * for the duration, so a double-click cannot submit twice.
11
+ */
12
+ onSubmit: (values: FormValues) => void | Promise<void>;
13
+ /**
14
+ * A failure to show above the fields. The caller owns it, because the
15
+ * interesting failures are the server's (`useWorkflowSubmit`'s `error`) and
16
+ * this component never sees them.
17
+ */
18
+ error?: string | undefined;
19
+ children?: ReactNode;
20
+ className?: string | undefined;
21
+ } & Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit" | "className">;
22
+ /**
23
+ * A form that hands its values to `onSubmit` as one object.
24
+ *
25
+ * Native validation still applies — a `required` field blocks the submit and the
26
+ * browser says so, which is better than anything this could render.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * import { Form, SubmitButton, TextField } from "@alexkroman1/aai-ui";
31
+ *
32
+ * function NameForm() {
33
+ * return (
34
+ * <Form onSubmit={(values) => console.log(values.topic)}>
35
+ * <TextField name="topic" label="Topic" required />
36
+ * <SubmitButton>Start</SubmitButton>
37
+ * </Form>
38
+ * );
39
+ * }
40
+ * ```
41
+ *
42
+ * @param props - See {@link FormProps}. Every `<form>` attribute except
43
+ * `onSubmit` and `className` is passed through.
44
+ *
45
+ * @public
46
+ */
47
+ export declare function Form({ onSubmit, error, children, className, ...rest }: FormProps): import("react").JSX.Element;
48
+ /**
49
+ * The form's submit button, disabled and relabelled while a submit is in
50
+ * flight.
51
+ *
52
+ * Accepts all standard `<button>` HTML attributes except `type` and `disabled`,
53
+ * in addition to the props below — so `aria-label` on an icon-only submit,
54
+ * `form`, `id`, `title` and `onClick` all work here exactly as they do on
55
+ * {@link Button}. `type` and `disabled` stay owned: this component sets both
56
+ * from `pending`, and letting a caller set either is how a form gets a submit
57
+ * button that does not submit.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * import { Form, SubmitButton, TextField } from "@alexkroman1/aai-ui";
62
+ *
63
+ * function Digest({ pending }: { pending: boolean }) {
64
+ * return (
65
+ * <Form onSubmit={() => undefined}>
66
+ * <TextField name="url" label="Link" required />
67
+ * <SubmitButton pending={pending} variant="secondary" size="lg">
68
+ * Summarize
69
+ * </SubmitButton>
70
+ * </Form>
71
+ * );
72
+ * }
73
+ * ```
74
+ *
75
+ * @param props - Button props.
76
+ *
77
+ * @public
78
+ */
79
+ export declare function SubmitButton({ children, pending, pendingLabel, size, variant, className, ...rest }: {
80
+ /** Button label. Replaced by `pendingLabel` while `pending`. */
81
+ children?: ReactNode;
82
+ /**
83
+ * Whether the WORK this form started is still going. Separate from the
84
+ * submit itself, which {@link Form} disables on its own: a workflow run
85
+ * outlives its `POST`, and the button should stay busy until the run is done.
86
+ */
87
+ pending?: boolean;
88
+ /** Label shown in place of `children` while `pending`. Defaults to `"Working…"`. */
89
+ pendingLabel?: string;
90
+ /** Size preset, passed through to {@link Button}. */
91
+ size?: ButtonSize | undefined;
92
+ /** Visual style, passed through to {@link Button}. Defaults to `"default"`. */
93
+ variant?: ButtonVariant | undefined;
94
+ /** Additional CSS class names, appended to {@link Button}'s own. */
95
+ className?: string | undefined;
96
+ } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "disabled" | "className">): import("react").JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { type FunctionComponent, type MemoExoticComponent } from "react";
2
+ /**
3
+ * Type scale for {@link Markdown}: `"default"` is the deployed agent UI's
4
+ * scale, `"compact"` a notch smaller for denser surfaces (the studio's chat
5
+ * transcript). Colors are unaffected — they come from the theme either way.
6
+ *
7
+ * @public
8
+ */
9
+ export type MarkdownVariant = "default" | "compact";
10
+ /**
11
+ * Props of {@link Markdown}.
12
+ *
13
+ * @public
14
+ */
15
+ export type MarkdownProps = {
16
+ /**
17
+ * The Markdown source. Required — this is the prose to render, normally one
18
+ * agent message or the streaming tail of one.
19
+ */
20
+ text: string;
21
+ /**
22
+ * Type scale. Defaults to `"default"`, the deployed agent UI's scale; pass
23
+ * `"compact"` for a denser surface. Colors are unaffected either way.
24
+ */
25
+ variant?: MarkdownVariant;
26
+ };
27
+ /**
28
+ * Agent prose, rendered as Markdown.
29
+ *
30
+ * Pipeline and S2S models write emphasis, lists, `code`, and links; before
31
+ * this they arrived as literal asterisks and backticks. Styling is
32
+ * per-element (theme colors via inline styles, spacing via Tailwind) so it
33
+ * stays on the default client's type scale and follows custom themes.
34
+ * The optional `variant` selects the type scale (see
35
+ * {@link MarkdownVariant}).
36
+ * GFM is on for tables and strikethrough. react-markdown does not render
37
+ * raw HTML unless rehype-raw is added — keep it that way, this text comes
38
+ * from a model.
39
+ *
40
+ * Memoized alongside `MessageBubble`: message content is referentially
41
+ * stable across snapshots, so only the streaming row re-parses.
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * import { Markdown, useSessionSelector } from "@alexkroman1/aai-ui";
46
+ *
47
+ * // The agent's reply as it streams, rendered rather than shown as literal
48
+ * // asterisks and backticks.
49
+ * function LiveReply() {
50
+ * const text = useSessionSelector((snapshot) => snapshot.agentTranscript);
51
+ * return text === null ? null : <Markdown text={text} variant="compact" />;
52
+ * }
53
+ * ```
54
+ *
55
+ * @public
56
+ */
57
+ export declare const Markdown: MemoExoticComponent<FunctionComponent<MarkdownProps>>;
@@ -1,21 +1,48 @@
1
+ /** @jsxImportSource react */
2
+ import { type FunctionComponent, type MemoExoticComponent } from "react";
3
+ import type { ConversationLogEntry } from "../conversation-log.ts";
4
+ /**
5
+ * Props of {@link MessageList}.
6
+ *
7
+ * @public
8
+ */
9
+ export type MessageListProps = {
10
+ /**
11
+ * Additional CSS class names for the outer scroll container, appended to its
12
+ * own rather than replacing them.
13
+ *
14
+ * The container is an {@link AutoScroll}, so it must end up with a BOUNDED
15
+ * height (`flex-1 min-h-0`, `h-full`, a fixed height). Unbounded, it grows
16
+ * with the conversation and never scrolls, so nothing pins to the newest
17
+ * message.
18
+ */
19
+ className?: string;
20
+ /**
21
+ * A persisted transcript to show in place of the live session's items —
22
+ * `useConversationLog().entries`, rendered as {@link ConversationView} renders it.
23
+ */
24
+ log?: readonly ConversationLogEntry[] | undefined;
25
+ };
1
26
  /**
2
27
  * Scrollable list of all chat messages, tool-call blocks, live transcript,
3
28
  * streaming agent utterance, and a thinking indicator.
4
29
  *
5
30
  * Messages and tool calls are interleaved in the correct order. The list
6
- * auto-scrolls to the latest content via {@link useAutoScroll}.
31
+ * auto-scrolls to the latest content.
7
32
  *
8
- * Must be rendered inside a {@link SessionProvider}.
33
+ * Must be rendered inside a `SessionProvider`.
9
34
  *
10
35
  * @example
11
36
  * ```tsx
12
- * <MessageList className="flex-1" />
37
+ * import { MessageList } from "@alexkroman1/aai-ui";
38
+ *
39
+ * function Conversation() {
40
+ * return <MessageList className="flex-1" />;
41
+ * }
13
42
  * ```
14
43
  *
15
- * @param className - Additional CSS class names applied to the scroll container.
44
+ * @param props - Container props.
16
45
  *
17
46
  * @public
18
47
  */
19
- export declare function MessageList({ className }: {
20
- className?: string;
21
- }): import("preact").JSX.Element;
48
+ export declare const MessageList: MemoExoticComponent<FunctionComponent<MessageListProps>>;