@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,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>>;
@@ -0,0 +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
+ };
26
+ /**
27
+ * Scrollable list of all chat messages, tool-call blocks, live transcript,
28
+ * streaming agent utterance, and a thinking indicator.
29
+ *
30
+ * Messages and tool calls are interleaved in the correct order. The list
31
+ * auto-scrolls to the latest content.
32
+ *
33
+ * Must be rendered inside a `SessionProvider`.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * import { MessageList } from "@alexkroman1/aai-ui";
38
+ *
39
+ * function Conversation() {
40
+ * return <MessageList className="flex-1" />;
41
+ * }
42
+ * ```
43
+ *
44
+ * @param props - Container props.
45
+ *
46
+ * @public
47
+ */
48
+ export declare const MessageList: MemoExoticComponent<FunctionComponent<MessageListProps>>;
@@ -0,0 +1,3 @@
1
+ import "../context.js";
2
+ import { t as MessageList } from "../message-list-DHZcLhRA.js";
3
+ export { MessageList };
@@ -0,0 +1,125 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * Which of the four buttons a {@link SessionControlButton} is.
4
+ *
5
+ * @public
6
+ */
7
+ export type SessionControlAction = "start" | "toggle" | "restart" | "end";
8
+ /**
9
+ * One button of {@link SessionControls}, as handed to `renderButton`.
10
+ *
11
+ * @public
12
+ */
13
+ export type SessionControlButton = {
14
+ /** Which button this is. A custom renderer switches on it for its look. */
15
+ action: SessionControlAction;
16
+ /** The label to show — the caller's own word, or the default. */
17
+ label: string;
18
+ /** The handler. Already bound; wire it to `onClick` as it is. */
19
+ onClick: () => void;
20
+ /**
21
+ * Whether the call is live. Meaningful on `toggle`, whose label already says
22
+ * which way it will flip, and handed to every button so a renderer can dim
23
+ * the others while paused.
24
+ */
25
+ running: boolean;
26
+ };
27
+ /**
28
+ * The five words {@link SessionControls} renders, every one overridable.
29
+ *
30
+ * @public
31
+ */
32
+ export type SessionControlsLabels = {
33
+ /** The button shown before the call starts. Default `"Start"`. */
34
+ start: string;
35
+ /** The toggle's label while running. Default `"Pause"`. */
36
+ pause: string;
37
+ /** The toggle's label while paused. Default `"Resume"`. */
38
+ resume: string;
39
+ /** Hang up and dial again. Default `"New Conversation"`. */
40
+ restart: string;
41
+ /** Hang up. Default `"End"`. */
42
+ end: string;
43
+ };
44
+ /**
45
+ * Props of {@link SessionControls}.
46
+ *
47
+ * @public
48
+ */
49
+ export type SessionControlsProps = {
50
+ /** The words this chrome has its own term for; the rest keep the defaults. */
51
+ labels?: Partial<SessionControlsLabels> | undefined;
52
+ /**
53
+ * Renders one button. Absent, each is a stock {@link Button}. A chrome
54
+ * with its own look renders its own `<button>` from the
55
+ * {@link SessionControlButton} it is handed — the component still decides
56
+ * WHICH buttons exist and what each one does.
57
+ */
58
+ renderButton?: ((button: SessionControlButton) => ReactNode) | undefined;
59
+ /** Additional CSS class names for the row, appended to its own layout classes. */
60
+ className?: string | undefined;
61
+ /** Rendered after the buttons — a count, a spacer, a status line. */
62
+ children?: ReactNode;
63
+ };
64
+ /**
65
+ * The full control row of a custom chrome: **Start** before the call, then
66
+ * **Pause / Resume**, **New Conversation** and **End** once it is up.
67
+ *
68
+ * {@link Controls} is the stock console's footer — Stop/Resume and New
69
+ * Conversation, with the URL chips — and it has no Start branch and no End,
70
+ * because the default shell shows a start SCREEN and a session there ends by
71
+ * closing the tab. A chrome that owns its whole frame has no start screen, so
72
+ * three of them each wrote this row: the same `!started` branch, the same
73
+ * three buttons behind it, and the same twelve-line comment on why the middle
74
+ * one is `end(); start()` and not `reset()`. The buttons' look is the
75
+ * chrome's — `renderButton` — and everything else is here once.
76
+ *
77
+ * **Why `restart` is `end()` then `start()`, and never `reset()`.** `reset()`
78
+ * clears the transcript and reconnects carrying the same session id, so every
79
+ * `sessionSlot` on the agent survives: a caller who pressed "New Conversation"
80
+ * on a stateful agent got a blank transcript in front of their old cart, game
81
+ * or incident board, with nothing on screen saying so, and the next tool call
82
+ * repopulated it. `end()` drops the resume identity, so the redial is a
83
+ * brand-new session — fresh state, greeting included — and `start()` puts the
84
+ * chrome straight back on the call rather than at its Start button.
85
+ *
86
+ * **Why End is `end()`.** It hangs up and flips `started` back, so the row
87
+ * returns to its Start button and the next start is a new session. `reset()`
88
+ * would keep the call live — the buttons never toggle back.
89
+ *
90
+ * Reads the session through {@link useSessionControls}: two one-field
91
+ * subscriptions, so the row re-renders when a flag flips and not on every
92
+ * transcript partial.
93
+ *
94
+ * @example A board's controls in its own colours, with a trailing count
95
+ * ```tsx
96
+ * import { SessionControls } from "@alexkroman1/aai-ui";
97
+ *
98
+ * const BUTTON = "px-4 py-2 rounded-md text-xs font-semibold cursor-pointer";
99
+ *
100
+ * function ShiftControls({ logged }: { logged: number }) {
101
+ * return (
102
+ * <SessionControls
103
+ * labels={{ start: "Start Dispatch", end: "End Shift" }}
104
+ * renderButton={({ action, label, onClick }) => (
105
+ * <button
106
+ * type="button"
107
+ * className={BUTTON}
108
+ * style={{ background: action === "end" ? "#dc2626" : "#2563eb", color: "white" }}
109
+ * onClick={onClick}
110
+ * >
111
+ * {label}
112
+ * </button>
113
+ * )}
114
+ * >
115
+ * <span className="ml-auto text-[10px]">{logged} incidents logged</span>
116
+ * </SessionControls>
117
+ * );
118
+ * }
119
+ * ```
120
+ *
121
+ * @param props - See {@link SessionControlsProps}.
122
+ *
123
+ * @public
124
+ */
125
+ export declare function SessionControls({ labels, renderButton, className, children, }: SessionControlsProps): ReactNode;
@@ -0,0 +1,69 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * Props of {@link SessionErrorBanner}.
4
+ *
5
+ * Every field is optional, so `<SessionErrorBanner />` is the whole call. It is
6
+ * a NAMED type all the same, for the reason `ControlsProps` and
7
+ * `ConsoleShellProps` are: an inline object literal in the signature leaves a
8
+ * `createElement(SessionErrorBanner, { className })` caller unable to infer the
9
+ * props at all, and gives the reference page nothing to link to.
10
+ *
11
+ * @public
12
+ */
13
+ export type SessionErrorBannerProps = {
14
+ /** Additional CSS class names for the banner, appended to its own. */
15
+ className?: string | undefined;
16
+ };
17
+ /**
18
+ * The announced banner for a failed session: the error's message and code, or
19
+ * nothing at all when the session is fine.
20
+ *
21
+ * **This used to be four lines inside `ConsoleShell`, and that is why it is its
22
+ * own component.** The banner was the reason `ConsoleShell` was published —
23
+ * `role="alert"` is the one part of that component a reviewer cannot see is
24
+ * missing, since per the `fatalError` latch in `session/browser-session.ts` the banner is
25
+ * the ONLY remaining signal a session died (the state eyebrow beside it goes
26
+ * back to reading like a live session), and a screen reader is never told an
27
+ * unannounced one appeared. But `ConsoleShell` is a whole FRAME: a centred
28
+ * `max-w-190` column with its own header and footer. Every full-bleed chrome —
29
+ * a two-pane board, a CRT — therefore could not adopt it, rebuilt the banner
30
+ * instead, and the three that did had ALREADY drifted: one rendered
31
+ * `ERROR: {message}` and dropped the code entirely, one `ERROR: {message}
32
+ * ({code})`, one `{message} ({code})`. Splitting the banner out is what lets a
33
+ * chrome take the announced-error decision without taking the layout, and
34
+ * `ConsoleShell` composes this rather than keeping a second copy, so the two
35
+ * cannot drift again.
36
+ *
37
+ * **It reads the session itself.** There is no `error` prop: a banner that
38
+ * takes its text from the caller is a banner a caller can forget to wire, which
39
+ * is exactly the failure above with an extra step. It subscribes narrowly via
40
+ * {@link useSessionError}, so a page that renders it does not re-render with
41
+ * the transcript.
42
+ *
43
+ * **The code is shown, always.** `SessionError.code` is the eight-member wire
44
+ * union — it is what a user pastes into a bug report and the only part of the
45
+ * error that is stable across wordings — and the chrome that dropped it left
46
+ * its readers with a sentence and no way to say which failure it was.
47
+ *
48
+ * Must be rendered inside the providers `client()` installs.
49
+ *
50
+ * @example A full-bleed chrome that wants the banner and not the frame
51
+ * ```tsx
52
+ * import { SessionErrorBanner } from "@alexkroman1/aai-ui";
53
+ *
54
+ * function Board() {
55
+ * return (
56
+ * <div className="grid grid-cols-[1fr_320px] h-screen">
57
+ * <main>…</main>
58
+ * <aside>…</aside>
59
+ * <SessionErrorBanner className="col-span-2" />
60
+ * </div>
61
+ * );
62
+ * }
63
+ * ```
64
+ *
65
+ * @param props - See {@link SessionErrorBannerProps}.
66
+ *
67
+ * @public
68
+ */
69
+ export declare function SessionErrorBanner({ className }: SessionErrorBannerProps): ReactNode;