@icanbwell/baileyai-chat-ui 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baileyai-chat-ui.cjs +2 -2
- package/dist/baileyai-chat-ui.css +1 -1
- package/dist/baileyai-chat-ui.js +255 -230
- package/dist/index.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./safeMarkdownUrl-DsMPGzpD.cjs");let l=require("react"),u=require("react-markdown");u=s(u,1);let d=require("remark-gfm");d=s(d,1);let f=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./safeMarkdownUrl-DsMPGzpD.cjs");let l=require("react"),u=require("react-markdown");u=s(u,1);let d=require("remark-gfm");d=s(d,1);let f=require("@radix-ui/react-tooltip");f=s(f,1);let p=require("react/jsx-runtime");var m=/<(search_tools|call_tool|function_calls|function_result)>([\s\S]*?)<\/\1>/g,h=/<name>([\s\S]*?)<\/name>/,g=/<arguments>([\s\S]*?)<\/arguments>/,_=/<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g,v=/<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;function y(e){let t=h.exec(e)?.[1]?.trim()||`unknown_tool`,n=g.exec(e)?.[1]?.trim();return n?{name:t,args:n}:{name:t}}function b(e){let t=[];_.lastIndex=0;let n;for(;(n=_.exec(e))!==null;){let[,e,r]=n,i={};v.lastIndex=0;let a;for(;(a=v.exec(r))!==null;)i[a[1]]=a[2].trim();let o=e.trim()||`unknown_tool`;t.push(Object.keys(i).length>0?{name:o,args:JSON.stringify(i,null,2)}:{name:o})}return t}function x(e){let t=[],n=e.replace(m,(e,n,r)=>(n===`call_tool`?t.push(y(r)):n===`search_tools`?t.push({name:`search_tools`,args:r.trim()}):n===`function_calls`?t.push(...b(r)):t.push({name:`function_result`,args:r.trim()}),``));return t.length===0?{cleanedText:n,matches:t}:{cleanedText:n.replace(/\n{3,}/g,`
|
|
2
2
|
|
|
3
3
|
`),matches:t}}function S(e){if(!e.startsWith(`data: `))return e;let t=``;for(let n of e.split(`
|
|
4
4
|
`)){if(!n.startsWith(`data: `))continue;let e=n.slice(6);if(e===`[DONE]`)break;try{let n=JSON.parse(e);n?.type===`response.output_text.delta`&&n.delta&&(t+=n.delta)}catch{}}return t||null}function C(e){let t=e.replace(/\r\n/g,`
|
|
@@ -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=(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},D=({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 D=(0,l.useRef)([]),O=(0,l.useRef)(new Map),k=(0,l.useRef)(new Map),A=(0,l.useRef)(null),j=(0,l.useCallback)(()=>{A.current!==null&&(clearTimeout(A.current),A.current=null)},[]),M=(0,l.useCallback)(e=>{j(),A.current=setTimeout(()=>{e.abort(new DOMException(`The assistant took too long to respond. Please try again.`,`TimeoutError`))},s)},[j,s]),N=(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=O.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,O.current.set(e,n),k.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)},[]),P=(0,l.useCallback)(async s=>{g(`streaming`),v(null);let c=Date.now();S.current=c;let l=crypto.randomUUID(),d={id:l,role:`assistant`,content:``,streaming:!0,createdAt:c};u(e=>[...e,d]),D.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=_,M(_);let b=``,x=null,w=!1,T=!1,A=[],P=(e,t)=>{g(`error`),v(e);let n={kind:`error`,message:e,at:Date.now(),turnSentAt:c,...t};A.push(n),f(e=>[...e,n])},F=(e,t)=>{e.forEach(e=>{if(e.type===`error`){x=e.message;let t={kind:`error`,message:e.message,at:Date.now(),turnSentAt:c};A.push(t),f(e=>[...e,t]);return}e.type===`response.output_text.delta`&&e.delta&&(T=!0),N(l,e,A)&&(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=>{M(_),b+=e;let{events:t,remainder:n,done:r}=C(b);b=n,F(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=``,F(e,t)}if(x){g(`error`),v(x);return}if(a===void 0||a>=400){P(E(a,s,u),{httpStatus:a,rawBody:s||void 0});return}if(!w){P(`Bailey returned an empty response.`);return}if(!T){P(`Bailey ran some tools but didn't return an answer. Try asking again.`);return}g(`idle`);let d=k.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},A)}catch(e){let t=e;if(t?.name===`TimeoutError`){P(t.message,{source:`client-timeout`});return}if(t?.name===`AbortError`){g(`idle`);return}P(t?.message||`Bailey request failed.`)}finally{j();let e=k.current.get(l)??``;O.current.delete(l),k.current.delete(l),u(e=>e.flatMap(e=>e.id===l?e.content?[{...e,streaming:!1}]:[]:[e])),D.current=D.current.flatMap(t=>t.id===l?e?[{...t,content:e,streaming:!1}]:[]:[t])}},[e,t,n,r,i,a,o,N,M,j]),F=(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:crypto.randomUUID(),role:`user`,content:t,createdAt:Date.now()},r=[...D.current,n];D.current=r,F([...w.current,n]),P(r)},[P,F]),sendHidden:(0,l.useCallback)(e=>{if(h===`streaming`)return;let t=e.trim();if(!t)return;b.current=t;let n={id:crypto.randomUUID(),role:`user`,content:t,createdAt:Date.now(),hidden:!0},r=[...D.current,n];D.current=r,P(r)},[P,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;F(n);let r=D.current,i=r[r.length-1],a=i&&i.role===`assistant`?r.slice(0,-1):r;D.current=a,P(a)},[P,F,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(),F([]),D.current=[],f([]),m(null),g(`idle`),v(null),b.current=``},[F])}};function O(...e){return e.filter(e=>!!(e&&e.trim())).join(`
|
|
10
10
|
|
|
11
|
-
`)}var k=`call_tool`,A=`a tool`;function j(e,t){let n={name:e===k?A: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===k){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 M=5,N=e=>e.type===`text`?e.value??``:(e.children??[]).map(N).join(``),P=e=>{if(e.tagName===`a`&&e.properties?.href)return e.properties.href;for(let t of e.children??[]){let e=P(t);if(e)return e}},F=(e,t)=>(e.children??[]).find(e=>e.tagName===t),I=e=>{let t=N(e),n=P(e);return n?{text:t,href:n}:{text:t}},L=e=>(e.children??[]).filter(e=>e.type===`element`).map(I),R=e=>{if(e.tagName!==`table`)return null;let t=F(e,`thead`),n=t&&F(t,`tr`);return{headers:n?L(n).map(e=>e.text):[],rows:(F(e,`tbody`)?.children??[]).filter(e=>e.tagName===`tr`).map(L)}},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```',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`,V=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}}},H={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:j(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 ${j(e.name,e.args).name}...`;case`tool_end`:{let t=j(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 X(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 oe(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 se(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:X(t.at),gapMs:t.at-i,label:t.kind===`tool_end`&&t.isError===!0?`Tool failed`:H[t.kind],summary:G(t,r),argsDetail:K(t,r),outputDetail:q(t),rawDetail:J(t)}})}function ce(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 le(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 ue(e){return e.some(e=>e.kind===`tool_end`&&e.isError||e.kind===`error`)}function de(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 fe({renderTable:e,renderChart:t}={}){return{a:({href:e,children:t})=>!e||!c.t(e)?(0,f.jsx)(f.Fragment,{children:t}):(0,f.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({node:t,children:n})=>{let r=t&&R(t);if(r&&z(r.rows)&&e){let t=r.rows.map(e=>e.map(e=>e.href&&!c.t(e.href)?{text:e.text}:e));return(0,f.jsx)(f.Fragment,{children:e({headers:r.headers,rows:t})})}return(0,f.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=V(Array.isArray(e)?e.join(``):String(e??``));if(r)return(0,f.jsx)(f.Fragment,{children:t(r)})}return(0,f.jsx)(`pre`,{children:e})}}}function pe({className:e}){return(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,f.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 me({className:e}){return(0,f.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,f.jsx)(`path`,{d:`M7 17 17 7`}),(0,f.jsx)(`path`,{d:`M9 7h8v8`})]})}function he({className:e}){return(0,f.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,f.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,f.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]})}function ge({className:e}){return(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M5 12.5 9.5 17 19 7`})})}function _e({className:e}){return(0,f.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,f.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,f.jsx)(`path`,{d:`M8.5 12.5 11 15l4.5-5.5`})]})}var ve=1500;function ye({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,f.jsx)(p.Provider,{delayDuration:200,children:(0,f.jsxs)(p.Root,{open:a||s,onOpenChange:c,children:[(0,f.jsx)(p.Trigger,{asChild:!0,children:(0,f.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(e)}catch{}o(!0),u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>o(!1),ve)},"aria-label":n,className:`bailey-copy-button${t?` ${t}`:``}`,children:a?(0,f.jsx)(ge,{className:`bailey-copy-icon`}):(0,f.jsx)(he,{className:`bailey-copy-icon`})})}),(0,f.jsx)(p.Portal,{children:(0,f.jsxs)(p.Content,{side:`top`,className:`bailey-tooltip-content`,children:[a?i:r,(0,f.jsx)(p.Arrow,{className:`bailey-tooltip-arrow`})]})})]})})}async function be(e){try{await navigator.clipboard.writeText(e)}catch{}}function xe({text:e,label:t=`Copy`}){return(0,f.jsx)(`button`,{type:`button`,onClick:()=>be(e),className:`bailey-trace-copy-button`,children:t})}function Se(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,f.jsxs)(`details`,{className:`bailey-trace-disclosure`,children:[(0,f.jsx)(`summary`,{className:`bailey-trace-disclosure-summary`,children:e}),n&&(0,f.jsx)(`div`,{className:`bailey-trace-disclosure-actions`,children:(0,f.jsx)(xe,{text:t})}),(0,f.jsx)(`pre`,{className:`bailey-trace-disclosure-content`,children:t})]})}function Q({row:e}){return(0,f.jsxs)(`div`,{className:`bailey-trace-row`,children:[(0,f.jsxs)(`div`,{className:`bailey-trace-row-header`,children:[(0,f.jsx)(`span`,{className:`bailey-trace-row-time`,children:e.time}),(0,f.jsx)(`span`,{className:`bailey-trace-row-gap`,title:`Time since the previous event`,children:oe(e.gapMs)}),(0,f.jsx)(`span`,{className:Se(e),children:e.label}),(0,f.jsx)(`span`,{className:`bailey-trace-row-summary`,children:e.summary})]}),e.argsDetail&&(0,f.jsx)(Z,{label:`args`,content:e.argsDetail}),e.outputDetail&&(0,f.jsx)(Z,{label:`output`,content:e.outputDetail}),e.rawDetail&&(0,f.jsx)(Z,{label:`raw`,content:e.rawDetail})]})}function Ce(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 we({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,f.jsxs)(`div`,{className:`bailey-trace-request-details`,children:[(0,f.jsxs)(`span`,{className:`bailey-trace-request-meta`,children:[`Last request — `,e.model,` · `,new Date(e.sentAt).toLocaleTimeString(),e.requestId?` · ${e.requestId}`:``]}),(0,f.jsx)(`span`,{className:`bailey-trace-request-meta`,children:Ce(e.streamStats,e.sentAt)}),(0,f.jsx)(Z,{label:`System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,content:e.systemPrompt,copyable:!0}),(0,f.jsx)(Z,{label:`Messages (${e.messages.length})`,content:JSON.stringify(e.messages,null,2),copyable:!0}),e.response&&(0,f.jsx)(Z,{label:`Response (${e.response.content.length.toLocaleString()} chars)`,content:e.response.content,copyable:!0}),(0,f.jsx)(Z,{label:`Full payload (JSON)`,content:t,copyable:!0})]})}function Te({events:e,lastRequest:t,onClear:n}){let r=(0,l.useMemo)(()=>se(e),[e]),i=(0,l.useMemo)(()=>le(r),[r]),a=(0,l.useMemo)(()=>JSON.stringify(e,null,2),[e]);return(0,f.jsxs)(`div`,{className:`bailey-trace-body`,children:[(0,f.jsxs)(`div`,{className:`bailey-trace-actions-row`,children:[e.length>0&&(0,f.jsx)(xe,{text:a,label:`Copy trace as JSON`}),(0,f.jsx)(`button`,{type:`button`,onClick:n,className:`bailey-trace-copy-button`,children:`Clear`})]}),t&&(0,f.jsx)(we,{request:t}),(0,f.jsx)(`div`,{className:`bailey-trace-rows`,children:i.map((e,t)=>{if(e.type===`single`)return(0,f.jsx)(Q,{row:e.row},e.row.key);let n=e.rows.filter(e=>e.isToolStart).length;if(n<=1)return(0,f.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,f.jsx)(Q,{row:e},e.key))},`group-${t}`);let r=e.rows.filter(e=>e.failed).length;return(0,f.jsxs)(`details`,{className:`bailey-trace-group`,children:[(0,f.jsxs)(`summary`,{className:`bailey-trace-group-summary`,children:[(0,f.jsx)(`strong`,{children:e.toolName}),` × `,n,r>0&&(0,f.jsxs)(`span`,{className:`bailey-trace-group-failed`,children:[` `,r,` failed`]})]}),(0,f.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,f.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)(()=>ue(e),[e]),o=(0,l.useMemo)(()=>ce(e),[e]);return e.length===0&&!t?null:(0,f.jsxs)(`div`,{className:`bailey-trace-panel`,children:[(0,f.jsxs)(`div`,{className:`bailey-trace-toggle-row`,children:[(0,f.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,f.jsx)(`span`,{className:a?`bailey-trace-summary bailey-trace-summary-error`:`bailey-trace-summary`,children:o})]}),r&&(0,f.jsx)(Te,{events:e,lastRequest:t,onClear:n})]})}var Ee=`How can bailey AI help you today?`,De=`Reply to bailey AI`,Oe={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!`},ke=[d.default],Ae=(0,l.memo)(function({content:e,components:t}){return(0,f.jsx)(`div`,{className:`bailey-markdown-content`,children:(0,f.jsx)(u.default,{remarkPlugins:ke,components:t,skipHtml:!0,children:e})})});function je(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 Me(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 Ne({chat:e,placeholder:t,replyPlaceholder:n=De,emptyPlaceholder:r,suggestions:i,privacyNote:a,resolveActivityIcon:o,className:s,height:c,width:u,hideDeveloperDetails:d=!1,renderMessageActions:p,renderTable:m,renderChart:h,labels:g,formatMessageTime:_}){let{messages:v,traceEvents:y,lastRequest:b,status:x,error:S,send:C,stop:w,retryLast:T,clearTrace:E,clearError:D,newChat:O}=e,[k,A]=(0,l.useState)(``),j={...Oe,...g},M=_??Me,N=(0,l.useRef)(null),P=(0,l.useRef)(null),F=(0,l.useRef)(!0),I=(0,l.useMemo)(()=>fe({renderTable:m,renderChart:h}),[m,h]),L=(0,l.useMemo)(()=>je(x,y,b),[x,y,b]),R=v.length===0,z=t??(R?r??Ee:n);(0,l.useEffect)(()=>{let e=P.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight;F.current=t<60};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),(0,l.useEffect)(()=>{F.current&&N.current?.scrollIntoView({behavior:x===`streaming`?`auto`:`smooth`,block:`nearest`})},[v,x]);let B=e=>{F.current=!0,C(e)};return(0,f.jsx)(`div`,{className:`bailey-chat-panel${s?` ${s}`:``}`,style:c!==void 0||u!==void 0?{height:c,width:u}:void 0,children:(0,f.jsxs)(`div`,{className:`bailey-chat-panel-inner`,children:[(0,f.jsx)(`div`,{className:`bailey-toolbar-row`,children:(0,f.jsx)(`button`,{type:`button`,onClick:O,disabled:v.length===0,"aria-label":j.newChatAriaLabel,className:`bailey-new-chat-button`,children:j.newChatButtonText})}),(0,f.jsxs)(`div`,{className:`bailey-chat-transcript`,ref:P,children:[R&&(i&&i.length>0?(0,f.jsxs)(`div`,{className:`bailey-suggestions`,children:[(0,f.jsx)(`div`,{className:`bailey-suggestions-title`,children:j.suggestionsTitle}),i.map((e,t)=>(0,f.jsxs)(`button`,{type:`button`,onClick:()=>B(e.value??e.label),className:`bailey-suggestion-card`,children:[(0,f.jsx)(`span`,{children:e.label}),(0,f.jsx)(me,{className:`bailey-suggestion-icon`})]},`${e.label}-${t}`))]}):(0,f.jsx)(`div`,{className:`bailey-empty-state`,children:j.emptyStateMessage})),v.map((e,t)=>{let n=e.role===`assistant`&&t===v.length-1,r=x===`streaming`&&n&&e.content===``,i=e.role===`assistant`&&!r?de(y,e.createdAt):[],a=i[i.length-1];return(0,f.jsx)(`div`,{className:e.role===`user`?`bailey-message-row bailey-message-row-user`:`bailey-message-row`,children:e.role===`user`?(0,f.jsxs)(`div`,{className:`bailey-user-message`,children:[(0,f.jsxs)(`div`,{className:`bailey-message-meta`,children:[(0,f.jsx)(`span`,{className:`bailey-message-meta-name`,children:j.youLabel}),e.createdAt!==void 0&&(0,f.jsx)(`span`,{children:M(e.createdAt)})]}),(0,f.jsx)(`div`,{className:`bailey-user-bubble`,children:e.content})]}):r?(0,f.jsx)(`div`,{className:`bailey-thinking-hint`,children:L??j.thinkingHint}):(0,f.jsxs)(`div`,{className:`bailey-assistant-message`,children:[a&&(0,f.jsxs)(`div`,{className:`bailey-activity-line`,children:[(0,f.jsx)(`span`,{className:`bailey-activity-icon`,children:o?.(a.toolName)??(0,f.jsx)(_e,{})}),(0,f.jsx)(`span`,{children:a.text})]}),(0,f.jsx)(Ae,{content:e.content,components:I}),e.streaming&&L&&(0,f.jsx)(`div`,{className:`bailey-streaming-hint`,children:L}),!e.streaming&&(0,f.jsxs)(`div`,{className:`bailey-message-actions`,children:[(0,f.jsx)(ye,{markdown:e.content,ariaLabel:j.copyButtonAriaLabel,tooltipDefaultText:j.copyButtonTooltipDefault,tooltipCopiedText:j.copyButtonTooltipCopied}),p?.(e)]})]})},e.id)}),(0,f.jsx)(`div`,{ref:N})]}),R&&a&&(0,f.jsxs)(`div`,{className:`bailey-privacy-note`,children:[a.text,` `,(0,f.jsx)(`a`,{href:a.linkHref,target:`_blank`,rel:`noreferrer`,children:a.linkLabel})]}),S&&(0,f.jsxs)(`div`,{className:`bailey-error-banner`,role:`alert`,children:[(0,f.jsx)(`span`,{children:S}),(0,f.jsxs)(`div`,{className:`bailey-error-actions`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:T,className:`bailey-retry-button`,children:j.retryButtonText}),(0,f.jsx)(`button`,{type:`button`,onClick:D,"aria-label":j.dismissErrorAriaLabel,className:`bailey-dismiss-button`,children:`✕`})]})]}),!d&&(0,f.jsx)($,{events:y,lastRequest:b,onClear:E}),(0,f.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!(!k.trim()||x===`streaming`)&&(B(k),A(``))},className:`bailey-input-row`,children:[(0,f.jsx)(`input`,{type:`text`,placeholder:z,"aria-label":z,value:k,onChange:e=>A(e.target.value),disabled:x===`streaming`,className:`bailey-input`}),x===`streaming`?(0,f.jsx)(`button`,{type:`button`,onClick:w,"aria-label":j.stopAriaLabel,className:`bailey-stop-button`,children:j.stopButtonText}):(0,f.jsx)(`button`,{type:`submit`,"aria-label":j.sendAriaLabel,disabled:!k.trim(),className:`bailey-send-button`,children:(0,f.jsx)(pe,{className:`bailey-send-icon`})})]})]})})}var Pe=`0.3.1-pre.2`;exports.ActivityIcon=_e,exports.ArrowUpRightIcon=me,exports.BAILEYAI_CHAT_UI_VERSION=Pe,exports.BAILEY_CHART_PROMPT_FRAGMENT=B,exports.BAILEY_TABLE_GRID_ROW_THRESHOLD=M,exports.BaileyChatPanel=Ne,exports.BaileyTracePanel=$,exports.CopyMarkdownButton=ye,exports.HeartIcon=pe,exports.TRACE_KIND_LABEL=H,exports.createBaileyMarkdownComponents=fe,exports.extractPseudoToolCalls=x,exports.extractTableData=R,exports.formatTraceGap=oe,exports.formatTraceTime=X,exports.hasTraceFailure=ue,exports.isSafeMarkdownUrl=c.t,exports.joinInstructions=O,exports.parseBaileyChartSpec=V,exports.parseSseFrames=C,exports.resolveToolCall=j,exports.shouldUseGrid=z,exports.toActivityLines=de,exports.toTraceRows=se,exports.toTraceSegments=le,exports.traceEventArgsDetail=K,exports.traceEventHint=Y,exports.traceEventOutputDetail=q,exports.traceEventRawDetail=J,exports.traceEventSummary=G,exports.traceEventToolName=W,exports.traceSummaryLine=ce,exports.useBaileyChat=D;
|
|
11
|
+
`)}var k=`call_tool`,A=`a tool`;function j(e,t){let n={name:e===k?A: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===k){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 M=5,N=e=>e.type===`text`?e.value??``:(e.children??[]).map(N).join(``),P=e=>{if(e.tagName===`a`&&e.properties?.href)return e.properties.href;for(let t of e.children??[]){let e=P(t);if(e)return e}},F=(e,t)=>(e.children??[]).find(e=>e.tagName===t),I=e=>{let t=N(e),n=P(e);return n?{text:t,href:n}:{text:t}},L=e=>(e.children??[]).filter(e=>e.type===`element`).map(I),R=e=>{if(e.tagName!==`table`)return null;let t=F(e,`thead`),n=t&&F(t,`tr`);return{headers:n?L(n).map(e=>e.text):[],rows:(F(e,`tbody`)?.children??[]).filter(e=>e.tagName===`tr`).map(L)}},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=[`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`||!V.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}}},H={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:j(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 ${j(e.name,e.args).name}...`;case`tool_end`:{let t=j(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 X(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 Z(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 oe(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:X(t.at),gapMs:t.at-i,label:t.kind===`tool_end`&&t.isError===!0?`Tool failed`:H[t.kind],summary:G(t,r),argsDetail:K(t,r),outputDetail:q(t),rawDetail:J(t)}})}function se(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 ce(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 le(e){return e.some(e=>e.kind===`tool_end`&&e.isError||e.kind===`error`)}function ue(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 de({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&&R(t);if(r&&z(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 fe({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 pe({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 me({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 he({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 ge({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 _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)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,p.jsx)(`path`,{d:`M8.5 12.5 11 15l4.5-5.5`})]})}var ve=1500;function ye({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{}o(!0),u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>o(!1),ve)},"aria-label":n,className:`bailey-copy-button${t?` ${t}`:``}`,children:a?(0,p.jsx)(ge,{className:`bailey-copy-icon`}):(0,p.jsx)(he,{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 be(e){try{await navigator.clipboard.writeText(e)}catch{}}function xe({text:e,label:t=`Copy`}){return(0,p.jsx)(`button`,{type:`button`,onClick:()=>be(e),className:`bailey-trace-copy-button`,children:t})}function Se(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 Q({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)(xe,{text:t})}),(0,p.jsx)(`pre`,{className:`bailey-trace-disclosure-content`,children:t})]})}function $({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:Z(e.gapMs)}),(0,p.jsx)(`span`,{className:Se(e),children:e.label}),(0,p.jsx)(`span`,{className:`bailey-trace-row-summary`,children:e.summary})]}),e.argsDetail&&(0,p.jsx)(Q,{label:`args`,content:e.argsDetail}),e.outputDetail&&(0,p.jsx)(Q,{label:`output`,content:e.outputDetail}),e.rawDetail&&(0,p.jsx)(Q,{label:`raw`,content:e.rawDetail})]})}function Ce(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 we({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:Ce(e.streamStats,e.sentAt)}),(0,p.jsx)(Q,{label:`System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,content:e.systemPrompt,copyable:!0}),(0,p.jsx)(Q,{label:`Messages (${e.messages.length})`,content:JSON.stringify(e.messages,null,2),copyable:!0}),e.response&&(0,p.jsx)(Q,{label:`Response (${e.response.content.length.toLocaleString()} chars)`,content:e.response.content,copyable:!0}),(0,p.jsx)(Q,{label:`Full payload (JSON)`,content:t,copyable:!0})]})}function Te({events:e,lastRequest:t,onClear:n}){let r=(0,l.useMemo)(()=>oe(e),[e]),i=(0,l.useMemo)(()=>ce(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)(xe,{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)(we,{request:t}),(0,p.jsx)(`div`,{className:`bailey-trace-rows`,children:i.map((e,t)=>{if(e.type===`single`)return(0,p.jsx)($,{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)($,{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)($,{row:e},e.key))})]},`group-${t}`)})})]})}function Ee({events:e,lastRequest:t,onClear:n}){let[r,i]=(0,l.useState)(!1),a=(0,l.useMemo)(()=>le(e),[e]),o=(0,l.useMemo)(()=>se(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)(Te,{events:e,lastRequest:t,onClear:n})]})}var De=`How can bailey AI help you today?`,Oe=`Reply to bailey AI`,ke={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!`},Ae=[d.default],je=(0,l.memo)(function({content:e,components:t}){return(0,p.jsx)(`div`,{className:`bailey-markdown-content`,children:(0,p.jsx)(u.default,{remarkPlugins:Ae,components:t,skipHtml:!0,children:e})})});function Me(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 Ne(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 Pe({chat:e,placeholder:t,replyPlaceholder:n=Oe,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={...ke,..._},N=v??Ne,P=(0,l.useRef)(null),F=(0,l.useRef)(null),I=(0,l.useRef)(!0),L=(0,l.useMemo)(()=>de({renderTable:h,renderChart:g}),[h,g]),R=(0,l.useMemo)(()=>Me(S,b,x),[S,b,x]),z=y.length===0,B=t??(z?r??De: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)(me,{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?ue(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)(_e,{})}),(0,p.jsx)(`span`,{children:a.text})]}),(0,p.jsx)(je,{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)(ye,{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)(Ee,{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)(pe,{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)(fe,{className:`bailey-send-icon`})})]})]})})}var Fe=`0.3.1-pre.2`;exports.ActivityIcon=_e,exports.ArrowUpRightIcon=me,exports.BAILEYAI_CHAT_UI_VERSION=Fe,exports.BAILEY_CHART_PROMPT_FRAGMENT=B,exports.BAILEY_TABLE_GRID_ROW_THRESHOLD=M,exports.BaileyChatPanel=Pe,exports.BaileyTracePanel=Ee,exports.CopyMarkdownButton=ye,exports.HeartIcon=fe,exports.TRACE_KIND_LABEL=H,exports.createBaileyMarkdownComponents=de,exports.extractPseudoToolCalls=x,exports.extractTableData=R,exports.formatTraceGap=Z,exports.formatTraceTime=X,exports.hasTraceFailure=le,exports.isSafeMarkdownUrl=c.t,exports.joinInstructions=O,exports.parseBaileyChartSpec=ae,exports.parseSseFrames=C,exports.resolveToolCall=j,exports.shouldUseGrid=z,exports.toActivityLines=ue,exports.toTraceRows=oe,exports.toTraceSegments=ce,exports.traceEventArgsDetail=K,exports.traceEventHint=Y,exports.traceEventOutputDetail=q,exports.traceEventRawDetail=J,exports.traceEventSummary=G,exports.traceEventToolName=W,exports.traceSummaryLine=se,exports.useBaileyChat=D;
|
|
@@ -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-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-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-leading:initial;--tw-space-y-reverse:0}}}@layer theme{:root,:host{--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-50:oklch(98.5% .002 247.839);--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;--color-white:#fff;--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{.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.static{position:static}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.my-2{margin-block:calc(var(--spacing) * 2)}.my-3{margin-block:calc(var(--spacing) * 3)}.mt-1{margin-top:var(--spacing)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.ml-1{margin-left:var(--spacing)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.table-cell{display:table-cell}.h-\[600px\]{height:600px}.h-full{height:100%}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-80{max-height:calc(var(--spacing) * 80)}.min-h-0{min-height:0}.w-full{width:100%}.max-w-\[75\%\]{max-width:75%}.flex-1{flex:1}.border-collapse{border-collapse:collapse}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-bailey-border{border-color:var(--color-bailey-border)}.border-bailey-error{border-color:var(--color-bailey-error)}.border-gray-200{border-color:var(--color-gray-200)}.bg-bailey-accent{background-color:var(--color-bailey-accent)}.bg-bailey-bubble-bg{background-color:var(--color-bailey-bubble-bg)}.bg-bailey-surface-muted{background-color:var(--color-bailey-surface-muted)}.bg-bailey-tooltip-bg{background-color:var(--color-bailey-tooltip-bg)}.bg-black{background-color:var(--color-black)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-green-100{background-color:var(--color-green-100)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-100{background-color:var(--color-red-100)}.fill-black{fill:var(--color-black)}.p-0{padding:0}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.px-1{padding-inline:var(--spacing)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0{padding-block:0}.py-1{padding-block:var(--spacing)}.py-2{padding-block:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.65rem\]{font-size:.65rem}.text-\[0\.85em\]{font-size:.85em}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.break-all{word-break:break-all}.whitespace-pre-wrap{white-space:pre-wrap}.text-bailey-accent{color:var(--color-bailey-accent)}.text-bailey-error{color:var(--color-bailey-error)}.text-bailey-text-secondary{color:var(--color-bailey-text-secondary)}.text-bailey-tooltip-text{color:var(--color-bailey-tooltip-text)}.text-black{color:var(--color-black)}.text-blue-700{color:var(--color-blue-700)}.text-gray-400{color:var(--color-gray-400)}.text-green-700{color:var(--color-green-700)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}@media (hover:hover){.hover\:text-bailey-text:hover{color:var(--color-bailey-text)}.hover\:text-black:hover{color:var(--color-black)}}}.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)}.bailey-chat-panel-inner{width:100%;height:100%;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;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{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);--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-error)}.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{background-color:var(--color-bailey-tooltip-bg);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));color:var(--color-bailey-tooltip-text);border-radius:.25rem}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg)}.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-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-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-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)}.bailey-chat-panel-inner{width:100%;height:100%;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;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}
|
|
3
3
|
/*$vite$:1*/
|
package/dist/baileyai-chat-ui.js
CHANGED
|
@@ -2,8 +2,8 @@ import { t as e } from "./safeMarkdownUrl-xI42YYzd.js";
|
|
|
2
2
|
import { memo as t, useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
3
3
|
import s from "react-markdown";
|
|
4
4
|
import c from "remark-gfm";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import * as l from "@radix-ui/react-tooltip";
|
|
6
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
7
|
//#region src/utils/pseudoToolCalls.ts
|
|
8
8
|
var p = /<(search_tools|call_tool|function_calls|function_result)>([\s\S]*?)<\/\1>/g, m = /<name>([\s\S]*?)<\/name>/, h = /<arguments>([\s\S]*?)<\/arguments>/, g = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, _ = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
|
|
9
9
|
function v(e) {
|
|
@@ -467,13 +467,13 @@ var j = 5, M = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
467
467
|
headers: n ? I(n).map((e) => e.text) : [],
|
|
468
468
|
rows: (P(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(I)
|
|
469
469
|
};
|
|
470
|
-
}, R = (e) => e.length > 5, z = "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```",
|
|
470
|
+
}, R = (e) => e.length > 5, z = "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```", B = [
|
|
471
471
|
"bar",
|
|
472
472
|
"line",
|
|
473
473
|
"pie",
|
|
474
474
|
"doughnut",
|
|
475
475
|
"scatter"
|
|
476
|
-
],
|
|
476
|
+
], V = 8, H = 50, U = 8, W = 500, G = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", ee = (e) => {
|
|
477
477
|
let t;
|
|
478
478
|
try {
|
|
479
479
|
t = JSON.parse(e);
|
|
@@ -482,17 +482,17 @@ var j = 5, M = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
482
482
|
}
|
|
483
483
|
if (typeof t != "object" || !t) return null;
|
|
484
484
|
let n = t;
|
|
485
|
-
if (typeof n.type != "string" || !
|
|
485
|
+
if (typeof n.type != "string" || !B.includes(n.type)) return null;
|
|
486
486
|
let r = n.type;
|
|
487
487
|
if (n.title !== void 0 && typeof n.title != "string") return null;
|
|
488
488
|
let i = n.title;
|
|
489
489
|
if (typeof n.data != "object" || n.data === null) return null;
|
|
490
490
|
let a = n.data;
|
|
491
|
-
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length >
|
|
491
|
+
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > V || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
|
|
492
492
|
for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
|
|
493
493
|
let o = a.datasets;
|
|
494
494
|
if (r === "scatter") {
|
|
495
|
-
for (let e of o) if (e.data.length < 1 || e.data.length >
|
|
495
|
+
for (let e of o) if (e.data.length < 1 || e.data.length > W || !e.data.every(G)) return null;
|
|
496
496
|
return {
|
|
497
497
|
type: r,
|
|
498
498
|
title: i,
|
|
@@ -500,7 +500,7 @@ var j = 5, M = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
500
500
|
};
|
|
501
501
|
}
|
|
502
502
|
if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
|
|
503
|
-
let s = a.labels, c = r === "pie" || r === "doughnut" ?
|
|
503
|
+
let s = a.labels, c = r === "pie" || r === "doughnut" ? U : H;
|
|
504
504
|
if (s.length < 1 || s.length > c) return null;
|
|
505
505
|
for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
|
|
506
506
|
return {
|
|
@@ -511,7 +511,7 @@ var j = 5, M = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
511
511
|
datasets: o
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
|
-
},
|
|
514
|
+
}, te = {
|
|
515
515
|
tool_start: "Tool start",
|
|
516
516
|
tool_end: "Tool end",
|
|
517
517
|
pseudo_tool_call: "Narrated tool call",
|
|
@@ -526,7 +526,7 @@ function K(e) {
|
|
|
526
526
|
function q(e, t = K(e)) {
|
|
527
527
|
return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function ne(e, t = K(e)) {
|
|
530
530
|
switch (e.kind) {
|
|
531
531
|
case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
|
|
532
532
|
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" : ""}`;
|
|
@@ -537,16 +537,16 @@ function J(e, t = K(e)) {
|
|
|
537
537
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function re(e, t = K(e)) {
|
|
541
541
|
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;
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function J(e) {
|
|
544
544
|
return e.kind === "tool_end" ? e.output ?? null : null;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Y(e) {
|
|
547
547
|
return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function X(e) {
|
|
550
550
|
switch (e.kind) {
|
|
551
551
|
case "tool_start": return `Calling ${A(e.name, e.args).name}...`;
|
|
552
552
|
case "tool_end": {
|
|
@@ -560,11 +560,11 @@ function Z(e) {
|
|
|
560
560
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function ie(e) {
|
|
564
564
|
let t = new Date(e);
|
|
565
565
|
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")}`;
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function ae(e) {
|
|
568
568
|
if (e <= 0) return "+0ms";
|
|
569
569
|
if (e < 1e3) return `+${Math.round(e)}ms`;
|
|
570
570
|
let t = e / 1e3;
|
|
@@ -572,7 +572,7 @@ function ie(e) {
|
|
|
572
572
|
let n = Math.floor(t / 60), r = Math.round(t % 60);
|
|
573
573
|
return `+${n}m${String(r).padStart(2, "0")}s`;
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function oe(e) {
|
|
576
576
|
return e.map((t, n) => {
|
|
577
577
|
let r = K(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
|
|
578
578
|
return {
|
|
@@ -581,21 +581,21 @@ function ae(e) {
|
|
|
581
581
|
toolName: q(t, r),
|
|
582
582
|
isToolStart: t.kind === "tool_start",
|
|
583
583
|
failed: t.kind === "tool_end" && t.isError === !0,
|
|
584
|
-
time:
|
|
584
|
+
time: ie(t.at),
|
|
585
585
|
gapMs: t.at - i,
|
|
586
|
-
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" :
|
|
587
|
-
summary:
|
|
588
|
-
argsDetail:
|
|
589
|
-
outputDetail:
|
|
590
|
-
rawDetail:
|
|
586
|
+
label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : te[t.kind],
|
|
587
|
+
summary: ne(t, r),
|
|
588
|
+
argsDetail: re(t, r),
|
|
589
|
+
outputDetail: J(t),
|
|
590
|
+
rawDetail: Y(t)
|
|
591
591
|
};
|
|
592
592
|
});
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function se(e) {
|
|
595
595
|
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 = [];
|
|
596
596
|
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(" · ");
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function ce(e) {
|
|
599
599
|
let t = [];
|
|
600
600
|
for (let n of e) {
|
|
601
601
|
let e = t[t.length - 1];
|
|
@@ -614,21 +614,21 @@ function se(e) {
|
|
|
614
614
|
}
|
|
615
615
|
return t;
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function le(e) {
|
|
618
618
|
return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function ue(e, t) {
|
|
621
621
|
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) => ({
|
|
622
622
|
key: `${e.at}-${t}`,
|
|
623
|
-
text:
|
|
623
|
+
text: X(e),
|
|
624
624
|
toolName: q(e)
|
|
625
625
|
}));
|
|
626
626
|
}
|
|
627
627
|
//#endregion
|
|
628
628
|
//#region src/ui/markdown.tsx
|
|
629
|
-
function
|
|
629
|
+
function de({ renderTable: t, renderChart: n } = {}) {
|
|
630
630
|
return {
|
|
631
|
-
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ u
|
|
631
|
+
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ d(u, { children: n }) : /* @__PURE__ */ d("a", {
|
|
632
632
|
href: t,
|
|
633
633
|
target: "_blank",
|
|
634
634
|
rel: "noopener noreferrer",
|
|
@@ -638,36 +638,51 @@ function ue({ renderTable: t, renderChart: n } = {}) {
|
|
|
638
638
|
let i = n && L(n);
|
|
639
639
|
if (i && R(i.rows) && t) {
|
|
640
640
|
let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
|
|
641
|
-
return /* @__PURE__ */ u
|
|
641
|
+
return /* @__PURE__ */ d(u, { children: t({
|
|
642
642
|
headers: i.headers,
|
|
643
643
|
rows: n
|
|
644
644
|
}) });
|
|
645
645
|
}
|
|
646
|
-
return /* @__PURE__ */
|
|
646
|
+
return /* @__PURE__ */ d("table", { children: r });
|
|
647
647
|
},
|
|
648
648
|
pre: ({ children: e }) => {
|
|
649
649
|
let t = (Array.isArray(e) ? e[0] : e)?.props;
|
|
650
650
|
if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
|
|
651
|
-
let e = t?.children, r =
|
|
652
|
-
if (r) return /* @__PURE__ */ u
|
|
651
|
+
let e = t?.children, r = ee(Array.isArray(e) ? e.join("") : String(e ?? ""));
|
|
652
|
+
if (r) return /* @__PURE__ */ d(u, { children: n(r) });
|
|
653
653
|
}
|
|
654
|
-
return /* @__PURE__ */
|
|
654
|
+
return /* @__PURE__ */ d("pre", { children: e });
|
|
655
655
|
}
|
|
656
656
|
};
|
|
657
657
|
}
|
|
658
658
|
//#endregion
|
|
659
659
|
//#region src/ui/icons.tsx
|
|
660
|
-
function
|
|
661
|
-
return /* @__PURE__ */
|
|
660
|
+
function fe({ className: e }) {
|
|
661
|
+
return /* @__PURE__ */ d("svg", {
|
|
662
662
|
viewBox: "0 0 24 24",
|
|
663
663
|
fill: "currentColor",
|
|
664
664
|
className: e,
|
|
665
665
|
"aria-hidden": "true",
|
|
666
|
-
children: /* @__PURE__ */
|
|
666
|
+
children: /* @__PURE__ */ d("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" })
|
|
667
667
|
});
|
|
668
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function pe({ className: e }) {
|
|
670
670
|
return /* @__PURE__ */ d("svg", {
|
|
671
|
+
viewBox: "0 0 24 24",
|
|
672
|
+
fill: "currentColor",
|
|
673
|
+
className: e,
|
|
674
|
+
"aria-hidden": "true",
|
|
675
|
+
children: /* @__PURE__ */ d("rect", {
|
|
676
|
+
x: "6",
|
|
677
|
+
y: "6",
|
|
678
|
+
width: "12",
|
|
679
|
+
height: "12",
|
|
680
|
+
rx: "2"
|
|
681
|
+
})
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
function Z({ className: e }) {
|
|
685
|
+
return /* @__PURE__ */ f("svg", {
|
|
671
686
|
viewBox: "0 0 24 24",
|
|
672
687
|
fill: "none",
|
|
673
688
|
stroke: "currentColor",
|
|
@@ -676,11 +691,11 @@ function fe({ className: e }) {
|
|
|
676
691
|
strokeLinejoin: "round",
|
|
677
692
|
className: e,
|
|
678
693
|
"aria-hidden": "true",
|
|
679
|
-
children: [/* @__PURE__ */
|
|
694
|
+
children: [/* @__PURE__ */ d("path", { d: "M7 17 17 7" }), /* @__PURE__ */ d("path", { d: "M9 7h8v8" })]
|
|
680
695
|
});
|
|
681
696
|
}
|
|
682
|
-
function
|
|
683
|
-
return /* @__PURE__ */
|
|
697
|
+
function me({ className: e }) {
|
|
698
|
+
return /* @__PURE__ */ f("svg", {
|
|
684
699
|
viewBox: "0 0 24 24",
|
|
685
700
|
fill: "none",
|
|
686
701
|
stroke: "currentColor",
|
|
@@ -689,17 +704,17 @@ function pe({ className: e }) {
|
|
|
689
704
|
strokeLinejoin: "round",
|
|
690
705
|
className: e,
|
|
691
706
|
"aria-hidden": "true",
|
|
692
|
-
children: [/* @__PURE__ */
|
|
707
|
+
children: [/* @__PURE__ */ d("rect", {
|
|
693
708
|
x: "8",
|
|
694
709
|
y: "8",
|
|
695
710
|
width: "12",
|
|
696
711
|
height: "12",
|
|
697
712
|
rx: "2"
|
|
698
|
-
}), /* @__PURE__ */
|
|
713
|
+
}), /* @__PURE__ */ d("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
|
|
699
714
|
});
|
|
700
715
|
}
|
|
701
|
-
function
|
|
702
|
-
return /* @__PURE__ */
|
|
716
|
+
function he({ className: e }) {
|
|
717
|
+
return /* @__PURE__ */ d("svg", {
|
|
703
718
|
viewBox: "0 0 24 24",
|
|
704
719
|
fill: "none",
|
|
705
720
|
stroke: "currentColor",
|
|
@@ -708,11 +723,11 @@ function me({ className: e }) {
|
|
|
708
723
|
strokeLinejoin: "round",
|
|
709
724
|
className: e,
|
|
710
725
|
"aria-hidden": "true",
|
|
711
|
-
children: /* @__PURE__ */
|
|
726
|
+
children: /* @__PURE__ */ d("path", { d: "M5 12.5 9.5 17 19 7" })
|
|
712
727
|
});
|
|
713
728
|
}
|
|
714
|
-
function
|
|
715
|
-
return /* @__PURE__ */
|
|
729
|
+
function ge({ className: e }) {
|
|
730
|
+
return /* @__PURE__ */ f("svg", {
|
|
716
731
|
viewBox: "0 0 24 24",
|
|
717
732
|
fill: "none",
|
|
718
733
|
stroke: "currentColor",
|
|
@@ -721,63 +736,63 @@ function he({ className: e }) {
|
|
|
721
736
|
strokeLinejoin: "round",
|
|
722
737
|
className: e,
|
|
723
738
|
"aria-hidden": "true",
|
|
724
|
-
children: [/* @__PURE__ */
|
|
739
|
+
children: [/* @__PURE__ */ d("circle", {
|
|
725
740
|
cx: "12",
|
|
726
741
|
cy: "12",
|
|
727
742
|
r: "9"
|
|
728
|
-
}), /* @__PURE__ */
|
|
743
|
+
}), /* @__PURE__ */ d("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
|
|
729
744
|
});
|
|
730
745
|
}
|
|
731
746
|
//#endregion
|
|
732
747
|
//#region src/ui/CopyMarkdownButton.tsx
|
|
733
|
-
var
|
|
734
|
-
function
|
|
735
|
-
let [c,
|
|
748
|
+
var _e = 1500;
|
|
749
|
+
function ve({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: i = "Copy as markdown", tooltipCopiedText: s = "Copied!" }) {
|
|
750
|
+
let [c, u] = o(!1), [p, m] = o(!1), h = a(null);
|
|
736
751
|
return r(() => () => {
|
|
737
752
|
h.current !== null && clearTimeout(h.current);
|
|
738
|
-
}, []), /* @__PURE__ */
|
|
753
|
+
}, []), /* @__PURE__ */ d(l.Provider, {
|
|
739
754
|
delayDuration: 200,
|
|
740
|
-
children: /* @__PURE__ */
|
|
755
|
+
children: /* @__PURE__ */ f(l.Root, {
|
|
741
756
|
open: c || p,
|
|
742
757
|
onOpenChange: m,
|
|
743
|
-
children: [/* @__PURE__ */
|
|
758
|
+
children: [/* @__PURE__ */ d(l.Trigger, {
|
|
744
759
|
asChild: !0,
|
|
745
|
-
children: /* @__PURE__ */
|
|
760
|
+
children: /* @__PURE__ */ d("button", {
|
|
746
761
|
type: "button",
|
|
747
762
|
onClick: async () => {
|
|
748
763
|
try {
|
|
749
764
|
await navigator.clipboard.writeText(e);
|
|
750
765
|
} catch {}
|
|
751
|
-
|
|
766
|
+
u(!0), h.current !== null && clearTimeout(h.current), h.current = setTimeout(() => u(!1), _e);
|
|
752
767
|
},
|
|
753
768
|
"aria-label": n,
|
|
754
769
|
className: `bailey-copy-button${t ? ` ${t}` : ""}`,
|
|
755
|
-
children:
|
|
770
|
+
children: d(c ? he : me, { className: "bailey-copy-icon" })
|
|
756
771
|
})
|
|
757
|
-
}), /* @__PURE__ */
|
|
772
|
+
}), /* @__PURE__ */ d(l.Portal, { children: /* @__PURE__ */ f(l.Content, {
|
|
758
773
|
side: "top",
|
|
759
774
|
className: "bailey-tooltip-content",
|
|
760
|
-
children: [c ? s : i, /* @__PURE__ */
|
|
775
|
+
children: [c ? s : i, /* @__PURE__ */ d(l.Arrow, { className: "bailey-tooltip-arrow" })]
|
|
761
776
|
}) })]
|
|
762
777
|
})
|
|
763
778
|
});
|
|
764
779
|
}
|
|
765
780
|
//#endregion
|
|
766
781
|
//#region src/ui/BaileyTracePanel.tsx
|
|
767
|
-
async function
|
|
782
|
+
async function ye(e) {
|
|
768
783
|
try {
|
|
769
784
|
await navigator.clipboard.writeText(e);
|
|
770
785
|
} catch {}
|
|
771
786
|
}
|
|
772
|
-
function
|
|
773
|
-
return /* @__PURE__ */
|
|
787
|
+
function be({ text: e, label: t = "Copy" }) {
|
|
788
|
+
return /* @__PURE__ */ d("button", {
|
|
774
789
|
type: "button",
|
|
775
|
-
onClick: () =>
|
|
790
|
+
onClick: () => ye(e),
|
|
776
791
|
className: "bailey-trace-copy-button",
|
|
777
792
|
children: t
|
|
778
793
|
});
|
|
779
794
|
}
|
|
780
|
-
function
|
|
795
|
+
function xe(e) {
|
|
781
796
|
if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
|
|
782
797
|
switch (e.kind) {
|
|
783
798
|
case "tool_start": return "bailey-trace-chip bailey-trace-chip-info";
|
|
@@ -787,18 +802,18 @@ function be(e) {
|
|
|
787
802
|
}
|
|
788
803
|
}
|
|
789
804
|
function Q({ label: e, content: t, copyable: n }) {
|
|
790
|
-
return /* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ f("details", {
|
|
791
806
|
className: "bailey-trace-disclosure",
|
|
792
807
|
children: [
|
|
793
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ d("summary", {
|
|
794
809
|
className: "bailey-trace-disclosure-summary",
|
|
795
810
|
children: e
|
|
796
811
|
}),
|
|
797
|
-
n && /* @__PURE__ */
|
|
812
|
+
n && /* @__PURE__ */ d("div", {
|
|
798
813
|
className: "bailey-trace-disclosure-actions",
|
|
799
|
-
children: /* @__PURE__ */
|
|
814
|
+
children: /* @__PURE__ */ d(be, { text: t })
|
|
800
815
|
}),
|
|
801
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ d("pre", {
|
|
802
817
|
className: "bailey-trace-disclosure-content",
|
|
803
818
|
children: t
|
|
804
819
|
})
|
|
@@ -806,53 +821,53 @@ function Q({ label: e, content: t, copyable: n }) {
|
|
|
806
821
|
});
|
|
807
822
|
}
|
|
808
823
|
function $({ row: e }) {
|
|
809
|
-
return /* @__PURE__ */
|
|
824
|
+
return /* @__PURE__ */ f("div", {
|
|
810
825
|
className: "bailey-trace-row",
|
|
811
826
|
children: [
|
|
812
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ f("div", {
|
|
813
828
|
className: "bailey-trace-row-header",
|
|
814
829
|
children: [
|
|
815
|
-
/* @__PURE__ */
|
|
830
|
+
/* @__PURE__ */ d("span", {
|
|
816
831
|
className: "bailey-trace-row-time",
|
|
817
832
|
children: e.time
|
|
818
833
|
}),
|
|
819
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ d("span", {
|
|
820
835
|
className: "bailey-trace-row-gap",
|
|
821
836
|
title: "Time since the previous event",
|
|
822
|
-
children:
|
|
837
|
+
children: ae(e.gapMs)
|
|
823
838
|
}),
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
className:
|
|
839
|
+
/* @__PURE__ */ d("span", {
|
|
840
|
+
className: xe(e),
|
|
826
841
|
children: e.label
|
|
827
842
|
}),
|
|
828
|
-
/* @__PURE__ */
|
|
843
|
+
/* @__PURE__ */ d("span", {
|
|
829
844
|
className: "bailey-trace-row-summary",
|
|
830
845
|
children: e.summary
|
|
831
846
|
})
|
|
832
847
|
]
|
|
833
848
|
}),
|
|
834
|
-
e.argsDetail && /* @__PURE__ */
|
|
849
|
+
e.argsDetail && /* @__PURE__ */ d(Q, {
|
|
835
850
|
label: "args",
|
|
836
851
|
content: e.argsDetail
|
|
837
852
|
}),
|
|
838
|
-
e.outputDetail && /* @__PURE__ */
|
|
853
|
+
e.outputDetail && /* @__PURE__ */ d(Q, {
|
|
839
854
|
label: "output",
|
|
840
855
|
content: e.outputDetail
|
|
841
856
|
}),
|
|
842
|
-
e.rawDetail && /* @__PURE__ */
|
|
857
|
+
e.rawDetail && /* @__PURE__ */ d(Q, {
|
|
843
858
|
label: "raw",
|
|
844
859
|
content: e.rawDetail
|
|
845
860
|
})
|
|
846
861
|
]
|
|
847
862
|
});
|
|
848
863
|
}
|
|
849
|
-
function
|
|
864
|
+
function Se(e, t) {
|
|
850
865
|
if (e.chunkCount === 0) return "Streamed: no chunks received";
|
|
851
866
|
if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
|
|
852
867
|
let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
|
|
853
868
|
return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
|
|
854
869
|
}
|
|
855
|
-
function
|
|
870
|
+
function Ce({ request: e }) {
|
|
856
871
|
let t = i(() => JSON.stringify({
|
|
857
872
|
model: e.model,
|
|
858
873
|
instructions: e.systemPrompt,
|
|
@@ -861,10 +876,10 @@ function Se({ request: e }) {
|
|
|
861
876
|
tools: e.tools,
|
|
862
877
|
toolChoice: e.toolChoice
|
|
863
878
|
}, null, 2), [e]);
|
|
864
|
-
return /* @__PURE__ */
|
|
879
|
+
return /* @__PURE__ */ f("div", {
|
|
865
880
|
className: "bailey-trace-request-details",
|
|
866
881
|
children: [
|
|
867
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ f("span", {
|
|
868
883
|
className: "bailey-trace-request-meta",
|
|
869
884
|
children: [
|
|
870
885
|
"Last request — ",
|
|
@@ -874,26 +889,26 @@ function Se({ request: e }) {
|
|
|
874
889
|
e.requestId ? ` · ${e.requestId}` : ""
|
|
875
890
|
]
|
|
876
891
|
}),
|
|
877
|
-
/* @__PURE__ */
|
|
892
|
+
/* @__PURE__ */ d("span", {
|
|
878
893
|
className: "bailey-trace-request-meta",
|
|
879
|
-
children:
|
|
894
|
+
children: Se(e.streamStats, e.sentAt)
|
|
880
895
|
}),
|
|
881
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ d(Q, {
|
|
882
897
|
label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
|
|
883
898
|
content: e.systemPrompt,
|
|
884
899
|
copyable: !0
|
|
885
900
|
}),
|
|
886
|
-
/* @__PURE__ */
|
|
901
|
+
/* @__PURE__ */ d(Q, {
|
|
887
902
|
label: `Messages (${e.messages.length})`,
|
|
888
903
|
content: JSON.stringify(e.messages, null, 2),
|
|
889
904
|
copyable: !0
|
|
890
905
|
}),
|
|
891
|
-
e.response && /* @__PURE__ */
|
|
906
|
+
e.response && /* @__PURE__ */ d(Q, {
|
|
892
907
|
label: `Response (${e.response.content.length.toLocaleString()} chars)`,
|
|
893
908
|
content: e.response.content,
|
|
894
909
|
copyable: !0
|
|
895
910
|
}),
|
|
896
|
-
/* @__PURE__ */
|
|
911
|
+
/* @__PURE__ */ d(Q, {
|
|
897
912
|
label: "Full payload (JSON)",
|
|
898
913
|
content: t,
|
|
899
914
|
copyable: !0
|
|
@@ -901,43 +916,43 @@ function Se({ request: e }) {
|
|
|
901
916
|
]
|
|
902
917
|
});
|
|
903
918
|
}
|
|
904
|
-
function
|
|
905
|
-
let r = i(() =>
|
|
906
|
-
return /* @__PURE__ */
|
|
919
|
+
function we({ events: e, lastRequest: t, onClear: n }) {
|
|
920
|
+
let r = i(() => oe(e), [e]), a = i(() => ce(r), [r]), o = i(() => JSON.stringify(e, null, 2), [e]);
|
|
921
|
+
return /* @__PURE__ */ f("div", {
|
|
907
922
|
className: "bailey-trace-body",
|
|
908
923
|
children: [
|
|
909
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ f("div", {
|
|
910
925
|
className: "bailey-trace-actions-row",
|
|
911
|
-
children: [e.length > 0 && /* @__PURE__ */
|
|
926
|
+
children: [e.length > 0 && /* @__PURE__ */ d(be, {
|
|
912
927
|
text: o,
|
|
913
928
|
label: "Copy trace as JSON"
|
|
914
|
-
}), /* @__PURE__ */
|
|
929
|
+
}), /* @__PURE__ */ d("button", {
|
|
915
930
|
type: "button",
|
|
916
931
|
onClick: n,
|
|
917
932
|
className: "bailey-trace-copy-button",
|
|
918
933
|
children: "Clear"
|
|
919
934
|
})]
|
|
920
935
|
}),
|
|
921
|
-
t && /* @__PURE__ */
|
|
922
|
-
/* @__PURE__ */
|
|
936
|
+
t && /* @__PURE__ */ d(Ce, { request: t }),
|
|
937
|
+
/* @__PURE__ */ d("div", {
|
|
923
938
|
className: "bailey-trace-rows",
|
|
924
939
|
children: a.map((e, t) => {
|
|
925
|
-
if (e.type === "single") return /* @__PURE__ */
|
|
940
|
+
if (e.type === "single") return /* @__PURE__ */ d($, { row: e.row }, e.row.key);
|
|
926
941
|
let n = e.rows.filter((e) => e.isToolStart).length;
|
|
927
|
-
if (n <= 1) return /* @__PURE__ */
|
|
942
|
+
if (n <= 1) return /* @__PURE__ */ d("div", {
|
|
928
943
|
className: "bailey-trace-rows",
|
|
929
|
-
children: e.rows.map((e) => /* @__PURE__ */
|
|
944
|
+
children: e.rows.map((e) => /* @__PURE__ */ d($, { row: e }, e.key))
|
|
930
945
|
}, `group-${t}`);
|
|
931
946
|
let r = e.rows.filter((e) => e.failed).length;
|
|
932
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ f("details", {
|
|
933
948
|
className: "bailey-trace-group",
|
|
934
|
-
children: [/* @__PURE__ */
|
|
949
|
+
children: [/* @__PURE__ */ f("summary", {
|
|
935
950
|
className: "bailey-trace-group-summary",
|
|
936
951
|
children: [
|
|
937
|
-
/* @__PURE__ */
|
|
952
|
+
/* @__PURE__ */ d("strong", { children: e.toolName }),
|
|
938
953
|
" × ",
|
|
939
954
|
n,
|
|
940
|
-
r > 0 && /* @__PURE__ */
|
|
955
|
+
r > 0 && /* @__PURE__ */ f("span", {
|
|
941
956
|
className: "bailey-trace-group-failed",
|
|
942
957
|
children: [
|
|
943
958
|
" ",
|
|
@@ -946,9 +961,9 @@ function Ce({ events: e, lastRequest: t, onClear: n }) {
|
|
|
946
961
|
]
|
|
947
962
|
})
|
|
948
963
|
]
|
|
949
|
-
}), /* @__PURE__ */
|
|
964
|
+
}), /* @__PURE__ */ d("div", {
|
|
950
965
|
className: "bailey-trace-rows",
|
|
951
|
-
children: e.rows.map((e) => /* @__PURE__ */
|
|
966
|
+
children: e.rows.map((e) => /* @__PURE__ */ d($, { row: e }, e.key))
|
|
952
967
|
})]
|
|
953
968
|
}, `group-${t}`);
|
|
954
969
|
})
|
|
@@ -956,13 +971,13 @@ function Ce({ events: e, lastRequest: t, onClear: n }) {
|
|
|
956
971
|
]
|
|
957
972
|
});
|
|
958
973
|
}
|
|
959
|
-
function
|
|
960
|
-
let [r, a] = o(!1), s = i(() =>
|
|
961
|
-
return e.length === 0 && !t ? null : /* @__PURE__ */
|
|
974
|
+
function Te({ events: e, lastRequest: t, onClear: n }) {
|
|
975
|
+
let [r, a] = o(!1), s = i(() => le(e), [e]), c = i(() => se(e), [e]);
|
|
976
|
+
return e.length === 0 && !t ? null : /* @__PURE__ */ f("div", {
|
|
962
977
|
className: "bailey-trace-panel",
|
|
963
|
-
children: [/* @__PURE__ */
|
|
978
|
+
children: [/* @__PURE__ */ f("div", {
|
|
964
979
|
className: "bailey-trace-toggle-row",
|
|
965
|
-
children: [/* @__PURE__ */
|
|
980
|
+
children: [/* @__PURE__ */ f("button", {
|
|
966
981
|
type: "button",
|
|
967
982
|
onClick: () => a((e) => !e),
|
|
968
983
|
"aria-expanded": r,
|
|
@@ -974,11 +989,11 @@ function we({ events: e, lastRequest: t, onClear: n }) {
|
|
|
974
989
|
e.length,
|
|
975
990
|
")"
|
|
976
991
|
]
|
|
977
|
-
}), c && /* @__PURE__ */
|
|
992
|
+
}), c && /* @__PURE__ */ d("span", {
|
|
978
993
|
className: s ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
|
|
979
994
|
children: c
|
|
980
995
|
})]
|
|
981
|
-
}), r && /* @__PURE__ */
|
|
996
|
+
}), r && /* @__PURE__ */ d(we, {
|
|
982
997
|
events: e,
|
|
983
998
|
lastRequest: t,
|
|
984
999
|
onClear: n
|
|
@@ -987,7 +1002,7 @@ function we({ events: e, lastRequest: t, onClear: n }) {
|
|
|
987
1002
|
}
|
|
988
1003
|
//#endregion
|
|
989
1004
|
//#region src/ui/BaileyChatPanel.tsx
|
|
990
|
-
var
|
|
1005
|
+
var Ee = "How can bailey AI help you today?", De = "Reply to bailey AI", Oe = {
|
|
991
1006
|
newChatButtonText: "New chat",
|
|
992
1007
|
newChatAriaLabel: "new chat",
|
|
993
1008
|
suggestionsTitle: "Suggested for you",
|
|
@@ -1002,212 +1017,222 @@ var Te = "How can bailey AI help you today?", Ee = "Reply to bailey AI", De = {
|
|
|
1002
1017
|
copyButtonAriaLabel: "copy response as markdown",
|
|
1003
1018
|
copyButtonTooltipDefault: "Copy as markdown",
|
|
1004
1019
|
copyButtonTooltipCopied: "Copied!"
|
|
1005
|
-
},
|
|
1006
|
-
return /* @__PURE__ */
|
|
1020
|
+
}, ke = [c], Ae = t(function({ content: e, components: t }) {
|
|
1021
|
+
return /* @__PURE__ */ d("div", {
|
|
1007
1022
|
className: "bailey-markdown-content",
|
|
1008
|
-
children: /* @__PURE__ */
|
|
1009
|
-
remarkPlugins:
|
|
1023
|
+
children: /* @__PURE__ */ d(s, {
|
|
1024
|
+
remarkPlugins: ke,
|
|
1010
1025
|
components: t,
|
|
1011
1026
|
skipHtml: !0,
|
|
1012
1027
|
children: e
|
|
1013
1028
|
})
|
|
1014
1029
|
});
|
|
1015
1030
|
});
|
|
1016
|
-
function
|
|
1031
|
+
function je(e, t, n) {
|
|
1017
1032
|
if (e !== "streaming") return;
|
|
1018
1033
|
let r = t.filter((e) => e.turnSentAt === n?.sentAt);
|
|
1019
|
-
if (r.length !== 0) return
|
|
1034
|
+
if (r.length !== 0) return X(r[r.length - 1]);
|
|
1020
1035
|
}
|
|
1021
|
-
function
|
|
1036
|
+
function Me(e) {
|
|
1022
1037
|
let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
|
|
1023
1038
|
hour: "numeric",
|
|
1024
1039
|
minute: "2-digit"
|
|
1025
1040
|
});
|
|
1026
1041
|
return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
|
|
1027
1042
|
}
|
|
1028
|
-
function
|
|
1029
|
-
let { messages:
|
|
1030
|
-
...
|
|
1031
|
-
...
|
|
1032
|
-
},
|
|
1033
|
-
renderTable:
|
|
1034
|
-
renderChart:
|
|
1035
|
-
}), [
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
]),
|
|
1043
|
+
function Ne({ chat: e, placeholder: t, replyPlaceholder: n = De, emptyPlaceholder: s, suggestions: c, privacyNote: u, resolveActivityIcon: p, className: m, height: h, width: g, hideDeveloperDetails: _ = !1, renderMessageActions: v, renderTable: y, renderChart: b, labels: x, formatMessageTime: S }) {
|
|
1044
|
+
let { messages: C, traceEvents: w, lastRequest: T, status: E, error: D, send: O, stop: k, retryLast: A, clearTrace: j, clearError: M, newChat: N } = e, [P, F] = o(""), I = {
|
|
1045
|
+
...Oe,
|
|
1046
|
+
...x
|
|
1047
|
+
}, L = S ?? Me, R = a(null), z = a(null), B = a(!0), V = i(() => de({
|
|
1048
|
+
renderTable: y,
|
|
1049
|
+
renderChart: b
|
|
1050
|
+
}), [y, b]), H = i(() => je(E, w, T), [
|
|
1051
|
+
E,
|
|
1052
|
+
w,
|
|
1053
|
+
T
|
|
1054
|
+
]), U = C.length === 0, W = t ?? (U ? s ?? Ee : n);
|
|
1040
1055
|
r(() => {
|
|
1041
|
-
let e =
|
|
1056
|
+
let e = z.current;
|
|
1042
1057
|
if (!e) return;
|
|
1043
1058
|
let t = () => {
|
|
1044
1059
|
let t = e.scrollHeight - e.scrollTop - e.clientHeight;
|
|
1045
|
-
|
|
1060
|
+
B.current = t < 60;
|
|
1046
1061
|
};
|
|
1047
1062
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1048
1063
|
}, []), r(() => {
|
|
1049
|
-
|
|
1050
|
-
behavior:
|
|
1064
|
+
B.current && R.current?.scrollIntoView({
|
|
1065
|
+
behavior: E === "streaming" ? "auto" : "smooth",
|
|
1051
1066
|
block: "nearest"
|
|
1052
1067
|
});
|
|
1053
|
-
}, [
|
|
1054
|
-
let
|
|
1055
|
-
|
|
1068
|
+
}, [C, E]);
|
|
1069
|
+
let G = (e) => {
|
|
1070
|
+
B.current = !0, O(e);
|
|
1056
1071
|
};
|
|
1057
|
-
return /* @__PURE__ */
|
|
1058
|
-
className: `bailey-chat-panel${
|
|
1059
|
-
style:
|
|
1060
|
-
height:
|
|
1061
|
-
width:
|
|
1072
|
+
return /* @__PURE__ */ d("div", {
|
|
1073
|
+
className: `bailey-chat-panel${m ? ` ${m}` : ""}`,
|
|
1074
|
+
style: h !== void 0 || g !== void 0 ? {
|
|
1075
|
+
height: h,
|
|
1076
|
+
width: g
|
|
1062
1077
|
} : void 0,
|
|
1063
|
-
children: /* @__PURE__ */
|
|
1078
|
+
children: /* @__PURE__ */ f("div", {
|
|
1064
1079
|
className: "bailey-chat-panel-inner",
|
|
1065
1080
|
children: [
|
|
1066
|
-
/* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ d("div", {
|
|
1067
1082
|
className: "bailey-toolbar-row",
|
|
1068
|
-
children: /* @__PURE__ */
|
|
1083
|
+
children: /* @__PURE__ */ d("button", {
|
|
1069
1084
|
type: "button",
|
|
1070
|
-
onClick:
|
|
1071
|
-
disabled:
|
|
1072
|
-
"aria-label":
|
|
1085
|
+
onClick: N,
|
|
1086
|
+
disabled: C.length === 0,
|
|
1087
|
+
"aria-label": I.newChatAriaLabel,
|
|
1073
1088
|
className: "bailey-new-chat-button",
|
|
1074
|
-
children:
|
|
1089
|
+
children: I.newChatButtonText
|
|
1075
1090
|
})
|
|
1076
1091
|
}),
|
|
1077
|
-
/* @__PURE__ */
|
|
1092
|
+
/* @__PURE__ */ f("div", {
|
|
1078
1093
|
className: "bailey-chat-transcript",
|
|
1079
|
-
ref:
|
|
1094
|
+
ref: z,
|
|
1080
1095
|
children: [
|
|
1081
|
-
|
|
1096
|
+
U && (c && c.length > 0 ? /* @__PURE__ */ f("div", {
|
|
1082
1097
|
className: "bailey-suggestions",
|
|
1083
|
-
children: [/* @__PURE__ */
|
|
1098
|
+
children: [/* @__PURE__ */ d("div", {
|
|
1084
1099
|
className: "bailey-suggestions-title",
|
|
1085
|
-
children:
|
|
1086
|
-
}), c.map((e, t) => /* @__PURE__ */
|
|
1100
|
+
children: I.suggestionsTitle
|
|
1101
|
+
}), c.map((e, t) => /* @__PURE__ */ f("button", {
|
|
1087
1102
|
type: "button",
|
|
1088
|
-
onClick: () =>
|
|
1103
|
+
onClick: () => G(e.value ?? e.label),
|
|
1089
1104
|
className: "bailey-suggestion-card",
|
|
1090
|
-
children: [/* @__PURE__ */
|
|
1105
|
+
children: [/* @__PURE__ */ d("span", { children: e.label }), /* @__PURE__ */ d(Z, { className: "bailey-suggestion-icon" })]
|
|
1091
1106
|
}, `${e.label}-${t}`))]
|
|
1092
|
-
}) : /* @__PURE__ */
|
|
1107
|
+
}) : /* @__PURE__ */ d("div", {
|
|
1093
1108
|
className: "bailey-empty-state",
|
|
1094
|
-
children:
|
|
1109
|
+
children: I.emptyStateMessage
|
|
1095
1110
|
})),
|
|
1096
|
-
|
|
1097
|
-
let n = e.role === "assistant" && t ===
|
|
1098
|
-
return /* @__PURE__ */
|
|
1111
|
+
C.map((e, t) => {
|
|
1112
|
+
let n = e.role === "assistant" && t === C.length - 1, r = E === "streaming" && n && e.content === "", i = e.role === "assistant" && !r ? ue(w, e.createdAt) : [], a = i[i.length - 1];
|
|
1113
|
+
return /* @__PURE__ */ d("div", {
|
|
1099
1114
|
className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
|
|
1100
|
-
children: e.role === "user" ? /* @__PURE__ */
|
|
1115
|
+
children: e.role === "user" ? /* @__PURE__ */ f("div", {
|
|
1101
1116
|
className: "bailey-user-message",
|
|
1102
|
-
children: [/* @__PURE__ */
|
|
1117
|
+
children: [/* @__PURE__ */ f("div", {
|
|
1103
1118
|
className: "bailey-message-meta",
|
|
1104
|
-
children: [/* @__PURE__ */
|
|
1119
|
+
children: [/* @__PURE__ */ d("span", {
|
|
1105
1120
|
className: "bailey-message-meta-name",
|
|
1106
|
-
children:
|
|
1107
|
-
}), e.createdAt !== void 0 && /* @__PURE__ */
|
|
1108
|
-
}), /* @__PURE__ */
|
|
1121
|
+
children: I.youLabel
|
|
1122
|
+
}), e.createdAt !== void 0 && /* @__PURE__ */ d("span", { children: L(e.createdAt) })]
|
|
1123
|
+
}), /* @__PURE__ */ d("div", {
|
|
1109
1124
|
className: "bailey-user-bubble",
|
|
1110
1125
|
children: e.content
|
|
1111
1126
|
})]
|
|
1112
|
-
}) : r ? /* @__PURE__ */
|
|
1127
|
+
}) : r ? /* @__PURE__ */ d("div", {
|
|
1113
1128
|
className: "bailey-thinking-hint",
|
|
1114
|
-
children:
|
|
1115
|
-
}) : /* @__PURE__ */
|
|
1129
|
+
children: H ?? I.thinkingHint
|
|
1130
|
+
}) : /* @__PURE__ */ f("div", {
|
|
1116
1131
|
className: "bailey-assistant-message",
|
|
1117
1132
|
children: [
|
|
1118
|
-
a && /* @__PURE__ */
|
|
1133
|
+
a && /* @__PURE__ */ f("div", {
|
|
1119
1134
|
className: "bailey-activity-line",
|
|
1120
|
-
children: [/* @__PURE__ */
|
|
1135
|
+
children: [/* @__PURE__ */ d("span", {
|
|
1121
1136
|
className: "bailey-activity-icon",
|
|
1122
|
-
children:
|
|
1123
|
-
}), /* @__PURE__ */
|
|
1137
|
+
children: p?.(a.toolName) ?? /* @__PURE__ */ d(ge, {})
|
|
1138
|
+
}), /* @__PURE__ */ d("span", { children: a.text })]
|
|
1124
1139
|
}),
|
|
1125
|
-
/* @__PURE__ */
|
|
1140
|
+
/* @__PURE__ */ d(Ae, {
|
|
1126
1141
|
content: e.content,
|
|
1127
|
-
components:
|
|
1142
|
+
components: V
|
|
1128
1143
|
}),
|
|
1129
|
-
e.streaming &&
|
|
1144
|
+
e.streaming && H && /* @__PURE__ */ d("div", {
|
|
1130
1145
|
className: "bailey-streaming-hint",
|
|
1131
|
-
children:
|
|
1146
|
+
children: H
|
|
1132
1147
|
}),
|
|
1133
|
-
!e.streaming && /* @__PURE__ */
|
|
1148
|
+
!e.streaming && /* @__PURE__ */ f("div", {
|
|
1134
1149
|
className: "bailey-message-actions",
|
|
1135
|
-
children: [/* @__PURE__ */
|
|
1150
|
+
children: [/* @__PURE__ */ d(ve, {
|
|
1136
1151
|
markdown: e.content,
|
|
1137
|
-
ariaLabel:
|
|
1138
|
-
tooltipDefaultText:
|
|
1139
|
-
tooltipCopiedText:
|
|
1140
|
-
}),
|
|
1152
|
+
ariaLabel: I.copyButtonAriaLabel,
|
|
1153
|
+
tooltipDefaultText: I.copyButtonTooltipDefault,
|
|
1154
|
+
tooltipCopiedText: I.copyButtonTooltipCopied
|
|
1155
|
+
}), v?.(e)]
|
|
1141
1156
|
})
|
|
1142
1157
|
]
|
|
1143
1158
|
})
|
|
1144
1159
|
}, e.id);
|
|
1145
1160
|
}),
|
|
1146
|
-
/* @__PURE__ */
|
|
1161
|
+
/* @__PURE__ */ d("div", { ref: R })
|
|
1147
1162
|
]
|
|
1148
1163
|
}),
|
|
1149
|
-
|
|
1164
|
+
U && u && /* @__PURE__ */ f("div", {
|
|
1150
1165
|
className: "bailey-privacy-note",
|
|
1151
1166
|
children: [
|
|
1152
|
-
|
|
1167
|
+
u.text,
|
|
1153
1168
|
" ",
|
|
1154
|
-
/* @__PURE__ */
|
|
1155
|
-
href:
|
|
1169
|
+
/* @__PURE__ */ d("a", {
|
|
1170
|
+
href: u.linkHref,
|
|
1156
1171
|
target: "_blank",
|
|
1157
1172
|
rel: "noreferrer",
|
|
1158
|
-
children:
|
|
1173
|
+
children: u.linkLabel
|
|
1159
1174
|
})
|
|
1160
1175
|
]
|
|
1161
1176
|
}),
|
|
1162
|
-
|
|
1177
|
+
D && /* @__PURE__ */ f("div", {
|
|
1163
1178
|
className: "bailey-error-banner",
|
|
1164
1179
|
role: "alert",
|
|
1165
|
-
children: [/* @__PURE__ */
|
|
1180
|
+
children: [/* @__PURE__ */ d("span", { children: D }), /* @__PURE__ */ f("div", {
|
|
1166
1181
|
className: "bailey-error-actions",
|
|
1167
|
-
children: [/* @__PURE__ */
|
|
1182
|
+
children: [/* @__PURE__ */ d("button", {
|
|
1168
1183
|
type: "button",
|
|
1169
|
-
onClick:
|
|
1184
|
+
onClick: A,
|
|
1170
1185
|
className: "bailey-retry-button",
|
|
1171
|
-
children:
|
|
1172
|
-
}), /* @__PURE__ */
|
|
1186
|
+
children: I.retryButtonText
|
|
1187
|
+
}), /* @__PURE__ */ d("button", {
|
|
1173
1188
|
type: "button",
|
|
1174
|
-
onClick:
|
|
1175
|
-
"aria-label":
|
|
1189
|
+
onClick: M,
|
|
1190
|
+
"aria-label": I.dismissErrorAriaLabel,
|
|
1176
1191
|
className: "bailey-dismiss-button",
|
|
1177
1192
|
children: "✕"
|
|
1178
1193
|
})]
|
|
1179
1194
|
})]
|
|
1180
1195
|
}),
|
|
1181
|
-
!
|
|
1182
|
-
events:
|
|
1183
|
-
lastRequest:
|
|
1184
|
-
onClear:
|
|
1196
|
+
!_ && /* @__PURE__ */ d(Te, {
|
|
1197
|
+
events: w,
|
|
1198
|
+
lastRequest: T,
|
|
1199
|
+
onClear: j
|
|
1185
1200
|
}),
|
|
1186
|
-
/* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ f("form", {
|
|
1187
1202
|
onSubmit: (e) => {
|
|
1188
|
-
e.preventDefault(), !(!
|
|
1203
|
+
e.preventDefault(), !(!P.trim() || E === "streaming") && (G(P), F(""));
|
|
1189
1204
|
},
|
|
1190
1205
|
className: "bailey-input-row",
|
|
1191
|
-
children: [/* @__PURE__ */
|
|
1206
|
+
children: [/* @__PURE__ */ d("input", {
|
|
1192
1207
|
type: "text",
|
|
1193
|
-
placeholder:
|
|
1194
|
-
"aria-label":
|
|
1195
|
-
value:
|
|
1196
|
-
onChange: (e) =>
|
|
1197
|
-
disabled:
|
|
1208
|
+
placeholder: W,
|
|
1209
|
+
"aria-label": W,
|
|
1210
|
+
value: P,
|
|
1211
|
+
onChange: (e) => F(e.target.value),
|
|
1212
|
+
disabled: E === "streaming",
|
|
1198
1213
|
className: "bailey-input"
|
|
1199
|
-
}),
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1214
|
+
}), E === "streaming" ? /* @__PURE__ */ d(l.Provider, {
|
|
1215
|
+
delayDuration: 200,
|
|
1216
|
+
children: /* @__PURE__ */ f(l.Root, { children: [/* @__PURE__ */ d(l.Trigger, {
|
|
1217
|
+
asChild: !0,
|
|
1218
|
+
children: /* @__PURE__ */ d("button", {
|
|
1219
|
+
type: "button",
|
|
1220
|
+
onClick: k,
|
|
1221
|
+
"aria-label": I.stopAriaLabel,
|
|
1222
|
+
className: "bailey-stop-button",
|
|
1223
|
+
children: /* @__PURE__ */ d(pe, { className: "bailey-stop-icon" })
|
|
1224
|
+
})
|
|
1225
|
+
}), /* @__PURE__ */ d(l.Portal, { children: /* @__PURE__ */ f(l.Content, {
|
|
1226
|
+
side: "top",
|
|
1227
|
+
className: "bailey-tooltip-content",
|
|
1228
|
+
children: [I.stopButtonText, /* @__PURE__ */ d(l.Arrow, { className: "bailey-tooltip-arrow" })]
|
|
1229
|
+
}) })] })
|
|
1230
|
+
}) : /* @__PURE__ */ d("button", {
|
|
1206
1231
|
type: "submit",
|
|
1207
|
-
"aria-label":
|
|
1208
|
-
disabled: !
|
|
1232
|
+
"aria-label": I.sendAriaLabel,
|
|
1233
|
+
disabled: !P.trim(),
|
|
1209
1234
|
className: "bailey-send-button",
|
|
1210
|
-
children: /* @__PURE__ */
|
|
1235
|
+
children: /* @__PURE__ */ d(fe, { className: "bailey-send-icon" })
|
|
1211
1236
|
})]
|
|
1212
1237
|
})
|
|
1213
1238
|
]
|
|
@@ -1216,6 +1241,6 @@ function Me({ chat: e, placeholder: t, replyPlaceholder: n = Ee, emptyPlaceholde
|
|
|
1216
1241
|
}
|
|
1217
1242
|
//#endregion
|
|
1218
1243
|
//#region src/index.ts
|
|
1219
|
-
var
|
|
1244
|
+
var Pe = "0.3.1-pre.2";
|
|
1220
1245
|
//#endregion
|
|
1221
|
-
export {
|
|
1246
|
+
export { ge as ActivityIcon, Z as ArrowUpRightIcon, Pe as BAILEYAI_CHAT_UI_VERSION, z as BAILEY_CHART_PROMPT_FRAGMENT, j as BAILEY_TABLE_GRID_ROW_THRESHOLD, Ne as BaileyChatPanel, Te as BaileyTracePanel, ve as CopyMarkdownButton, fe as HeartIcon, te as TRACE_KIND_LABEL, de as createBaileyMarkdownComponents, b as extractPseudoToolCalls, L as extractTableData, ae as formatTraceGap, ie as formatTraceTime, le as hasTraceFailure, e as isSafeMarkdownUrl, D as joinInstructions, ee as parseBaileyChartSpec, S as parseSseFrames, A as resolveToolCall, R as shouldUseGrid, ue as toActivityLines, oe as toTraceRows, ce as toTraceSegments, re as traceEventArgsDetail, X as traceEventHint, J as traceEventOutputDetail, Y as traceEventRawDetail, ne as traceEventSummary, q as traceEventToolName, se as traceSummaryLine, E as useBaileyChat };
|
package/dist/index.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare interface BaileyChatPanelLabels {
|
|
|
69
69
|
dismissErrorAriaLabel: string;
|
|
70
70
|
/** Accessible name for the submit control. */
|
|
71
71
|
sendAriaLabel: string;
|
|
72
|
-
/**
|
|
72
|
+
/** Tooltip text shown on hover for the streaming-abort control. */
|
|
73
73
|
stopButtonText: string;
|
|
74
74
|
/** Accessible name for the streaming-abort control. */
|
|
75
75
|
stopAriaLabel: string;
|
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.2",
|
|
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": {
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
},
|
|
46
46
|
"packageManager": "yarn@4.14.1",
|
|
47
47
|
"scripts": {
|
|
48
|
-
"build": "vite build",
|
|
48
|
+
"build": "vite build && node scripts/scope-theme-vars.js",
|
|
49
49
|
"dev": "vite dev/ --config vite.config.ts",
|
|
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\""
|
|
53
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\" \"dev/**/*.{ts,tsx}\" \"vite.config.ts\" \"*.js\" \"scripts/**/*.js\""
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@emotion/react": "^11.0.0",
|