a11oy / console /assets /A11oyCodeChat-CLGElxYs.js
betterwithage's picture
sync(space): full source mirror — resolve all GitHub<->Space drift (CTO)
a6a5d8e verified
Raw
History Blame
22.5 kB
import{i as g,r as i,k as t,C as pe,S as ye}from"./index-BVfpSx5Q.js";import{m as Z}from"./proxy-Dwi19u3x.js";import{X as he}from"./x-C5WZKxrb.js";/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fe=g("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xe=g("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ge=g("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const be=g("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ke=g("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const je=g("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ve=g("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const we=g("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Se=g("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $e=g("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ne=g("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ze=g("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const te=g("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]),e={bg:"#0a0a0a",surface:"rgba(255,255,255,0.025)",surfaceStrong:"rgba(255,255,255,0.045)",border:"rgba(255,255,255,0.08)",borderStrong:"rgba(255,255,255,0.12)",text:"#f5f5f5",dim:"#8a8a8a",muted:"#5e5e5e",accent:"#c9b787",ok:"#6dba6d",warn:"#d6a84e",crit:"#d66a6a",info:"#6a9fd6",mono:"var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace)"},P="/api/a11oy/code",ee="You are a11oy.code — the SZL Holdings conversational orchestrator. You answer at Opus-4.8 quality: precise, structured, with working code and honest uncertainty. You can call tools to orchestrate the Amaru / Sentra / Rosie / Killinchu flagships and reach GitHub, Hugging Face, the web, the sandboxed shell/filesystem, and the Killinchu drone fleet. Every action is PURIQ-gated and Khipu-receipted. Stream your reasoning concisely. Prefer markdown, mermaid diagrams, and KaTeX where it clarifies.",_={};function T(a,r){return _[a]||(_[a]=new Promise(c=>{if(r&&window[r])return c();const p=document.createElement("script");p.src=a,p.async=!0,p.onload=()=>c(),p.onerror=()=>c(),document.head.appendChild(p)})),_[a]}function Me(a){if(document.querySelector(`link[href="${a}"]`))return;const r=document.createElement("link");r.rel="stylesheet",r.href=a,document.head.appendChild(r)}function U(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function Ce(a){await T("https://cdn.jsdelivr.net/npm/marked/marked.min.js","marked");const r=window.marked;if(!r)return`<div style="white-space:pre-wrap">${U(a)}</div>`;try{return r.parse(a,{breaks:!0,gfm:!0})}catch{return`<div style="white-space:pre-wrap">${U(a)}</div>`}}async function Re(a){Me("https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css"),await T("https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js","katex"),await T("https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/auto-render.min.js","renderMathInElement");const r=window.renderMathInElement;if(r)try{r(a,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}],throwOnError:!1})}catch{}}let Ee=0;async function He(a){await T("https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js","mermaid");const r=window.mermaid;if(r)try{r.initialize({startOnLoad:!1,theme:"dark",securityLevel:"loose"});const c=Array.from(a.querySelectorAll("code.language-mermaid, pre code.language-mermaid"));for(const p of c){const b=p.textContent||"",k=p.closest("pre")||p;try{const{svg:j}=await r.render(`mmd-${Ee++}`,b),M=document.createElement("div");M.innerHTML=j,k.replaceWith(M)}catch{}}}catch{}}function _e({content:a,live:r}){const c=i.useRef(null),[p,b]=i.useState("");return i.useEffect(()=>{let k=!1;return Ce(a).then(j=>{k||b(j)}),()=>{k=!0}},[a]),i.useEffect(()=>{r||!c.current||!p||(Re(c.current),He(c.current))},[p,r]),t.jsx("div",{ref:c,className:"a11oy-md",style:{fontSize:14,lineHeight:1.6,color:e.text},dangerouslySetInnerHTML:{__html:p||(r?"":U(a))}})}function Te({m:a}){const r=[];return a.model&&r.push({icon:xe,label:a.model,color:e.accent}),a.tier&&r.push({icon:te,label:a.tier,color:e.info}),typeof a.latency_ms=="number"&&r.push({icon:fe,label:`${a.latency_ms} ms`,color:e.dim}),typeof a.cost_usd=="number"&&r.push({icon:ge,label:`$${a.cost_usd.toFixed(5)}`,color:e.dim}),typeof a.yuyay13=="number"&&r.push({icon:ye,label:`Yuyay-13 ${a.yuyay13.toFixed(2)}`,color:a.yuyay13>=.62?e.ok:e.warn}),a.khipu&&r.push({icon:ke,label:`khipu ${a.khipu.slice(0,10)}`,color:e.muted}),r.length?t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:r.map((c,p)=>{const b=c.icon;return t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5",style:{fontSize:10,fontFamily:e.mono,background:e.surface,border:`1px solid ${e.border}`,color:c.color},title:c.label,children:[t.jsx(b,{size:11})," ",c.label]},p)})}):null}function Fe({tools:a}){return a!=null&&a.length?t.jsx("div",{className:"mt-2 space-y-1.5",children:a.map(r=>{const c=r.status==="denied"?e.crit:r.status==="done"?e.ok:e.warn;return t.jsxs("div",{className:"rounded-md px-2.5 py-1.5",style:{background:e.surface,border:`1px solid ${e.border}`,fontSize:11,fontFamily:e.mono},children:[t.jsxs("div",{className:"flex items-center gap-1.5",style:{color:c},children:[t.jsx(te,{size:11}),t.jsx("span",{style:{fontWeight:600},children:r.name}),t.jsxs("span",{style:{color:e.muted},children:["· ",r.status]}),r.gate&&t.jsxs("span",{style:{color:r.gate.allow?e.ok:e.crit},children:["· PURIQ ",r.gate.score.toFixed(2)," ",r.gate.allow?"allow":"deny"]})]}),r.args&&t.jsx("pre",{style:{color:e.dim,margin:"4px 0 0",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:JSON.stringify(r.args).slice(0,300)}),r.result!==void 0&&t.jsx("pre",{style:{color:e.dim,margin:"4px 0 0",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(typeof r.result=="string"?r.result:JSON.stringify(r.result)).slice(0,400)})]},r.id)})}):null}function qe(){const[a,r]=i.useState([]),[c,p]=i.useState(""),[b,k]=i.useState(!1),[j,M]=i.useState(ee),[B,oe]=i.useState(!1),[ae,re]=i.useState([{id:"router",label:"router picks (auto)"}]),[R,ne]=i.useState("router"),[v,F]=i.useState([]),[I,K]=i.useState(!1),[E]=i.useState(()=>{const o="a11oy_code_user";let l=localStorage.getItem(o);return l||(l="founder-"+Math.random().toString(36).slice(2,8),localStorage.setItem(o,l)),l}),[$,Ie]=i.useState(()=>"conv-"+Math.random().toString(36).slice(2,10)),H=i.useRef(null),L=i.useRef(null),W=i.useRef(null),O=i.useRef([]),Y=i.useRef(null);i.useEffect(()=>{fetch(`${P}/models`).then(o=>o.ok?o.json():null).then(o=>{if(!o)return;const l=(o.models||o.data||[]).map(n=>({id:n.id||n.model||n.name,label:`${n.id||n.name}${n.tier?` · ${n.tier}`:""}`,tier:n.tier,license:n.license}));re([{id:"router",label:"router picks (auto)"},...l])}).catch(()=>{})},[]),i.useEffect(()=>{var o;(o=L.current)==null||o.scrollTo({top:L.current.scrollHeight,behavior:"smooth"})},[a,b]);const se=i.useCallback(()=>{var o;(o=H.current)==null||o.abort(),H.current=null,k(!1)},[]),J=i.useCallback(async()=>{var h;const o=c.trim();if(!o&&!v.length||b)return;const l={role:"user",content:o,images:v.length?[...v]:void 0},n={role:"assistant",content:"",tools:[]},m=[...a,l];r([...m,n]),p(""),F([]),k(!0);const x=new AbortController;H.current=x;const f=[{role:"system",content:j}];for(const d of m)(h=d.images)!=null&&h.length?f.push({role:d.role,content:[{type:"text",text:d.content},...d.images.map(w=>({type:"image_url",image_url:{url:w}}))]}):f.push({role:d.role,content:d.content});const y=d=>r(w=>{const S=[...w],N={...S[S.length-1]};return d(N),S[S.length-1]=N,S});try{const d=await fetch(`${P}/chat/stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:f,model:R==="router"?void 0:R,user_id:E,conversation_id:$,stream:!0,tools:"auto"}),signal:x.signal});if(!d.ok||!d.body){y(A=>{A.content=`⚠️ Backend error ${d.status}. ${d.status===503?"No inference credential available — see GAP CHECK.":""}`}),k(!1);return}const w=d.body.getReader(),S=new TextDecoder;let N="";for(;;){const{done:A,value:ue}=await w.read();if(A)break;N+=S.decode(ue,{stream:!0});const G=N.split(`
`);N=G.pop()||"";for(const me of G){let q="";const Q=[];for(const u of me.split(`
`)){const z=u.trimEnd();z.startsWith("event:")?q=z.slice(6).trim():z.startsWith("data:")&&Q.push(z.slice(5).trim())}const D=Q.join(`
`);if(!D||D==="[DONE]")continue;let s;try{s=JSON.parse(D)}catch{continue}switch(q&&!s.type&&(s.type=q),s.type){case"route":y(u=>{u.model=s.model,u.tier=s.tier});break;case"token":case"delta":y(u=>{u.content+=s.text??s.delta??""});break;case"tool_call":y(u=>{u.tools=[...u.tools||[],{id:s.id||s.name||String(Math.random()),name:s.name,args:s.arguments??s.args,gate:s.gate,status:"pending"}]});break;case"tool_result":y(u=>{const z=u.tools||[];let X=!1;u.tools=z.slice().reverse().map(C=>!X&&C.name===s.name&&C.status==="pending"?(X=!0,{...C,result:s.result??s.error,status:s.gate&&s.gate.allow===!1||s.ok===!1?"denied":"done",gate:s.gate||C.gate}):C).reverse()});break;case"done":y(u=>{u.latency_ms=s.latency_ms,u.cost_usd=s.cost_usd,u.yuyay13=s.yuyay13,u.khipu=s.khipu_hash??s.khipu,s.model&&(u.model=s.model),s.tier&&(u.tier=s.tier)});break;case"error":y(u=>{u.content+=`
⚠️ ${s.message||"error"}`});break}}}}catch(d){(d==null?void 0:d.name)!=="AbortError"&&y(w=>{w.content+=`
⚠️ ${(d==null?void 0:d.message)||"stream failed"}`})}finally{k(!1),H.current=null}},[c,v,b,a,j,R,E,$]),le=i.useCallback(async()=>{var o;if(I){(o=W.current)==null||o.stop(),K(!1);return}try{const l=await navigator.mediaDevices.getUserMedia({audio:!0}),n=new MediaRecorder(l);O.current=[],n.ondataavailable=m=>m.data.size&&O.current.push(m.data),n.onstop=async()=>{l.getTracks().forEach(f=>f.stop());const m=new Blob(O.current,{type:"audio/webm"}),x=new FormData;x.append("file",m,"speech.webm");try{const f=await fetch(`${P}/voice/stt`,{method:"POST",body:x});if(f.ok){const y=await f.json();y.text&&p(h=>(h?h+" ":"")+y.text)}}catch{}},n.start(),W.current=n,K(!0)}catch{}},[I]),ie=i.useCallback(o=>{try{const l=new SpeechSynthesisUtterance(o.replace(/[#*`>_~]/g,"").slice(0,4e3));l.rate=1.05,window.speechSynthesis.cancel(),window.speechSynthesis.speak(l)}catch{}},[]),ce=i.useCallback(o=>{o&&Array.from(o).slice(0,4).forEach(l=>{const n=new FileReader;n.onload=()=>F(m=>[...m,n.result]),n.readAsDataURL(l)})},[]),V=i.useCallback(o=>{var y;let l="",n="text/plain";if(o==="json")l=JSON.stringify({conversation_id:$,user_id:E,system:j,messages:a},null,2),n="application/json";else{l=`# a11oy.code conversation ${$}
`;for(const h of a)l+=`## ${h.role}
${h.content}
`,h.model&&(l+=`> model: ${h.model} · ${h.latency_ms??"?"}ms · Yuyay-13 ${h.yuyay13??"?"} · khipu ${h.khipu??"?"}
`),(y=h.tools)!=null&&y.length&&(l+=h.tools.map(d=>`> tool: ${d.name} (${d.status})`).join(`
`)+`
`);n="text/markdown"}const m=new Blob([l],{type:n}),x=URL.createObjectURL(m),f=document.createElement("a");f.href=x,f.download=`a11oy-code-${$}.${o}`,f.click(),URL.revokeObjectURL(x)},[a,j,$,E]),de=a.length===0;return t.jsxs("div",{className:"flex flex-col h-screen",style:{background:e.bg,color:e.text},children:[t.jsx("style",{children:`
.a11oy-md p { margin: 0 0 8px; }
.a11oy-md h1,.a11oy-md h2,.a11oy-md h3 { color:${e.text}; font-weight:600; margin:12px 0 6px; }
.a11oy-md h1{font-size:18px}.a11oy-md h2{font-size:16px}.a11oy-md h3{font-size:14px}
.a11oy-md a { color:${e.accent}; text-decoration:underline; }
.a11oy-md ul,.a11oy-md ol { margin:0 0 8px; padding-left:20px; }
.a11oy-md li { margin:2px 0; }
.a11oy-md code { font-family:${e.mono}; background:${e.surfaceStrong}; padding:1px 5px; border-radius:4px; font-size:12.5px; }
.a11oy-md pre { background:#111; border:1px solid ${e.border}; border-radius:8px; padding:12px; overflow-x:auto; margin:8px 0; }
.a11oy-md pre code { background:none; padding:0; font-size:12.5px; line-height:1.5; }
.a11oy-md blockquote { border-left:2px solid ${e.border}; margin:8px 0; padding-left:12px; color:${e.dim}; }
.a11oy-md table { border-collapse:collapse; margin:8px 0; font-size:13px; }
.a11oy-md th,.a11oy-md td { border:1px solid ${e.border}; padding:5px 9px; }
.a11oy-md img { max-width:100%; border-radius:8px; margin:6px 0; }
`}),t.jsxs("header",{className:"flex items-center gap-3 px-5 py-3 shrink-0",style:{borderBottom:`1px solid ${e.border}`},children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{style:{fontFamily:e.mono,fontSize:15,fontWeight:700,color:e.accent},children:"a11oy.code"}),t.jsx("span",{style:{fontSize:11,color:e.muted},children:"conversational orchestrator"})]}),t.jsx("div",{className:"flex-1"}),t.jsxs("div",{className:"relative",children:[t.jsx("select",{value:R,onChange:o=>ne(o.target.value),className:"appearance-none rounded-md pr-7 pl-2.5 py-1.5",style:{background:e.surface,border:`1px solid ${e.border}`,color:e.text,fontSize:12,fontFamily:e.mono},children:ae.map(o=>t.jsx("option",{value:o.id,style:{background:"#111"},children:o.label},o.id))}),t.jsx(pe,{size:13,style:{position:"absolute",right:7,top:9,color:e.dim,pointerEvents:"none"}})]}),t.jsx("button",{onClick:()=>oe(o=>!o),title:"System prompt",className:"p-1.5 rounded-md",style:{border:`1px solid ${e.border}`,color:B?e.accent:e.dim},children:t.jsx($e,{size:15})}),t.jsx("button",{onClick:()=>V("md"),title:"Export markdown",className:"p-1.5 rounded-md",style:{border:`1px solid ${e.border}`,color:e.dim},children:t.jsx(be,{size:15})}),t.jsx("button",{onClick:()=>V("json"),title:"Export JSON",className:"px-2 py-1.5 rounded-md",style:{border:`1px solid ${e.border}`,color:e.dim,fontSize:11,fontFamily:e.mono},children:"JSON"})]}),B&&t.jsxs("div",{className:"px-5 py-3 shrink-0",style:{borderBottom:`1px solid ${e.border}`,background:e.surface},children:[t.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[t.jsx("span",{style:{fontSize:11,color:e.dim,fontFamily:e.mono},children:"SYSTEM PROMPT"}),t.jsx("button",{onClick:()=>M(ee),style:{fontSize:11,color:e.accent},children:"reset"})]}),t.jsx("textarea",{value:j,onChange:o=>M(o.target.value),rows:4,className:"w-full rounded-md p-2.5",style:{background:"#111",border:`1px solid ${e.border}`,color:e.text,fontSize:12.5,lineHeight:1.5,resize:"vertical"}})]}),t.jsx("div",{ref:L,className:"flex-1 overflow-y-auto px-4 md:px-8 py-6",children:t.jsxs("div",{className:"max-w-3xl mx-auto space-y-5",children:[de&&t.jsxs(Z.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"text-center py-20",children:[t.jsx("div",{style:{fontFamily:e.mono,fontSize:24,fontWeight:700,color:e.accent},children:"a11oy.code"}),t.jsx("p",{style:{color:e.dim,marginTop:8,fontSize:14},children:"Talk to a11oy. Opus-4.8-quality answers via the unified open-LLM router."}),t.jsx("p",{style:{color:e.muted,marginTop:4,fontSize:12},children:"Ask it to orchestrate Amaru · Sentra · Rosie · Killinchu, or reach GitHub / HF / web / the drone fleet."})]}),a.map((o,l)=>{var x;const n=b&&l===a.length-1&&o.role==="assistant",m=o.role==="user";return t.jsx(Z.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:`flex ${m?"justify-end":"justify-start"}`,children:t.jsxs("div",{className:"rounded-2xl px-4 py-3",style:{maxWidth:m?"80%":"100%",width:m?void 0:"100%",background:m?e.surfaceStrong:"transparent",border:m?`1px solid ${e.border}`:"none"},children:[!m&&t.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[t.jsx("span",{style:{fontFamily:e.mono,fontSize:11,color:e.accent},children:"a11oy"}),n&&t.jsx(ve,{size:12,className:"animate-spin",style:{color:e.dim}}),t.jsx("div",{className:"flex-1"}),!n&&o.content&&t.jsx("button",{onClick:()=>ie(o.content),title:"Speak",style:{color:e.dim},children:t.jsx(ze,{size:13})})]}),(x=o.images)!=null&&x.length?t.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:o.images.map((f,y)=>t.jsx("img",{src:f,style:{maxHeight:120,borderRadius:8,border:`1px solid ${e.border}`}},y))}):null,m?t.jsx("div",{style:{fontSize:14,lineHeight:1.6,whiteSpace:"pre-wrap"},children:o.content}):t.jsxs(t.Fragment,{children:[t.jsx(Fe,{tools:o.tools||[]}),t.jsx(_e,{content:o.content,live:n}),n&&!o.content&&t.jsx("span",{style:{color:e.dim,fontSize:13},children:"thinking…"}),t.jsx(Te,{m:o})]})]})},l)})]})}),t.jsx("div",{className:"shrink-0 px-4 md:px-8 py-4",style:{borderTop:`1px solid ${e.border}`},children:t.jsxs("div",{className:"max-w-3xl mx-auto",children:[v.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:v.map((o,l)=>t.jsxs("div",{className:"relative",children:[t.jsx("img",{src:o,style:{height:56,borderRadius:6,border:`1px solid ${e.border}`}}),t.jsx("button",{onClick:()=>F(n=>n.filter((m,x)=>x!==l)),className:"absolute -top-1.5 -right-1.5 rounded-full p-0.5",style:{background:e.crit,color:"#fff"},children:t.jsx(he,{size:11})})]},l))}),t.jsxs("div",{className:"flex items-end gap-2 rounded-2xl px-3 py-2",style:{background:e.surface,border:`1px solid ${e.borderStrong}`},children:[t.jsx("input",{ref:Y,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:o=>ce(o.target.files)}),t.jsx("button",{onClick:()=>{var o;return(o=Y.current)==null?void 0:o.click()},title:"Attach image",className:"p-1.5",style:{color:e.dim},children:t.jsx(je,{size:18})}),t.jsx("button",{onClick:le,title:"Voice input",className:"p-1.5",style:{color:I?e.crit:e.dim},children:t.jsx(we,{size:18})}),t.jsx("textarea",{value:c,onChange:o=>p(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),J())},placeholder:"Talk to a11oy…",rows:1,className:"flex-1 bg-transparent outline-none resize-none py-1.5",style:{color:e.text,fontSize:14,lineHeight:1.5,maxHeight:160}}),b?t.jsx("button",{onClick:se,className:"p-2 rounded-xl",style:{background:e.crit,color:"#fff"},title:"Stop",children:t.jsx(Ne,{size:16})}):t.jsx("button",{onClick:J,disabled:!c.trim()&&!v.length,className:"p-2 rounded-xl",style:{background:e.accent,color:"#0a0a0a",opacity:!c.trim()&&!v.length?.4:1},title:"Send",children:t.jsx(Se,{size:16})})]}),t.jsx("p",{style:{fontSize:10.5,color:e.muted,marginTop:6,textAlign:"center",fontFamily:e.mono},children:"PURIQ-gated · Khipu-receipted · Yuyay-13 · state-changing actions require 2-person attestation"})]})})]})}export{qe as A11oyCodeChat,qe as default};