@icanbwell/baileyai-chat-ui 0.5.3 → 0.5.5
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 +29 -1
- package/dist/baileyai-chat-ui.cjs +1 -1
- package/dist/baileyai-chat-ui.css +1 -1
- package/dist/baileyai-chat-ui.js +121 -122
- package/dist/index.d.ts +14 -5
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -117,7 +117,26 @@ chat.sendHidden('The user is currently viewing their cardiovascular vitals.');
|
|
|
117
117
|
Firing `sendHidden` before the user has sent anything themselves means `messages` is no longer
|
|
118
118
|
empty once the assistant's reply arrives, even though the user never asked a question — so
|
|
119
119
|
`BaileyChatPanel`'s empty state (`suggestions`, `privacyNote`, `emptyPlaceholder`) won't render in
|
|
120
|
-
that case.
|
|
120
|
+
that case. If a host needs `privacyNote` to survive this (e.g. it's a persistent compliance
|
|
121
|
+
disclosure rather than a first-impression nicety), pass `privacyNote={{ ..., alwaysVisible: true }}`
|
|
122
|
+
to render it in every state, not just the empty one.
|
|
123
|
+
|
|
124
|
+
## Privacy note
|
|
125
|
+
|
|
126
|
+
Pass `privacyNote` to render a short compliance/privacy disclosure as a footer beneath the input row — there's no default copy or link, so nothing renders unless a host supplies one:
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<BaileyChatPanel
|
|
130
|
+
chat={chat}
|
|
131
|
+
privacyNote={{
|
|
132
|
+
markdown: 'Bailey may use your health data to respond. See our [privacy policy](https://example.com/privacy).',
|
|
133
|
+
}}
|
|
134
|
+
/>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`markdown` is rendered through the same safe-link markdown pipeline as message content (so `[label](https://...)`, `**bold**`, etc. all work), but inline — unlike a message, the note's paragraphs never introduce their own line breaks, since it's meant to read as a single footer line.
|
|
138
|
+
|
|
139
|
+
By default the note only renders in the empty state, before the first message. Pass `alwaysVisible: true` to keep it showing for the entire conversation instead — see [Sending a hidden turn](#sending-a-hidden-turn) above for why a host might need this.
|
|
121
140
|
|
|
122
141
|
## Localization
|
|
123
142
|
|
|
@@ -162,6 +181,15 @@ The package ships CSS custom properties with sensible defaults; override any of
|
|
|
162
181
|
|
|
163
182
|
The package's own `styles.css` deliberately skips Tailwind's Preflight reset, so it coexists with a host app's own base styles (e.g. MUI's `CssBaseline`) without a global collision.
|
|
164
183
|
|
|
184
|
+
If your host app is itself built with Tailwind v4, import your own Tailwind stylesheet **before** `@icanbwell/baileyai-chat-ui/styles.css`:
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
import './your-app.css'; // your own Tailwind build, first
|
|
188
|
+
import '@icanbwell/baileyai-chat-ui/styles.css';
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Tailwind resolves `@layer` priority by order of first appearance across the whole page, not per-stylesheet. This package's CSS only registers a partial `theme, utilities` layer order (it has no `base` layer — Preflight is skipped, as above); your app's Tailwind build registers the full `theme, base, components, utilities` order. Import your app's stylesheet first and that full order wins outright; import this package's first and its partial registration is what gets established instead, which can leave your own Preflight reset (`base`) outranking your own utility classes (`utilities`) — buttons/inputs styled with your utilities would silently lose that styling. See `examples/container-app/tests/css-isolation.spec.ts` for a reproduction.
|
|
192
|
+
|
|
165
193
|
## Development
|
|
166
194
|
|
|
167
195
|
```bash
|
|
@@ -8,4 +8,4 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
8
8
|
`).filter(e=>e.length>0),n=`message`,a=[];for(let e of t)e.startsWith(`event:`)?n=e.slice(6).trim():e.startsWith(`data:`)&&a.push(e.slice(5).trim());if(a.length===0)continue;let o=a.join(`
|
|
9
9
|
`);if(o===`[DONE]`){i=!0;continue}let s;try{s=JSON.parse(o)}catch{s=void 0}let c=s;if(n===`error`){let e=typeof c?.message==`string`?c.message:o;r.push({type:`error`,message:e})}else if(c?.type===`response.output_text.delta`&&typeof c.delta==`string`){let e=S(c.delta);e&&r.push({type:`response.output_text.delta`,delta:e})}else c&&typeof c.type==`string`?r.push(c):n!==`message`&&r.push({type:`info`,message:`${n}: ${o}`})}return{events:r,remainder:n,done:i}}var w=200,T=15e4,E=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`,D=(e,t,n)=>{if(e===401||e===403)return`Bailey isn't reachable with your current login.`;let r=`Bailey request failed (status ${e??`network error`}).`,i=(n||t||``).trim();return i?`${r} ${i.length>w?`${i.slice(0,w)}…`:i}`:r},O=({transport:e,model:t,instructions:n,tools:r=[],toolChoice:i,firstUserMessagePrefix:a,onAssistantMessageComplete:o,idleTimeoutMs:s=T})=>{let[c,u]=(0,l.useState)([]),[d,f]=(0,l.useState)([]),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(`idle`),[_,v]=(0,l.useState)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(``),S=(0,l.useRef)(0),w=(0,l.useRef)([]);(0,l.useEffect)(()=>{w.current=c},[c]);let O=(0,l.useRef)([]),k=(0,l.useRef)(new Map),A=(0,l.useRef)(new Map),j=(0,l.useRef)(null),M=(0,l.useCallback)(()=>{j.current!==null&&(clearTimeout(j.current),j.current=null)},[]),N=(0,l.useCallback)(e=>{M(),j.current=setTimeout(()=>{e.abort(new DOMException(`The assistant took too long to respond. Please try again.`,`TimeoutError`))},s)},[M,s]);(0,l.useEffect)(()=>()=>{y.current?.abort(),M()},[M]);let P=(0,l.useCallback)((e,t,n)=>{let r=e=>{n.push(e),f(t=>[...t,e])};if(t.type===`response.output_text.delta`){if(!t.delta)return!1;let n=k.current.get(e)??{raw:``,emittedCount:0};n.raw+=t.delta;let{cleanedText:i,matches:a}=x(n.raw),o=i.trim(),s=a.slice(n.emittedCount);if(n.emittedCount=a.length,k.current.set(e,n),A.current.set(e,o),u(t=>t.map(t=>t.id===e?{...t,content:o}:t)),s.length>0){let e=Date.now(),t=S.current;s.forEach(n=>r({kind:`pseudo_tool_call`,name:n.name,args:n.args,at:e,turnSentAt:t}))}return!0}if(t.type===`response.output_item.added`||t.type===`response.output_item.done`){let e=t.item;if(e.type===`function_call`||e.type===`mcp_call`){let n=Date.now(),i=S.current,a=e.name||`unknown_tool`;return r(t.type===`response.output_item.added`?{kind:`tool_start`,name:a,args:e.arguments,at:n,turnSentAt:i}:{kind:`tool_end`,name:a,args:e.arguments,at:n,turnSentAt:i,output:e.output,isError:e.is_error,runtimeSeconds:e.runtime_seconds}),!0}return!1}return t.type===`task.progress`?(r({kind:`progress`,status:t.status,message:t.message,at:Date.now(),turnSentAt:S.current}),!0):t.type===`response.output_text.done`||t.type===`response.created`||t.type===`response.completed`?!1:t.type===`info`?(r({kind:`info`,message:t.message,at:Date.now(),turnSentAt:S.current}),!0):(r({kind:`raw`,eventType:t.type,raw:JSON.stringify(t),at:Date.now(),turnSentAt:S.current}),!0)},[]),F=(0,l.useCallback)(async s=>{g(`streaming`),v(null);let c=Date.now();S.current=c;let l=E(),d={id:l,role:`assistant`,content:``,streaming:!0,createdAt:c};u(e=>[...e,d]),O.current=[...s,d];let p=s.findIndex(e=>e.role===`user`&&!e.hidden),h=s.map((e,t)=>t===p&&a?{role:e.role,content:`${a}${e.content}`}:{role:e.role,content:e.content});m({model:t,systemPrompt:n,messages:h,tools:r,toolChoice:i,stream:!0,sentAt:c,streamStats:{chunkCount:0,firstChunkAt:null,lastChunkAt:null}});let _=new AbortController;y.current=_,N(_);let b=``,x=null,w=!1,T=!1,j=[],F=(e,t)=>{g(`error`),v(e);let n={kind:`error`,message:e,at:Date.now(),turnSentAt:c,...t};j.push(n),f(e=>[...e,n])},I=(e,t)=>{e.forEach(e=>{if(e.type===`error`){x=e.message;let t={kind:`error`,message:e.message,at:Date.now(),turnSentAt:c};j.push(t),f(e=>[...e,t]);return}e.type===`response.output_text.delta`&&e.delta&&(T=!0),P(l,e,j)&&(w=!0)}),t&&u(e=>e.map(e=>e.id===l?{...e,streaming:!1}:e))};try{let{status:a,text:s,errorMessage:u}=await e.streamChat({model:t,instructions:n,input:h,tools:r,toolChoice:i,signal:_.signal,onChunk:e=>{N(_),b+=e;let{events:t,remainder:n,done:r}=C(b);b=n,I(t,r);let i=Date.now();m(e=>e&&e.sentAt===c?{...e,streamStats:{chunkCount:e.streamStats.chunkCount+1,firstChunkAt:e.streamStats.firstChunkAt??i,lastChunkAt:i}}:e)},onRequestId:e=>{m(t=>t&&t.sentAt===c?{...t,requestId:e}:t)}});if(b.trim()){let{events:e,done:t}=C(`${b}\n\n`);b=``,I(e,t)}if(x){g(`error`),v(x);return}if(a===void 0||a>=400){F(D(a,s,u),{httpStatus:a,rawBody:s||void 0});return}if(!w){F(`Bailey returned an empty response.`);return}if(!T){F(`Bailey ran some tools but didn't return an answer. Try asking again.`);return}g(`idle`);let d=A.current.get(l)??``;m(e=>e&&e.sentAt===c?{...e,response:{content:d}}:e),o&&await o({id:l,role:`assistant`,content:d,streaming:!1},j)}catch(e){let t=e;if(t?.name===`TimeoutError`){F(t.message,{source:`client-timeout`});return}if(t?.name===`AbortError`){g(`idle`);return}F(t?.message||`Bailey request failed.`)}finally{M();let e=A.current.get(l)??``;k.current.delete(l),A.current.delete(l),u(e=>e.flatMap(e=>e.id===l?e.content?[{...e,streaming:!1}]:[]:[e])),O.current=O.current.flatMap(t=>t.id===l?e?[{...t,content:e,streaming:!1}]:[]:[t])}},[e,t,n,r,i,a,o,P,N,M]),I=(0,l.useCallback)(e=>{w.current=e,u(e)},[]);return{messages:c,traceEvents:d,lastRequest:p,status:h,error:_,send:(0,l.useCallback)(e=>{let t=e.trim();if(!t)return;b.current=t;let n={id:E(),role:`user`,content:t,createdAt:Date.now()},r=[...O.current,n];O.current=r,I([...w.current,n]),F(r)},[F,I]),sendHidden:(0,l.useCallback)(e=>{if(h===`streaming`)return;let t=e.trim();if(!t)return;b.current=t;let n={id:E(),role:`user`,content:t,createdAt:Date.now(),hidden:!0},r=[...O.current,n];O.current=r,F(r)},[F,h]),stop:(0,l.useCallback)(()=>{y.current?.abort()},[]),retryLast:(0,l.useCallback)(()=>{if(h===`streaming`||!b.current)return;let e=w.current,t=e[e.length-1],n=t&&t.role===`assistant`?e.slice(0,-1):e;I(n);let r=O.current,i=r[r.length-1],a=i&&i.role===`assistant`?r.slice(0,-1):r;O.current=a,F(a)},[F,I,h]),clearTrace:(0,l.useCallback)(()=>f([]),[]),clearError:(0,l.useCallback)(()=>{v(null),g(e=>e===`error`?`idle`:e)},[]),newChat:(0,l.useCallback)(()=>{y.current?.abort(),I([]),O.current=[],f([]),m(null),g(`idle`),v(null),b.current=``},[I])}};function k(...e){return e.filter(e=>!!(e&&e.trim())).join(`
|
|
10
10
|
|
|
11
|
-
`)}var A=`call_tool`,j=`a tool`;function M(e,t){let n={name:e===A?j:e,args:null,viaCallTool:!1};if(!t)return n;let r;try{r=JSON.parse(t)}catch{return n}if(typeof r!=`object`||!r)return n;let i=r;if(e===A){let e=typeof i.name==`string`?i.name:void 0;if(!e)return n;let t=i.arguments;return{name:e,args:typeof t==`object`&&t?t:null,viaCallTool:!0}}return{name:e,args:i,viaCallTool:!1}}var N=5,P=e=>e.type===`text`?e.value??``:(e.children??[]).map(P).join(``),F=e=>{if(e.tagName===`a`&&e.properties?.href)return e.properties.href;for(let t of e.children??[]){let e=F(t);if(e)return e}},I=(e,t)=>(e.children??[]).find(e=>e.tagName===t),L=e=>{let t=P(e),n=F(e);return n?{text:t,href:n}:{text:t}},R=e=>(e.children??[]).filter(e=>e.type===`element`).map(L),z=e=>{if(e.tagName!==`table`)return null;let t=I(e,`thead`),n=t&&I(t,`tr`);return{headers:n?R(n).map(e=>e.text):[],rows:(I(e,`tbody`)?.children??[]).filter(e=>e.tagName===`tr`).map(R)}},B=e=>e.length>5,V='When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {"type": "bar" | "line" | "pie" | "doughnut" | "scatter", "title"?: string, "data": {"labels": string[], "datasets": [{"label": string, "data": number[]}]}}. For "scatter" charts, omit "labels" and give each dataset "data" as an array of {"x": number, "y": number} points instead of a number array. "pie" and "doughnut" charts must have exactly one dataset. Do not include any other fields (no "options", no colors) — the app handles styling. Example:\n```chartjs\n{"type": "line", "title": "BP readings", "data": {"labels": ["Jul 14", "Jul 21", "Jul 28"], "datasets": [{"label": "Systolic", "data": [120, 118, 122]}]}}\n```',ee=[`bar`,`line`,`pie`,`doughnut`,`scatter`],te=8,ne=50,re=8,ie=500,ae=e=>typeof e==`object`&&!!e&&typeof e.x==`number`&&typeof e.y==`number`,H=e=>{let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let n=t;if(typeof n.type!=`string`||!ee.includes(n.type))return null;let r=n.type;if(n.title!==void 0&&typeof n.title!=`string`)return null;let i=n.title;if(typeof n.data!=`object`||n.data===null)return null;let a=n.data;if(!Array.isArray(a.datasets)||a.datasets.length<1||a.datasets.length>te||(r===`pie`||r===`doughnut`)&&a.datasets.length!==1)return null;for(let e of a.datasets)if(typeof e!=`object`||!e||typeof e.label!=`string`||!Array.isArray(e.data))return null;let o=a.datasets;if(r===`scatter`){for(let e of o)if(e.data.length<1||e.data.length>ie||!e.data.every(ae))return null;return{type:r,title:i,data:{datasets:o}}}if(!Array.isArray(a.labels)||!a.labels.every(e=>typeof e==`string`))return null;let s=a.labels,c=r===`pie`||r===`doughnut`?re:ne;if(s.length<1||s.length>c)return null;for(let e of o)if(e.data.length!==s.length||!e.data.every(e=>typeof e==`number`))return null;return{type:r,title:i,data:{labels:s,datasets:o}}},U={tool_start:`Tool start`,tool_end:`Tool end`,pseudo_tool_call:`Narrated tool call`,progress:`Progress`,info:`Info`,error:`Error`,raw:`Raw event`};function W(e){return e.kind!==`tool_start`&&e.kind!==`tool_end`?null:M(e.name,e.args)}function G(e,t=W(e)){return e.kind===`pseudo_tool_call`?e.name:t?.name??null}function K(e,t=W(e)){switch(e.kind){case`tool_start`:return t.viaCallTool?`${t.name} (via call_tool)`:t.name;case`tool_end`:return`${t.viaCallTool?`${t.name} (via call_tool)`:t.name}${e.runtimeSeconds===void 0?``:` — ${e.runtimeSeconds.toFixed(2)}s`}${e.isError?` — failed`:``}`;case`pseudo_tool_call`:return`${e.name} — written as text, not actually called`;case`progress`:return e.message?`${e.status} — ${e.message}`:e.status;case`info`:return e.message;case`error`:return e.httpStatus?`${e.message} (HTTP ${e.httpStatus})`:e.message;case`raw`:return`Unrecognized event: ${e.eventType}`}}function q(e,t=W(e)){return e.kind===`tool_start`||e.kind===`tool_end`?t.args?JSON.stringify(t.args,null,2):e.args??null:e.kind===`pseudo_tool_call`?e.args??null:null}function J(e){return e.kind===`tool_end`?e.output??null:null}function oe(e){return e.kind===`raw`?e.raw:e.kind===`error`?e.rawBody??null:null}function Y(e){switch(e.kind){case`tool_start`:return`Calling ${M(e.name,e.args).name}...`;case`tool_end`:{let t=M(e.name,e.args).name;return e.isError?`${t} failed`:`${t} returned`}case`pseudo_tool_call`:return`${e.name} (written as text, not called)`;case`progress`:return e.message??e.status;case`info`:return e.message;case`error`:return e.source===`client-timeout`?`Timed out: ${e.message}`:`Error: ${e.message}`;case`raw`:return`Unrecognized event: ${e.eventType}`}}function se(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function ce(e){if(e<=0)return`+0ms`;if(e<1e3)return`+${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`+${t.toFixed(1)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return`+${n}m${String(r).padStart(2,`0`)}s`}function le(e){return e.map((t,n)=>{let r=W(t),i=n===0?t.turnSentAt:e[n-1].at;return{key:`${t.at}-${n}`,kind:t.kind,toolName:G(t,r),isToolStart:t.kind===`tool_start`,failed:t.kind===`tool_end`&&t.isError===!0,time:se(t.at),gapMs:t.at-i,label:t.kind===`tool_end`&&t.isError===!0?`Tool failed`:U[t.kind],summary:K(t,r),argsDetail:q(t,r),outputDetail:J(t),rawDetail:oe(t)}})}function ue(e){let t=e.filter(e=>e.kind===`tool_end`),n=t.filter(e=>e.kind===`tool_end`&&e.isError),r=e.filter(e=>e.kind===`error`),i=[];return t.length>0&&i.push(`${t.length} tool call${t.length===1?``:`s`}`+(n.length>0?`, ${n.length} failed`:``)),r.length>0&&i.push(`${r.length} stream error${r.length===1?``:`s`}`),i.join(` · `)}function de(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.toolName&&e?.type===`group`&&e.toolName===n.toolName){e.rows.push(n);continue}t.push(n.toolName?{type:`group`,toolName:n.toolName,rows:[n]}:{type:`single`,row:n})}return t}function fe(e){return e.some(e=>e.kind===`tool_end`&&e.isError||e.kind===`error`)}function pe(e,t){return t===void 0?[]:e.filter(e=>e.turnSentAt===t&&(e.kind===`tool_end`||e.kind===`pseudo_tool_call`||e.kind===`progress`)).map((e,t)=>({key:`${e.at}-${t}`,text:Y(e),toolName:G(e)}))}function me({renderTable:e,renderChart:t}={}){return{a:({href:e,children:t})=>!e||!c.t(e)?(0,p.jsx)(p.Fragment,{children:t}):(0,p.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({node:t,children:n})=>{let r=t&&z(t);if(r&&B(r.rows)&&e){let t=r.rows.map(e=>e.map(e=>e.href&&!c.t(e.href)?{text:e.text}:e));return(0,p.jsx)(p.Fragment,{children:e({headers:r.headers,rows:t})})}return(0,p.jsx)(`table`,{children:n})},pre:({children:e})=>{let n=(Array.isArray(e)?e[0]:e)?.props;if((n?.className?.split(` `)??[]).includes(`language-chartjs`)&&t){let e=n?.children,r=H(Array.isArray(e)?e.join(``):String(e??``));if(r)return(0,p.jsx)(p.Fragment,{children:t(r)})}return(0,p.jsx)(`pre`,{children:e})}}}function he({className:e}){return(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,p.jsx)(`path`,{d:`M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z`})})}function ge({className:e}){return(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,p.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`})})}function _e({className:e}){return(0,p.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,p.jsx)(`path`,{d:`M7 17 17 7`}),(0,p.jsx)(`path`,{d:`M9 7h8v8`})]})}function ve({className:e}){return(0,p.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,p.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,p.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]})}function ye({className:e}){return(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,p.jsx)(`path`,{d:`M5 12.5 9.5 17 19 7`})})}function be({className:e}){return(0,p.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,p.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,p.jsx)(`path`,{d:`M8.5 12.5 11 15l4.5-5.5`})]})}var xe=1500;function Se({markdown:e,className:t,ariaLabel:n=`copy response as markdown`,tooltipDefaultText:r=`Copy as markdown`,tooltipCopiedText:i=`Copied!`}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(!1),u=(0,l.useRef)(null);return(0,l.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),(0,p.jsx)(f.Provider,{delayDuration:200,children:(0,p.jsxs)(f.Root,{open:a||s,onOpenChange:c,children:[(0,p.jsx)(f.Trigger,{asChild:!0,children:(0,p.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(e)}catch{return}o(!0),u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>o(!1),xe)},"aria-label":n,className:`bailey-copy-button${t?` ${t}`:``}`,children:a?(0,p.jsx)(ye,{className:`bailey-copy-icon`}):(0,p.jsx)(ve,{className:`bailey-copy-icon`})})}),(0,p.jsx)(f.Portal,{children:(0,p.jsxs)(f.Content,{side:`top`,className:`bailey-tooltip-content`,children:[a?i:r,(0,p.jsx)(f.Arrow,{className:`bailey-tooltip-arrow`})]})})]})})}async function Ce(e){try{await navigator.clipboard.writeText(e)}catch{}}function X({text:e,label:t=`Copy`}){return(0,p.jsx)(`button`,{type:`button`,onClick:()=>Ce(e),className:`bailey-trace-copy-button`,children:t})}function we(e){if(e.failed||e.kind===`error`)return`bailey-trace-chip bailey-trace-chip-error`;switch(e.kind){case`tool_start`:return`bailey-trace-chip bailey-trace-chip-info`;case`tool_end`:return`bailey-trace-chip bailey-trace-chip-success`;case`progress`:return`bailey-trace-chip bailey-trace-chip-secondary`;default:return`bailey-trace-chip bailey-trace-chip-default`}}function Z({label:e,content:t,copyable:n}){return(0,p.jsxs)(`details`,{className:`bailey-trace-disclosure`,children:[(0,p.jsx)(`summary`,{className:`bailey-trace-disclosure-summary`,children:e}),n&&(0,p.jsx)(`div`,{className:`bailey-trace-disclosure-actions`,children:(0,p.jsx)(X,{text:t})}),(0,p.jsx)(`pre`,{className:`bailey-trace-disclosure-content`,children:t})]})}function Q({row:e}){return(0,p.jsxs)(`div`,{className:`bailey-trace-row`,children:[(0,p.jsxs)(`div`,{className:`bailey-trace-row-header`,children:[(0,p.jsx)(`span`,{className:`bailey-trace-row-time`,children:e.time}),(0,p.jsx)(`span`,{className:`bailey-trace-row-gap`,title:`Time since the previous event`,children:ce(e.gapMs)}),(0,p.jsx)(`span`,{className:we(e),children:e.label}),(0,p.jsx)(`span`,{className:`bailey-trace-row-summary`,children:e.summary})]}),e.argsDetail&&(0,p.jsx)(Z,{label:`args`,content:e.argsDetail}),e.outputDetail&&(0,p.jsx)(Z,{label:`output`,content:e.outputDetail}),e.rawDetail&&(0,p.jsx)(Z,{label:`raw`,content:e.rawDetail})]})}function Te(e,t){if(e.chunkCount===0)return`Streamed: no chunks received`;if(e.chunkCount===1||e.firstChunkAt===null)return`Streamed: 1 chunk (not incremental)`;let n=e.firstChunkAt-t,r=(e.lastChunkAt??e.firstChunkAt)-e.firstChunkAt;return`Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r/1e3).toFixed(1)}s`}function Ee({request:e}){let t=(0,l.useMemo)(()=>JSON.stringify({model:e.model,instructions:e.systemPrompt,input:e.messages,stream:e.stream,tools:e.tools,toolChoice:e.toolChoice},null,2),[e]);return(0,p.jsxs)(`div`,{className:`bailey-trace-request-details`,children:[(0,p.jsxs)(`span`,{className:`bailey-trace-request-meta`,children:[`Last request — `,e.model,` · `,new Date(e.sentAt).toLocaleTimeString(),e.requestId?` · ${e.requestId}`:``]}),(0,p.jsx)(`span`,{className:`bailey-trace-request-meta`,children:Te(e.streamStats,e.sentAt)}),(0,p.jsx)(Z,{label:`System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,content:e.systemPrompt,copyable:!0}),(0,p.jsx)(Z,{label:`Messages (${e.messages.length})`,content:JSON.stringify(e.messages,null,2),copyable:!0}),e.response&&(0,p.jsx)(Z,{label:`Response (${e.response.content.length.toLocaleString()} chars)`,content:e.response.content,copyable:!0}),(0,p.jsx)(Z,{label:`Full payload (JSON)`,content:t,copyable:!0})]})}function De({events:e,lastRequest:t,onClear:n}){let r=(0,l.useMemo)(()=>le(e),[e]),i=(0,l.useMemo)(()=>de(r),[r]),a=(0,l.useMemo)(()=>JSON.stringify(e,null,2),[e]);return(0,p.jsxs)(`div`,{className:`bailey-trace-body`,children:[(0,p.jsxs)(`div`,{className:`bailey-trace-actions-row`,children:[e.length>0&&(0,p.jsx)(X,{text:a,label:`Copy trace as JSON`}),(0,p.jsx)(`button`,{type:`button`,onClick:n,className:`bailey-trace-copy-button`,children:`Clear`})]}),t&&(0,p.jsx)(Ee,{request:t}),(0,p.jsx)(`div`,{className:`bailey-trace-rows`,children:i.map((e,t)=>{if(e.type===`single`)return(0,p.jsx)(Q,{row:e.row},e.row.key);let n=e.rows.filter(e=>e.isToolStart).length;if(n<=1)return(0,p.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,p.jsx)(Q,{row:e},e.key))},`group-${t}`);let r=e.rows.filter(e=>e.failed).length;return(0,p.jsxs)(`details`,{className:`bailey-trace-group`,children:[(0,p.jsxs)(`summary`,{className:`bailey-trace-group-summary`,children:[(0,p.jsx)(`strong`,{children:e.toolName}),` × `,n,r>0&&(0,p.jsxs)(`span`,{className:`bailey-trace-group-failed`,children:[` `,r,` failed`]})]}),(0,p.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,p.jsx)(Q,{row:e},e.key))})]},`group-${t}`)})})]})}function $({events:e,lastRequest:t,onClear:n}){let[r,i]=(0,l.useState)(!1),a=(0,l.useMemo)(()=>fe(e),[e]),o=(0,l.useMemo)(()=>ue(e),[e]);return e.length===0&&!t?null:(0,p.jsxs)(`div`,{className:`bailey-trace-panel`,children:[(0,p.jsxs)(`div`,{className:`bailey-trace-toggle-row`,children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,className:a?`bailey-trace-toggle bailey-trace-toggle-error`:`bailey-trace-toggle`,children:[a&&!r?`⚠ `:``,r?`Hide details`:`Show details`,` (`,e.length,`)`]}),o&&(0,p.jsx)(`span`,{className:a?`bailey-trace-summary bailey-trace-summary-error`:`bailey-trace-summary`,children:o})]}),r&&(0,p.jsx)(De,{events:e,lastRequest:t,onClear:n})]})}var Oe=`How can bailey AI help you today?`,ke=`Reply to bailey AI`,Ae={newChatButtonText:`New chat`,newChatAriaLabel:`new chat`,suggestionsTitle:`Suggested for you`,emptyStateMessage:`Ask Bailey a question to get started.`,youLabel:`You`,thinkingHint:`Thinking…`,retryButtonText:`Retry`,dismissErrorAriaLabel:`dismiss error`,sendAriaLabel:`send`,stopButtonText:`Stop`,stopAriaLabel:`stop`,copyButtonAriaLabel:`copy response as markdown`,copyButtonTooltipDefault:`Copy as markdown`,copyButtonTooltipCopied:`Copied!`},je=[d.default],Me=(0,l.memo)(function({content:e,components:t}){return(0,p.jsx)(`div`,{className:`bailey-markdown-content`,children:(0,p.jsx)(u.default,{remarkPlugins:je,components:t,skipHtml:!0,children:e})})});function Ne(e,t,n){if(e!==`streaming`)return;let r=t.filter(e=>e.turnSentAt===n?.sentAt);if(r.length!==0)return Y(r[r.length-1])}function Pe(e){let t=new Date(e),n=t.toDateString()===new Date().toDateString(),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return n?`Today ${r}`:`${t.toLocaleDateString()} ${r}`}function Fe({chat:e,placeholder:t,replyPlaceholder:n=ke,emptyPlaceholder:r,suggestions:i,privacyNote:a,resolveActivityIcon:o,className:s,height:c,width:u,hideDeveloperDetails:d=!1,renderMessageActions:m,renderTable:h,renderChart:g,labels:_,formatMessageTime:v}){let{messages:y,traceEvents:b,lastRequest:x,status:S,error:C,send:w,stop:T,retryLast:E,clearTrace:D,clearError:O,newChat:k}=e,[A,j]=(0,l.useState)(``),M={...Ae,..._},N=v??Pe,P=(0,l.useRef)(null),F=(0,l.useRef)(null),I=(0,l.useRef)(!0),L=(0,l.useMemo)(()=>me({renderTable:h,renderChart:g}),[h,g]),R=(0,l.useMemo)(()=>Ne(S,b,x),[S,b,x]),z=y.length===0,B=t??(z?r??Oe:n);(0,l.useEffect)(()=>{let e=F.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight;I.current=t<60};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),(0,l.useEffect)(()=>{I.current&&P.current?.scrollIntoView({behavior:S===`streaming`?`auto`:`smooth`,block:`nearest`})},[y,S]);let V=e=>{I.current=!0,w(e)};return(0,p.jsx)(`div`,{className:`bailey-chat-panel${s?` ${s}`:``}`,style:c!==void 0||u!==void 0?{height:c,width:u}:void 0,children:(0,p.jsxs)(`div`,{className:`bailey-chat-panel-inner`,children:[(0,p.jsx)(`div`,{className:`bailey-toolbar-row`,children:(0,p.jsx)(`button`,{type:`button`,onClick:k,disabled:y.length===0,"aria-label":M.newChatAriaLabel,className:`bailey-new-chat-button`,children:M.newChatButtonText})}),(0,p.jsxs)(`div`,{className:`bailey-chat-transcript`,ref:F,children:[z&&(i&&i.length>0?(0,p.jsxs)(`div`,{className:`bailey-suggestions`,children:[(0,p.jsx)(`div`,{className:`bailey-suggestions-title`,children:M.suggestionsTitle}),i.map((e,t)=>(0,p.jsxs)(`button`,{type:`button`,onClick:()=>V(e.value??e.label),className:`bailey-suggestion-card`,children:[(0,p.jsx)(`span`,{children:e.label}),(0,p.jsx)(_e,{className:`bailey-suggestion-icon`})]},`${e.label}-${t}`))]}):(0,p.jsx)(`div`,{className:`bailey-empty-state`,children:M.emptyStateMessage})),y.map((e,t)=>{let n=e.role===`assistant`&&t===y.length-1,r=S===`streaming`&&n&&e.content===``,i=e.role===`assistant`&&!r?pe(b,e.createdAt):[],a=i[i.length-1];return(0,p.jsx)(`div`,{className:e.role===`user`?`bailey-message-row bailey-message-row-user`:`bailey-message-row`,children:e.role===`user`?(0,p.jsxs)(`div`,{className:`bailey-user-message`,children:[(0,p.jsxs)(`div`,{className:`bailey-message-meta`,children:[(0,p.jsx)(`span`,{className:`bailey-message-meta-name`,children:M.youLabel}),e.createdAt!==void 0&&(0,p.jsx)(`span`,{children:N(e.createdAt)})]}),(0,p.jsx)(`div`,{className:`bailey-user-bubble`,children:e.content})]}):r?(0,p.jsx)(`div`,{className:`bailey-thinking-hint`,children:R??M.thinkingHint}):(0,p.jsxs)(`div`,{className:`bailey-assistant-message`,children:[a&&(0,p.jsxs)(`div`,{className:`bailey-activity-line`,children:[(0,p.jsx)(`span`,{className:`bailey-activity-icon`,children:o?.(a.toolName)??(0,p.jsx)(be,{})}),(0,p.jsx)(`span`,{children:a.text})]}),(0,p.jsx)(Me,{content:e.content,components:L}),e.streaming&&R&&(0,p.jsx)(`div`,{className:`bailey-streaming-hint`,children:R}),!e.streaming&&(0,p.jsxs)(`div`,{className:`bailey-message-actions`,children:[(0,p.jsx)(Se,{markdown:e.content,ariaLabel:M.copyButtonAriaLabel,tooltipDefaultText:M.copyButtonTooltipDefault,tooltipCopiedText:M.copyButtonTooltipCopied}),m?.(e)]})]})},e.id)}),(0,p.jsx)(`div`,{ref:P})]}),z&&a&&(0,p.jsxs)(`div`,{className:`bailey-privacy-note`,children:[a.text,` `,(0,p.jsx)(`a`,{href:a.linkHref,target:`_blank`,rel:`noreferrer`,children:a.linkLabel})]}),C&&(0,p.jsxs)(`div`,{className:`bailey-error-banner`,role:`alert`,children:[(0,p.jsx)(`span`,{children:C}),(0,p.jsxs)(`div`,{className:`bailey-error-actions`,children:[(0,p.jsx)(`button`,{type:`button`,onClick:E,className:`bailey-retry-button`,children:M.retryButtonText}),(0,p.jsx)(`button`,{type:`button`,onClick:O,"aria-label":M.dismissErrorAriaLabel,className:`bailey-dismiss-button`,children:`✕`})]})]}),!d&&(0,p.jsx)($,{events:b,lastRequest:x,onClear:D}),(0,p.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!(!A.trim()||S===`streaming`)&&(V(A),j(``))},className:`bailey-input-row`,children:[(0,p.jsx)(`input`,{type:`text`,placeholder:B,"aria-label":B,value:A,onChange:e=>j(e.target.value),disabled:S===`streaming`,className:`bailey-input`}),S===`streaming`?(0,p.jsx)(f.Provider,{delayDuration:200,children:(0,p.jsxs)(f.Root,{children:[(0,p.jsx)(f.Trigger,{asChild:!0,children:(0,p.jsx)(`button`,{type:`button`,onClick:T,"aria-label":M.stopAriaLabel,className:`bailey-stop-button`,children:(0,p.jsx)(ge,{className:`bailey-stop-icon`})})}),(0,p.jsx)(f.Portal,{children:(0,p.jsxs)(f.Content,{side:`top`,className:`bailey-tooltip-content`,children:[M.stopButtonText,(0,p.jsx)(f.Arrow,{className:`bailey-tooltip-arrow`})]})})]})}):(0,p.jsx)(`button`,{type:`submit`,"aria-label":M.sendAriaLabel,disabled:!A.trim(),className:`bailey-send-button`,children:(0,p.jsx)(he,{className:`bailey-send-icon`})})]})]})})}var Ie=`0.3.1-pre.2`;exports.ActivityIcon=be,exports.ArrowUpRightIcon=_e,exports.BAILEYAI_CHAT_UI_VERSION=Ie,exports.BAILEY_CHART_PROMPT_FRAGMENT=V,exports.BAILEY_TABLE_GRID_ROW_THRESHOLD=N,exports.BaileyChatPanel=Fe,exports.BaileyTracePanel=$,exports.CopyMarkdownButton=Se,exports.HeartIcon=he,exports.TRACE_KIND_LABEL=U,exports.createBaileyMarkdownComponents=me,exports.extractPseudoToolCalls=x,exports.extractTableData=z,exports.formatTraceGap=ce,exports.formatTraceTime=se,exports.hasTraceFailure=fe,exports.isSafeMarkdownUrl=c.t,exports.joinInstructions=k,exports.parseBaileyChartSpec=H,exports.parseSseFrames=C,exports.resolveToolCall=M,exports.shouldUseGrid=B,exports.toActivityLines=pe,exports.toTraceRows=le,exports.toTraceSegments=de,exports.traceEventArgsDetail=q,exports.traceEventHint=Y,exports.traceEventOutputDetail=J,exports.traceEventRawDetail=oe,exports.traceEventSummary=K,exports.traceEventToolName=G,exports.traceSummaryLine=ue,exports.useBaileyChat=O;
|
|
11
|
+
`)}var A=`call_tool`,j=`a tool`;function M(e,t){let n={name:e===A?j:e,args:null,viaCallTool:!1};if(!t)return n;let r;try{r=JSON.parse(t)}catch{return n}if(typeof r!=`object`||!r)return n;let i=r;if(e===A){let e=typeof i.name==`string`?i.name:void 0;if(!e)return n;let t=i.arguments;return{name:e,args:typeof t==`object`&&t?t:null,viaCallTool:!0}}return{name:e,args:i,viaCallTool:!1}}var N=5,P=e=>e.type===`text`?e.value??``:(e.children??[]).map(P).join(``),F=e=>{if(e.tagName===`a`&&e.properties?.href)return e.properties.href;for(let t of e.children??[]){let e=F(t);if(e)return e}},I=(e,t)=>(e.children??[]).find(e=>e.tagName===t),L=e=>{let t=P(e),n=F(e);return n?{text:t,href:n}:{text:t}},R=e=>(e.children??[]).filter(e=>e.type===`element`).map(L),z=e=>{if(e.tagName!==`table`)return null;let t=I(e,`thead`),n=t&&I(t,`tr`);return{headers:n?R(n).map(e=>e.text):[],rows:(I(e,`tbody`)?.children??[]).filter(e=>e.tagName===`tr`).map(R)}},B=e=>e.length>5,V='When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {"type": "bar" | "line" | "pie" | "doughnut" | "scatter", "title"?: string, "data": {"labels": string[], "datasets": [{"label": string, "data": number[]}]}}. For "scatter" charts, omit "labels" and give each dataset "data" as an array of {"x": number, "y": number} points instead of a number array. "pie" and "doughnut" charts must have exactly one dataset. Do not include any other fields (no "options", no colors) — the app handles styling. Example:\n```chartjs\n{"type": "line", "title": "BP readings", "data": {"labels": ["Jul 14", "Jul 21", "Jul 28"], "datasets": [{"label": "Systolic", "data": [120, 118, 122]}]}}\n```',H=[`bar`,`line`,`pie`,`doughnut`,`scatter`],ee=8,te=50,ne=8,re=500,ie=e=>typeof e==`object`&&!!e&&typeof e.x==`number`&&typeof e.y==`number`,ae=e=>{let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let n=t;if(typeof n.type!=`string`||!H.includes(n.type))return null;let r=n.type;if(n.title!==void 0&&typeof n.title!=`string`)return null;let i=n.title;if(typeof n.data!=`object`||n.data===null)return null;let a=n.data;if(!Array.isArray(a.datasets)||a.datasets.length<1||a.datasets.length>ee||(r===`pie`||r===`doughnut`)&&a.datasets.length!==1)return null;for(let e of a.datasets)if(typeof e!=`object`||!e||typeof e.label!=`string`||!Array.isArray(e.data))return null;let o=a.datasets;if(r===`scatter`){for(let e of o)if(e.data.length<1||e.data.length>re||!e.data.every(ie))return null;return{type:r,title:i,data:{datasets:o}}}if(!Array.isArray(a.labels)||!a.labels.every(e=>typeof e==`string`))return null;let s=a.labels,c=r===`pie`||r===`doughnut`?ne:te;if(s.length<1||s.length>c)return null;for(let e of o)if(e.data.length!==s.length||!e.data.every(e=>typeof e==`number`))return null;return{type:r,title:i,data:{labels:s,datasets:o}}},oe={tool_start:`Tool start`,tool_end:`Tool end`,pseudo_tool_call:`Narrated tool call`,progress:`Progress`,info:`Info`,error:`Error`,raw:`Raw event`};function U(e){return e.kind!==`tool_start`&&e.kind!==`tool_end`?null:M(e.name,e.args)}function W(e,t=U(e)){return e.kind===`pseudo_tool_call`?e.name:t?.name??null}function G(e,t=U(e)){switch(e.kind){case`tool_start`:return t.viaCallTool?`${t.name} (via call_tool)`:t.name;case`tool_end`:return`${t.viaCallTool?`${t.name} (via call_tool)`:t.name}${e.runtimeSeconds===void 0?``:` — ${e.runtimeSeconds.toFixed(2)}s`}${e.isError?` — failed`:``}`;case`pseudo_tool_call`:return`${e.name} — written as text, not actually called`;case`progress`:return e.message?`${e.status} — ${e.message}`:e.status;case`info`:return e.message;case`error`:return e.httpStatus?`${e.message} (HTTP ${e.httpStatus})`:e.message;case`raw`:return`Unrecognized event: ${e.eventType}`}}function K(e,t=U(e)){return e.kind===`tool_start`||e.kind===`tool_end`?t.args?JSON.stringify(t.args,null,2):e.args??null:e.kind===`pseudo_tool_call`?e.args??null:null}function q(e){return e.kind===`tool_end`?e.output??null:null}function J(e){return e.kind===`raw`?e.raw:e.kind===`error`?e.rawBody??null:null}function Y(e){switch(e.kind){case`tool_start`:return`Calling ${M(e.name,e.args).name}...`;case`tool_end`:{let t=M(e.name,e.args).name;return e.isError?`${t} failed`:`${t} returned`}case`pseudo_tool_call`:return`${e.name} (written as text, not called)`;case`progress`:return e.message??e.status;case`info`:return e.message;case`error`:return e.source===`client-timeout`?`Timed out: ${e.message}`:`Error: ${e.message}`;case`raw`:return`Unrecognized event: ${e.eventType}`}}function se(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function ce(e){if(e<=0)return`+0ms`;if(e<1e3)return`+${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`+${t.toFixed(1)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return`+${n}m${String(r).padStart(2,`0`)}s`}function le(e){return e.map((t,n)=>{let r=U(t),i=n===0?t.turnSentAt:e[n-1].at;return{key:`${t.at}-${n}`,kind:t.kind,toolName:W(t,r),isToolStart:t.kind===`tool_start`,failed:t.kind===`tool_end`&&t.isError===!0,time:se(t.at),gapMs:t.at-i,label:t.kind===`tool_end`&&t.isError===!0?`Tool failed`:oe[t.kind],summary:G(t,r),argsDetail:K(t,r),outputDetail:q(t),rawDetail:J(t)}})}function ue(e){let t=e.filter(e=>e.kind===`tool_end`),n=t.filter(e=>e.kind===`tool_end`&&e.isError),r=e.filter(e=>e.kind===`error`),i=[];return t.length>0&&i.push(`${t.length} tool call${t.length===1?``:`s`}`+(n.length>0?`, ${n.length} failed`:``)),r.length>0&&i.push(`${r.length} stream error${r.length===1?``:`s`}`),i.join(` · `)}function de(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.toolName&&e?.type===`group`&&e.toolName===n.toolName){e.rows.push(n);continue}t.push(n.toolName?{type:`group`,toolName:n.toolName,rows:[n]}:{type:`single`,row:n})}return t}function fe(e){return e.some(e=>e.kind===`tool_end`&&e.isError||e.kind===`error`)}function pe(e,t){return t===void 0?[]:e.filter(e=>e.turnSentAt===t&&(e.kind===`tool_end`||e.kind===`pseudo_tool_call`||e.kind===`progress`)).map((e,t)=>({key:`${e.at}-${t}`,text:Y(e),toolName:W(e)}))}function X({renderTable:e,renderChart:t}={}){return{a:({href:e,children:t})=>!e||!c.t(e)?(0,p.jsx)(p.Fragment,{children:t}):(0,p.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({node:t,children:n})=>{let r=t&&z(t);if(r&&B(r.rows)&&e){let t=r.rows.map(e=>e.map(e=>e.href&&!c.t(e.href)?{text:e.text}:e));return(0,p.jsx)(p.Fragment,{children:e({headers:r.headers,rows:t})})}return(0,p.jsx)(`table`,{children:n})},pre:({children:e})=>{let n=(Array.isArray(e)?e[0]:e)?.props;if((n?.className?.split(` `)??[]).includes(`language-chartjs`)&&t){let e=n?.children,r=ae(Array.isArray(e)?e.join(``):String(e??``));if(r)return(0,p.jsx)(p.Fragment,{children:t(r)})}return(0,p.jsx)(`pre`,{children:e})}}}function me({className:e}){return(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,p.jsx)(`path`,{d:`M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z`})})}function he({className:e}){return(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,p.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`})})}function ge({className:e}){return(0,p.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,p.jsx)(`path`,{d:`M7 17 17 7`}),(0,p.jsx)(`path`,{d:`M9 7h8v8`})]})}function _e({className:e}){return(0,p.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,p.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,p.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]})}function ve({className:e}){return(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,p.jsx)(`path`,{d:`M5 12.5 9.5 17 19 7`})})}function ye({className:e}){return(0,p.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,p.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,p.jsx)(`path`,{d:`M8.5 12.5 11 15l4.5-5.5`})]})}var be=1500;function xe({markdown:e,className:t,ariaLabel:n=`copy response as markdown`,tooltipDefaultText:r=`Copy as markdown`,tooltipCopiedText:i=`Copied!`}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(!1),u=(0,l.useRef)(null);return(0,l.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),(0,p.jsx)(f.Provider,{delayDuration:200,children:(0,p.jsxs)(f.Root,{open:a||s,onOpenChange:c,children:[(0,p.jsx)(f.Trigger,{asChild:!0,children:(0,p.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(e)}catch{return}o(!0),u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>o(!1),be)},"aria-label":n,className:`bailey-copy-button${t?` ${t}`:``}`,children:a?(0,p.jsx)(ve,{className:`bailey-copy-icon`}):(0,p.jsx)(_e,{className:`bailey-copy-icon`})})}),(0,p.jsx)(f.Portal,{children:(0,p.jsxs)(f.Content,{side:`top`,className:`bailey-tooltip-content`,children:[a?i:r,(0,p.jsx)(f.Arrow,{className:`bailey-tooltip-arrow`})]})})]})})}async function Se(e){try{await navigator.clipboard.writeText(e)}catch{}}function Ce({text:e,label:t=`Copy`}){return(0,p.jsx)(`button`,{type:`button`,onClick:()=>Se(e),className:`bailey-trace-copy-button`,children:t})}function we(e){if(e.failed||e.kind===`error`)return`bailey-trace-chip bailey-trace-chip-error`;switch(e.kind){case`tool_start`:return`bailey-trace-chip bailey-trace-chip-info`;case`tool_end`:return`bailey-trace-chip bailey-trace-chip-success`;case`progress`:return`bailey-trace-chip bailey-trace-chip-secondary`;default:return`bailey-trace-chip bailey-trace-chip-default`}}function Z({label:e,content:t,copyable:n}){return(0,p.jsxs)(`details`,{className:`bailey-trace-disclosure`,children:[(0,p.jsx)(`summary`,{className:`bailey-trace-disclosure-summary`,children:e}),n&&(0,p.jsx)(`div`,{className:`bailey-trace-disclosure-actions`,children:(0,p.jsx)(Ce,{text:t})}),(0,p.jsx)(`pre`,{className:`bailey-trace-disclosure-content`,children:t})]})}function Q({row:e}){return(0,p.jsxs)(`div`,{className:`bailey-trace-row`,children:[(0,p.jsxs)(`div`,{className:`bailey-trace-row-header`,children:[(0,p.jsx)(`span`,{className:`bailey-trace-row-time`,children:e.time}),(0,p.jsx)(`span`,{className:`bailey-trace-row-gap`,title:`Time since the previous event`,children:ce(e.gapMs)}),(0,p.jsx)(`span`,{className:we(e),children:e.label}),(0,p.jsx)(`span`,{className:`bailey-trace-row-summary`,children:e.summary})]}),e.argsDetail&&(0,p.jsx)(Z,{label:`args`,content:e.argsDetail}),e.outputDetail&&(0,p.jsx)(Z,{label:`output`,content:e.outputDetail}),e.rawDetail&&(0,p.jsx)(Z,{label:`raw`,content:e.rawDetail})]})}function Te(e,t){if(e.chunkCount===0)return`Streamed: no chunks received`;if(e.chunkCount===1||e.firstChunkAt===null)return`Streamed: 1 chunk (not incremental)`;let n=e.firstChunkAt-t,r=(e.lastChunkAt??e.firstChunkAt)-e.firstChunkAt;return`Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r/1e3).toFixed(1)}s`}function Ee({request:e}){let t=(0,l.useMemo)(()=>JSON.stringify({model:e.model,instructions:e.systemPrompt,input:e.messages,stream:e.stream,tools:e.tools,toolChoice:e.toolChoice},null,2),[e]);return(0,p.jsxs)(`div`,{className:`bailey-trace-request-details`,children:[(0,p.jsxs)(`span`,{className:`bailey-trace-request-meta`,children:[`Last request — `,e.model,` · `,new Date(e.sentAt).toLocaleTimeString(),e.requestId?` · ${e.requestId}`:``]}),(0,p.jsx)(`span`,{className:`bailey-trace-request-meta`,children:Te(e.streamStats,e.sentAt)}),(0,p.jsx)(Z,{label:`System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,content:e.systemPrompt,copyable:!0}),(0,p.jsx)(Z,{label:`Messages (${e.messages.length})`,content:JSON.stringify(e.messages,null,2),copyable:!0}),e.response&&(0,p.jsx)(Z,{label:`Response (${e.response.content.length.toLocaleString()} chars)`,content:e.response.content,copyable:!0}),(0,p.jsx)(Z,{label:`Full payload (JSON)`,content:t,copyable:!0})]})}function De({events:e,lastRequest:t,onClear:n}){let r=(0,l.useMemo)(()=>le(e),[e]),i=(0,l.useMemo)(()=>de(r),[r]),a=(0,l.useMemo)(()=>JSON.stringify(e,null,2),[e]);return(0,p.jsxs)(`div`,{className:`bailey-trace-body`,children:[(0,p.jsxs)(`div`,{className:`bailey-trace-actions-row`,children:[e.length>0&&(0,p.jsx)(Ce,{text:a,label:`Copy trace as JSON`}),(0,p.jsx)(`button`,{type:`button`,onClick:n,className:`bailey-trace-copy-button`,children:`Clear`})]}),t&&(0,p.jsx)(Ee,{request:t}),(0,p.jsx)(`div`,{className:`bailey-trace-rows`,children:i.map((e,t)=>{if(e.type===`single`)return(0,p.jsx)(Q,{row:e.row},e.row.key);let n=e.rows.filter(e=>e.isToolStart).length;if(n<=1)return(0,p.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,p.jsx)(Q,{row:e},e.key))},`group-${t}`);let r=e.rows.filter(e=>e.failed).length;return(0,p.jsxs)(`details`,{className:`bailey-trace-group`,children:[(0,p.jsxs)(`summary`,{className:`bailey-trace-group-summary`,children:[(0,p.jsx)(`strong`,{children:e.toolName}),` × `,n,r>0&&(0,p.jsxs)(`span`,{className:`bailey-trace-group-failed`,children:[` `,r,` failed`]})]}),(0,p.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,p.jsx)(Q,{row:e},e.key))})]},`group-${t}`)})})]})}function $({events:e,lastRequest:t,onClear:n}){let[r,i]=(0,l.useState)(!1),a=(0,l.useMemo)(()=>fe(e),[e]),o=(0,l.useMemo)(()=>ue(e),[e]);return e.length===0&&!t?null:(0,p.jsxs)(`div`,{className:`bailey-trace-panel`,children:[(0,p.jsxs)(`div`,{className:`bailey-trace-toggle-row`,children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,className:a?`bailey-trace-toggle bailey-trace-toggle-error`:`bailey-trace-toggle`,children:[a&&!r?`⚠ `:``,r?`Hide details`:`Show details`,` (`,e.length,`)`]}),o&&(0,p.jsx)(`span`,{className:a?`bailey-trace-summary bailey-trace-summary-error`:`bailey-trace-summary`,children:o})]}),r&&(0,p.jsx)(De,{events:e,lastRequest:t,onClear:n})]})}var Oe=`How can bailey AI help you today?`,ke=`Reply to bailey AI`,Ae={newChatButtonText:`New chat`,newChatAriaLabel:`new chat`,suggestionsTitle:`Suggested for you`,emptyStateMessage:`Ask Bailey a question to get started.`,youLabel:`You`,thinkingHint:`Thinking…`,retryButtonText:`Retry`,dismissErrorAriaLabel:`dismiss error`,sendAriaLabel:`send`,stopButtonText:`Stop`,stopAriaLabel:`stop`,copyButtonAriaLabel:`copy response as markdown`,copyButtonTooltipDefault:`Copy as markdown`,copyButtonTooltipCopied:`Copied!`},je=[d.default],Me={...X(),p:({children:e})=>(0,p.jsx)(p.Fragment,{children:e})},Ne=(0,l.memo)(function({content:e,components:t}){return(0,p.jsx)(`div`,{className:`bailey-markdown-content`,children:(0,p.jsx)(u.default,{remarkPlugins:je,components:t,skipHtml:!0,children:e})})});function Pe(e,t,n){if(e!==`streaming`)return;let r=t.filter(e=>e.turnSentAt===n?.sentAt);if(r.length!==0)return Y(r[r.length-1])}function Fe(e){let t=new Date(e),n=t.toDateString()===new Date().toDateString(),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return n?`Today ${r}`:`${t.toLocaleDateString()} ${r}`}function Ie({chat:e,placeholder:t,replyPlaceholder:n=ke,emptyPlaceholder:r,suggestions:i,privacyNote:a,resolveActivityIcon:o,className:s,height:c,width:d,hideDeveloperDetails:m=!1,renderMessageActions:h,renderTable:g,renderChart:_,labels:v,formatMessageTime:y}){let{messages:b,traceEvents:x,lastRequest:S,status:C,error:w,send:T,stop:E,retryLast:D,clearTrace:O,clearError:k,newChat:A}=e,[j,M]=(0,l.useState)(``),N={...Ae,...v},P=y??Fe,F=(0,l.useRef)(null),I=(0,l.useRef)(null),L=(0,l.useRef)(!0),R=(0,l.useMemo)(()=>X({renderTable:g,renderChart:_}),[g,_]),z=(0,l.useMemo)(()=>Pe(C,x,S),[C,x,S]),B=b.length===0,V=t??(B?r??Oe:n);(0,l.useEffect)(()=>{let e=I.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight;L.current=t<60};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),(0,l.useEffect)(()=>{L.current&&F.current?.scrollIntoView({behavior:C===`streaming`?`auto`:`smooth`,block:`nearest`})},[b,C]);let H=e=>{L.current=!0,T(e)};return(0,p.jsx)(`div`,{className:`bailey-chat-panel${s?` ${s}`:``}`,style:c!==void 0||d!==void 0?{height:c,width:d}:void 0,children:(0,p.jsxs)(`div`,{className:`bailey-chat-panel-inner`,children:[(0,p.jsx)(`div`,{className:`bailey-toolbar-row`,children:(0,p.jsx)(`button`,{type:`button`,onClick:A,disabled:b.length===0,"aria-label":N.newChatAriaLabel,className:`bailey-new-chat-button`,children:N.newChatButtonText})}),(0,p.jsxs)(`div`,{className:`bailey-chat-transcript`,ref:I,children:[B&&(i&&i.length>0?(0,p.jsxs)(`div`,{className:`bailey-suggestions`,children:[(0,p.jsx)(`div`,{className:`bailey-suggestions-title`,children:N.suggestionsTitle}),i.map((e,t)=>(0,p.jsxs)(`button`,{type:`button`,onClick:()=>H(e.value??e.label),className:`bailey-suggestion-card`,children:[(0,p.jsx)(`span`,{children:e.label}),(0,p.jsx)(ge,{className:`bailey-suggestion-icon`})]},`${e.label}-${t}`))]}):(0,p.jsx)(`div`,{className:`bailey-empty-state`,children:N.emptyStateMessage})),b.map((e,t)=>{let n=e.role===`assistant`&&t===b.length-1,r=C===`streaming`&&n&&e.content===``,i=e.role===`assistant`&&!r?pe(x,e.createdAt):[],a=i[i.length-1];return(0,p.jsx)(`div`,{className:e.role===`user`?`bailey-message-row bailey-message-row-user`:`bailey-message-row`,children:e.role===`user`?(0,p.jsxs)(`div`,{className:`bailey-user-message`,children:[(0,p.jsxs)(`div`,{className:`bailey-message-meta`,children:[(0,p.jsx)(`span`,{className:`bailey-message-meta-name`,children:N.youLabel}),e.createdAt!==void 0&&(0,p.jsx)(`span`,{children:P(e.createdAt)})]}),(0,p.jsx)(`div`,{className:`bailey-user-bubble`,children:e.content})]}):r?(0,p.jsx)(`div`,{className:`bailey-thinking-hint`,children:z??N.thinkingHint}):(0,p.jsxs)(`div`,{className:`bailey-assistant-message`,children:[a&&(0,p.jsxs)(`div`,{className:`bailey-activity-line`,children:[(0,p.jsx)(`span`,{className:`bailey-activity-icon`,children:o?.(a.toolName)??(0,p.jsx)(ye,{})}),(0,p.jsx)(`span`,{children:a.text})]}),(0,p.jsx)(Ne,{content:e.content,components:R}),e.streaming&&z&&(0,p.jsx)(`div`,{className:`bailey-streaming-hint`,children:z}),!e.streaming&&(0,p.jsxs)(`div`,{className:`bailey-message-actions`,children:[(0,p.jsx)(xe,{markdown:e.content,ariaLabel:N.copyButtonAriaLabel,tooltipDefaultText:N.copyButtonTooltipDefault,tooltipCopiedText:N.copyButtonTooltipCopied}),h?.(e)]})]})},e.id)}),(0,p.jsx)(`div`,{ref:F})]}),w&&(0,p.jsxs)(`div`,{className:`bailey-error-banner`,role:`alert`,children:[(0,p.jsx)(`span`,{children:w}),(0,p.jsxs)(`div`,{className:`bailey-error-actions`,children:[(0,p.jsx)(`button`,{type:`button`,onClick:D,className:`bailey-retry-button`,children:N.retryButtonText}),(0,p.jsx)(`button`,{type:`button`,onClick:k,"aria-label":N.dismissErrorAriaLabel,className:`bailey-dismiss-button`,children:`✕`})]})]}),!m&&(0,p.jsx)($,{events:x,lastRequest:S,onClear:O}),(0,p.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!(!j.trim()||C===`streaming`)&&(H(j),M(``))},className:`bailey-input-row`,children:[(0,p.jsx)(`input`,{type:`text`,placeholder:V,"aria-label":V,value:j,onChange:e=>M(e.target.value),disabled:C===`streaming`,className:`bailey-input`}),C===`streaming`?(0,p.jsx)(f.Provider,{delayDuration:200,children:(0,p.jsxs)(f.Root,{children:[(0,p.jsx)(f.Trigger,{asChild:!0,children:(0,p.jsx)(`button`,{type:`button`,onClick:E,"aria-label":N.stopAriaLabel,className:`bailey-stop-button`,children:(0,p.jsx)(he,{className:`bailey-stop-icon`})})}),(0,p.jsx)(f.Portal,{children:(0,p.jsxs)(f.Content,{side:`top`,className:`bailey-tooltip-content`,children:[N.stopButtonText,(0,p.jsx)(f.Arrow,{className:`bailey-tooltip-arrow`})]})})]})}):(0,p.jsx)(`button`,{type:`submit`,"aria-label":N.sendAriaLabel,disabled:!j.trim(),className:`bailey-send-button`,children:(0,p.jsx)(me,{className:`bailey-send-icon`})})]}),(B||a?.alwaysVisible)&&a&&(0,p.jsx)(`div`,{className:`bailey-privacy-note`,children:(0,p.jsx)(u.default,{remarkPlugins:je,components:Me,skipHtml:!0,children:a.markdown})})]})})}var Le=`0.3.1-pre.2`;exports.ActivityIcon=ye,exports.ArrowUpRightIcon=ge,exports.BAILEYAI_CHAT_UI_VERSION=Le,exports.BAILEY_CHART_PROMPT_FRAGMENT=V,exports.BAILEY_TABLE_GRID_ROW_THRESHOLD=N,exports.BaileyChatPanel=Ie,exports.BaileyTracePanel=$,exports.CopyMarkdownButton=xe,exports.HeartIcon=me,exports.TRACE_KIND_LABEL=oe,exports.createBaileyMarkdownComponents=X,exports.extractPseudoToolCalls=x,exports.extractTableData=z,exports.formatTraceGap=ce,exports.formatTraceTime=se,exports.hasTraceFailure=fe,exports.isSafeMarkdownUrl=c.t,exports.joinInstructions=k,exports.parseBaileyChartSpec=ae,exports.parseSseFrames=C,exports.resolveToolCall=M,exports.shouldUseGrid=B,exports.toActivityLines=pe,exports.toTraceRows=le,exports.toTraceSegments=de,exports.traceEventArgsDetail=K,exports.traceEventHint=Y,exports.traceEventOutputDetail=q,exports.traceEventRawDetail=J,exports.traceEventSummary=G,exports.traceEventToolName=W,exports.traceSummaryLine=ue,exports.useBaileyChat=O;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
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-font-weight: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-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0}}}@layer theme{.bailey-chat-panel{--font-sans:"Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-2xl:1rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-toolbar-row{justify-content:flex-end;display:flex}.bailey-new-chat-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-new-chat-button:hover{text-decoration-line:underline}}.bailey-new-chat-button:disabled{cursor:default;opacity:.5;text-decoration-line:none}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);display:flex}.bailey-empty-state{height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{padding-inline:calc(var(--spacing) * 4);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-activity-line{margin-bottom:calc(var(--spacing) * 2);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}@property --tw-font-weight{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-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}
|
|
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-font-weight: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-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0}}}@layer theme{.bailey-chat-panel{--font-sans:"Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-2xl:1rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-toolbar-row{justify-content:flex-end;display:flex}.bailey-new-chat-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-new-chat-button:hover{text-decoration-line:underline}}.bailey-new-chat-button:disabled{cursor:default;opacity:.5;text-decoration-line:none}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);display:flex}.bailey-empty-state{height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-activity-line{margin-bottom:calc(var(--spacing) * 2);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}@property --tw-font-weight{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-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}
|
|
3
3
|
/*$vite$:1*/
|
package/dist/baileyai-chat-ui.js
CHANGED
|
@@ -471,13 +471,13 @@ var M = 5, N = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
471
471
|
headers: n ? L(n).map((e) => e.text) : [],
|
|
472
472
|
rows: (F(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(L)
|
|
473
473
|
};
|
|
474
|
-
}, z = (e) => e.length > 5, B = "When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {\"type\": \"bar\" | \"line\" | \"pie\" | \"doughnut\" | \"scatter\", \"title\"?: string, \"data\": {\"labels\": string[], \"datasets\": [{\"label\": string, \"data\": number[]}]}}. For \"scatter\" charts, omit \"labels\" and give each dataset \"data\" as an array of {\"x\": number, \"y\": number} points instead of a number array. \"pie\" and \"doughnut\" charts must have exactly one dataset. Do not include any other fields (no \"options\", no colors) — the app handles styling. Example:\n```chartjs\n{\"type\": \"line\", \"title\": \"BP readings\", \"data\": {\"labels\": [\"Jul 14\", \"Jul 21\", \"Jul 28\"], \"datasets\": [{\"label\": \"Systolic\", \"data\": [120, 118, 122]}]}}\n```",
|
|
474
|
+
}, z = (e) => e.length > 5, B = "When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {\"type\": \"bar\" | \"line\" | \"pie\" | \"doughnut\" | \"scatter\", \"title\"?: string, \"data\": {\"labels\": string[], \"datasets\": [{\"label\": string, \"data\": number[]}]}}. For \"scatter\" charts, omit \"labels\" and give each dataset \"data\" as an array of {\"x\": number, \"y\": number} points instead of a number array. \"pie\" and \"doughnut\" charts must have exactly one dataset. Do not include any other fields (no \"options\", no colors) — the app handles styling. Example:\n```chartjs\n{\"type\": \"line\", \"title\": \"BP readings\", \"data\": {\"labels\": [\"Jul 14\", \"Jul 21\", \"Jul 28\"], \"datasets\": [{\"label\": \"Systolic\", \"data\": [120, 118, 122]}]}}\n```", V = [
|
|
475
475
|
"bar",
|
|
476
476
|
"line",
|
|
477
477
|
"pie",
|
|
478
478
|
"doughnut",
|
|
479
479
|
"scatter"
|
|
480
|
-
],
|
|
480
|
+
], ee = 8, H = 50, U = 8, W = 500, G = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", te = (e) => {
|
|
481
481
|
let t;
|
|
482
482
|
try {
|
|
483
483
|
t = JSON.parse(e);
|
|
@@ -486,17 +486,17 @@ var M = 5, N = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
486
486
|
}
|
|
487
487
|
if (typeof t != "object" || !t) return null;
|
|
488
488
|
let n = t;
|
|
489
|
-
if (typeof n.type != "string" || !
|
|
489
|
+
if (typeof n.type != "string" || !V.includes(n.type)) return null;
|
|
490
490
|
let r = n.type;
|
|
491
491
|
if (n.title !== void 0 && typeof n.title != "string") return null;
|
|
492
492
|
let i = n.title;
|
|
493
493
|
if (typeof n.data != "object" || n.data === null) return null;
|
|
494
494
|
let a = n.data;
|
|
495
|
-
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length >
|
|
495
|
+
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > ee || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
|
|
496
496
|
for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
|
|
497
497
|
let o = a.datasets;
|
|
498
498
|
if (r === "scatter") {
|
|
499
|
-
for (let e of o) if (e.data.length < 1 || e.data.length > W || !e.data.every(
|
|
499
|
+
for (let e of o) if (e.data.length < 1 || e.data.length > W || !e.data.every(G)) return null;
|
|
500
500
|
return {
|
|
501
501
|
type: r,
|
|
502
502
|
title: i,
|
|
@@ -515,7 +515,7 @@ var M = 5, N = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
515
515
|
datasets: o
|
|
516
516
|
}
|
|
517
517
|
};
|
|
518
|
-
},
|
|
518
|
+
}, ne = {
|
|
519
519
|
tool_start: "Tool start",
|
|
520
520
|
tool_end: "Tool end",
|
|
521
521
|
pseudo_tool_call: "Narrated tool call",
|
|
@@ -524,13 +524,13 @@ var M = 5, N = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
524
524
|
error: "Error",
|
|
525
525
|
raw: "Raw event"
|
|
526
526
|
};
|
|
527
|
-
function
|
|
527
|
+
function K(e) {
|
|
528
528
|
return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : j(e.name, e.args);
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function q(e, t = K(e)) {
|
|
531
531
|
return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function J(e, t = K(e)) {
|
|
534
534
|
switch (e.kind) {
|
|
535
535
|
case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
|
|
536
536
|
case "tool_end": return `${t.viaCallTool ? `${t.name} (via call_tool)` : t.name}${e.runtimeSeconds === void 0 ? "" : ` — ${e.runtimeSeconds.toFixed(2)}s`}${e.isError ? " — failed" : ""}`;
|
|
@@ -541,16 +541,16 @@ function q(e, t = G(e)) {
|
|
|
541
541
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function re(e, t = K(e)) {
|
|
545
545
|
return e.kind === "tool_start" || e.kind === "tool_end" ? t.args ? JSON.stringify(t.args, null, 2) : e.args ?? null : e.kind === "pseudo_tool_call" ? e.args ?? null : null;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function ie(e) {
|
|
548
548
|
return e.kind === "tool_end" ? e.output ?? null : null;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function Y(e) {
|
|
551
551
|
return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function X(e) {
|
|
554
554
|
switch (e.kind) {
|
|
555
555
|
case "tool_start": return `Calling ${j(e.name, e.args).name}...`;
|
|
556
556
|
case "tool_end": {
|
|
@@ -564,11 +564,11 @@ function Z(e) {
|
|
|
564
564
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function ae(e) {
|
|
568
568
|
let t = new Date(e);
|
|
569
569
|
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}:${String(t.getSeconds()).padStart(2, "0")}.${String(t.getMilliseconds()).padStart(3, "0")}`;
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function oe(e) {
|
|
572
572
|
if (e <= 0) return "+0ms";
|
|
573
573
|
if (e < 1e3) return `+${Math.round(e)}ms`;
|
|
574
574
|
let t = e / 1e3;
|
|
@@ -576,30 +576,30 @@ function ae(e) {
|
|
|
576
576
|
let n = Math.floor(t / 60), r = Math.round(t % 60);
|
|
577
577
|
return `+${n}m${String(r).padStart(2, "0")}s`;
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function se(e) {
|
|
580
580
|
return e.map((t, n) => {
|
|
581
|
-
let r =
|
|
581
|
+
let r = K(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
|
|
582
582
|
return {
|
|
583
583
|
key: `${t.at}-${n}`,
|
|
584
584
|
kind: t.kind,
|
|
585
|
-
toolName:
|
|
585
|
+
toolName: q(t, r),
|
|
586
586
|
isToolStart: t.kind === "tool_start",
|
|
587
587
|
failed: t.kind === "tool_end" && t.isError === !0,
|
|
588
|
-
time:
|
|
588
|
+
time: ae(t.at),
|
|
589
589
|
gapMs: t.at - i,
|
|
590
|
-
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" :
|
|
591
|
-
summary:
|
|
592
|
-
argsDetail:
|
|
593
|
-
outputDetail:
|
|
594
|
-
rawDetail:
|
|
590
|
+
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : ne[t.kind],
|
|
591
|
+
summary: J(t, r),
|
|
592
|
+
argsDetail: re(t, r),
|
|
593
|
+
outputDetail: ie(t),
|
|
594
|
+
rawDetail: Y(t)
|
|
595
595
|
};
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function ce(e) {
|
|
599
599
|
let t = e.filter((e) => e.kind === "tool_end"), n = t.filter((e) => e.kind === "tool_end" && e.isError), r = e.filter((e) => e.kind === "error"), i = [];
|
|
600
600
|
return t.length > 0 && i.push(`${t.length} tool call${t.length === 1 ? "" : "s"}` + (n.length > 0 ? `, ${n.length} failed` : "")), r.length > 0 && i.push(`${r.length} stream error${r.length === 1 ? "" : "s"}`), i.join(" · ");
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function le(e) {
|
|
603
603
|
let t = [];
|
|
604
604
|
for (let n of e) {
|
|
605
605
|
let e = t[t.length - 1];
|
|
@@ -618,19 +618,19 @@ function ce(e) {
|
|
|
618
618
|
}
|
|
619
619
|
return t;
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function ue(e) {
|
|
622
622
|
return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function de(e, t) {
|
|
625
625
|
return t === void 0 ? [] : e.filter((e) => e.turnSentAt === t && (e.kind === "tool_end" || e.kind === "pseudo_tool_call" || e.kind === "progress")).map((e, t) => ({
|
|
626
626
|
key: `${e.at}-${t}`,
|
|
627
|
-
text:
|
|
628
|
-
toolName:
|
|
627
|
+
text: X(e),
|
|
628
|
+
toolName: q(e)
|
|
629
629
|
}));
|
|
630
630
|
}
|
|
631
631
|
//#endregion
|
|
632
632
|
//#region src/ui/markdown.tsx
|
|
633
|
-
function
|
|
633
|
+
function Z({ renderTable: t, renderChart: n } = {}) {
|
|
634
634
|
return {
|
|
635
635
|
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ d(u, { children: n }) : /* @__PURE__ */ d("a", {
|
|
636
636
|
href: t,
|
|
@@ -652,7 +652,7 @@ function de({ renderTable: t, renderChart: n } = {}) {
|
|
|
652
652
|
pre: ({ children: e }) => {
|
|
653
653
|
let t = (Array.isArray(e) ? e[0] : e)?.props;
|
|
654
654
|
if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
|
|
655
|
-
let e = t?.children, r =
|
|
655
|
+
let e = t?.children, r = te(Array.isArray(e) ? e.join("") : String(e ?? ""));
|
|
656
656
|
if (r) return /* @__PURE__ */ d(u, { children: n(r) });
|
|
657
657
|
}
|
|
658
658
|
return /* @__PURE__ */ d("pre", { children: e });
|
|
@@ -840,7 +840,7 @@ function $({ row: e }) {
|
|
|
840
840
|
/* @__PURE__ */ d("span", {
|
|
841
841
|
className: "bailey-trace-row-gap",
|
|
842
842
|
title: "Time since the previous event",
|
|
843
|
-
children:
|
|
843
|
+
children: oe(e.gapMs)
|
|
844
844
|
}),
|
|
845
845
|
/* @__PURE__ */ d("span", {
|
|
846
846
|
className: Se(e),
|
|
@@ -923,7 +923,7 @@ function we({ request: e }) {
|
|
|
923
923
|
});
|
|
924
924
|
}
|
|
925
925
|
function Te({ events: e, lastRequest: t, onClear: n }) {
|
|
926
|
-
let r = i(() =>
|
|
926
|
+
let r = i(() => se(e), [e]), a = i(() => le(r), [r]), o = i(() => JSON.stringify(e, null, 2), [e]);
|
|
927
927
|
return /* @__PURE__ */ f("div", {
|
|
928
928
|
className: "bailey-trace-body",
|
|
929
929
|
children: [
|
|
@@ -978,7 +978,7 @@ function Te({ events: e, lastRequest: t, onClear: n }) {
|
|
|
978
978
|
});
|
|
979
979
|
}
|
|
980
980
|
function Ee({ events: e, lastRequest: t, onClear: n }) {
|
|
981
|
-
let [r, a] = o(!1), s = i(() =>
|
|
981
|
+
let [r, a] = o(!1), s = i(() => ue(e), [e]), c = i(() => ce(e), [e]);
|
|
982
982
|
return e.length === 0 && !t ? null : /* @__PURE__ */ f("div", {
|
|
983
983
|
className: "bailey-trace-panel",
|
|
984
984
|
children: [/* @__PURE__ */ f("div", {
|
|
@@ -1023,7 +1023,10 @@ var De = "How can bailey AI help you today?", Oe = "Reply to bailey AI", ke = {
|
|
|
1023
1023
|
copyButtonAriaLabel: "copy response as markdown",
|
|
1024
1024
|
copyButtonTooltipDefault: "Copy as markdown",
|
|
1025
1025
|
copyButtonTooltipCopied: "Copied!"
|
|
1026
|
-
}, Ae = [c], je =
|
|
1026
|
+
}, Ae = [c], je = {
|
|
1027
|
+
...Z(),
|
|
1028
|
+
p: ({ children: e }) => /* @__PURE__ */ d(u, { children: e })
|
|
1029
|
+
}, Me = t(function({ content: e, components: t }) {
|
|
1027
1030
|
return /* @__PURE__ */ d("div", {
|
|
1028
1031
|
className: "bailey-markdown-content",
|
|
1029
1032
|
children: /* @__PURE__ */ d(s, {
|
|
@@ -1034,52 +1037,52 @@ var De = "How can bailey AI help you today?", Oe = "Reply to bailey AI", ke = {
|
|
|
1034
1037
|
})
|
|
1035
1038
|
});
|
|
1036
1039
|
});
|
|
1037
|
-
function
|
|
1040
|
+
function Ne(e, t, n) {
|
|
1038
1041
|
if (e !== "streaming") return;
|
|
1039
1042
|
let r = t.filter((e) => e.turnSentAt === n?.sentAt);
|
|
1040
|
-
if (r.length !== 0) return
|
|
1043
|
+
if (r.length !== 0) return X(r[r.length - 1]);
|
|
1041
1044
|
}
|
|
1042
|
-
function
|
|
1045
|
+
function Pe(e) {
|
|
1043
1046
|
let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
|
|
1044
1047
|
hour: "numeric",
|
|
1045
1048
|
minute: "2-digit"
|
|
1046
1049
|
});
|
|
1047
1050
|
return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
|
|
1048
1051
|
}
|
|
1049
|
-
function
|
|
1050
|
-
let { messages:
|
|
1052
|
+
function Fe({ chat: e, placeholder: t, replyPlaceholder: n = Oe, emptyPlaceholder: c, suggestions: u, privacyNote: p, resolveActivityIcon: m, className: h, height: g, width: _, hideDeveloperDetails: v = !1, renderMessageActions: y, renderTable: b, renderChart: x, labels: S, formatMessageTime: C }) {
|
|
1053
|
+
let { messages: w, traceEvents: T, lastRequest: E, status: D, error: O, send: k, stop: A, retryLast: j, clearTrace: M, clearError: N, newChat: P } = e, [F, I] = o(""), L = {
|
|
1051
1054
|
...ke,
|
|
1052
|
-
...
|
|
1053
|
-
},
|
|
1054
|
-
renderTable:
|
|
1055
|
-
renderChart:
|
|
1056
|
-
}), [
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
]),
|
|
1055
|
+
...S
|
|
1056
|
+
}, R = C ?? Pe, z = a(null), B = a(null), V = a(!0), ee = i(() => Z({
|
|
1057
|
+
renderTable: b,
|
|
1058
|
+
renderChart: x
|
|
1059
|
+
}), [b, x]), H = i(() => Ne(D, T, E), [
|
|
1060
|
+
D,
|
|
1061
|
+
T,
|
|
1062
|
+
E
|
|
1063
|
+
]), U = w.length === 0, W = t ?? (U ? c ?? De : n);
|
|
1061
1064
|
r(() => {
|
|
1062
|
-
let e =
|
|
1065
|
+
let e = B.current;
|
|
1063
1066
|
if (!e) return;
|
|
1064
1067
|
let t = () => {
|
|
1065
1068
|
let t = e.scrollHeight - e.scrollTop - e.clientHeight;
|
|
1066
|
-
|
|
1069
|
+
V.current = t < 60;
|
|
1067
1070
|
};
|
|
1068
1071
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1069
1072
|
}, []), r(() => {
|
|
1070
|
-
|
|
1071
|
-
behavior:
|
|
1073
|
+
V.current && z.current?.scrollIntoView({
|
|
1074
|
+
behavior: D === "streaming" ? "auto" : "smooth",
|
|
1072
1075
|
block: "nearest"
|
|
1073
1076
|
});
|
|
1074
|
-
}, [
|
|
1075
|
-
let
|
|
1076
|
-
|
|
1077
|
+
}, [w, D]);
|
|
1078
|
+
let G = (e) => {
|
|
1079
|
+
V.current = !0, k(e);
|
|
1077
1080
|
};
|
|
1078
1081
|
return /* @__PURE__ */ d("div", {
|
|
1079
|
-
className: `bailey-chat-panel${
|
|
1080
|
-
style:
|
|
1081
|
-
height:
|
|
1082
|
-
width:
|
|
1082
|
+
className: `bailey-chat-panel${h ? ` ${h}` : ""}`,
|
|
1083
|
+
style: g !== void 0 || _ !== void 0 ? {
|
|
1084
|
+
height: g,
|
|
1085
|
+
width: _
|
|
1083
1086
|
} : void 0,
|
|
1084
1087
|
children: /* @__PURE__ */ f("div", {
|
|
1085
1088
|
className: "bailey-chat-panel-inner",
|
|
@@ -1088,34 +1091,34 @@ function Pe({ chat: e, placeholder: t, replyPlaceholder: n = Oe, emptyPlaceholde
|
|
|
1088
1091
|
className: "bailey-toolbar-row",
|
|
1089
1092
|
children: /* @__PURE__ */ d("button", {
|
|
1090
1093
|
type: "button",
|
|
1091
|
-
onClick:
|
|
1092
|
-
disabled:
|
|
1093
|
-
"aria-label":
|
|
1094
|
+
onClick: P,
|
|
1095
|
+
disabled: w.length === 0,
|
|
1096
|
+
"aria-label": L.newChatAriaLabel,
|
|
1094
1097
|
className: "bailey-new-chat-button",
|
|
1095
|
-
children:
|
|
1098
|
+
children: L.newChatButtonText
|
|
1096
1099
|
})
|
|
1097
1100
|
}),
|
|
1098
1101
|
/* @__PURE__ */ f("div", {
|
|
1099
1102
|
className: "bailey-chat-transcript",
|
|
1100
|
-
ref:
|
|
1103
|
+
ref: B,
|
|
1101
1104
|
children: [
|
|
1102
|
-
|
|
1105
|
+
U && (u && u.length > 0 ? /* @__PURE__ */ f("div", {
|
|
1103
1106
|
className: "bailey-suggestions",
|
|
1104
1107
|
children: [/* @__PURE__ */ d("div", {
|
|
1105
1108
|
className: "bailey-suggestions-title",
|
|
1106
|
-
children:
|
|
1107
|
-
}),
|
|
1109
|
+
children: L.suggestionsTitle
|
|
1110
|
+
}), u.map((e, t) => /* @__PURE__ */ f("button", {
|
|
1108
1111
|
type: "button",
|
|
1109
|
-
onClick: () =>
|
|
1112
|
+
onClick: () => G(e.value ?? e.label),
|
|
1110
1113
|
className: "bailey-suggestion-card",
|
|
1111
1114
|
children: [/* @__PURE__ */ d("span", { children: e.label }), /* @__PURE__ */ d(me, { className: "bailey-suggestion-icon" })]
|
|
1112
1115
|
}, `${e.label}-${t}`))]
|
|
1113
1116
|
}) : /* @__PURE__ */ d("div", {
|
|
1114
1117
|
className: "bailey-empty-state",
|
|
1115
|
-
children:
|
|
1118
|
+
children: L.emptyStateMessage
|
|
1116
1119
|
})),
|
|
1117
|
-
|
|
1118
|
-
let n = e.role === "assistant" && t ===
|
|
1120
|
+
w.map((e, t) => {
|
|
1121
|
+
let n = e.role === "assistant" && t === w.length - 1, r = D === "streaming" && n && e.content === "", i = e.role === "assistant" && !r ? de(T, e.createdAt) : [], a = i[i.length - 1];
|
|
1119
1122
|
return /* @__PURE__ */ d("div", {
|
|
1120
1123
|
className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
|
|
1121
1124
|
children: e.role === "user" ? /* @__PURE__ */ f("div", {
|
|
@@ -1124,15 +1127,15 @@ function Pe({ chat: e, placeholder: t, replyPlaceholder: n = Oe, emptyPlaceholde
|
|
|
1124
1127
|
className: "bailey-message-meta",
|
|
1125
1128
|
children: [/* @__PURE__ */ d("span", {
|
|
1126
1129
|
className: "bailey-message-meta-name",
|
|
1127
|
-
children:
|
|
1128
|
-
}), e.createdAt !== void 0 && /* @__PURE__ */ d("span", { children:
|
|
1130
|
+
children: L.youLabel
|
|
1131
|
+
}), e.createdAt !== void 0 && /* @__PURE__ */ d("span", { children: R(e.createdAt) })]
|
|
1129
1132
|
}), /* @__PURE__ */ d("div", {
|
|
1130
1133
|
className: "bailey-user-bubble",
|
|
1131
1134
|
children: e.content
|
|
1132
1135
|
})]
|
|
1133
1136
|
}) : r ? /* @__PURE__ */ d("div", {
|
|
1134
1137
|
className: "bailey-thinking-hint",
|
|
1135
|
-
children:
|
|
1138
|
+
children: H ?? L.thinkingHint
|
|
1136
1139
|
}) : /* @__PURE__ */ f("div", {
|
|
1137
1140
|
className: "bailey-assistant-message",
|
|
1138
1141
|
children: [
|
|
@@ -1140,106 +1143,102 @@ function Pe({ chat: e, placeholder: t, replyPlaceholder: n = Oe, emptyPlaceholde
|
|
|
1140
1143
|
className: "bailey-activity-line",
|
|
1141
1144
|
children: [/* @__PURE__ */ d("span", {
|
|
1142
1145
|
className: "bailey-activity-icon",
|
|
1143
|
-
children:
|
|
1146
|
+
children: m?.(a.toolName) ?? /* @__PURE__ */ d(_e, {})
|
|
1144
1147
|
}), /* @__PURE__ */ d("span", { children: a.text })]
|
|
1145
1148
|
}),
|
|
1146
|
-
/* @__PURE__ */ d(
|
|
1149
|
+
/* @__PURE__ */ d(Me, {
|
|
1147
1150
|
content: e.content,
|
|
1148
1151
|
components: ee
|
|
1149
1152
|
}),
|
|
1150
|
-
e.streaming &&
|
|
1153
|
+
e.streaming && H && /* @__PURE__ */ d("div", {
|
|
1151
1154
|
className: "bailey-streaming-hint",
|
|
1152
|
-
children:
|
|
1155
|
+
children: H
|
|
1153
1156
|
}),
|
|
1154
1157
|
!e.streaming && /* @__PURE__ */ f("div", {
|
|
1155
1158
|
className: "bailey-message-actions",
|
|
1156
1159
|
children: [/* @__PURE__ */ d(ye, {
|
|
1157
1160
|
markdown: e.content,
|
|
1158
|
-
ariaLabel:
|
|
1159
|
-
tooltipDefaultText:
|
|
1160
|
-
tooltipCopiedText:
|
|
1161
|
-
}),
|
|
1161
|
+
ariaLabel: L.copyButtonAriaLabel,
|
|
1162
|
+
tooltipDefaultText: L.copyButtonTooltipDefault,
|
|
1163
|
+
tooltipCopiedText: L.copyButtonTooltipCopied
|
|
1164
|
+
}), y?.(e)]
|
|
1162
1165
|
})
|
|
1163
1166
|
]
|
|
1164
1167
|
})
|
|
1165
1168
|
}, e.id);
|
|
1166
1169
|
}),
|
|
1167
|
-
/* @__PURE__ */ d("div", { ref:
|
|
1170
|
+
/* @__PURE__ */ d("div", { ref: z })
|
|
1168
1171
|
]
|
|
1169
1172
|
}),
|
|
1170
|
-
|
|
1171
|
-
className: "bailey-privacy-note",
|
|
1172
|
-
children: [
|
|
1173
|
-
u.text,
|
|
1174
|
-
" ",
|
|
1175
|
-
/* @__PURE__ */ d("a", {
|
|
1176
|
-
href: u.linkHref,
|
|
1177
|
-
target: "_blank",
|
|
1178
|
-
rel: "noreferrer",
|
|
1179
|
-
children: u.linkLabel
|
|
1180
|
-
})
|
|
1181
|
-
]
|
|
1182
|
-
}),
|
|
1183
|
-
D && /* @__PURE__ */ f("div", {
|
|
1173
|
+
O && /* @__PURE__ */ f("div", {
|
|
1184
1174
|
className: "bailey-error-banner",
|
|
1185
1175
|
role: "alert",
|
|
1186
|
-
children: [/* @__PURE__ */ d("span", { children:
|
|
1176
|
+
children: [/* @__PURE__ */ d("span", { children: O }), /* @__PURE__ */ f("div", {
|
|
1187
1177
|
className: "bailey-error-actions",
|
|
1188
1178
|
children: [/* @__PURE__ */ d("button", {
|
|
1189
1179
|
type: "button",
|
|
1190
|
-
onClick:
|
|
1180
|
+
onClick: j,
|
|
1191
1181
|
className: "bailey-retry-button",
|
|
1192
|
-
children:
|
|
1182
|
+
children: L.retryButtonText
|
|
1193
1183
|
}), /* @__PURE__ */ d("button", {
|
|
1194
1184
|
type: "button",
|
|
1195
|
-
onClick:
|
|
1196
|
-
"aria-label":
|
|
1185
|
+
onClick: N,
|
|
1186
|
+
"aria-label": L.dismissErrorAriaLabel,
|
|
1197
1187
|
className: "bailey-dismiss-button",
|
|
1198
1188
|
children: "✕"
|
|
1199
1189
|
})]
|
|
1200
1190
|
})]
|
|
1201
1191
|
}),
|
|
1202
|
-
!
|
|
1203
|
-
events:
|
|
1204
|
-
lastRequest:
|
|
1205
|
-
onClear:
|
|
1192
|
+
!v && /* @__PURE__ */ d(Ee, {
|
|
1193
|
+
events: T,
|
|
1194
|
+
lastRequest: E,
|
|
1195
|
+
onClear: M
|
|
1206
1196
|
}),
|
|
1207
1197
|
/* @__PURE__ */ f("form", {
|
|
1208
1198
|
onSubmit: (e) => {
|
|
1209
|
-
e.preventDefault(), !(!
|
|
1199
|
+
e.preventDefault(), !(!F.trim() || D === "streaming") && (G(F), I(""));
|
|
1210
1200
|
},
|
|
1211
1201
|
className: "bailey-input-row",
|
|
1212
1202
|
children: [/* @__PURE__ */ d("input", {
|
|
1213
1203
|
type: "text",
|
|
1214
|
-
placeholder:
|
|
1215
|
-
"aria-label":
|
|
1216
|
-
value:
|
|
1217
|
-
onChange: (e) =>
|
|
1218
|
-
disabled:
|
|
1204
|
+
placeholder: W,
|
|
1205
|
+
"aria-label": W,
|
|
1206
|
+
value: F,
|
|
1207
|
+
onChange: (e) => I(e.target.value),
|
|
1208
|
+
disabled: D === "streaming",
|
|
1219
1209
|
className: "bailey-input"
|
|
1220
|
-
}),
|
|
1210
|
+
}), D === "streaming" ? /* @__PURE__ */ d(l.Provider, {
|
|
1221
1211
|
delayDuration: 200,
|
|
1222
1212
|
children: /* @__PURE__ */ f(l.Root, { children: [/* @__PURE__ */ d(l.Trigger, {
|
|
1223
1213
|
asChild: !0,
|
|
1224
1214
|
children: /* @__PURE__ */ d("button", {
|
|
1225
1215
|
type: "button",
|
|
1226
|
-
onClick:
|
|
1227
|
-
"aria-label":
|
|
1216
|
+
onClick: A,
|
|
1217
|
+
"aria-label": L.stopAriaLabel,
|
|
1228
1218
|
className: "bailey-stop-button",
|
|
1229
1219
|
children: /* @__PURE__ */ d(pe, { className: "bailey-stop-icon" })
|
|
1230
1220
|
})
|
|
1231
1221
|
}), /* @__PURE__ */ d(l.Portal, { children: /* @__PURE__ */ f(l.Content, {
|
|
1232
1222
|
side: "top",
|
|
1233
1223
|
className: "bailey-tooltip-content",
|
|
1234
|
-
children: [
|
|
1224
|
+
children: [L.stopButtonText, /* @__PURE__ */ d(l.Arrow, { className: "bailey-tooltip-arrow" })]
|
|
1235
1225
|
}) })] })
|
|
1236
1226
|
}) : /* @__PURE__ */ d("button", {
|
|
1237
1227
|
type: "submit",
|
|
1238
|
-
"aria-label":
|
|
1239
|
-
disabled: !
|
|
1228
|
+
"aria-label": L.sendAriaLabel,
|
|
1229
|
+
disabled: !F.trim(),
|
|
1240
1230
|
className: "bailey-send-button",
|
|
1241
1231
|
children: /* @__PURE__ */ d(fe, { className: "bailey-send-icon" })
|
|
1242
1232
|
})]
|
|
1233
|
+
}),
|
|
1234
|
+
(U || p?.alwaysVisible) && p && /* @__PURE__ */ d("div", {
|
|
1235
|
+
className: "bailey-privacy-note",
|
|
1236
|
+
children: /* @__PURE__ */ d(s, {
|
|
1237
|
+
remarkPlugins: Ae,
|
|
1238
|
+
components: je,
|
|
1239
|
+
skipHtml: !0,
|
|
1240
|
+
children: p.markdown
|
|
1241
|
+
})
|
|
1243
1242
|
})
|
|
1244
1243
|
]
|
|
1245
1244
|
})
|
|
@@ -1247,6 +1246,6 @@ function Pe({ chat: e, placeholder: t, replyPlaceholder: n = Oe, emptyPlaceholde
|
|
|
1247
1246
|
}
|
|
1248
1247
|
//#endregion
|
|
1249
1248
|
//#region src/index.ts
|
|
1250
|
-
var
|
|
1249
|
+
var Ie = "0.3.1-pre.2";
|
|
1251
1250
|
//#endregion
|
|
1252
|
-
export { _e as ActivityIcon, me as ArrowUpRightIcon,
|
|
1251
|
+
export { _e as ActivityIcon, me as ArrowUpRightIcon, Ie as BAILEYAI_CHAT_UI_VERSION, B as BAILEY_CHART_PROMPT_FRAGMENT, M as BAILEY_TABLE_GRID_ROW_THRESHOLD, Fe as BaileyChatPanel, Ee as BaileyTracePanel, ye as CopyMarkdownButton, fe as HeartIcon, ne as TRACE_KIND_LABEL, Z as createBaileyMarkdownComponents, b as extractPseudoToolCalls, R as extractTableData, oe as formatTraceGap, ae as formatTraceTime, ue as hasTraceFailure, e as isSafeMarkdownUrl, O as joinInstructions, te as parseBaileyChartSpec, S as parseSseFrames, j as resolveToolCall, z as shouldUseGrid, de as toActivityLines, se as toTraceRows, le as toTraceSegments, re as traceEventArgsDetail, X as traceEventHint, ie as traceEventOutputDetail, Y as traceEventRawDetail, J as traceEventSummary, q as traceEventToolName, ce as traceSummaryLine, D as useBaileyChat };
|
package/dist/index.d.ts
CHANGED
|
@@ -96,8 +96,10 @@ export declare interface BaileyChatPanelProps extends BaileyMarkdownRenderers {
|
|
|
96
96
|
* been sent. Clicking one calls chat.send(value ?? label). Omit to keep the plain
|
|
97
97
|
* "Ask Bailey a question to get started." empty state. */
|
|
98
98
|
suggestions?: BaileySuggestion[];
|
|
99
|
-
/** A short privacy/compliance note rendered
|
|
100
|
-
*
|
|
99
|
+
/** A short privacy/compliance note rendered below the input row, as the panel's bottom-most
|
|
100
|
+
* element — empty state only by default, or every state if `privacyNote.alwaysVisible` is
|
|
101
|
+
* set. No default — the exact copy/link is host-specific, so nothing is shown unless a host
|
|
102
|
+
* supplies one. */
|
|
101
103
|
privacyNote?: BaileyPrivacyNote;
|
|
102
104
|
/** Customizes the icon shown next to an inline activity line (e.g. "Checking your vitals.")
|
|
103
105
|
* based on the tool/event name — defaults to a single generic icon for every line, rather
|
|
@@ -205,9 +207,16 @@ export declare interface BaileyOutputItem {
|
|
|
205
207
|
}
|
|
206
208
|
|
|
207
209
|
export declare interface BaileyPrivacyNote {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
210
|
+
/** The note's copy, as markdown — e.g. `"Bailey may use your health data to respond. See our
|
|
211
|
+
* [privacy policy](https://example.com/privacy)."` Rendered through the same safe-link
|
|
212
|
+
* markdown pipeline as message content, but inline: paragraphs don't introduce line breaks,
|
|
213
|
+
* since this renders as a single-line footer. */
|
|
214
|
+
markdown: string;
|
|
215
|
+
/** Renders the note in every state, not just the empty state (the default). For a host
|
|
216
|
+
* where this copy is a persistent compliance requirement (e.g. a consumer-rights
|
|
217
|
+
* disclosure) rather than a first-impression nicety. Defaults to false, preserving
|
|
218
|
+
* today's behavior for every existing caller. */
|
|
219
|
+
alwaysVisible?: boolean;
|
|
211
220
|
}
|
|
212
221
|
|
|
213
222
|
export declare type BaileyStreamEvent = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icanbwell/baileyai-chat-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Shared React chat UI and streaming logic for Bailey, the icanbwell AI assistant",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"test": "vitest run",
|
|
51
51
|
"test:watch": "vitest",
|
|
52
52
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p dev/tsconfig.json --noEmit",
|
|
53
|
-
"lint": "eslint \"src/**/*.{ts,tsx}\" \"dev/**/*.{ts,tsx}\" \"vite.config.ts\" \"*.js\" \"scripts/**/*.js\""
|
|
53
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\" \"dev/**/*.{ts,tsx}\" \"vite.config.ts\" \"*.js\" \"scripts/**/*.js\"",
|
|
54
|
+
"test:container": "yarn build && cd examples/container-app && npm run pack-parent && yarn install && yarn playwright install --with-deps chromium && yarn test"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
56
57
|
"@emotion/react": "^11.0.0",
|