@alexkroman1/aai-ui 10.0.1 → 11.0.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 (25) hide show
  1. package/dist/{aai-logo-9xRBGVFl.js → aai-logo-CXZGPSIY.js} +2 -1
  2. package/dist/{chat-view-BJ6sOARu.js → chat-view-DDTtrh7N.js} +2 -2
  3. package/dist/components/button.js +11 -10
  4. package/dist/components/chat-view.js +1 -1
  5. package/dist/components/controls.js +1 -1
  6. package/dist/components/message-list.js +1 -1
  7. package/dist/components/start-screen.js +1 -1
  8. package/dist/components/tool-call-block.js +1 -1
  9. package/dist/default-client/assets/{audio-CoVe8N48.js → audio-BuDICbPf.js} +1 -1
  10. package/dist/default-client/assets/{capture-processor-Dmc-KEpb.js → capture-processor-BO5IsLJE.js} +1 -1
  11. package/dist/default-client/assets/client-audio-constants-CP13UQZt.js +1 -0
  12. package/dist/default-client/assets/index-B8Zz9w5B.js +298 -0
  13. package/dist/default-client/assets/{playback-processor-DwQ9tE7X.js → playback-processor-BWxNmYZp.js} +1 -1
  14. package/dist/default-client/index.html +2 -2
  15. package/dist/define-client.js +2 -2
  16. package/dist/index.js +32 -26
  17. package/dist/internal.js +1 -1
  18. package/dist/{message-list-Dtl03sGr.js → message-list-BJYyuIcR.js} +1 -1
  19. package/dist/{session-core-0hClhPz-.js → session-core-DxBYsfHA.js} +1 -4
  20. package/dist/session-core.js +1 -1
  21. package/dist/{tool-call-block-B7KlhaWl.js → tool-call-block-tcPQAkcP.js} +11 -10
  22. package/dist/{url-chips-DxXKgyL9.js → url-chips-YqhCjWfQ.js} +2 -1
  23. package/package.json +28 -23
  24. package/dist/default-client/assets/client-audio-constants-Ck0IJO4c.js +0 -1
  25. package/dist/default-client/assets/index-DS-RCrri.js +0 -299
@@ -13,6 +13,7 @@ import { memo } from "react";
13
13
  * @internal
14
14
  */
15
15
  const AaiLogo = memo(function AaiLogo({ size = 20 }) {
16
+ const theme = useTheme();
16
17
  return /* @__PURE__ */ jsxs("svg", {
17
18
  role: "img",
18
19
  "aria-label": "AssemblyAI",
@@ -22,7 +23,7 @@ const AaiLogo = memo(function AaiLogo({ size = 20 }) {
22
23
  xmlns: "http://www.w3.org/2000/svg",
23
24
  style: {
24
25
  display: "block",
25
- color: useTheme().text
26
+ color: theme.text
26
27
  },
27
28
  children: [
28
29
  /* @__PURE__ */ jsx("path", {
@@ -1,7 +1,7 @@
1
- import { t as MessageList } from "./message-list-Dtl03sGr.js";
1
+ import { t as MessageList } from "./message-list-BJYyuIcR.js";
2
2
  import { useSessionSelector, useTheme } from "./context.js";
3
3
  import { n as THINKING_COLOR, r as inkTint, t as ERROR_COLOR } from "./_colors-j8XMToi9.js";
4
- import { t as AaiLogo } from "./aai-logo-9xRBGVFl.js";
4
+ import { t as AaiLogo } from "./aai-logo-CXZGPSIY.js";
5
5
  import { t as Eyebrow } from "./eyebrow-C6ZFuiz6.js";
6
6
  import { Controls } from "./components/controls.js";
7
7
  import clsx from "clsx";
@@ -63,18 +63,19 @@ function variantColors(variant, theme) {
63
63
  function Button({ variant = "default", size = "default", className, children, style, ...rest }) {
64
64
  const theme = useTheme();
65
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
+ outlineColor: theme.primary,
74
+ ...style
75
+ };
66
76
  return /* @__PURE__ */ jsx("button", {
67
77
  type: "button",
68
- style: {
69
- "--aai-btn-bg": colors.bg,
70
- "--aai-btn-fg": colors.fg,
71
- "--aai-btn-bd": colors.border,
72
- "--aai-btn-bg-hover": colors.hoverBg,
73
- "--aai-btn-fg-hover": colors.hoverFg,
74
- "--aai-btn-bd-hover": colors.hoverBorder,
75
- outlineColor: theme.primary,
76
- ...style
77
- },
78
+ style: vars,
78
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)", "outline-none focus-visible:[outline:2px_solid] focus-visible:[outline-offset:2px]", "disabled:cursor-not-allowed disabled:opacity-50", className),
79
80
  ...rest,
80
81
  children
@@ -1,3 +1,3 @@
1
1
  import "../context.js";
2
- import { t as ChatView } from "../chat-view-BJ6sOARu.js";
2
+ import { t as ChatView } from "../chat-view-DDTtrh7N.js";
3
3
  export { ChatView };
@@ -1,6 +1,6 @@
1
1
  import { useSessionCore, useSessionSelector } from "../context.js";
2
2
  import { Button } from "./button.js";
3
- import { n as SessionUrlChips } from "../url-chips-DxXKgyL9.js";
3
+ import { n as SessionUrlChips } from "../url-chips-YqhCjWfQ.js";
4
4
  import clsx from "clsx";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { memo } from "react";
@@ -1,3 +1,3 @@
1
- import { t as MessageList } from "../message-list-Dtl03sGr.js";
1
+ import { t as MessageList } from "../message-list-BJYyuIcR.js";
2
2
  import "../context.js";
3
3
  export { MessageList };
@@ -1,7 +1,7 @@
1
1
  import { useSessionCore, useSessionSelector, useTheme } from "../context.js";
2
2
  import { r as inkTint } from "../_colors-j8XMToi9.js";
3
3
  import { Button } from "./button.js";
4
- import { t as AaiLogo } from "../aai-logo-9xRBGVFl.js";
4
+ import { t as AaiLogo } from "../aai-logo-CXZGPSIY.js";
5
5
  import { t as Eyebrow } from "../eyebrow-C6ZFuiz6.js";
6
6
  import clsx from "clsx";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,3 +1,3 @@
1
1
  import "../context.js";
2
- import { t as ToolCallBlock } from "../tool-call-block-B7KlhaWl.js";
2
+ import { t as ToolCallBlock } from "../tool-call-block-tcPQAkcP.js";
3
3
  export { ToolCallBlock };
@@ -1 +1 @@
1
- import{o as e,s as t}from"./client-audio-constants-Ck0IJO4c.js";var n={echoCancellation:!0,noiseSuppression:!1,autoGainControl:!1,voiceIsolation:!1};function r(e,t,n){if(e!==t)throw Error(`Browser refused the ${n} sample rate: asked for ${t} Hz, got ${e} Hz`)}function i(e){let t=Error(`Audio ${e} worklet crashed`);return console.error(`[aai-ui]`,t.message),t}function a(e){e.then(e=>{for(let t of e.getTracks())t.stop()}).catch(()=>{})}function o(e,t,n){let r=new AudioWorkletNode(e,`capture-processor`,{channelCount:1,channelCountMode:`explicit`}),i=null;return r.port.onmessage=e=>{let r=e.data;r.event===`chunk`&&r.buffer?t(r.buffer):r.event===`silent`?n?.():r.event===`stopped`&&(i?.(),i=null)},{node:r,start(){r.port.postMessage({event:`start`})},stop(){let{promise:e,resolve:t}=Promise.withResolvers(),n=setTimeout(t,250);return i=()=>{clearTimeout(n),t()},r.port.postMessage({event:`stop`}),e}}}async function s(s){let{sttSampleRate:c,ttsSampleRate:l,captureWorkletSrc:u,playbackWorkletSrc:d,onMicData:f,onError:p,onPlaybackStats:m,onPlaybackProgress:h,onMicSilent:g}=s,_=new AudioContext({sampleRate:l,latencyHint:`playback`}),v=c===l,y=v?_:new AudioContext({sampleRate:c,latencyHint:`interactive`});async function b(){let e=v?[_]:[_,y];await Promise.all(e.map(e=>e.close().catch(e=>{console.warn(`AudioContext close failed:`,e)})))}let x=navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:`default`},...n}}),S;try{[S]=await Promise.all([x,_.resume(),y.resume(),y.audioWorklet.addModule(u),_.audioWorklet.addModule(d)]),r(y.sampleRate,c,`capture`),r(_.sampleRate,l,`playback`)}catch(e){throw a(x),await b(),e}let C=y.createMediaStreamSource(S),w=o(y,f,g);C.connect(w.node),w.node.onprocessorerror=()=>p?.(i(`capture`)),w.start();let T=null,E=null,D=0,O=null,k=new AbortController;function A(){E?.(),E=null,O=null}function j(e){e.stats&&e.stats.concealedSamples>0&&m?.(e.stats),e.reason!==`interrupt`&&(O===null||e.turn===O)&&A()}function M(){if(T)return T;let e=new AudioWorkletNode(_,`playback-processor`);return e.connect(_.destination),e.port.onmessage=e=>{e.data.event===`stop`?j(e.data):e.data.event===`progress`&&h?.(e.data.bufferedMs)},e.onprocessorerror=()=>{let e=i(`playback`);A(),p?.(e)},T=e,e}let N={enqueue(e){k.signal.aborted||e.byteLength!==0&&M().port.postMessage({event:`write`,buffer:new Uint8Array(e)},[e])},done(){if(!T)return Promise.resolve();let n=++D;if(T.port.postMessage({event:`done`,turn:n}),_.state!==`running`)return O=null,Promise.resolve();let{promise:r,resolve:i}=Promise.withResolvers();E?.();let a=()=>{clearInterval(o),clearTimeout(s),E===a&&(E=null,O=null),i()},o=setInterval(()=>{_.state!==`running`&&a()},t),s=setTimeout(a,e);return E=a,O=n,r},flush(){T&&(A(),T.port.postMessage({event:`interrupt`}))},async close(){if(!k.signal.aborted){k.abort(),await w.stop(),C.disconnect(),w.node.disconnect(),T&&T.disconnect();for(let e of S.getTracks())e.stop();await b()}},async[Symbol.asyncDispose](){await N.close()}};return N}export{s as createVoiceIO};
1
+ import{a as e,o as t}from"./client-audio-constants-CP13UQZt.js";var n={echoCancellation:!0,noiseSuppression:!1,autoGainControl:!1,voiceIsolation:!1};function r(e,t,n){if(e!==t)throw Error(`Browser refused the ${n} sample rate: asked for ${t} Hz, got ${e} Hz`)}function i(e){let t=Error(`Audio ${e} worklet crashed`);return console.error(`[aai-ui]`,t.message),t}function a(e){e.then(e=>{for(let t of e.getTracks())t.stop()}).catch(()=>{})}function o(e,t,n){let r=new AudioWorkletNode(e,`capture-processor`,{channelCount:1,channelCountMode:`explicit`}),i=null;return r.port.onmessage=e=>{let r=e.data;r.event===`chunk`&&r.buffer?t(r.buffer):r.event===`silent`?n?.():r.event===`stopped`&&(i?.(),i=null)},{node:r,start(){r.port.postMessage({event:`start`})},stop(){let{promise:e,resolve:t}=Promise.withResolvers(),n=setTimeout(t,250);return i=()=>{clearTimeout(n),t()},r.port.postMessage({event:`stop`}),e}}}async function s(s){let{sttSampleRate:c,ttsSampleRate:l,captureWorkletSrc:u,playbackWorkletSrc:d,onMicData:f,onError:p,onPlaybackStats:m,onPlaybackProgress:h,onMicSilent:g}=s,_=new AudioContext({sampleRate:l,latencyHint:`playback`}),v=c===l,y=v?_:new AudioContext({sampleRate:c,latencyHint:`interactive`});async function b(){let e=v?[_]:[_,y];await Promise.all(e.map(e=>e.close().catch(e=>{console.warn(`AudioContext close failed:`,e)})))}let x=navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:`default`},...n}}),S;try{[S]=await Promise.all([x,_.resume(),y.resume(),y.audioWorklet.addModule(u),_.audioWorklet.addModule(d)]),r(y.sampleRate,c,`capture`),r(_.sampleRate,l,`playback`)}catch(e){throw a(x),await b(),e}let C=y.createMediaStreamSource(S),w=o(y,f,g);C.connect(w.node),w.node.onprocessorerror=()=>p?.(i(`capture`)),w.start();let T=null,E=null,D=0,O=null,k=new AbortController;function A(){E?.(),E=null,O=null}function j(e){e.stats&&e.stats.concealedSamples>0&&m?.(e.stats),e.reason!==`interrupt`&&(O===null||e.turn===O)&&A()}function M(){if(T)return T;let e=new AudioWorkletNode(_,`playback-processor`);return e.connect(_.destination),e.port.onmessage=e=>{e.data.event===`stop`?j(e.data):e.data.event===`progress`&&h?.(e.data.bufferedMs)},e.onprocessorerror=()=>{let e=i(`playback`);A(),p?.(e)},T=e,e}let N={enqueue(e){k.signal.aborted||e.byteLength!==0&&M().port.postMessage({event:`write`,buffer:new Uint8Array(e)},[e])},done(){if(!T)return Promise.resolve();let n=++D;if(T.port.postMessage({event:`done`,turn:n}),_.state!==`running`)return O=null,Promise.resolve();let{promise:r,resolve:i}=Promise.withResolvers();E?.();let a=()=>{clearInterval(o),clearTimeout(s),E===a&&(E=null,O=null),i()},o=setInterval(()=>{_.state!==`running`&&a()},t),s=setTimeout(a,e);return E=a,O=n,r},flush(){T&&(A(),T.port.postMessage({event:`interrupt`}))},async close(){if(!k.signal.aborted){k.abort(),await w.stop(),C.disconnect(),w.node.disconnect(),T&&T.disconnect();for(let e of S.getTracks())e.stop();await b()}},async[Symbol.asyncDispose](){await N.close()}};return N}export{s as createVoiceIO};
@@ -1,4 +1,4 @@
1
- import{i as e,n as t}from"./client-audio-constants-Ck0IJO4c.js";import{t as n}from"./_module-url-BX0RuRU2.js";var r=`
1
+ import{r as e,t}from"./client-audio-constants-CP13UQZt.js";import{t as n}from"./_module-url-BX0RuRU2.js";var r=`
2
2
  class CaptureProcessor extends AudioWorkletProcessor {
3
3
  constructor(options) {
4
4
  super();
@@ -0,0 +1 @@
1
+ var e=.1,t=1500,n=.001,r=1e3,i=65e3,a=65536;export{i as a,n as i,a as n,r as o,t as r,e as t};