@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.
- 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 +58 -0
- package/dist/components/button.js +85 -0
- package/dist/components/chat-view.d.ts +35 -0
- package/dist/components/chat-view.js +3 -0
- package/dist/components/console-shell.d.ts +85 -0
- package/dist/components/controls.d.ts +33 -0
- package/dist/components/controls.js +49 -0
- 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 +48 -0
- package/dist/components/message-list.js +3 -0
- 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 +42 -0
- package/dist/components/sidebar-layout.js +56 -0
- package/dist/components/start-screen.d.ts +37 -0
- package/dist/components/start-screen.js +71 -0
- package/dist/components/tool-call-block.d.ts +28 -0
- package/dist/components/tool-call-block.js +3 -0
- 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 +129 -32
- package/dist/index.js +5503 -18
- 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 +58 -31
- package/styles.css +152 -30
- package/dist/_components/app.d.ts +0 -23
- package/dist/_components/app.js +0 -41
- package/dist/_components/button.d.ts +0 -50
- package/dist/_components/button.js +0 -46
- package/dist/_components/chat-view.d.ts +0 -29
- package/dist/_components/chat-view.js +0 -61
- package/dist/_components/controls.d.ts +0 -18
- package/dist/_components/controls.js +0 -37
- 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/message-list.d.ts +0 -21
- package/dist/_components/message-list.js +0 -76
- package/dist/_components/sidebar-layout.d.ts +0 -21
- package/dist/_components/sidebar-layout.js +0 -36
- package/dist/_components/start-screen.d.ts +0 -26
- package/dist/_components/start-screen.js +0 -51
- 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-call-block.d.ts +0 -27
- package/dist/_components/tool-call-block.js +0 -118
- 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/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/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
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ThinkingIndicator } from "./thinking-indicator.js";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { jsx } from "preact/jsx-runtime";
|
|
4
|
-
//#region _components/transcript.tsx
|
|
5
|
-
/**
|
|
6
|
-
* Live speech-to-text transcript shown while the user is speaking.
|
|
7
|
-
* Returns `null` when there is no active utterance.
|
|
8
|
-
*
|
|
9
|
-
* Displays a {@link ThinkingIndicator} while waiting for the first
|
|
10
|
-
* transcription text (i.e., `userUtterance` is `""`).
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* const { session } = useSession();
|
|
15
|
-
* <Transcript userUtterance={session.userUtterance} />
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @param userUtterance - Reactive string (`null` when idle, `""` when
|
|
19
|
-
* listening but no text yet, or the transcript text).
|
|
20
|
-
* @param className - Additional CSS class names.
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
function Transcript({ userUtterance, className }) {
|
|
25
|
-
if (userUtterance.value === null) return null;
|
|
26
|
-
return /* @__PURE__ */ jsx("div", {
|
|
27
|
-
class: clsx("flex flex-col items-end w-full", className),
|
|
28
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
29
|
-
class: "max-w-[min(82%,64ch)] whitespace-pre-wrap wrap-break-word text-sm leading-[150%] text-aai-text-muted bg-aai-surface-faint border border-aai-border px-3 py-2 rounded-aai ml-auto",
|
|
30
|
-
children: userUtterance.value || /* @__PURE__ */ jsx(ThinkingIndicator, {})
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
export { Transcript };
|
package/dist/audio.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/** Configuration for creating a {@link VoiceIO} instance. */
|
|
2
|
-
export type VoiceIOOptions = {
|
|
3
|
-
/** Sample rate in Hz expected by the STT engine (e.g. 16000). */
|
|
4
|
-
sttSampleRate: number;
|
|
5
|
-
/** Sample rate in Hz used by the TTS engine (e.g. 22050). */
|
|
6
|
-
ttsSampleRate: number;
|
|
7
|
-
/** Source URL or data URI for the capture AudioWorklet processor. */
|
|
8
|
-
captureWorkletSrc: string;
|
|
9
|
-
/** Source URL or data URI for the playback AudioWorklet processor. */
|
|
10
|
-
playbackWorkletSrc: string;
|
|
11
|
-
/** Callback invoked with buffered PCM16 microphone data to send to the server. */
|
|
12
|
-
onMicData: (pcm16: ArrayBuffer) => void;
|
|
13
|
-
/** Callback invoked with the current playback position in samples. */
|
|
14
|
-
onPlaybackProgress?: (samplesPlayed: number) => void;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Audio I/O interface for voice capture and playback.
|
|
18
|
-
*
|
|
19
|
-
* Manages microphone capture via an AudioWorklet, resampling to the STT
|
|
20
|
-
* sample rate, and TTS audio playback through a second AudioWorklet. Implements
|
|
21
|
-
* {@link AsyncDisposable} for resource cleanup.
|
|
22
|
-
*/
|
|
23
|
-
export type VoiceIO = AsyncDisposable & {
|
|
24
|
-
/** Enqueue a PCM16 audio buffer for playback through the TTS pipeline. */
|
|
25
|
-
enqueue(pcm16Buffer: ArrayBuffer): void;
|
|
26
|
-
/** Signal that all TTS audio for the current turn has been enqueued.
|
|
27
|
-
* Resolves when the worklet has finished playing all buffered audio. */
|
|
28
|
-
done(): Promise<void>;
|
|
29
|
-
/** Immediately stop playback and discard any buffered TTS audio. */
|
|
30
|
-
flush(): void;
|
|
31
|
-
/** Release all audio resources (microphone, AudioContext, worklets). */
|
|
32
|
-
close(): Promise<void>;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Create a {@link VoiceIO} instance that captures microphone audio and
|
|
36
|
-
* plays back TTS audio using the Web Audio API.
|
|
37
|
-
*
|
|
38
|
-
* The AudioContext runs at the TTS sample rate for playback fidelity.
|
|
39
|
-
* Captured audio is resampled to the STT rate when the rates differ.
|
|
40
|
-
*
|
|
41
|
-
* @param opts - Voice I/O configuration options.
|
|
42
|
-
* @returns A promise that resolves to a {@link VoiceIO} handle.
|
|
43
|
-
* @throws If microphone access is denied or AudioWorklet registration fails.
|
|
44
|
-
*/
|
|
45
|
-
export declare function createVoiceIO(opts: VoiceIOOptions): Promise<VoiceIO>;
|
package/dist/audio.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { MIC_BUFFER_SECONDS } from "./types.js";
|
|
2
|
-
//#region audio.ts
|
|
3
|
-
/**
|
|
4
|
-
* Create a {@link VoiceIO} instance that captures microphone audio and
|
|
5
|
-
* plays back TTS audio using the Web Audio API.
|
|
6
|
-
*
|
|
7
|
-
* The AudioContext runs at the TTS sample rate for playback fidelity.
|
|
8
|
-
* Captured audio is resampled to the STT rate when the rates differ.
|
|
9
|
-
*
|
|
10
|
-
* @param opts - Voice I/O configuration options.
|
|
11
|
-
* @returns A promise that resolves to a {@link VoiceIO} handle.
|
|
12
|
-
* @throws If microphone access is denied or AudioWorklet registration fails.
|
|
13
|
-
*/
|
|
14
|
-
async function createVoiceIO(opts) {
|
|
15
|
-
const { sttSampleRate, ttsSampleRate, captureWorkletSrc, playbackWorkletSrc, onMicData } = opts;
|
|
16
|
-
const contextRate = ttsSampleRate;
|
|
17
|
-
const ctx = new AudioContext({
|
|
18
|
-
sampleRate: contextRate,
|
|
19
|
-
latencyHint: "playback"
|
|
20
|
-
});
|
|
21
|
-
await ctx.resume();
|
|
22
|
-
const stream = await navigator.mediaDevices.getUserMedia({ audio: {
|
|
23
|
-
sampleRate: contextRate,
|
|
24
|
-
echoCancellation: true,
|
|
25
|
-
noiseSuppression: true,
|
|
26
|
-
autoGainControl: true
|
|
27
|
-
} });
|
|
28
|
-
try {
|
|
29
|
-
await Promise.all([ctx.audioWorklet.addModule(captureWorkletSrc), ctx.audioWorklet.addModule(playbackWorkletSrc)]);
|
|
30
|
-
} catch (err) {
|
|
31
|
-
for (const t of stream.getTracks()) t.stop();
|
|
32
|
-
await ctx.close().catch((err) => {
|
|
33
|
-
console.warn("AudioContext close failed:", err);
|
|
34
|
-
});
|
|
35
|
-
throw err;
|
|
36
|
-
}
|
|
37
|
-
const mic = ctx.createMediaStreamSource(stream);
|
|
38
|
-
const capNode = new AudioWorkletNode(ctx, "capture-processor", {
|
|
39
|
-
channelCount: 1,
|
|
40
|
-
channelCountMode: "explicit",
|
|
41
|
-
processorOptions: {
|
|
42
|
-
contextRate,
|
|
43
|
-
sttSampleRate
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
mic.connect(capNode);
|
|
47
|
-
const chunkSizeBytes = Math.floor(sttSampleRate * MIC_BUFFER_SECONDS) * 2;
|
|
48
|
-
const capBufA = new Uint8Array(chunkSizeBytes * 2);
|
|
49
|
-
const capBufB = new Uint8Array(chunkSizeBytes * 2);
|
|
50
|
-
let capBuf = capBufA;
|
|
51
|
-
let capOffset = 0;
|
|
52
|
-
capNode.port.postMessage({ event: "start" });
|
|
53
|
-
capNode.port.onmessage = (e) => {
|
|
54
|
-
if (e.data.event !== "chunk") return;
|
|
55
|
-
const chunk = new Uint8Array(e.data.buffer);
|
|
56
|
-
capBuf.set(chunk, capOffset);
|
|
57
|
-
capOffset += chunk.byteLength;
|
|
58
|
-
if (capOffset >= chunkSizeBytes) {
|
|
59
|
-
const sendBuf = capBuf;
|
|
60
|
-
const filled = capOffset;
|
|
61
|
-
capBuf = capBuf === capBufA ? capBufB : capBufA;
|
|
62
|
-
capOffset = 0;
|
|
63
|
-
onMicData(sendBuf.buffer.slice(0, filled));
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
let playNode = null;
|
|
67
|
-
let onPlaybackStop = null;
|
|
68
|
-
const lifecycle = new AbortController();
|
|
69
|
-
const { onPlaybackProgress } = opts;
|
|
70
|
-
function ensurePlayNode() {
|
|
71
|
-
if (playNode) return playNode;
|
|
72
|
-
const node = new AudioWorkletNode(ctx, "playback-processor", { processorOptions: { sampleRate: contextRate } });
|
|
73
|
-
node.connect(ctx.destination);
|
|
74
|
-
node.port.onmessage = (e) => {
|
|
75
|
-
if (e.data.event === "stop") {
|
|
76
|
-
node.disconnect();
|
|
77
|
-
if (playNode === node) playNode = null;
|
|
78
|
-
onPlaybackStop?.();
|
|
79
|
-
onPlaybackStop = null;
|
|
80
|
-
} else if (e.data.event === "progress") onPlaybackProgress?.(e.data.readPos);
|
|
81
|
-
};
|
|
82
|
-
playNode = node;
|
|
83
|
-
return node;
|
|
84
|
-
}
|
|
85
|
-
const io = {
|
|
86
|
-
enqueue(pcm16Buffer) {
|
|
87
|
-
if (lifecycle.signal.aborted) return;
|
|
88
|
-
if (pcm16Buffer.byteLength === 0) return;
|
|
89
|
-
ensurePlayNode().port.postMessage({
|
|
90
|
-
event: "write",
|
|
91
|
-
buffer: new Uint8Array(pcm16Buffer)
|
|
92
|
-
}, [pcm16Buffer]);
|
|
93
|
-
},
|
|
94
|
-
done() {
|
|
95
|
-
if (!playNode) return Promise.resolve();
|
|
96
|
-
return new Promise((resolve) => {
|
|
97
|
-
onPlaybackStop = resolve;
|
|
98
|
-
playNode?.port.postMessage({ event: "done" });
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
flush() {
|
|
102
|
-
if (playNode) playNode.port.postMessage({ event: "interrupt" });
|
|
103
|
-
},
|
|
104
|
-
async close() {
|
|
105
|
-
if (lifecycle.signal.aborted) return;
|
|
106
|
-
lifecycle.abort();
|
|
107
|
-
capNode.port.postMessage({ event: "stop" });
|
|
108
|
-
mic.disconnect();
|
|
109
|
-
capNode.disconnect();
|
|
110
|
-
if (playNode) playNode.disconnect();
|
|
111
|
-
for (const t of stream.getTracks()) t.stop();
|
|
112
|
-
await ctx.close().catch(() => {});
|
|
113
|
-
},
|
|
114
|
-
async [Symbol.asyncDispose]() {
|
|
115
|
-
await io.close();
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
return io;
|
|
119
|
-
}
|
|
120
|
-
//#endregion
|
|
121
|
-
export { createVoiceIO };
|
package/dist/client-context.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Theme overrides for the default UI. Applied as CSS custom properties.
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export type ClientTheme = {
|
|
7
|
-
/** Background color. Default: `#101010`. */
|
|
8
|
-
bg?: string;
|
|
9
|
-
/** Primary accent color. Default: `#fab283`. */
|
|
10
|
-
primary?: string;
|
|
11
|
-
/** Main text color. */
|
|
12
|
-
text?: string;
|
|
13
|
-
/** Surface/card color. */
|
|
14
|
-
surface?: string;
|
|
15
|
-
/** Border color. */
|
|
16
|
-
border?: string;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Resolved client-level configuration available to default UI components.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export type ClientConfig = {
|
|
24
|
-
title?: string | undefined;
|
|
25
|
-
theme?: ClientTheme | undefined;
|
|
26
|
-
};
|
|
27
|
-
export declare const ClientConfigProvider: import("preact").Provider<ClientConfig>;
|
|
28
|
-
/**
|
|
29
|
-
* Read client config (title, theme) from the nearest provider.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
export declare function useClientConfig(): ClientConfig;
|
package/dist/client-context.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createContext } from "preact";
|
|
2
|
-
import { useContext } from "preact/hooks";
|
|
3
|
-
//#region client-context.ts
|
|
4
|
-
const Ctx = createContext({});
|
|
5
|
-
const ClientConfigProvider = Ctx.Provider;
|
|
6
|
-
/**
|
|
7
|
-
* Read client config (title, theme) from the nearest provider.
|
|
8
|
-
*
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
function useClientConfig() {
|
|
12
|
-
return useContext(Ctx);
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { ClientConfigProvider, useClientConfig };
|
package/dist/client-handler.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ReadyConfig } from "@alexkroman1/aai/protocol";
|
|
2
|
-
import type { VoiceIO } from "./audio.ts";
|
|
3
|
-
import type { AgentState, ChatMessage, Reactive, SessionError, ToolCallInfo } from "./types.ts";
|
|
4
|
-
type BatchFn = (fn: () => void) => void;
|
|
5
|
-
/**
|
|
6
|
-
* Handles server→client messages and updates reactive Preact signals
|
|
7
|
-
* accordingly (state transitions, transcripts, messages, audio playback).
|
|
8
|
-
*
|
|
9
|
-
* @internal Exported for testing only.
|
|
10
|
-
*/
|
|
11
|
-
export declare class ClientHandler {
|
|
12
|
-
#private;
|
|
13
|
-
constructor(opts: {
|
|
14
|
-
state: Reactive<AgentState>;
|
|
15
|
-
messages: Reactive<ChatMessage[]>;
|
|
16
|
-
toolCalls: Reactive<ToolCallInfo[]>;
|
|
17
|
-
userUtterance: Reactive<string | null>;
|
|
18
|
-
agentUtterance: Reactive<string | null>;
|
|
19
|
-
error: Reactive<SessionError | null>;
|
|
20
|
-
voiceIO: () => VoiceIO | null;
|
|
21
|
-
batch: BatchFn;
|
|
22
|
-
});
|
|
23
|
-
/** Single entry point for all server→client session events. */
|
|
24
|
-
event(e: import("@alexkroman1/aai/protocol").ClientEvent): void;
|
|
25
|
-
/** Enqueue a PCM16 audio chunk for playback. Transitions state to `"speaking"` on the first chunk. */
|
|
26
|
-
playAudioChunk(chunk: Uint8Array): void;
|
|
27
|
-
/**
|
|
28
|
-
* Signal that the server has finished sending audio for this turn.
|
|
29
|
-
* Waits for the audio queue to drain, then transitions state to `"listening"`.
|
|
30
|
-
* Uses the `#generation` counter to discard stale completions from interrupted turns.
|
|
31
|
-
*/
|
|
32
|
-
playAudioDone(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Dispatch an incoming WebSocket message (text or binary).
|
|
35
|
-
*
|
|
36
|
-
* Returns the parsed config if the message is a `config` message,
|
|
37
|
-
* otherwise `null`.
|
|
38
|
-
*/
|
|
39
|
-
handleMessage(data: string | ArrayBuffer): (ReadyConfig & {
|
|
40
|
-
sessionId?: string;
|
|
41
|
-
}) | null;
|
|
42
|
-
}
|
|
43
|
-
export {};
|