@alexkroman1/aai-ui 3.2.0 → 5.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.
- package/dist/audio.d.ts +0 -33
- package/dist/audio.js +2 -20
- package/dist/{chat-view-C1oJxsWz.js → chat-view-CW-tZCMm.js} +1 -4
- package/dist/components/chat-view.js +1 -1
- package/dist/components/console-shell.d.ts +0 -9
- package/dist/components/markdown.d.ts +21 -0
- package/dist/components/message-list.d.ts +0 -8
- package/dist/components/message-list.js +3 -230
- package/dist/components/url-chips.d.ts +0 -15
- package/dist/context.d.ts +1 -1
- package/dist/default-client/assets/audio-Bu1LSuiR.js +1 -0
- package/dist/default-client/assets/{capture-processor-DYl6YIu5.js → capture-processor-ssRD81Mo.js} +1 -1
- package/dist/default-client/assets/index-0-DXv-S4.js +192 -0
- package/dist/default-client/assets/index-CRfdZPH1.css +2 -0
- package/dist/default-client/assets/{playback-processor-CeEGzgVT.js → playback-processor-CRwbxC1v.js} +1 -1
- package/dist/default-client/index.html +2 -2
- package/dist/define-client.d.ts +13 -2
- package/dist/define-client.js +120 -4
- package/dist/hooks.d.ts +40 -2
- package/dist/hooks.js +24 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -8
- package/dist/message-list-q2lTiFhF.js +381 -0
- package/dist/{session-core-DgioOYyx.js → session-core-Bjkr4PAP.js} +112 -57
- package/dist/session-core-audio-setup.d.ts +3 -6
- package/dist/session-core-messages.d.ts +2 -1
- package/dist/session-core-reconnect.d.ts +4 -3
- package/dist/session-core-types.d.ts +11 -12
- package/dist/session-core-url.d.ts +5 -0
- package/dist/session-core.d.ts +0 -1
- package/dist/session-core.js +1 -1
- package/dist/types.d.ts +18 -2
- package/dist/types.js +2 -2
- package/package.json +4 -2
- package/dist/default-client/assets/audio-CIZMTfDQ.js +0 -1
- package/dist/default-client/assets/index-BeVXjGwG.js +0 -344
- package/dist/default-client/assets/index-Dv-Q5VRL.css +0 -2
- package/dist/define-client-fjNCp9be.js +0 -150
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-wide:.025em;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--font-aai:"Monument Grotesk", "ABC Monument Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;--font-aai-serif:"Source Serif 4", "Source Serif Pro", Charter, "Iowan Old Style", Georgia, serif;--font-aai-mono:"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;--radius-aai:4px}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}html,body{margin:0;padding:0}}@layer components;@layer utilities{.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.static{position:static}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-auto{margin-inline:auto}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2\.5{margin-block:calc(var(--spacing) * 2.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-4{height:calc(var(--spacing) * 4)}.h-9{height:calc(var(--spacing) * 9)}.h-11{height:calc(var(--spacing) * 11)}.h-\[7px\]{height:7px}.h-screen{height:100vh}.max-h-64{max-height:calc(var(--spacing) * 64)}.min-h-0{min-height:0}.min-h-5{min-height:calc(var(--spacing) * 5)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-4{width:calc(var(--spacing) * 4)}.w-\[7px\]{width:7px}.w-fit{width:fit-content}.w-full{width:100%}.max-w-75{max-width:calc(var(--spacing) * 75)}.max-w-105{max-width:calc(var(--spacing) * 105)}.max-w-190{max-width:calc(var(--spacing) * 190)}.max-w-\[60\%\]{max-width:60%}.max-w-\[82\%\]{max-width:82%}.max-w-\[min\(78\%\,64ch\)\]{max-width:min(78%,64ch)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.rotate-90{rotate:90deg}.cursor-pointer{cursor:pointer}.\[scrollbar-width\:none\]{scrollbar-width:none}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.appearance-none{appearance:none}.flex-col{flex-direction:column}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded-aai{border-radius:var(--radius-aai)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.bg-transparent{background-color:#0000}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-7{padding:calc(var(--spacing) * 7)}.px-1{padding-inline:var(--spacing)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-7{padding-inline:calc(var(--spacing) * 7)}.px-10{padding-inline:calc(var(--spacing) * 10)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-left{text-align:left}.font-aai{font-family:var(--font-aai)}.font-aai-mono{font-family:var(--font-aai-mono)}.font-aai-serif{font-family:var(--font-aai-serif)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12\.5px\]{font-size:12.5px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[22px\]{font-size:22px}.text-\[32px\]{font-size:32px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-\[1\.2\]{--tw-leading:1.2;line-height:1.2}.leading-\[1\.15\]{--tw-leading:1.15;line-height:1.15}.leading-\[22px\]{--tw-leading:22px;line-height:22px}.leading-\[23px\]{--tw-leading:23px;line-height:23px}.leading-\[130\%\]{--tw-leading:130%;line-height:130%}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[-0\.2px\]{--tw-tracking:-.2px;letter-spacing:-.2px}.tracking-\[1\.2px\]{--tw-tracking:1.2px;letter-spacing:1.2px}.tracking-\[1\.4px\]{--tw-tracking:1.4px;letter-spacing:1.4px}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-balance{text-wrap:balance}.wrap-break-word{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.uppercase{text-transform:uppercase}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:px-16{padding-inline:calc(var(--spacing) * 16)}.sm\:py-14{padding-block:calc(var(--spacing) * 14)}}}@keyframes aai-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.45;transform:scale(.82)}}@keyframes aai-bounce{0%,80%,to{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}@keyframes aai-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.tool-shimmer{-webkit-text-fill-color:transparent;background:linear-gradient(90deg,currentColor 25%,#0000 50%,currentColor 75%) 0 0/200% 100%;-webkit-background-clip:text;background-clip:text;animation:2s infinite aai-shimmer}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
|
package/dist/default-client/assets/{playback-processor-CeEGzgVT.js → playback-processor-CRwbxC1v.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./index-
|
|
1
|
+
import{i as e}from"./index-0-DXv-S4.js";import{t}from"./_module-url-BX0RuRU2.js";var n=t(`
|
|
2
2
|
class PlaybackProcessor extends AudioWorkletProcessor {
|
|
3
3
|
constructor(options) {
|
|
4
4
|
super();
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<title>aai</title>
|
|
7
7
|
<link rel="icon" href="./favicon.ico" />
|
|
8
8
|
<style>html, body { background: #FBF8F2; margin: 0; }</style>
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-0-DXv-S4.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CRfdZPH1.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<main id="app"></main>
|
package/dist/define-client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsxImportSource react */
|
|
2
2
|
import { type ComponentType } from "react";
|
|
3
3
|
import { type ToolDisplayConfig } from "./components/tool-config-context.ts";
|
|
4
|
-
import {
|
|
4
|
+
import type { SessionCore } from "./session-core-types.ts";
|
|
5
5
|
import type { ClientTheme, WebSocketConstructor } from "./types.ts";
|
|
6
6
|
/**
|
|
7
7
|
* Base options shared by both client tiers.
|
|
@@ -46,7 +46,18 @@ type ConfigTier = BaseOptions & {
|
|
|
46
46
|
type ComponentTier = BaseOptions & {
|
|
47
47
|
/** Full custom component to render instead of the default shell. */
|
|
48
48
|
component: ComponentType;
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Agent name. With a custom component there is no shell header to put it
|
|
51
|
+
* in, so it becomes the page title.
|
|
52
|
+
*
|
|
53
|
+
* Allowed here rather than `never` because `client({ name, component })` is
|
|
54
|
+
* the natural thing to write and two different models wrote it. As `never`
|
|
55
|
+
* it failed with *"Type 'string' is not assignable to type 'undefined'"*,
|
|
56
|
+
* which explains nothing, and cost a build round each time. There is a real
|
|
57
|
+
* use for the value — a custom-UI page otherwise inherits whatever title
|
|
58
|
+
* the HTML shell shipped with — so it is honoured instead of banned.
|
|
59
|
+
*/
|
|
60
|
+
name?: string;
|
|
50
61
|
sidebar?: never;
|
|
51
62
|
sidebarWidth?: never;
|
|
52
63
|
tools?: never;
|
package/dist/define-client.js
CHANGED
|
@@ -1,5 +1,121 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import "./context.js";
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
1
|
+
import { r as fetchClientConfig, t as createSessionCore } from "./session-core-Bjkr4PAP.js";
|
|
2
|
+
import { SessionProvider, ThemeProvider } from "./context.js";
|
|
3
|
+
import { t as ChatView } from "./chat-view-CW-tZCMm.js";
|
|
4
|
+
import { n as ToolConfigContext } from "./tool-call-block-DIxpG8GM.js";
|
|
5
|
+
import { SidebarLayout } from "./components/sidebar-layout.js";
|
|
6
|
+
import { StartScreen } from "./components/start-screen.js";
|
|
7
|
+
import { createElement, useEffect, useState } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { flushSync } from "react-dom";
|
|
10
|
+
import { createRoot } from "react-dom/client";
|
|
11
|
+
//#region define-client.tsx
|
|
12
|
+
/** @jsxImportSource react */
|
|
13
|
+
function resolveContainer(target = "#app") {
|
|
14
|
+
if (typeof target !== "string") return target;
|
|
15
|
+
const el = document.querySelector(target);
|
|
16
|
+
if (!el) throw new Error(`Element not found: ${target}`);
|
|
17
|
+
return el;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Default shell rendered in config tier.
|
|
21
|
+
* Wraps StartScreen → (SidebarLayout →) ChatView.
|
|
22
|
+
*/
|
|
23
|
+
function DefaultShell({ name, Sidebar, sidebarWidth }) {
|
|
24
|
+
const chat = /* @__PURE__ */ jsx(ChatView, { title: name });
|
|
25
|
+
return /* @__PURE__ */ jsx(StartScreen, {
|
|
26
|
+
title: name,
|
|
27
|
+
children: Sidebar ? /* @__PURE__ */ jsx(SidebarLayout, {
|
|
28
|
+
sidebar: /* @__PURE__ */ jsx(Sidebar, {}),
|
|
29
|
+
sidebarWidth,
|
|
30
|
+
children: chat
|
|
31
|
+
}) : chat
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Config-tier root: fetches the server-declared display name via
|
|
36
|
+
* `GET client-config` and renders the chat shell. The shell renders
|
|
37
|
+
* immediately — optimistically — while the lookup is in flight; servers
|
|
38
|
+
* without the endpoint (every lookup failure resolves to the empty default)
|
|
39
|
+
* work exactly as before.
|
|
40
|
+
*/
|
|
41
|
+
function DefaultRoot({ platformUrl, name, Sidebar, sidebarWidth }) {
|
|
42
|
+
const [resolved, setResolved] = useState(null);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
let cancelled = false;
|
|
45
|
+
fetchClientConfig(platformUrl).then((cfg) => {
|
|
46
|
+
if (!cancelled) setResolved(cfg);
|
|
47
|
+
});
|
|
48
|
+
return () => {
|
|
49
|
+
cancelled = true;
|
|
50
|
+
};
|
|
51
|
+
}, [platformUrl]);
|
|
52
|
+
return /* @__PURE__ */ jsx(DefaultShell, {
|
|
53
|
+
name: name ?? resolved?.name,
|
|
54
|
+
Sidebar,
|
|
55
|
+
sidebarWidth
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Define and mount a client UI for a voice agent.
|
|
60
|
+
*
|
|
61
|
+
* **Tier 1 (config-only):** Pass options without `component` to get the
|
|
62
|
+
* default shell (StartScreen + ChatView, optional sidebar).
|
|
63
|
+
*
|
|
64
|
+
* **Tier 2 (custom component):** Pass `component` to render a fully custom
|
|
65
|
+
* root component inside the providers.
|
|
66
|
+
*
|
|
67
|
+
* @example Tier 1
|
|
68
|
+
* ```tsx
|
|
69
|
+
* client({
|
|
70
|
+
* name: "Pizza Ordering",
|
|
71
|
+
* theme: { bg: "#1a1a1a", primary: "#e55" },
|
|
72
|
+
* sidebar: OrderPanel,
|
|
73
|
+
* tools: { add_pizza: { icon: "🍕", label: "Adding pizza" } },
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example Tier 2
|
|
78
|
+
* ```tsx
|
|
79
|
+
* client({ component: MyCustomApp });
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @returns A {@link ClientHandle} for cleanup.
|
|
83
|
+
* @throws If the target element is not found in the DOM.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
function client(config) {
|
|
88
|
+
const container = resolveContainer(config.target);
|
|
89
|
+
const platformUrl = config.platformUrl ?? globalThis.location.origin + globalThis.location.pathname;
|
|
90
|
+
const session = createSessionCore({
|
|
91
|
+
platformUrl,
|
|
92
|
+
onSessionId: config.onSessionId,
|
|
93
|
+
resumeSessionId: config.resumeSessionId,
|
|
94
|
+
WebSocket: config.WebSocket
|
|
95
|
+
});
|
|
96
|
+
if (config.name && typeof document !== "undefined") document.title = config.name;
|
|
97
|
+
const rootNode = config.component ? createElement(config.component) : createElement(DefaultRoot, {
|
|
98
|
+
platformUrl,
|
|
99
|
+
name: config.name,
|
|
100
|
+
Sidebar: config.sidebar,
|
|
101
|
+
sidebarWidth: config.sidebarWidth
|
|
102
|
+
});
|
|
103
|
+
const toolConfig = config.tools ?? {};
|
|
104
|
+
const root = createRoot(container);
|
|
105
|
+
flushSync(() => {
|
|
106
|
+
root.render(createElement(ToolConfigContext.Provider, { value: toolConfig }, createElement(ThemeProvider, { value: config.theme }, createElement(SessionProvider, { value: session }, rootNode))));
|
|
107
|
+
});
|
|
108
|
+
const handle = {
|
|
109
|
+
session,
|
|
110
|
+
dispose() {
|
|
111
|
+
root.unmount();
|
|
112
|
+
session[Symbol.dispose]();
|
|
113
|
+
},
|
|
114
|
+
[Symbol.dispose]() {
|
|
115
|
+
handle.dispose();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
return handle;
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
5
121
|
export { client };
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
|
+
import type { DefaultToolResult } from "@alexkroman1/aai";
|
|
1
2
|
import type { ToolCallInfo } from "./types.ts";
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Fire a callback when a tool call settles, with the tool's JSON result.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam R - The result shape. Defaults to {@link DefaultToolResult} —
|
|
7
|
+
* `any`, for the same reason `ctx.state` is: the value is the author's own
|
|
8
|
+
* tool output round-tripped through JSON, so `unknown` (which this was) made
|
|
9
|
+
* the ordinary spelling
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* useToolResult("get_quote", (r) => setPrice(r.price))
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* a compile error on a client that runs correctly, and `aai build` refuses
|
|
16
|
+
* to publish it. Pass the shape — `useToolResult<Quote>(…)` — to get real
|
|
17
|
+
* checking, which also documents what the tool returns.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useToolResult<R = DefaultToolResult>(toolName: string, callback: (result: R, toolCall: ToolCallInfo) => void): void;
|
|
20
|
+
export declare function useToolResult<R = DefaultToolResult>(callback: (name: string, result: R, toolCall: ToolCallInfo) => void): void;
|
|
21
|
+
/**
|
|
22
|
+
* The agent's projected session state, or `null` before the first push.
|
|
23
|
+
*
|
|
24
|
+
* The counterpart to `syncState` on the agent: whatever that projection
|
|
25
|
+
* returns is what arrives here. It replaces the pattern this exists to
|
|
26
|
+
* remove — returning a state snapshot from every tool, declaring a type for
|
|
27
|
+
* what those tools happen to return, and mirroring it into `useState` through
|
|
28
|
+
* `useToolResult`, which was three things to keep in step and which 58% of
|
|
29
|
+
* measured generated agents built by hand.
|
|
30
|
+
*
|
|
31
|
+
* ```tsx
|
|
32
|
+
* const cart = useAgentState<{ cart: Item[] }>();
|
|
33
|
+
* return <Cart items={cart?.cart ?? []} />;
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* Typed by the caller for the same reason `useToolResult` is: the shape is
|
|
37
|
+
* the author's own projection, which the framework cannot see. It is
|
|
38
|
+
* nullable on purpose — nothing has been pushed before the first tool call,
|
|
39
|
+
* and a UI has to render that moment.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useAgentState<S = DefaultToolResult>(): S | null;
|
|
4
42
|
export declare function useEvent<T = unknown>(event: string, callback: (data: T) => void): void;
|
|
5
43
|
export declare function useToolCallStart(toolName: string, callback: (toolCall: ToolCallInfo) => void): void;
|
|
6
44
|
export declare function useToolCallStart(callback: (toolCall: ToolCallInfo) => void): void;
|
package/dist/hooks.js
CHANGED
|
@@ -77,6 +77,29 @@ function useToolResult(...args) {
|
|
|
77
77
|
else callback(tc.name, parsed, tc);
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* The agent's projected session state, or `null` before the first push.
|
|
82
|
+
*
|
|
83
|
+
* The counterpart to `syncState` on the agent: whatever that projection
|
|
84
|
+
* returns is what arrives here. It replaces the pattern this exists to
|
|
85
|
+
* remove — returning a state snapshot from every tool, declaring a type for
|
|
86
|
+
* what those tools happen to return, and mirroring it into `useState` through
|
|
87
|
+
* `useToolResult`, which was three things to keep in step and which 58% of
|
|
88
|
+
* measured generated agents built by hand.
|
|
89
|
+
*
|
|
90
|
+
* ```tsx
|
|
91
|
+
* const cart = useAgentState<{ cart: Item[] }>();
|
|
92
|
+
* return <Cart items={cart?.cart ?? []} />;
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* Typed by the caller for the same reason `useToolResult` is: the shape is
|
|
96
|
+
* the author's own projection, which the framework cannot see. It is
|
|
97
|
+
* nullable on purpose — nothing has been pushed before the first tool call,
|
|
98
|
+
* and a UI has to render that moment.
|
|
99
|
+
*/
|
|
100
|
+
function useAgentState() {
|
|
101
|
+
return useSessionSelector((snapshot) => snapshot.agentState);
|
|
102
|
+
}
|
|
80
103
|
function useEvent(event, callback) {
|
|
81
104
|
const customEvents = useSessionSelector((s) => s.customEvents);
|
|
82
105
|
const watermarkRef = useRef(0);
|
|
@@ -102,4 +125,4 @@ function useToolCallStart(...args) {
|
|
|
102
125
|
});
|
|
103
126
|
}
|
|
104
127
|
//#endregion
|
|
105
|
-
export { useEvent, useToolCallStart, useToolResult };
|
|
128
|
+
export { useAgentState, useEvent, useToolCallStart, useToolResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { floatToPcm16 } from "./audio.ts";
|
|
2
1
|
export { buildAgentUrl, type ClientConfigResponse, fetchClientConfig, } from "./client-config.ts";
|
|
3
2
|
export { Button } from "./components/button.tsx";
|
|
4
3
|
export { ChatView } from "./components/chat-view.tsx";
|
|
5
4
|
export { Controls } from "./components/controls.tsx";
|
|
5
|
+
export { Markdown } from "./components/markdown.tsx";
|
|
6
6
|
export { MessageList } from "./components/message-list.tsx";
|
|
7
7
|
export { SidebarLayout } from "./components/sidebar-layout.tsx";
|
|
8
8
|
export { StartScreen } from "./components/start-screen.tsx";
|
|
@@ -13,8 +13,8 @@ export type { Session } from "./context.ts";
|
|
|
13
13
|
export { SessionProvider, ThemeProvider, useSession, useSessionSelector, useTheme, } from "./context.ts";
|
|
14
14
|
export type { ClientConfig, ClientHandle, } from "./define-client.tsx";
|
|
15
15
|
export { client } from "./define-client.tsx";
|
|
16
|
-
export { useEvent, useToolCallStart, useToolResult } from "./hooks.ts";
|
|
17
|
-
export type { CustomEvent, SessionCore, SessionCoreOptions, SessionSnapshot, } from "./session-core.ts";
|
|
16
|
+
export { useAgentState, useEvent, useToolCallStart, useToolResult } from "./hooks.ts";
|
|
18
17
|
export { createSessionCore } from "./session-core.ts";
|
|
19
|
-
export type {
|
|
18
|
+
export type { CustomEvent, SessionCore, SessionCoreOptions, SessionSnapshot, } from "./session-core-types.ts";
|
|
19
|
+
export type { AgentState, ChatMessage, ClientTheme, SessionError, SessionErrorCode, ToolCallInfo, VoiceSessionOptions, } from "./types.ts";
|
|
20
20
|
export { VOICE_CAPTURE_CONSTRAINTS } from "./types.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { floatToPcm16 } from "./audio.js";
|
|
3
|
-
import { n as buildAgentUrl, r as fetchClientConfig, t as client } from "./define-client-fjNCp9be.js";
|
|
1
|
+
import { n as buildAgentUrl, r as fetchClientConfig, t as createSessionCore } from "./session-core-Bjkr4PAP.js";
|
|
4
2
|
import { SessionProvider, ThemeProvider, useSession, useSessionSelector, useTheme } from "./context.js";
|
|
5
3
|
import { Button } from "./components/button.js";
|
|
6
|
-
import { t as ChatView } from "./chat-view-
|
|
4
|
+
import { t as ChatView } from "./chat-view-CW-tZCMm.js";
|
|
7
5
|
import { i as UiUrlChip, n as ApiUrlChip, r as SessionUrlChips, t as Controls } from "./controls-DV368uhb.js";
|
|
6
|
+
import { n as Markdown, t as MessageList } from "./message-list-q2lTiFhF.js";
|
|
8
7
|
import { n as ToolConfigContext } from "./tool-call-block-DIxpG8GM.js";
|
|
9
|
-
import { MessageList } from "./components/message-list.js";
|
|
10
8
|
import { SidebarLayout } from "./components/sidebar-layout.js";
|
|
11
9
|
import { StartScreen } from "./components/start-screen.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
10
|
+
import { VOICE_CAPTURE_CONSTRAINTS } from "./types.js";
|
|
11
|
+
import { client } from "./define-client.js";
|
|
12
|
+
import { useAgentState, useEvent, useToolCallStart, useToolResult } from "./hooks.js";
|
|
13
|
+
export { ApiUrlChip, Button, ChatView, Controls, Markdown, MessageList, SessionProvider, SessionUrlChips, SidebarLayout, StartScreen, ThemeProvider, ToolConfigContext, UiUrlChip, VOICE_CAPTURE_CONSTRAINTS, buildAgentUrl, client, createSessionCore, fetchClientConfig, useAgentState, useEvent, useSession, useSessionSelector, useTheme, useToolCallStart, useToolResult };
|