@alexkroman1/aai-ui 5.0.1 → 5.1.1

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 (30) hide show
  1. package/dist/{_colors-DYX7XRTr.js → _colors-Bfh3-BVE.js} +3 -1
  2. package/dist/{_utils-CN1yVgYS.js → _utils-CsqbIVGI.js} +10 -1
  3. package/dist/_utils.d.ts +6 -0
  4. package/dist/{chat-view-CW-tZCMm.js → chat-view-C6N2oXjo.js} +4 -4
  5. package/dist/client-config.d.ts +3 -2
  6. package/dist/components/_colors.d.ts +2 -0
  7. package/dist/components/chat-view.js +1 -1
  8. package/dist/components/controls.js +1 -1
  9. package/dist/components/message-list.js +1 -1
  10. package/dist/components/start-screen.js +1 -1
  11. package/dist/components/tool-call-block.js +1 -1
  12. package/dist/components/url-chips.d.ts +2 -1
  13. package/dist/{controls-DV368uhb.js → controls-Cqg7T4FN.js} +5 -8
  14. package/dist/default-client/assets/{audio-BdEKgLwT.js → audio-C1U_foBG.js} +1 -1
  15. package/dist/default-client/assets/{capture-processor-_QJe3nzY.js → capture-processor-dyyJArQs.js} +1 -1
  16. package/dist/default-client/assets/index-CGZajs1V.js +192 -0
  17. package/dist/default-client/assets/{playback-processor-C_F19eUJ.js → playback-processor-BO2TdYrv.js} +1 -1
  18. package/dist/default-client/index.html +1 -1
  19. package/dist/define-client.d.ts +6 -8
  20. package/dist/define-client.js +5 -4
  21. package/dist/hooks.js +1 -1
  22. package/dist/index.js +5 -5
  23. package/dist/{message-list-q2lTiFhF.js → message-list-CD9GxrlH.js} +106 -104
  24. package/dist/{session-core-ByBLnLfW.js → session-core-Bvga6tUS.js} +31 -25
  25. package/dist/session-core-audio-setup.d.ts +10 -1
  26. package/dist/session-core-types.d.ts +8 -4
  27. package/dist/session-core.js +1 -1
  28. package/dist/{tool-call-block-DIxpG8GM.js → tool-call-block-O9vLqoyU.js} +2 -2
  29. package/package.json +2 -2
  30. package/dist/default-client/assets/index-RQnhfgSS.js +0 -192
@@ -15,6 +15,8 @@ const TEXT_FAINT = "#6F6A60";
15
15
  const SURFACE_TINT = "rgba(20,18,12,0.03)";
16
16
  /** Error red tuned for warm light surfaces. */
17
17
  const ERROR_COLOR = "#B3261E";
18
+ /** Amber used by the "thinking" state indicator. */
19
+ const THINKING_COLOR = "#B98900";
18
20
  /**
19
21
  * Derive the user-bubble fill/edge from the theme primary (the mock's
20
22
  * indigo-50 background with an indigo-100 border), so custom themes keep a
@@ -24,4 +26,4 @@ function primaryTint(primary, surface, pct) {
24
26
  return `color-mix(in srgb, ${primary} ${pct}%, ${surface})`;
25
27
  }
26
28
  //#endregion
27
- export { primaryTint as a, TEXT_MUTED as i, SURFACE_TINT as n, TEXT_FAINT as r, ERROR_COLOR as t };
29
+ export { THINKING_COLOR as a, TEXT_MUTED as i, SURFACE_TINT as n, primaryTint as o, TEXT_FAINT as r, ERROR_COLOR as t };
@@ -9,5 +9,14 @@ function tryParseJSON(str) {
9
9
  function truncate(s, max = 80) {
10
10
  return s.length > max ? `${s.slice(0, max)}...` : s;
11
11
  }
12
+ /**
13
+ * The page this UI is served from — the agent's base URL when none is
14
+ * configured explicitly. One definition so `client()`'s default and the
15
+ * shareable-URL chip can never disagree about which agent the page is.
16
+ */
17
+ function pageBaseUrl() {
18
+ if (typeof location === "undefined") return "";
19
+ return location.origin + location.pathname;
20
+ }
12
21
  //#endregion
13
- export { tryParseJSON as n, truncate as t };
22
+ export { truncate as n, tryParseJSON as r, pageBaseUrl as t };
package/dist/_utils.d.ts CHANGED
@@ -2,3 +2,9 @@
2
2
  export declare function tryParseJSON(str: string | undefined): unknown;
3
3
  /** Truncate a string to `max` characters, appending an ellipsis when cut. */
4
4
  export declare function truncate(s: string, max?: number): string;
5
+ /**
6
+ * The page this UI is served from — the agent's base URL when none is
7
+ * configured explicitly. One definition so `client()`'s default and the
8
+ * shareable-URL chip can never disagree about which agent the page is.
9
+ */
10
+ export declare function pageBaseUrl(): string;
@@ -1,9 +1,9 @@
1
1
  import { useSessionSelector, useTheme } from "./context.js";
2
- import { r as TEXT_FAINT, t as ERROR_COLOR } from "./_colors-DYX7XRTr.js";
2
+ import { a as THINKING_COLOR, r as TEXT_FAINT, t as ERROR_COLOR } from "./_colors-Bfh3-BVE.js";
3
3
  import { t as AaiLogo } from "./aai-logo-B8lDmsut.js";
4
4
  import { t as Eyebrow } from "./eyebrow-C6ZFuiz6.js";
5
- import { t as Controls } from "./controls-DV368uhb.js";
6
- import { t as MessageList } from "./message-list-q2lTiFhF.js";
5
+ import { t as Controls } from "./controls-Cqg7T4FN.js";
6
+ import { t as MessageList } from "./message-list-CD9GxrlH.js";
7
7
  import clsx from "clsx";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  //#region components/console-shell.tsx
@@ -18,7 +18,7 @@ function stateColor(state, primary) {
18
18
  case "listening":
19
19
  case "speaking":
20
20
  case "ready": return primary;
21
- case "thinking": return "#B98900";
21
+ case "thinking": return THINKING_COLOR;
22
22
  case "error": return ERROR_COLOR;
23
23
  default: return TEXT_FAINT;
24
24
  }
@@ -26,8 +26,9 @@ export declare function buildAgentUrl(platformUrl: string, endpointPath: string)
26
26
  * server) — a durable fact worth latching. A lookup that FAILED means
27
27
  * nothing about the server, and treating the two alike is how a single 503
28
28
  * (a sandbox mid-boot, or one that failed to start) pinned a session to the
29
- * platform's `/:slug/websocket` — answered `410 Gone` on every retry, with
30
- * no re-brokering even after the agent recovered.
29
+ * platform's `/:slug/websocket` — a WebSocket redirect browsers don't
30
+ * follow, so every retry failed with no re-brokering even after the agent
31
+ * recovered.
31
32
  */
32
33
  export declare function loadClientConfig(platformUrl: string, fetchFn?: typeof globalThis.fetch): Promise<ClientConfigResponse | null>;
33
34
  /** Fetch the agent's client config; any failure yields the agent default. */
@@ -14,6 +14,8 @@ export declare const TEXT_FAINT = "#6F6A60";
14
14
  export declare const SURFACE_TINT = "rgba(20,18,12,0.03)";
15
15
  /** Error red tuned for warm light surfaces. */
16
16
  export declare const ERROR_COLOR = "#B3261E";
17
+ /** Amber used by the "thinking" state indicator. */
18
+ export declare const THINKING_COLOR = "#B98900";
17
19
  /**
18
20
  * Derive the user-bubble fill/edge from the theme primary (the mock's
19
21
  * indigo-50 background with an indigo-100 border), so custom themes keep a
@@ -1,3 +1,3 @@
1
1
  import "../context.js";
2
- import { t as ChatView } from "../chat-view-CW-tZCMm.js";
2
+ import { t as ChatView } from "../chat-view-C6N2oXjo.js";
3
3
  export { ChatView };
@@ -1,3 +1,3 @@
1
1
  import "../context.js";
2
- import { t as Controls } from "../controls-DV368uhb.js";
2
+ import { t as Controls } from "../controls-Cqg7T4FN.js";
3
3
  export { Controls };
@@ -1,3 +1,3 @@
1
1
  import "../context.js";
2
- import { t as MessageList } from "../message-list-q2lTiFhF.js";
2
+ import { t as MessageList } from "../message-list-CD9GxrlH.js";
3
3
  export { MessageList };
@@ -1,6 +1,6 @@
1
1
  import { useSessionCore, useSessionSelector, useTheme } from "../context.js";
2
2
  import { Button } from "./button.js";
3
- import "../_colors-DYX7XRTr.js";
3
+ import "../_colors-Bfh3-BVE.js";
4
4
  import { t as AaiLogo } from "../aai-logo-B8lDmsut.js";
5
5
  import { t as Eyebrow } from "../eyebrow-C6ZFuiz6.js";
6
6
  import clsx from "clsx";
@@ -1,3 +1,3 @@
1
1
  import "../context.js";
2
- import { t as ToolCallBlock } from "../tool-call-block-DIxpG8GM.js";
2
+ import { t as ToolCallBlock } from "../tool-call-block-O9vLqoyU.js";
3
3
  export { ToolCallBlock };
@@ -1,5 +1,6 @@
1
1
  /**
2
- * The session's shareable UI URL.
2
+ * The session's shareable UI URL — the page this UI is served from, what
3
+ * you'd send someone to talk to the agent.
3
4
  *
4
5
  * @public
5
6
  */
@@ -1,6 +1,7 @@
1
1
  import { useSessionCore, useSessionSelector, useTheme } from "./context.js";
2
2
  import { Button } from "./components/button.js";
3
- import { i as TEXT_MUTED, n as SURFACE_TINT, r as TEXT_FAINT } from "./_colors-DYX7XRTr.js";
3
+ import { i as TEXT_MUTED, n as SURFACE_TINT, r as TEXT_FAINT } from "./_colors-Bfh3-BVE.js";
4
+ import { t as pageBaseUrl } from "./_utils-CsqbIVGI.js";
4
5
  import clsx from "clsx";
5
6
  import { memo, useEffect, useRef, useState } from "react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -50,20 +51,16 @@ function UrlChip({ label, url, hint, testId, className }) {
50
51
  })]
51
52
  });
52
53
  }
53
- /** The page this UI is served from — what you'd send someone to talk to the agent. */
54
- function pageUrl() {
55
- if (typeof window === "undefined") return "";
56
- return `${window.location.origin}${window.location.pathname}`;
57
- }
58
54
  /**
59
- * The session's shareable UI URL.
55
+ * The session's shareable UI URL — the page this UI is served from, what
56
+ * you'd send someone to talk to the agent.
60
57
  *
61
58
  * @public
62
59
  */
63
60
  function UiUrlChip({ className }) {
64
61
  return /* @__PURE__ */ jsx(UrlChip, {
65
62
  label: "UI",
66
- url: pageUrl(),
63
+ url: pageBaseUrl(),
67
64
  hint: "Shareable UI",
68
65
  testId: "ui-url-chip",
69
66
  className
@@ -1 +1 @@
1
- import{a as e,o as t,t as n}from"./index-RQnhfgSS.js";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){e.then(e=>{for(let t of e.getTracks())t.stop()}).catch(()=>{})}function a(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(){return new Promise(e=>{let t=setTimeout(e,250);i=()=>{clearTimeout(t),e()},r.port.postMessage({event:`stop`})})}}}async function o(o){let{sttSampleRate:s,ttsSampleRate:c,captureWorkletSrc:l,playbackWorkletSrc:u,onMicData:d,onError:f,onPlaybackStats:p,onMicSilent:m}=o,h=new AudioContext({sampleRate:c,latencyHint:`playback`}),g=s===c,_=g?h:new AudioContext({sampleRate:s,latencyHint:`interactive`});async function v(){let e=g?[h]:[h,_];await Promise.all(e.map(e=>e.close().catch(e=>{console.warn(`AudioContext close failed:`,e)})))}let y=navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:`default`},...n}}),b;try{[b]=await Promise.all([y,h.resume(),_.resume(),_.audioWorklet.addModule(l),h.audioWorklet.addModule(u)]),r(_.sampleRate,s,`capture`),r(h.sampleRate,c,`playback`)}catch(e){throw i(y),await v(),e}let x=_.createMediaStreamSource(b),S=a(_,d,m);x.connect(S.node),S.node.onprocessorerror=()=>{let e=Error(`Audio capture worklet crashed`);console.error(`[aai-ui]`,e.message),f?.(e)},S.start();let C=null,w=null,T=new AbortController;function E(){if(C)return C;let e=new AudioWorkletNode(h,`playback-processor`);return e.connect(h.destination),e.port.onmessage=e=>{if(e.data.event===`stop`){let t=e.data.stats;if(t&&t.concealedSamples>0&&p?.(t),e.data.reason===`interrupt`)return;w?.(),w=null}},e.onprocessorerror=()=>{let e=Error(`Audio playback worklet crashed`);console.error(`[aai-ui]`,e.message),w?.(),w=null,f?.(e)},C=e,e}let D={enqueue(e){T.signal.aborted||e.byteLength!==0&&E().port.postMessage({event:`write`,buffer:new Uint8Array(e)},[e])},done(){return!C||(C.port.postMessage({event:`done`}),h.state!==`running`)?Promise.resolve():new Promise(n=>{w?.();let r=()=>{clearInterval(i),clearTimeout(a),w===r&&(w=null),n()},i=setInterval(()=>{h.state!==`running`&&r()},t),a=setTimeout(r,e);w=r})},flush(){C&&(w?.(),w=null,C.port.postMessage({event:`interrupt`}))},async close(){if(!T.signal.aborted){T.abort(),await S.stop(),x.disconnect(),S.node.disconnect(),C&&C.disconnect();for(let e of b.getTracks())e.stop();await v()}},async[Symbol.asyncDispose](){await D.close()}};return D}export{o as createVoiceIO};
1
+ import{a as e,o as t,t as n}from"./index-CGZajs1V.js";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){e.then(e=>{for(let t of e.getTracks())t.stop()}).catch(()=>{})}function a(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(){return new Promise(e=>{let t=setTimeout(e,250);i=()=>{clearTimeout(t),e()},r.port.postMessage({event:`stop`})})}}}async function o(o){let{sttSampleRate:s,ttsSampleRate:c,captureWorkletSrc:l,playbackWorkletSrc:u,onMicData:d,onError:f,onPlaybackStats:p,onMicSilent:m}=o,h=new AudioContext({sampleRate:c,latencyHint:`playback`}),g=s===c,_=g?h:new AudioContext({sampleRate:s,latencyHint:`interactive`});async function v(){let e=g?[h]:[h,_];await Promise.all(e.map(e=>e.close().catch(e=>{console.warn(`AudioContext close failed:`,e)})))}let y=navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:`default`},...n}}),b;try{[b]=await Promise.all([y,h.resume(),_.resume(),_.audioWorklet.addModule(l),h.audioWorklet.addModule(u)]),r(_.sampleRate,s,`capture`),r(h.sampleRate,c,`playback`)}catch(e){throw i(y),await v(),e}let x=_.createMediaStreamSource(b),S=a(_,d,m);x.connect(S.node),S.node.onprocessorerror=()=>{let e=Error(`Audio capture worklet crashed`);console.error(`[aai-ui]`,e.message),f?.(e)},S.start();let C=null,w=null,T=new AbortController;function E(){if(C)return C;let e=new AudioWorkletNode(h,`playback-processor`);return e.connect(h.destination),e.port.onmessage=e=>{if(e.data.event===`stop`){let t=e.data.stats;if(t&&t.concealedSamples>0&&p?.(t),e.data.reason===`interrupt`)return;w?.(),w=null}},e.onprocessorerror=()=>{let e=Error(`Audio playback worklet crashed`);console.error(`[aai-ui]`,e.message),w?.(),w=null,f?.(e)},C=e,e}let D={enqueue(e){T.signal.aborted||e.byteLength!==0&&E().port.postMessage({event:`write`,buffer:new Uint8Array(e)},[e])},done(){return!C||(C.port.postMessage({event:`done`}),h.state!==`running`)?Promise.resolve():new Promise(n=>{w?.();let r=()=>{clearInterval(i),clearTimeout(a),w===r&&(w=null),n()},i=setInterval(()=>{h.state!==`running`&&r()},t),a=setTimeout(r,e);w=r})},flush(){C&&(w?.(),w=null,C.port.postMessage({event:`interrupt`}))},async close(){if(!T.signal.aborted){T.abort(),await S.stop(),x.disconnect(),S.node.disconnect(),C&&C.disconnect();for(let e of b.getTracks())e.stop();await v()}},async[Symbol.asyncDispose](){await D.close()}};return D}export{o as createVoiceIO};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./index-RQnhfgSS.js";import{t as n}from"./_module-url-BX0RuRU2.js";var r=n(`
1
+ import{n as e,r as t}from"./index-CGZajs1V.js";import{t as n}from"./_module-url-BX0RuRU2.js";var r=n(`
2
2
  class CaptureProcessor extends AudioWorkletProcessor {
3
3
  constructor(options) {
4
4
  super();