@alexkroman1/aai-ui 0.12.3 → 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.
- package/README.md +257 -0
- package/dist/_colors-CpZO-88A.js +78 -0
- package/dist/_module-url-C13kAJ87.js +15 -0
- package/dist/_page-shell.d.ts +11 -0
- package/dist/_recover-run.d.ts +79 -0
- package/dist/_repeat-until.d.ts +30 -0
- package/dist/_run-controls.d.ts +33 -0
- package/dist/_submission-state.d.ts +92 -0
- package/dist/_tap-to-talk-state.d.ts +88 -0
- package/dist/_utils-Mi-SCFA1.js +47 -0
- package/dist/_utils.d.ts +26 -0
- package/dist/_web-storage.d.ts +43 -0
- package/dist/_workflow-api-ref.d.ts +37 -0
- package/dist/_workflow-files.d.ts +34 -0
- package/dist/_workflow-test-defs.d.ts +38 -0
- package/dist/aai-logo-D8pMVn9_.js +85 -0
- package/dist/agent-state-labels.d.ts +65 -0
- package/dist/agent-state.d.ts +108 -0
- package/dist/audio/capture.d.ts +44 -0
- package/dist/audio/index.d.ts +18 -0
- package/dist/audio/index.js +431 -0
- package/dist/audio/preconnect.d.ts +87 -0
- package/dist/audio/voice-io.d.ts +112 -0
- package/dist/build-default-client.d.ts +1 -0
- package/dist/chat-view-BCbI7gD4.js +396 -0
- package/dist/client-config-C7fQrioM.js +139 -0
- package/dist/client-config.d.ts +119 -0
- package/dist/client-dir.d.ts +44 -0
- package/dist/client-dir.js +58 -0
- package/dist/client-identity.d.ts +131 -0
- package/dist/client-tool.d.ts +51 -0
- package/dist/components/_colors.d.ts +73 -0
- package/dist/components/_form-readiness.d.ts +56 -0
- package/dist/components/_form-values.d.ts +19 -0
- package/dist/components/aai-logo.d.ts +12 -0
- package/dist/components/audio-result.d.ts +94 -0
- package/dist/components/auto-scroll.d.ts +74 -0
- package/dist/components/bullet-list.d.ts +74 -0
- package/dist/components/button.d.ts +29 -21
- package/dist/components/button.js +62 -23
- package/dist/components/chat-view.d.ts +24 -18
- package/dist/components/chat-view.js +2 -60
- package/dist/components/console-shell.d.ts +85 -0
- package/dist/components/controls.d.ts +21 -6
- package/dist/components/controls.js +31 -19
- package/dist/components/conversation-view.d.ts +130 -0
- package/dist/components/eyebrow.d.ts +12 -0
- package/dist/components/facts.d.ts +81 -0
- package/dist/components/form-fields.d.ts +142 -0
- package/dist/components/form-types.d.ts +73 -0
- package/dist/components/form.d.ts +96 -0
- package/dist/components/markdown.d.ts +57 -0
- package/dist/components/message-list.d.ts +34 -7
- package/dist/components/message-list.js +2 -75
- package/dist/components/session-controls.d.ts +125 -0
- package/dist/components/session-error-banner.d.ts +69 -0
- package/dist/components/session-state-dot.d.ts +111 -0
- package/dist/components/sidebar-layout.d.ts +31 -10
- package/dist/components/sidebar-layout.js +32 -12
- package/dist/components/start-screen.d.ts +17 -6
- package/dist/components/start-screen.js +34 -14
- package/dist/components/tool-call-block.d.ts +15 -14
- package/dist/components/tool-call-block.js +2 -117
- package/dist/components/tool-call-row.d.ts +75 -0
- package/dist/components/tool-config-context.d.ts +22 -0
- package/dist/components/upload-progress.d.ts +76 -0
- package/dist/components/url-chips.d.ts +29 -0
- package/dist/components/workflow-fields.d.ts +46 -0
- package/dist/components/workflow-pending-note.d.ts +81 -0
- package/dist/components/workflow-progress.d.ts +81 -0
- package/dist/components/workflow-run-error.d.ts +48 -0
- package/dist/components/workflow-run-panel.d.ts +79 -0
- package/dist/context.d.ts +288 -0
- package/dist/context.js +382 -0
- package/dist/conversation-log.d.ts +88 -0
- package/dist/default-client/assets/_module-url-BX0RuRU2.js +1 -0
- package/dist/default-client/assets/audio-cGFGID-2.js +1 -0
- package/dist/default-client/assets/capture-processor-BUABoo3_.js +90 -0
- package/dist/default-client/assets/index-8ihb1Urm.css +2 -0
- package/dist/default-client/assets/index-BQURVARl.js +126 -0
- package/dist/default-client/assets/playback-processor-ABOa11j0.js +314 -0
- package/dist/default-client/favicon.ico +0 -0
- package/dist/default-client/index.html +15 -0
- package/dist/default-client.d.ts +23 -0
- package/dist/define-client.d.ts +162 -26
- package/dist/define-client.js +201 -55
- package/dist/eyebrow-UfmSz9yy.js +27 -0
- package/dist/hooks-DN4gHYsj.js +182 -0
- package/dist/hooks.d.ts +172 -0
- package/dist/hooks.js +3 -0
- package/dist/hooks.test-d.d.ts +14 -0
- package/dist/inbox-protocol.d.ts +128 -0
- package/dist/inbox.d.ts +132 -0
- package/dist/index.d.ts +126 -29
- package/dist/index.js +5500 -15
- package/dist/internal.d.ts +43 -0
- package/dist/internal.js +8 -0
- package/dist/linked-client.d.ts +70 -0
- package/dist/message-list-DHZcLhRA.js +682 -0
- package/dist/notice-player.d.ts +70 -0
- package/dist/page.d.ts +114 -0
- package/dist/phone.d.ts +50 -0
- package/dist/route-fetch.d.ts +79 -0
- package/dist/session/audio-effects.d.ts +31 -0
- package/dist/session/audio-setup.d.ts +57 -0
- package/dist/session/audio-state.d.ts +157 -0
- package/dist/session/browser-session.d.ts +30 -0
- package/dist/session/close.d.ts +26 -0
- package/dist/session/dial.d.ts +65 -0
- package/dist/session/handshake.d.ts +60 -0
- package/dist/session/index.d.ts +17 -0
- package/dist/session/index.js +2 -0
- package/dist/session/messages.d.ts +63 -0
- package/dist/session/mic.d.ts +64 -0
- package/dist/session/preconnect.d.ts +48 -0
- package/dist/session/reconnect.d.ts +25 -0
- package/dist/session/resume-store.d.ts +57 -0
- package/dist/session/state.d.ts +146 -0
- package/dist/session/ticket.d.ts +44 -0
- package/dist/session/types.d.ts +476 -0
- package/dist/session/url.d.ts +17 -0
- package/dist/session/user-turn.d.ts +55 -0
- package/dist/session-CE0Ipsb3.js +2129 -0
- package/dist/stored-value.d.ts +103 -0
- package/dist/tool-call-block-uXtMOUWN.js +204 -0
- package/dist/tool-config-context-Es4YUzV2.js +19 -0
- package/dist/types.d.ts +272 -34
- package/dist/types.js +35 -4
- package/dist/upload/files.d.ts +83 -0
- package/dist/upload/index.d.ts +15 -0
- package/dist/upload/pause.d.ts +31 -0
- package/dist/upload/recall.d.ts +67 -0
- package/dist/upload/report.d.ts +26 -0
- package/dist/upload/session.d.ts +99 -0
- package/dist/url-chips-oyy_Eiqh.js +239 -0
- package/dist/use-client-runs.d.ts +87 -0
- package/dist/use-conversation-log.d.ts +86 -0
- package/dist/use-conversation.d.ts +131 -0
- package/dist/use-copy.d.ts +74 -0
- package/dist/use-download-url.d.ts +84 -0
- package/dist/use-flash.d.ts +61 -0
- package/dist/use-inbox.d.ts +101 -0
- package/dist/use-push-to-talk.d.ts +105 -0
- package/dist/use-route-mutation.d.ts +113 -0
- package/dist/use-route.d.ts +82 -0
- package/dist/use-run-key.d.ts +133 -0
- package/dist/use-session-controls.d.ts +69 -0
- package/dist/use-session-id.d.ts +57 -0
- package/dist/use-tap-to-talk.d.ts +138 -0
- package/dist/use-user-transcript-uyHhzy4d.js +73 -0
- package/dist/use-user-transcript.d.ts +75 -0
- package/dist/use-workflow-form.d.ts +285 -0
- package/dist/use-workflow-progress.d.ts +137 -0
- package/dist/use-workflow-run-DdhWmbx-.js +697 -0
- package/dist/use-workflow-run.d.ts +100 -0
- package/dist/use-workflow-runs.d.ts +71 -0
- package/dist/use-workflow-stream.d.ts +154 -0
- package/dist/use-workflows.d.ts +77 -0
- package/dist/workflow-client.d.ts +136 -0
- package/dist/workflow-def-types.d.ts +31 -0
- package/dist/workflow-events.d.ts +39 -0
- package/dist/workflow-field-kind.d.ts +95 -0
- package/dist/workflow-status-labels.d.ts +35 -0
- package/dist/worklets/_module-url.d.ts +10 -0
- package/dist/worklets/_playback-bench-harness.d.ts +181 -0
- package/dist/worklets/_playback-bench-host.d.ts +63 -0
- package/dist/worklets/_playback-bench-page.d.ts +65 -0
- package/dist/worklets/_tts-trace-harness.d.ts +142 -0
- package/dist/worklets/_worklet-test-utils.d.ts +27 -0
- package/dist/worklets/capture-processor.d.ts +4 -2
- package/dist/worklets/capture-processor.js +73 -33
- package/dist/worklets/playback-processor.d.ts +4 -2
- package/dist/worklets/playback-processor.js +258 -42
- package/package.json +57 -32
- package/styles.css +152 -30
- package/dist/audio.d.ts +0 -45
- package/dist/audio.js +0 -121
- package/dist/client-context.d.ts +0 -33
- package/dist/client-context.js +0 -15
- package/dist/client-handler.d.ts +0 -43
- package/dist/components/app.d.ts +0 -23
- package/dist/components/app.js +0 -41
- package/dist/components/error-banner.d.ts +0 -21
- package/dist/components/error-banner.js +0 -27
- package/dist/components/message-bubble.d.ts +0 -23
- package/dist/components/message-bubble.js +0 -35
- package/dist/components/state-indicator.d.ts +0 -29
- package/dist/components/state-indicator.js +0 -37
- package/dist/components/thinking-indicator.d.ts +0 -16
- package/dist/components/thinking-indicator.js +0 -34
- package/dist/components/tool-icons.d.ts +0 -17
- package/dist/components/tool-icons.js +0 -128
- package/dist/components/transcript.d.ts +0 -25
- package/dist/components/transcript.js +0 -35
- package/dist/session-CWB7vmqz.js +0 -429
- package/dist/session.d.ts +0 -69
- package/dist/session.js +0 -2
- package/dist/signals.d.ts +0 -120
- package/dist/signals.js +0 -161
- package/dist/tsdown.config.d.ts +0 -2
- package/dist/types.test-d.d.ts +0 -7
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link BulletList}.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type BulletListProps = {
|
|
8
|
+
/**
|
|
9
|
+
* The bullets, in the order they should read.
|
|
10
|
+
*
|
|
11
|
+
* TEXT rather than `ReactNode`, deliberately: every list this replaced was a
|
|
12
|
+
* string array straight off a run's output, and taking strings is what lets
|
|
13
|
+
* this component key them (see the component doc). A page that needs a link
|
|
14
|
+
* inside a bullet wants its own `<ul>`, not a prop here.
|
|
15
|
+
*/
|
|
16
|
+
items: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Rendered as a heading above the list, inside a wrapping `<section>`.
|
|
19
|
+
*
|
|
20
|
+
* Omitted (or `null`/`false`, so `title={cond && "Risks"}` means what it
|
|
21
|
+
* looks like) renders the bare `<ul>` with no wrapper — which is what four of
|
|
22
|
+
* the five lists this replaced were.
|
|
23
|
+
*/
|
|
24
|
+
title?: ReactNode | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* `"sm"` adds `text-sm`, which two of the five copies carried and three did
|
|
27
|
+
* not. `"base"` is the default and adds nothing.
|
|
28
|
+
*/
|
|
29
|
+
size?: "sm" | "base" | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* ADDED to the list's own classes rather than replacing them. There is no
|
|
32
|
+
* `tailwind-merge` in this package, so a class that CONFLICTS with a base one
|
|
33
|
+
* is not reliably the winner — use this for additions, not overrides.
|
|
34
|
+
*/
|
|
35
|
+
className?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A disc-bulleted list of short strings — a run's key points, findings, risks.
|
|
39
|
+
*
|
|
40
|
+
* Five pages had written this, byte-identical apart from a `text-sm` suffix on
|
|
41
|
+
* two of them, and all five had the same two defects. Both are the reason this
|
|
42
|
+
* is a component rather than four lines a page repeats:
|
|
43
|
+
*
|
|
44
|
+
* - **All five keyed by the string itself, and these lists are MODEL OUTPUT.**
|
|
45
|
+
* Two identical bullets are entirely plausible — a summariser that repeats
|
|
46
|
+
* itself is a bad summary, not a bad program — and a repeated string is then
|
|
47
|
+
* a duplicate `key`: React warns, and the two `<li>`s contend for one slot in
|
|
48
|
+
* the reconciliation. What is keyed here instead is the content PLUS how many
|
|
49
|
+
* times that content has already appeared in this list, which is unique by
|
|
50
|
+
* construction and unchanged by a re-render that did not change the text.
|
|
51
|
+
* (Position alone would also be sound — these lists are replaced wholesale by
|
|
52
|
+
* each new output and never reordered — but it is what `noArrayIndexKey`
|
|
53
|
+
* exists to talk you out of, and a unique key is one `Map` away, so there is
|
|
54
|
+
* no reason to spend a lint suppression on it.)
|
|
55
|
+
* - **Three of the five rendered an empty `<ul>` under a heading.** Two had
|
|
56
|
+
* hand-rolled `if (items.length === 0) return null` and three had not, so the
|
|
57
|
+
* same absent field was "nothing" on two pages and a stray heading with a
|
|
58
|
+
* void under it on three. Emptiness renders NOTHING here, `title` included:
|
|
59
|
+
* a heading over no bullets is a claim the run did not make.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* import { BulletList } from "@alexkroman1/aai-ui";
|
|
64
|
+
*
|
|
65
|
+
* function Findings({ risks }: { risks: string[] }) {
|
|
66
|
+
* return <BulletList title="Risks" items={risks} size="sm" />;
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param props - Bullet-list props.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export declare function BulletList({ items, title, size, className }: BulletListProps): ReactNode;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
2
|
/**
|
|
3
|
-
* Visual style of a {@link Button}
|
|
3
|
+
* Visual style of a {@link Button} (design-system "website refresh":
|
|
4
|
+
* rectangular, ALL-CAPS, tracked labels).
|
|
4
5
|
*
|
|
5
|
-
* - `"default"` — Primary filled button (
|
|
6
|
-
* - `"secondary"` —
|
|
7
|
-
* - `"ghost"` —
|
|
6
|
+
* - `"default"` — Primary filled button (indigo background).
|
|
7
|
+
* - `"secondary"` — Outlined primary (transparent background, primary border).
|
|
8
|
+
* - `"ghost"` — Raised neutral (surface background with hairline border).
|
|
8
9
|
*
|
|
9
10
|
* @public
|
|
10
11
|
*/
|
|
@@ -12,8 +13,8 @@ export type ButtonVariant = "default" | "secondary" | "ghost";
|
|
|
12
13
|
/**
|
|
13
14
|
* Size preset for a {@link Button}.
|
|
14
15
|
*
|
|
15
|
-
* - `"default"` — Compact (height
|
|
16
|
-
* - `"lg"` —
|
|
16
|
+
* - `"default"` — Compact control (height 36 px).
|
|
17
|
+
* - `"lg"` — Primary CTA (height 44 px, generous padding).
|
|
17
18
|
*
|
|
18
19
|
* @public
|
|
19
20
|
*/
|
|
@@ -26,25 +27,32 @@ export type ButtonSize = "default" | "lg";
|
|
|
26
27
|
*
|
|
27
28
|
* @example
|
|
28
29
|
* ```tsx
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* </Button>
|
|
30
|
+
* import { Button } from "@alexkroman1/aai-ui";
|
|
31
|
+
*
|
|
32
|
+
* function Actions({ onStop }: { onStop: () => void }) {
|
|
33
|
+
* return (
|
|
34
|
+
* <>
|
|
35
|
+
* <Button variant="secondary" onClick={onStop}>Stop</Button>
|
|
36
|
+
* <Button size="lg" className="w-full">Start Conversation</Button>
|
|
37
|
+
* </>
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
36
40
|
* ```
|
|
37
41
|
*
|
|
38
|
-
* @param
|
|
39
|
-
* @
|
|
40
|
-
* @
|
|
41
|
-
*
|
|
42
|
+
* @param props - Button props: `variant` (visual style — see
|
|
43
|
+
* {@link ButtonVariant}, defaults to `"default"`), `size` (see
|
|
44
|
+
* {@link ButtonSize}, defaults to `"default"`), `className` (appended to the
|
|
45
|
+
* button's own classes), `children` (the label), and any `<button>` attribute.
|
|
42
46
|
*
|
|
43
47
|
* @public
|
|
44
48
|
*/
|
|
45
|
-
export declare function Button({ variant, size, className, children, ...rest }: {
|
|
49
|
+
export declare function Button({ variant, size, className, children, style, ...rest }: {
|
|
50
|
+
/** Visual style. Defaults to `"default"`. */
|
|
46
51
|
variant?: ButtonVariant;
|
|
52
|
+
/** Size preset. Defaults to `"default"`. */
|
|
47
53
|
size?: ButtonSize;
|
|
54
|
+
/** Additional CSS class names, appended to the button's own. */
|
|
48
55
|
className?: string;
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
/** Button label / content. */
|
|
57
|
+
children?: ReactNode;
|
|
58
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "className">): import("react").JSX.Element;
|
|
@@ -1,14 +1,38 @@
|
|
|
1
|
+
import { useTheme } from "../context.js";
|
|
2
|
+
import { a as inkTint, i as focusRingStyle, n as FOCUS_RING, o as primaryTint } from "../_colors-CpZO-88A.js";
|
|
1
3
|
import clsx from "clsx";
|
|
2
|
-
import { jsx } from "
|
|
3
|
-
//#region components/button.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/button.tsx
|
|
6
|
+
/** @jsxImportSource react */
|
|
7
|
+
/** One variant's rest and hover colors, derived from the theme. */
|
|
8
|
+
function variantColors(variant, theme) {
|
|
9
|
+
switch (variant) {
|
|
10
|
+
case "default": return {
|
|
11
|
+
bg: theme.primary,
|
|
12
|
+
fg: theme.surface,
|
|
13
|
+
border: "transparent",
|
|
14
|
+
hoverBg: inkTint(theme.text, theme.primary, 14),
|
|
15
|
+
hoverFg: theme.surface,
|
|
16
|
+
hoverBorder: "transparent"
|
|
17
|
+
};
|
|
18
|
+
case "secondary": return {
|
|
19
|
+
bg: "transparent",
|
|
20
|
+
fg: theme.primary,
|
|
21
|
+
border: theme.primary,
|
|
22
|
+
hoverBg: primaryTint(theme.primary, theme.surface, 8),
|
|
23
|
+
hoverFg: theme.primary,
|
|
24
|
+
hoverBorder: theme.primary
|
|
25
|
+
};
|
|
26
|
+
default: return {
|
|
27
|
+
bg: theme.surface,
|
|
28
|
+
fg: theme.text,
|
|
29
|
+
border: theme.border,
|
|
30
|
+
hoverBg: inkTint(theme.text, theme.surface, 5),
|
|
31
|
+
hoverFg: theme.text,
|
|
32
|
+
hoverBorder: theme.border
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
12
36
|
/**
|
|
13
37
|
* A styled button with variant and size presets.
|
|
14
38
|
*
|
|
@@ -17,27 +41,42 @@ const LG_STYLE = {
|
|
|
17
41
|
*
|
|
18
42
|
* @example
|
|
19
43
|
* ```tsx
|
|
20
|
-
*
|
|
21
|
-
* Stop
|
|
22
|
-
* </Button>
|
|
44
|
+
* import { Button } from "@alexkroman1/aai-ui";
|
|
23
45
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
46
|
+
* function Actions({ onStop }: { onStop: () => void }) {
|
|
47
|
+
* return (
|
|
48
|
+
* <>
|
|
49
|
+
* <Button variant="secondary" onClick={onStop}>Stop</Button>
|
|
50
|
+
* <Button size="lg" className="w-full">Start Conversation</Button>
|
|
51
|
+
* </>
|
|
52
|
+
* );
|
|
53
|
+
* }
|
|
27
54
|
* ```
|
|
28
55
|
*
|
|
29
|
-
* @param
|
|
30
|
-
* @
|
|
31
|
-
* @
|
|
32
|
-
*
|
|
56
|
+
* @param props - Button props: `variant` (visual style — see
|
|
57
|
+
* {@link ButtonVariant}, defaults to `"default"`), `size` (see
|
|
58
|
+
* {@link ButtonSize}, defaults to `"default"`), `className` (appended to the
|
|
59
|
+
* button's own classes), `children` (the label), and any `<button>` attribute.
|
|
33
60
|
*
|
|
34
61
|
* @public
|
|
35
62
|
*/
|
|
36
|
-
function Button({ variant = "default", size = "default", className, children, ...rest }) {
|
|
63
|
+
function Button({ variant = "default", size = "default", className, children, style, ...rest }) {
|
|
64
|
+
const theme = useTheme();
|
|
65
|
+
const colors = variantColors(variant, theme);
|
|
66
|
+
const vars = {
|
|
67
|
+
"--aai-btn-bg": colors.bg,
|
|
68
|
+
"--aai-btn-fg": colors.fg,
|
|
69
|
+
"--aai-btn-bd": colors.border,
|
|
70
|
+
"--aai-btn-bg-hover": colors.hoverBg,
|
|
71
|
+
"--aai-btn-fg-hover": colors.hoverFg,
|
|
72
|
+
"--aai-btn-bd-hover": colors.hoverBorder,
|
|
73
|
+
...focusRingStyle(theme.primary),
|
|
74
|
+
...style
|
|
75
|
+
};
|
|
37
76
|
return /* @__PURE__ */ jsx("button", {
|
|
38
77
|
type: "button",
|
|
39
|
-
style:
|
|
40
|
-
|
|
78
|
+
style: vars,
|
|
79
|
+
className: clsx("inline-flex items-center justify-center appearance-none m-0 w-fit whitespace-nowrap", size === "lg" ? "h-11 px-7 text-xs" : "h-9 px-5 text-[11px]", "rounded-aai font-aai font-medium tracking-[1.4px] uppercase leading-none", "cursor-pointer border transition-colors duration-150", "bg-(--aai-btn-bg) text-(--aai-btn-fg) border-(--aai-btn-bd)", "enabled:hover:bg-(--aai-btn-bg-hover) enabled:hover:text-(--aai-btn-fg-hover)", "enabled:hover:border-(--aai-btn-bd-hover)", FOCUS_RING, "disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
41
80
|
...rest,
|
|
42
81
|
children
|
|
43
82
|
});
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsxImportSource react */
|
|
2
|
+
import type { ReactNode } from "react";
|
|
2
3
|
/**
|
|
3
|
-
* The main chat interface for a voice agent session
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The main chat interface for a voice agent session — the design-system
|
|
5
|
+
* "voice agent console": a 760px column on the cream page with a header
|
|
6
|
+
* (logo + live-status eyebrow), the conversation on a raised white card,
|
|
7
|
+
* and the session controls beneath it.
|
|
6
8
|
*
|
|
7
|
-
* Must be rendered inside a
|
|
9
|
+
* Must be rendered inside a `SessionProvider`.
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
10
12
|
* ```tsx
|
|
11
|
-
*
|
|
12
|
-
* <ChatView />
|
|
13
|
-
* </StartScreen>
|
|
14
|
-
* ```
|
|
13
|
+
* import { ChatView, StartScreen } from "@alexkroman1/aai-ui";
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
15
|
+
* function App() {
|
|
16
|
+
* return (
|
|
17
|
+
* <StartScreen icon="🍕" title="Pizza Palace">
|
|
18
|
+
* <ChatView />
|
|
19
|
+
* </StartScreen>
|
|
20
|
+
* );
|
|
21
|
+
* }
|
|
21
22
|
* ```
|
|
22
23
|
*
|
|
23
|
-
* @param
|
|
24
|
+
* @param props - Chat surface props.
|
|
24
25
|
*
|
|
25
26
|
* @public
|
|
26
27
|
*/
|
|
27
|
-
export declare function ChatView({ className }: {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
export declare function ChatView({ icon, title, className, }: {
|
|
29
|
+
/** Element rendered in place of the logo in the header. */
|
|
30
|
+
icon?: ReactNode | undefined;
|
|
31
|
+
/** Title string for the header. Defaults to the agent's declared name. */
|
|
32
|
+
title?: string | undefined;
|
|
33
|
+
/** Additional CSS class names for the root element, appended to its own. */
|
|
34
|
+
className?: string | undefined;
|
|
35
|
+
}): ReactNode;
|
|
@@ -1,61 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
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
|
|
1
|
+
import { t as ChatView } from "../chat-view-BCbI7gD4.js";
|
|
2
|
+
import "../context.js";
|
|
61
3
|
export { ChatView };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { AgentState } from "../types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Props of {@link ConsoleShell}.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type ConsoleShellProps = {
|
|
9
|
+
/** Element rendered in place of the logo in the header. */
|
|
10
|
+
icon?: ReactNode | undefined;
|
|
11
|
+
/** Title string for the header. */
|
|
12
|
+
title?: string | undefined;
|
|
13
|
+
/** Live status shown in the header eyebrow. */
|
|
14
|
+
state: AgentState;
|
|
15
|
+
/** Whether the status dot pulses. */
|
|
16
|
+
pulsing: boolean;
|
|
17
|
+
/** Card content — normally a {@link MessageList}. */
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
/** Row rendered beneath the card (controls). */
|
|
20
|
+
footer: ReactNode;
|
|
21
|
+
/** Additional CSS class names for the root element, appended to its own. */
|
|
22
|
+
className?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The design-system "console" chrome: a 760px column on the themed page with a
|
|
26
|
+
* header (icon + live-status eyebrow), an announced error banner, the main
|
|
27
|
+
* content on a raised card, and a footer row beneath it.
|
|
28
|
+
*
|
|
29
|
+
* {@link ChatView} is this shell with `<MessageList>` inside it and
|
|
30
|
+
* `<Controls>` under it, and until now that was the only way to get it — the
|
|
31
|
+
* shell itself was internal, so a client wanting its own conversation markup
|
|
32
|
+
* had to rebuild the chrome as well. Each one that did re-derived the error
|
|
33
|
+
* banner WITHOUT `role="alert"`.
|
|
34
|
+
*
|
|
35
|
+
* **The banner is {@link SessionErrorBanner} now, composed here rather than
|
|
36
|
+
* spelled out.** It was four lines of this file, and this file is a whole
|
|
37
|
+
* FRAME — a centred `max-w-190` column — so the full-bleed chromes that needed
|
|
38
|
+
* the announced banner could not take it without taking a layout that would
|
|
39
|
+
* replace the design they exist to demonstrate. Composing means there is one
|
|
40
|
+
* banner, and it means this component no longer takes an `error` prop: the
|
|
41
|
+
* banner reads the session itself, which is one fewer thing a caller can wire
|
|
42
|
+
* up wrong.
|
|
43
|
+
*
|
|
44
|
+
* Reach for it when the conversation is yours and the frame is not. Reach for
|
|
45
|
+
* `<ChatView>` when both are ours. Reach for `<SessionErrorBanner>` alone when
|
|
46
|
+
* neither is.
|
|
47
|
+
*
|
|
48
|
+
* Must be rendered inside the providers `mountClient()` installs.
|
|
49
|
+
*
|
|
50
|
+
* @example A custom conversation in the stock chrome
|
|
51
|
+
* ```tsx
|
|
52
|
+
* import {
|
|
53
|
+
* ConsoleShell,
|
|
54
|
+
* Controls,
|
|
55
|
+
* useConversation,
|
|
56
|
+
* useSessionStatus,
|
|
57
|
+
* } from "@alexkroman1/aai-ui";
|
|
58
|
+
*
|
|
59
|
+
* function Console() {
|
|
60
|
+
* const state = useSessionStatus();
|
|
61
|
+
* const { items } = useConversation();
|
|
62
|
+
* return (
|
|
63
|
+
* <ConsoleShell
|
|
64
|
+
* title="Dispatch"
|
|
65
|
+
* state={state}
|
|
66
|
+
* pulsing={state === "listening"}
|
|
67
|
+
* footer={<Controls />}
|
|
68
|
+
* >
|
|
69
|
+
* <ul>
|
|
70
|
+
* {items.map((item) => (
|
|
71
|
+
* <li key={item.kind === "message" ? item.message.id : item.toolCall.callId}>
|
|
72
|
+
* {item.kind === "message" ? item.message.content : item.toolCall.name}
|
|
73
|
+
* </li>
|
|
74
|
+
* ))}
|
|
75
|
+
* </ul>
|
|
76
|
+
* </ConsoleShell>
|
|
77
|
+
* );
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param props - See {@link ConsoleShellProps}.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export declare function ConsoleShell({ icon, title, state, pulsing, children, footer, className, }: ConsoleShellProps): ReactNode;
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
+
import { type FunctionComponent, type MemoExoticComponent } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Props of {@link Controls}.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type ControlsProps = {
|
|
8
|
+
/**
|
|
9
|
+
* Additional CSS class names, appended to the container's own layout
|
|
10
|
+
* classes rather than replacing them.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
1
14
|
/**
|
|
2
15
|
* Session control buttons: **Stop / Resume** and **New Conversation**.
|
|
3
16
|
*
|
|
4
17
|
* Reads session state from {@link useSession}. Must be rendered inside a
|
|
5
|
-
*
|
|
18
|
+
* `SessionProvider`.
|
|
6
19
|
*
|
|
7
20
|
* @example
|
|
8
21
|
* ```tsx
|
|
9
|
-
*
|
|
22
|
+
* import { Controls } from "@alexkroman1/aai-ui";
|
|
23
|
+
*
|
|
24
|
+
* function Footer() {
|
|
25
|
+
* return <Controls className="justify-end" />;
|
|
26
|
+
* }
|
|
10
27
|
* ```
|
|
11
28
|
*
|
|
12
|
-
* @param
|
|
29
|
+
* @param props - Container props.
|
|
13
30
|
*
|
|
14
31
|
* @public
|
|
15
32
|
*/
|
|
16
|
-
export declare
|
|
17
|
-
className?: string;
|
|
18
|
-
}): import("preact").JSX.Element;
|
|
33
|
+
export declare const Controls: MemoExoticComponent<FunctionComponent<ControlsProps>>;
|
|
@@ -1,37 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useSessionCore, useSessionSelector } from "../context.js";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
|
+
import { n as SessionUrlChips } from "../url-chips-oyy_Eiqh.js";
|
|
4
|
+
import { memo } from "react";
|
|
3
5
|
import clsx from "clsx";
|
|
4
|
-
import { jsx, jsxs } from "
|
|
5
|
-
//#region components/controls.tsx
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/controls.tsx
|
|
8
|
+
/** @jsxImportSource react */
|
|
6
9
|
/**
|
|
7
10
|
* Session control buttons: **Stop / Resume** and **New Conversation**.
|
|
8
11
|
*
|
|
9
12
|
* Reads session state from {@link useSession}. Must be rendered inside a
|
|
10
|
-
*
|
|
13
|
+
* `SessionProvider`.
|
|
11
14
|
*
|
|
12
15
|
* @example
|
|
13
16
|
* ```tsx
|
|
14
|
-
*
|
|
17
|
+
* import { Controls } from "@alexkroman1/aai-ui";
|
|
18
|
+
*
|
|
19
|
+
* function Footer() {
|
|
20
|
+
* return <Controls className="justify-end" />;
|
|
21
|
+
* }
|
|
15
22
|
* ```
|
|
16
23
|
*
|
|
17
|
-
* @param
|
|
24
|
+
* @param props - Container props.
|
|
18
25
|
*
|
|
19
26
|
* @public
|
|
20
27
|
*/
|
|
21
|
-
function Controls({ className }) {
|
|
22
|
-
const
|
|
28
|
+
const Controls = memo(function Controls({ className }) {
|
|
29
|
+
const running = useSessionSelector((s) => s.running);
|
|
30
|
+
const { toggle, restart } = useSessionCore();
|
|
23
31
|
return /* @__PURE__ */ jsxs("div", {
|
|
24
|
-
|
|
25
|
-
children: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
className: clsx("flex flex-wrap items-center gap-3 shrink-0", className),
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Button, {
|
|
35
|
+
variant: "secondary",
|
|
36
|
+
onClick: toggle,
|
|
37
|
+
children: running ? "Stop" : "Resume"
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ jsx(Button, {
|
|
40
|
+
variant: "ghost",
|
|
41
|
+
onClick: restart,
|
|
42
|
+
children: "New Conversation"
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ jsx(SessionUrlChips, { className: "basis-full sm:basis-auto sm:ml-auto sm:max-w-[60%]" })
|
|
45
|
+
]
|
|
34
46
|
});
|
|
35
|
-
}
|
|
47
|
+
});
|
|
36
48
|
//#endregion
|
|
37
49
|
export { Controls };
|