agent-relay-server 0.35.3 → 0.35.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/docs/openapi.json +1 -1
  2. package/package.json +1 -1
  3. package/public/assets/{activity-WjOShx3N.js → activity-CPuZGkeP.js} +2 -2
  4. package/public/assets/{activity-WjOShx3N.js.map → activity-CPuZGkeP.js.map} +1 -1
  5. package/public/assets/{agents-Cihuuoxa.js → agents-Bz4eJ4zH.js} +2 -2
  6. package/public/assets/{agents-Cihuuoxa.js.map → agents-Bz4eJ4zH.js.map} +1 -1
  7. package/public/assets/{analytics-B5_HS2Lt.js → analytics-inmkBD_j.js} +2 -2
  8. package/public/assets/{analytics-B5_HS2Lt.js.map → analytics-inmkBD_j.js.map} +1 -1
  9. package/public/assets/{automation-CoOe2nEA.js → automation-DRN2lcqQ.js} +2 -2
  10. package/public/assets/{automation-CoOe2nEA.js.map → automation-DRN2lcqQ.js.map} +1 -1
  11. package/public/assets/chat-Dn3TEhl0.js +2 -0
  12. package/public/assets/chat-Dn3TEhl0.js.map +1 -0
  13. package/public/assets/display-Bebqs1qu.js.map +1 -1
  14. package/public/assets/{formatted-body-impl-DhCblnWM.js → formatted-body-impl-DP9iZsd4.js} +2 -2
  15. package/public/assets/{formatted-body-impl-DhCblnWM.js.map → formatted-body-impl-DP9iZsd4.js.map} +1 -1
  16. package/public/assets/{index-CvSlyTSI.js → index-BL8r94_U.js} +5 -5
  17. package/public/assets/{index-CvSlyTSI.js.map → index-BL8r94_U.js.map} +1 -1
  18. package/public/assets/{maintenance-CUxxVXsc.js → maintenance-DtfpsMZa.js} +2 -2
  19. package/public/assets/{maintenance-CUxxVXsc.js.map → maintenance-DtfpsMZa.js.map} +1 -1
  20. package/public/assets/{managed-agents-VZEeMMSP.js → managed-agents-C5pzetBh.js} +2 -2
  21. package/public/assets/{managed-agents-VZEeMMSP.js.map → managed-agents-C5pzetBh.js.map} +1 -1
  22. package/public/assets/{markdown-preview-impl-Bbwmbxvn.js → markdown-preview-impl-4s9YDGM7.js} +2 -2
  23. package/public/assets/{markdown-preview-impl-Bbwmbxvn.js.map → markdown-preview-impl-4s9YDGM7.js.map} +1 -1
  24. package/public/assets/{memory-BQAC3YmR.js → memory-BWfDbph3.js} +2 -2
  25. package/public/assets/{memory-BQAC3YmR.js.map → memory-BWfDbph3.js.map} +1 -1
  26. package/public/assets/{messages-_sdHV42k.js → messages-C8cP25kp.js} +2 -2
  27. package/public/assets/{messages-_sdHV42k.js.map → messages-C8cP25kp.js.map} +1 -1
  28. package/public/assets/{orchestrators-BkHHgd83.js → orchestrators-Clu8MNKo.js} +2 -2
  29. package/public/assets/{orchestrators-BkHHgd83.js.map → orchestrators-Clu8MNKo.js.map} +1 -1
  30. package/public/assets/{overview-CYAHOUyA.js → overview-CXcGh2D6.js} +2 -2
  31. package/public/assets/{overview-CYAHOUyA.js.map → overview-CXcGh2D6.js.map} +1 -1
  32. package/public/assets/{pairs-BvMH1CS7.js → pairs-eOZl_lQn.js} +2 -2
  33. package/public/assets/{pairs-BvMH1CS7.js.map → pairs-eOZl_lQn.js.map} +1 -1
  34. package/public/assets/{security-Dsdr3lSX.js → security-CA03sHyP.js} +2 -2
  35. package/public/assets/{security-Dsdr3lSX.js.map → security-CA03sHyP.js.map} +1 -1
  36. package/public/assets/{settings-DlovIWdE.js → settings-KTOwGJiW.js} +2 -2
  37. package/public/assets/{settings-DlovIWdE.js.map → settings-KTOwGJiW.js.map} +1 -1
  38. package/public/assets/{tasks-Cgan8Oqb.js → tasks-D6jbr2y6.js} +2 -2
  39. package/public/assets/{tasks-Cgan8Oqb.js.map → tasks-D6jbr2y6.js.map} +1 -1
  40. package/public/assets/{terminal-viewer-impl-DVW-LRbz.js → terminal-viewer-impl-DFODXxpG.js} +2 -2
  41. package/public/assets/{terminal-viewer-impl-DVW-LRbz.js.map → terminal-viewer-impl-DFODXxpG.js.map} +1 -1
  42. package/public/assets/{work-queue-B4CifZKH.js → work-queue-BWWckTVy.js} +2 -2
  43. package/public/assets/{work-queue-B4CifZKH.js.map → work-queue-BWWckTVy.js.map} +1 -1
  44. package/public/index.html +1 -1
  45. package/public/assets/chat-0ZbxHlDu.js +0 -2
  46. package/public/assets/chat-0ZbxHlDu.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,An as n,D as r,Dn as i,Dt as a,E as o,Et as s,Ft as c,G as l,H as u,I as d,It as f,J as p,Jt as m,K as h,Lt as g,P as _,Pn as v,Vn as y,Wt as b,Z as x,an as S,at as C,b as w,c as T,dn as E,en as D,et as O,g as k,i as A,in as j,it as M,jn as ee,kn as N,kt as P,mn as te,nn as ne,qt as F,r as I,rn as re,s as ie,tn as L,tt as ae,wn as oe,x as se,xn as ce,yn as R,yt as z}from"./lucide-react-CD8Xl2U3.js";import{t as le}from"./react-dom-CX8inunm.js";import{d as ue,i as de,l as fe,s as pe,t as B,u as me}from"./store-CICRhg1m.js";import{B as V,D as H,E as he,F as U,H as ge,J as _e,L as ve,M as ye,N as be,O as xe,S as Se,U as Ce,a as we,et as W,g as Te,i as Ee,m as De,u as G,w as K,z as Oe}from"./display-Bebqs1qu.js";import{t as q}from"./badge-t8zAwHW9.js";import{t as J}from"./button-DDA5P2YQ.js";import{t as ke}from"./input-BW9UD3FM.js";import{t as Ae}from"./copy-button-CE8e2c-F.js";import{C as je,E as Me,I as Ne,S as Pe,T as Fe,_ as Ie,a as Le,d as Re,g as ze,h as Be,i as Ve,k as He,l as Ue,m as We,o as Ge,p as Ke,r as qe,t as Je,v as Ye,w as Y,y as Xe}from"./index-BL8r94_U.js";import{t as Ze}from"./use-keyboard-viewport-DxY_xJV5.js";import{n as Qe,t as $e}from"./branch-state-badge-EliCEAQI.js";var X=e(y(),1);function et(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function tt(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function nt(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function rt(e,t){return e.filter(e=>e.status===`online`&&ye(t,e.baseDir)).sort((e,t)=>H(t.baseDir).length-H(e.baseDir).length)[0]||e.find(e=>e.status===`online`)}function it(){return typeof window<`u`&&window.matchMedia(`(min-width: 1280px)`).matches}function at(){return typeof window<`u`&&!!window.getSelection()?.toString()}function ot(e){let t=e.payload?.attachments;return Array.isArray(t)?t.filter(e=>!!(e&&typeof e==`object`&&typeof e.artifactId==`string`)):[]}var st=[`👍`,`❤️`,`✅`,`👀`];function Z(e){let t=new Map;for(let n of e.reactions||[]){let e=xe(n.emoji),r=t.get(e)??{emoji:e,count:0,mine:!1,actors:[]};r.count+=1,r.mine=r.mine||n.actorId===`user`,r.actors.push(n.actorId),t.set(e,r)}return[...t.values()].sort((e,t)=>t.count-e.count||e.emoji.localeCompare(t.emoji))}function Q(e){return Se(e)}function ct(e,n){let r=e.readBy||[],i=e.resolvedToAgent||n||e.to,a=i?r.includes(i):!1,o=r.some(e=>e!==W);if(a||o){let e=a?i:r.find(e=>e!==W);return{label:`read`,title:e?`Read by ${e}`:`Read by agent`,tone:`ok`,icon:S}}if(e.deliveryStatus===`delivered`)return{label:`delivered`,title:`Delivered to agent inbox`,tone:`ok`,icon:S};if(e.deliveryStatus===`queued`)return{label:`queued`,title:`Queued until the target agent is available`,tone:`warn`,icon:b};if(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`){let n=e.deliveryPoisonReason||e.deliveryLastError||e.deliveryStatus;return{label:e.deliveryStatus,title:n,tone:`danger`,icon:t}}return{label:`sent`,title:`Accepted by Relay`,tone:`muted`,icon:j}}function lt(e){let t=V(e.createdAt);return(e.reactions||[]).reduce((e,t)=>Math.max(e,V(t.updatedAt||t.createdAt)),t)}function ut(e){return e?e.messages.reduce((e,t)=>Math.max(e,lt(t)),0):0}function dt(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function ft(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function pt(){let e=B(e=>e.agents),t=B(e=>e.showBuiltIns),n=B(e=>e.showOffline),r=B(e=>e.chatAgentSearch),i=B(e=>e.chatAgentProviderFilter),a=B(e=>e.chatAgentStatusFilter),o=B(e=>e.chatAgentTagFilter),s=B(e=>e.chatAgentCapFilter),c=B(e=>e.chatAgentHostFilter),l=B(e=>e.chatAgentSort),u=B(e=>e.chatAgentSortDir),d=B(e=>e.managedPolicies);return(0,X.useMemo)(()=>{let f=Ce(e,t,d);if(n||(f=f.filter(e=>e.status!==`offline`)),r){let e=r.toLowerCase();f=f.filter(t=>t.id.toLowerCase().includes(e)||(t.name||``).toLowerCase().includes(e)||(t.label||``).toLowerCase().includes(e)||(t.tags||[]).some(t=>t.toLowerCase().includes(e))||(t.capabilities||[]).some(t=>t.toLowerCase().includes(e)))}i&&(f=f.filter(e=>we(e)===i)),a&&(f=f.filter(e=>e.status===a)),o&&(f=f.filter(e=>(e.tags||[]).includes(o))),s&&(f=f.filter(e=>(e.capabilities||[]).includes(s))),c&&(f=f.filter(e=>(e.machine||``)===c));let p=u===`desc`?-1:1;return[...f].sort((e,t)=>l===`name`?G(e).localeCompare(G(t))*p:l===`lastSeen`?(V(t.lastSeen)-V(e.lastSeen))*p||G(e).localeCompare(G(t)):((_e[e.status]??9)-(_e[t.status]??9))*p||G(e).localeCompare(G(t)))},[e,t,n,d,r,i,a,o,s,c,l,u])}var $=N();function mt({threads:e,onSelectAgent:t}){let n=B(e=>e.set),a=B(e=>e.openInboxThread),o=B(e=>e.openAgentSpawn),s=B(e=>e.selectedInboxThread),c=B(e=>e.chatAgentSearch),l=B(e=>e.chatAgentSort),u=B(e=>e.chatAgentSortDir),f=B(e=>e.chatAgentProviderFilter),p=B(e=>e.chatAgentStatusFilter),m=B(e=>e.chatAgentTagFilter),h=B(e=>e.chatAgentCapFilter),g=B(e=>e.chatAgentHostFilter),_=B(e=>e.chatAgentGroupBy),v=B(e=>e.chatAgentFiltersCollapsed),y=de(),b=pt(),x=(0,X.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.peer,n);return t},[e]),S=(0,X.useMemo)(()=>{if(l!==`lastMessage`)return b;let e=u===`desc`?-1:1;return[...b].sort((t,n)=>{let r=ut(x.get(t.id));return(ut(x.get(n.id))-r)*e||G(t).localeCompare(G(n))})},[b,l,u,x]),C=(0,X.useMemo)(()=>[...new Set(b.flatMap(e=>e.tags||[]))],[b]),w=(0,X.useMemo)(()=>[...new Set(b.flatMap(e=>ge(e.capabilities||[])))],[b]),T=Ne(),E=(0,X.useMemo)(()=>{if(_!==`project`)return null;let e=new Map;for(let t of S){let n=We(t)||`No project`,r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[S,_]),O=[f,p,m,h,g].filter(Boolean).length;function k(e){a(e,x.get(e)?.messages),t?.(e)}function A(e){let t=x.get(e.id),n=t?.attention.unread||0,r=t?.previewMessage,a=ut(t),o=s===e.id,c=Be(e),l=We(e),u=c.Icon;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{className:i(`w-full text-left px-3 py-2.5 flex items-start gap-2.5 hover:bg-muted/50 transition-colors border-b border-border/50`,o&&`bg-muted/60`),onClick:()=>k(e.id),children:[(0,$.jsxs)(`div`,{className:`relative shrink-0 mt-0.5`,children:[(0,$.jsx)(ze,{agent:e}),(0,$.jsx)(Ie,{agent:e,now:y,className:`absolute -bottom-0.5 -right-0.5 w-2 h-2`})]}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-1 mb-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium truncate`,children:G(e)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[a>0&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,title:De(a),children:Oe(y,a)}),n>0&&(0,$.jsx)(q,{className:`bg-red-500 text-white text-xs min-w-[18px] h-[18px] flex items-center justify-center shrink-0 px-1`,children:n})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-0.5 text-[10px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{title:c.title,className:`inline-flex shrink-0`,children:(0,$.jsx)(u,{className:i(`h-3 w-3`,c.iconColor)})}),(0,$.jsx)(`span`,{className:`truncate`,children:l||c.label}),e.context&&(0,$.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,$.jsx)(Ke,{utilization:e.context.utilization,size:18})})]}),r&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate leading-tight`,children:[r.from===`user`?`You: `:``,he(r)]}),e.status!==`offline`&&(0,$.jsx)(`div`,{className:`mt-1`,children:(0,$.jsx)(`span`,{className:i(`text-xs`,e.status===`busy`?`text-yellow-400`:`text-emerald-400`),children:e.status})})]})]})},e.id)}return(0,$.jsxs)(`div`,{className:`flex flex-col h-full border-r border-border min-w-0`,children:[(0,$.jsxs)(`div`,{className:`p-3 border-b border-border space-y-2`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(r,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground pointer-events-none`}),(0,$.jsx)(ke,{placeholder:`Search agents...`,value:c,onChange:e=>n({chatAgentSearch:e.target.value}),className:`pl-8 h-7 text-xs`})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n({chatAgentFiltersCollapsed:!v}),className:`sm:hidden flex w-full items-center justify-between h-6 px-1.5 text-xs rounded-md border border-border bg-background text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(se,{className:`w-3.5 h-3.5`}),`Filters & sort`,O>0&&(0,$.jsx)(q,{className:`bg-primary/20 text-primary text-[10px] h-4 min-w-4 px-1 flex items-center justify-center`,children:O})]}),v?(0,$.jsx)(re,{className:`w-3.5 h-3.5`}):(0,$.jsx)(D,{className:`w-3.5 h-3.5`})]}),(0,$.jsxs)(`div`,{className:i(`space-y-2`,v?`hidden`:`block`,`sm:block`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsxs)(`select`,{value:l,onChange:e=>n({chatAgentSort:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,$.jsx)(`option`,{value:`status`,children:`By status`}),(0,$.jsx)(`option`,{value:`name`,children:`By name`}),(0,$.jsx)(`option`,{value:`lastSeen`,children:`By last seen`}),(0,$.jsx)(`option`,{value:`lastMessage`,children:`By last activity`})]}),(0,$.jsx)(J,{variant:`ghost`,size:`icon-xs`,onClick:()=>n({chatAgentSortDir:u===`asc`?`desc`:`asc`}),children:u===`asc`?(0,$.jsx)(R,{className:`w-3.5 h-3.5`}):(0,$.jsx)(oe,{className:`w-3.5 h-3.5`})})]}),(0,$.jsxs)(`select`,{value:_,onChange:e=>n({chatAgentGroupBy:e.target.value}),className:`w-full h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`No grouping`}),(0,$.jsx)(`option`,{value:`project`,children:`Group by project`})]}),(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(`select`,{value:f,onChange:e=>n({chatAgentProviderFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`All types`}),(0,$.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,$.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,$.jsx)(`option`,{value:`agent`,children:`Agent`}),(0,$.jsx)(`option`,{value:`user`,children:`User`})]}),(0,$.jsxs)(`select`,{value:p,onChange:e=>n({chatAgentStatusFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`All status`}),(0,$.jsx)(`option`,{value:`online`,children:`Online`}),(0,$.jsx)(`option`,{value:`idle`,children:`Idle`}),(0,$.jsx)(`option`,{value:`busy`,children:`Busy`}),(0,$.jsx)(`option`,{value:`offline`,children:`Offline`})]}),T.length>1&&(0,$.jsxs)(`select`,{value:g,onChange:e=>n({chatAgentHostFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`All hosts`}),T.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]}),(C.length>0||w.length>0)&&(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[C.length>0&&(0,$.jsxs)(`select`,{value:m,onChange:e=>n({chatAgentTagFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`All tags`}),C.map(e=>(0,$.jsxs)(`option`,{value:e,children:[`#`,e]},e))]}),w.length>0&&(0,$.jsxs)(`select`,{value:h,onChange:e=>n({chatAgentCapFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`All caps`}),w.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]})]})]}),(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full shrink-0 items-center gap-2.5 border-b border-border px-3 py-2 text-left transition-colors hover:bg-muted/50`,onClick:o,children:[(0,$.jsx)(`div`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-dashed border-primary/50 bg-primary/10 text-primary`,children:(0,$.jsx)(d,{className:`h-3.5 w-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium`,children:`New Agent`}),(0,$.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:`Spawn a fresh chat agent`})]})]}),(0,$.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:S.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-10 text-center px-4`,children:[(0,$.jsx)(te,{className:`w-8 h-8 text-zinc-600 mb-2`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No agents match filters`})]}):E?E.map(([e,t])=>(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-1.5 border-b border-border/50 bg-background/95 px-3 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground backdrop-blur`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e}),(0,$.jsx)(`span`,{className:`text-muted-foreground/50`,children:t.length})]}),(0,$.jsx)(`ul`,{children:t.map(A)})]},e)):(0,$.jsx)(`ul`,{children:S.map(A)})})]})}var ht=[{name:`/reply`,source:`skill`,description:`Reply to a relay message by id`,argumentHint:`<messageId> <body>`},{name:`/message`,source:`skill`,description:`Send a relay message to an agent, label, tag, or broadcast`,argumentHint:`<target> <body>`},{name:`/pair`,source:`skill`,description:`Start or manage a two-agent pair session`},{name:`/react`,source:`skill`,description:`Add a reaction to a relay message`,argumentHint:`<messageId> <emoji>`},{name:`/read-message`,source:`skill`,description:`Fetch a full relay message by id`,argumentHint:`<messageId>`},{name:`/send-claimable`,source:`skill`,description:`Enqueue a claimable work item for one agent to claim`},{name:`/status`,source:`skill`,description:`Show this agent's relay status`},{name:`/tags`,source:`skill`,description:`List or update this agent's relay tags`},{name:`/label`,source:`skill`,description:`Read, set, or clear this agent's relay label`},{name:`/disconnect`,source:`skill`,description:`End the current relay pair session`}],gt=[{name:`/clear`,source:`builtin`,description:`Clear conversation history and free up context`},{name:`/compact`,source:`builtin`,description:`Compact the conversation to reclaim context`,argumentHint:`[instructions]`},{name:`/model`,source:`builtin`,description:`Switch the active model`,argumentHint:`[model]`},{name:`/help`,source:`builtin`,description:`Show help`}],_t=[{name:`/compact`,source:`builtin`,description:`Compact the conversation to reclaim context`},{name:`/new`,source:`builtin`,description:`Start a new thread`}];function vt(e){return[...e===`claude`?gt:e===`codex`?_t:[],...ht]}function yt({selectedInboxThread:e,agent:t,now:n,blockedState:r,thread:i,exportableThread:o,importedHistory:u,showBackButton:d,onBack:p,openAgentDetail:h,openWorkspaceFocus:v,voiceTtsEnabled:y,setVoiceTtsEnabled:b,canOpenTerminal:x,terminalOpening:S,handleOpenTerminal:C,canInterrupt:w,interruptAgent:E,canCompact:D,canClearContext:A,canShutdown:j,openConfirm:M,workspaceAction:ee,doAgentAction:N,openFilesForAgent:P,forkFromAgent:te,markInboxThreadUnread:ne,markInboxThreadRead:F,exportThread:I}){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-3 md:px-4 py-2.5 md:py-3 border-b border-border shrink-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 md:gap-2.5 min-w-0`,children:[d&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,onClick:p,className:`shrink-0 -ml-1`,children:(0,$.jsx)(ce,{className:`w-4 h-4`})}),(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 md:gap-2.5 min-w-0 hover:opacity-80 transition-opacity`,onClick:()=>t&&h(t),disabled:!t,children:[(0,$.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,$.jsx)(ze,{agent:t}),(0,$.jsx)(Ie,{agent:t,now:n,className:`absolute -bottom-0.5 -right-0.5 w-2 h-2`})]}),(0,$.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t?G(t):e}),t&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[r?`blocked: ${r.label}`:t.status,t.machine&&` · ${t.machine}`,typeof t.meta?.cwd==`string`&&t.meta.cwd&&` · ${ve(t.meta.cwd,1)}`]})]})]}),t&&(0,$.jsx)(Re,{agent:t,compact:!0,className:`hidden @4xl/chat:flex shrink-0`}),t?.context&&(0,$.jsx)(Ke,{utilization:t.context.utilization}),t?.branchState&&t.branchWorkspaceId&&(0,$.jsx)($e,{state:t.branchState,className:`shrink-0`,onClick:()=>void v(t.branchWorkspaceId)}),i?.attention.unread?(0,$.jsxs)(q,{className:`bg-red-500/20 text-red-400 text-xs shrink-0 hidden @2xl/chat:flex`,children:[i.attention.unread,` unread`]}):null]}),(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 md:gap-1 shrink-0`,children:t&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ae,{value:t.id,label:`Copy agent ID`,size:`icon-sm`}),ue.available&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,title:y?`Speaking agent responses aloud — click to mute (engine & voice in Settings)`:`Speak agent responses aloud (active chat) — engine & voice in Settings`,className:y?`text-primary`:``,onClick:()=>b(!y),children:y?(0,$.jsx)(T,{className:`w-3.5 h-3.5`}):(0,$.jsx)(ie,{className:`w-3.5 h-3.5`})}),x&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,disabled:S,title:`Terminal`,onClick:()=>void C(),children:(0,$.jsx)(k,{className:`w-3.5 h-3.5`})}),w&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`text-red-400 hover:text-red-300`,title:`Interrupt`,onClick:E,children:(0,$.jsx)(m,{className:`w-3.5 h-3.5`})}),(t.branchState===`changes`||t.branchState===`idle`)&&t.branchWorkspaceId&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex text-amber-400 hover:text-amber-300`,title:`Mark workspace ready — hand off to the auto-merge`,onClick:()=>M(`Mark Workspace Ready`,`Mark ${G(t)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>ee(t.branchWorkspaceId,`ready`)),children:(0,$.jsx)(a,{className:`w-3.5 h-3.5`})}),D&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Compact`,onClick:()=>M(`Compact Agent`,`Compact context for ${G(t)}?`,()=>N(t,`compact`)),children:(0,$.jsx)(l,{className:`w-3.5 h-3.5`})}),A&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Clear context`,onClick:()=>M(`Clear Context`,`Clear context for ${G(t)}?`,()=>N(t,`clearContext`)),children:(0,$.jsx)(c,{className:`w-3.5 h-3.5`})}),j&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Shutdown`,onClick:()=>M(`Shutdown Agent`,`Shutdown ${G(t)}?`,()=>N(t,`shutdown`)),children:(0,$.jsx)(_,{className:`w-3.5 h-3.5`})}),t&&typeof t.meta?.cwd==`string`&&t.meta.cwd&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Open ${t.meta.cwd} in Files`,onClick:()=>void P(t),children:(0,$.jsx)(s,{className:`w-3.5 h-3.5`})}),t&&i&&i.messages.length>0&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Fork — spawn new agent with this chat history`,onClick:()=>te(t.id,i.messages),children:(0,$.jsx)(z,{className:`w-3.5 h-3.5`})}),i&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Mark unread`,onClick:()=>ne(e),children:(0,$.jsx)(O,{className:`w-3.5 h-3.5`})}),i&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Mark read`,onClick:()=>F(i.peer,i.messages),children:(0,$.jsx)(ae,{className:`w-3.5 h-3.5`})}),o&&(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Export thread`,onClick:()=>I({...o,importedHistory:u},`json`),children:(0,$.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,$.jsxs)(Pe,{children:[(0,$.jsx)(Me,{asChild:!0,children:(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`@4xl/chat:hidden`,children:(0,$.jsx)(f,{className:`w-3.5 h-3.5`})})}),(0,$.jsxs)(je,{align:`end`,children:[x&&(0,$.jsxs)(Y,{disabled:S,onClick:()=>void C(),children:[(0,$.jsx)(k,{className:`w-3.5 h-3.5`}),`Terminal`]}),w&&(0,$.jsxs)(Y,{onClick:E,children:[(0,$.jsx)(m,{className:`w-3.5 h-3.5`}),`Interrupt`]}),(t.branchState===`changes`||t.branchState===`idle`)&&t.branchWorkspaceId&&(0,$.jsxs)(Y,{onClick:()=>M(`Mark Workspace Ready`,`Mark ${G(t)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>ee(t.branchWorkspaceId,`ready`)),children:[(0,$.jsx)(a,{className:`w-3.5 h-3.5`}),`Mark Ready`]}),D&&(0,$.jsxs)(Y,{onClick:()=>M(`Compact Agent`,`Compact context for ${G(t)}?`,()=>N(t,`compact`)),children:[(0,$.jsx)(l,{className:`w-3.5 h-3.5`}),`Compact`]}),A&&(0,$.jsxs)(Y,{onClick:()=>M(`Clear Context`,`Clear context for ${G(t)}?`,()=>N(t,`clearContext`)),children:[(0,$.jsx)(c,{className:`w-3.5 h-3.5`}),`Clear Context`]}),j&&(0,$.jsxs)(Y,{onClick:()=>M(`Shutdown Agent`,`Shutdown ${G(t)}?`,()=>N(t,`shutdown`)),children:[(0,$.jsx)(_,{className:`w-3.5 h-3.5`}),`Shutdown`]}),t&&typeof t.meta?.cwd==`string`&&t.meta.cwd&&(0,$.jsxs)(Y,{onClick:()=>void P(t),children:[(0,$.jsx)(s,{className:`w-3.5 h-3.5`}),`Open Files`]}),t&&i&&i.messages.length>0&&(0,$.jsxs)(Y,{onClick:()=>te(t.id,i.messages),children:[(0,$.jsx)(z,{className:`w-3.5 h-3.5`}),`Fork`]}),(x||D||A||j)&&(0,$.jsx)(Fe,{}),i&&(0,$.jsxs)(Y,{onClick:()=>ne(e),children:[(0,$.jsx)(O,{className:`w-3.5 h-3.5`}),`Mark Unread`]}),i&&(0,$.jsxs)(Y,{onClick:()=>F(i.peer,i.messages),children:[(0,$.jsx)(ae,{className:`w-3.5 h-3.5`}),`Mark Read`]}),o&&(0,$.jsxs)(Y,{onClick:()=>I({...o,importedHistory:u},`json`),children:[(0,$.jsx)(g,{className:`w-3.5 h-3.5`}),`Download`]})]})]})]})})]})}function bt({matches:e,activeIndex:t,onAccept:n,onHover:r}){return e.length===0?null:(0,$.jsx)(`div`,{className:`absolute bottom-full left-3 right-3 md:left-4 md:right-4 mb-2 z-20 max-h-64 overflow-auto rounded-xl border border-border bg-popover shadow-lg`,children:e.map((e,a)=>(0,$.jsxs)(`button`,{onMouseDown:t=>{t.preventDefault(),n(e)},onMouseEnter:()=>r(a),className:i(`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm`,a===t?`bg-accent`:`hover:bg-accent/50`),children:[(0,$.jsx)(`span`,{className:`font-medium shrink-0`,children:e.name}),e.argumentHint&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:e.argumentHint}),e.description&&(0,$.jsx)(`span`,{className:`ml-auto truncate text-xs text-muted-foreground/70`,children:e.description})]},e.name))})}function xt({value:e,onChange:t,onKeyDown:n,onPaste:r,placeholder:a,className:o}){let s=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=s.current;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,200)+`px`)},[e]),(0,X.useEffect)(()=>{let e=window.visualViewport;if(!e)return;function t(){let e=s.current;!e||document.activeElement!==e||requestAnimationFrame(()=>{e.scrollIntoView({block:`nearest`,behavior:`smooth`})})}return e.addEventListener(`resize`,t),()=>e.removeEventListener(`resize`,t)},[]),(0,$.jsx)(`textarea`,{ref:s,value:e,onChange:t,onKeyDown:n,onPaste:r,placeholder:a,rows:1,className:i(`w-full resize-none rounded-xl border border-border bg-background px-3.5 py-2.5 text-sm`,`placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`min-h-[42px] max-h-[200px] overflow-y-auto`,o)})}function St({item:e,onRemove:n}){let[r,a]=(0,X.useState)(!1),o=!!(e.previewUrl&&!e.error);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-border bg-card px-2.5 py-2 text-xs`,children:[(0,$.jsx)(`button`,{type:`button`,disabled:!o,onClick:()=>a(!0),className:`group/pending relative flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded bg-muted disabled:cursor-default`,title:o?`Preview image`:e.fileName,children:e.previewUrl?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`img`,{src:e.previewUrl,alt:e.fileName,className:`h-full w-full object-cover`}),(0,$.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/pending:bg-black/30 transition-colors`,children:(0,$.jsx)(I,{className:`h-3.5 w-3.5 text-white opacity-0 group-hover/pending:opacity-100 transition-opacity drop-shadow-md`})})]}):e.error?(0,$.jsx)(t,{className:`h-4 w-4 text-red-400`}):e.uploading?(0,$.jsx)(M,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,$.jsx)(P,{className:`h-4 w-4 text-muted-foreground`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate font-medium`,children:e.fileName}),(0,$.jsx)(`p`,{className:i(`truncate text-muted-foreground`,e.error&&`text-red-400`),children:e.error||(e.uploading?`Uploading`:et(e.size))})]}),(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,title:`Remove attachment`,onClick:n,children:(0,$.jsx)(A,{className:`h-3.5 w-3.5`})})]}),e.previewUrl&&(0,$.jsx)(Ve,{open:r,onOpenChange:a,children:(0,$.jsxs)(Le,{className:`max-w-[95vw] max-h-[95vh] w-auto p-0 bg-black/95 border-zinc-800 gap-0 overflow-hidden`,showCloseButton:!1,children:[(0,$.jsx)(Ge,{className:`sr-only`,children:e.fileName}),(0,$.jsxs)(`div`,{className:`relative flex items-center justify-center min-h-[200px]`,children:[(0,$.jsx)(`img`,{src:e.previewUrl,alt:e.fileName,className:`max-w-[93vw] max-h-[90vh] object-contain`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>a(!1),className:`absolute top-2 right-2 rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Close`,children:(0,$.jsx)(A,{className:`w-4 h-4`})})]})]})})]})}function Ct({draft:e,placeholder:t,chatSending:n,disabled:r,hasPendingUploads:a,readyAttachmentCount:s,pendingAttachments:c,micAvailable:l,micState:d,slashMatches:f,slashActiveIndex:p,onDraftChange:m,onKeyDown:g,onPaste:_,onUploadFiles:v,onRemovePendingAttachment:y,onSend:b,onAcceptSlash:x,onSlashHover:S,onStartPtt:C,onStopPtt:w,footerText:T}){let E=(0,X.useRef)(null),[D,O]=(0,X.useState)(!1),k=!e.trim()&&s===0||a||n||r;return(0,$.jsxs)(`div`,{className:i(`relative shrink-0 border-t border-border px-3 md:px-4 py-2.5 md:py-3 safe-area-bottom`,D&&`bg-primary/5 ring-1 ring-primary/40`),onDragOver:e=>{e.preventDefault(),O(!0)},onDragLeave:()=>O(!1),onDrop:e=>{e.preventDefault(),O(!1),v(e.dataTransfer.files)},children:[c.length>0&&(0,$.jsx)(`div`,{className:`mb-2 grid gap-2 sm:grid-cols-2`,children:c.map(e=>(0,$.jsx)(St,{item:e,onRemove:()=>y(e.id)},e.id))}),(0,$.jsx)(`input`,{ref:E,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files&&v(e.target.files),e.currentTarget.value=``}}),(0,$.jsx)(bt,{matches:f,activeIndex:p,onAccept:x,onHover:S}),(0,$.jsxs)(`div`,{className:`hidden md:flex items-end gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,size:`icon`,title:`Attach files`,disabled:n,onClick:()=>E.current?.click(),className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px]`,children:(0,$.jsx)(u,{className:`w-4 h-4`})}),(0,$.jsx)(xt,{value:e,onChange:e=>m(e.target.value),onKeyDown:g,onPaste:_,placeholder:t,className:`flex-1`}),l&&(0,$.jsx)(J,{variant:`ghost`,size:`icon`,title:d===`recording`?`Release to transcribe`:`Hold to talk`,disabled:n||d===`transcribing`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),C()},onPointerUp:e=>{e.preventDefault();try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}w()},className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px] ${d===`recording`?`text-red-400 animate-pulse`:``}`,children:d===`transcribing`?(0,$.jsx)(M,{className:`w-4 h-4 animate-spin`}):(0,$.jsx)(h,{className:`w-4 h-4`})}),(0,$.jsx)(J,{size:`icon`,disabled:k,onClick:b,className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px]`,children:(0,$.jsx)(o,{className:`w-4 h-4`})})]}),(0,$.jsxs)(`div`,{className:`md:hidden space-y-2`,children:[(0,$.jsx)(xt,{value:e,onChange:e=>m(e.target.value),onKeyDown:g,onPaste:_,placeholder:t,className:`w-full`}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,size:`icon`,title:`Attach files`,disabled:n,onClick:()=>E.current?.click(),className:`rounded-xl h-9 w-9`,children:(0,$.jsx)(u,{className:`w-4 h-4`})}),l&&(0,$.jsx)(J,{variant:`ghost`,size:`icon`,title:d===`recording`?`Release to transcribe`:`Hold to talk`,disabled:n||d===`transcribing`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),C()},onPointerUp:e=>{e.preventDefault();try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}w()},className:`rounded-xl h-9 w-9 ${d===`recording`?`text-red-400 animate-pulse`:``}`,children:d===`transcribing`?(0,$.jsx)(M,{className:`w-4 h-4 animate-spin`}):(0,$.jsx)(h,{className:`w-4 h-4`})})]}),(0,$.jsx)(J,{size:`icon`,disabled:k,onClick:b,className:`rounded-xl h-9 w-9`,children:(0,$.jsx)(o,{className:`w-4 h-4`})})]})]}),T&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1.5 hidden md:block`,children:T})]})}var wt=e(le(),1);function Tt({preview:e,error:t,onReadError:n,onMouseEnter:r,onMouseLeave:i}){let{anchor:a}=e,o=Math.min(560,window.innerWidth-24),s=Math.min(380,window.innerHeight-24),c=Math.max(12,Math.min(a.left,window.innerWidth-o-12));return(0,wt.createPortal)((0,$.jsxs)(`div`,{className:`fixed z-50 flex flex-col overflow-hidden rounded-lg border border-border bg-background shadow-xl`,style:{top:window.innerHeight-a.bottom>=s+8?a.bottom+8:a.top-8-s>=12?a.top-8-s:Math.max(12,window.innerHeight-s-12),left:c,width:o,height:s},onMouseEnter:r,onMouseLeave:i,children:[(0,$.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-border px-2.5`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-medium text-muted-foreground`,children:e.path}),t&&(0,$.jsx)(`span`,{className:`max-w-[12rem] truncate text-[11px] text-red-400`,children:t}),(0,$.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/70`,children:`click to pin`})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:e.type===`directory`?(0,$.jsx)(Ye,{orchestratorId:e.orchestratorId,selectedPath:e.path,onReadError:n}):(0,$.jsx)(Xe,{orchestratorId:e.orchestratorId,selectedPath:e.path,line:e.line,onReadError:n})})]}),document.body)}function Et(){return(0,X.useSyncExternalStore)(e=>ue.subscribe(e),()=>ue.getPlayingKey(),()=>null)}function Dt({attachment:e,outbound:n}){let r=e.kind===`image`,a=e.title||e.artifactId,[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let t=!1,n=null;async function r(){d(!0),l(null),s(null);try{let r=await ee(`/artifacts/${encodeURIComponent(e.artifactId)}/content`);if(t)return;n=URL.createObjectURL(r),s(n)}catch(e){t||l(e.message)}finally{t||d(!1)}}return r(),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e.artifactId]);function m(){if(!o)return;let e=document.createElement(`a`);e.href=o,e.download=a,document.body.appendChild(e),e.click(),e.remove()}return r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>o&&p(!0),disabled:!o,className:`group/img mt-2 block overflow-hidden rounded-md border border-foreground/10 bg-black/10 text-left disabled:cursor-default relative`,children:o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`img`,{src:o,alt:a,loading:`lazy`,className:`block max-h-72 max-w-full object-contain`}),(0,$.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/img:bg-black/30 transition-colors`,children:(0,$.jsx)(I,{className:`w-6 h-6 text-white opacity-0 group-hover/img:opacity-100 transition-opacity drop-shadow-md`})})]}):(0,$.jsxs)(`span`,{className:i(`flex min-h-20 items-center gap-2 px-3 py-2 text-xs`,c?`text-red-400`:`text-muted-foreground`),children:[u?(0,$.jsx)(M,{className:`h-4 w-4 animate-spin`}):(0,$.jsx)(t,{className:`h-4 w-4`}),c||`Loading image`]})}),o&&(0,$.jsx)(Ve,{open:f,onOpenChange:p,children:(0,$.jsxs)(Le,{className:`max-w-[95vw] max-h-[95vh] w-auto p-0 bg-black/95 border-zinc-800 gap-0 overflow-hidden`,showCloseButton:!1,children:[(0,$.jsx)(Ge,{className:`sr-only`,children:a}),(0,$.jsxs)(`div`,{className:`relative flex items-center justify-center min-h-[200px]`,children:[(0,$.jsx)(`img`,{src:o,alt:a,className:`max-w-[93vw] max-h-[90vh] object-contain`}),(0,$.jsxs)(`div`,{className:`absolute top-2 right-2 flex gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:m,className:`rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Download`,children:(0,$.jsx)(g,{className:`w-4 h-4`})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>p(!1),className:`rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Close`,children:(0,$.jsx)(A,{className:`w-4 h-4`})})]})]})]})})]}):(0,$.jsxs)(`button`,{type:`button`,onClick:m,disabled:!o,className:i(`mt-2 flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-xs transition-colors disabled:cursor-default disabled:opacity-70`,n?`border-primary-foreground/20 bg-primary-foreground/10 hover:bg-primary-foreground/15`:`border-border bg-background hover:bg-muted`),children:[u?(0,$.jsx)(M,{className:`h-4 w-4 shrink-0 animate-spin`}):c?(0,$.jsx)(t,{className:`h-4 w-4 shrink-0 text-red-400`}):(0,$.jsx)(P,{className:`h-4 w-4 shrink-0`}),(0,$.jsx)(`span`,{className:i(`min-w-0 flex-1 truncate`,c&&`text-red-400`),children:c||a}),(0,$.jsx)(g,{className:`h-3.5 w-3.5 shrink-0`})]})}function Ot({open:e,onToggle:t,onReact:n}){return(0,$.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,$.jsx)(`button`,{type:`button`,title:`Add reaction`,onClick:t,className:i(`inline-flex h-5 w-6 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-sm transition hover:bg-muted hover:text-foreground`,e?`opacity-100`:`opacity-0 pointer-events-none md:group-hover/msg:opacity-100 md:group-hover/msg:pointer-events-auto`),children:(0,$.jsx)(w,{className:`h-3 w-3`})}),e&&(0,$.jsx)(`div`,{className:`absolute bottom-full left-0 z-30 mb-1 flex gap-0.5 rounded-full border border-border bg-popover p-0.5 shadow-md`,children:st.map(e=>(0,$.jsx)(`button`,{type:`button`,title:`React ${e}`,onClick:()=>n(e),className:`inline-flex h-6 w-7 items-center justify-center rounded-full text-xs transition-colors hover:bg-muted`,children:e},e))})]})}var kt=(0,X.memo)(function({msg:e,peer:t,onOpenReferencedPath:n,onPreviewReferencedPath:r,onPreviewReferencedPathEnd:a}){let o=e.from===W,s=B(e=>e.reactToMessage),c=B(e=>e.voiceTtsEnabled),l=Et(),u=B(e=>{let n=e.agentsById[t]?.meta?.cwd;return typeof n==`string`?n:``}),[d,f]=(0,X.useState)(!1),p=(0,X.useRef)(null),h=(0,X.useRef)(null),g=(0,X.useRef)(!1),_=K(e),v=dt(e.occurredAt??e.createdAt),y=ot(e),b=Z(e),x=o?ct(e,t):null,S=x?.icon,C=l===String(e.id),w=c&&!o&&!Q(e)&&_.trim().length>0;function E(t){t.stopPropagation(),C?ue.bargeIn():ue.speak(e.body,String(e.id))}(0,X.useEffect)(()=>{if(!d)return;function e(e){at()||p.current&&!p.current.contains(e.target)&&f(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)}},[d]);function D(e){return tt(u||`/`,e)}function O(e,t){let r=D(e);n?.(r,t)}function k(e,t,n){let i=D(e);r?.(i,t,n)}function A(t){s(e,t),f(!1)}function j(e){e.button===0&&(h.current={x:e.clientX,y:e.clientY},g.current=!1)}function M(e){let t=h.current;t&&(Math.abs(e.clientX-t.x)>3||Math.abs(e.clientY-t.y)>3)&&(g.current=!0)}function ee(t){if(!(Q(e)||o)&&!t.target.closest(`a,button,input,textarea,select,[role="button"]`)){if(g.current||at()){g.current=!1;return}f(e=>!e)}}return(0,$.jsx)(`div`,{"data-msg-id":e.id,className:i(`group/msg flex mb-3`,o?`justify-end`:`justify-start`),children:(0,$.jsxs)(`div`,{ref:p,className:`relative max-w-[85%] md:max-w-[75%]`,children:[w&&(0,$.jsx)(`button`,{type:`button`,title:C?`Stop playback`:`Play aloud`,onClick:E,className:i(`absolute -top-2 -right-2 z-20 inline-flex h-6 w-6 items-center justify-center rounded-full border bg-popover shadow-sm transition`,C?`border-primary/50 text-primary opacity-100`:`border-border text-muted-foreground opacity-70 hover:bg-muted hover:text-foreground hover:opacity-100 [@media(hover:hover)]:md:opacity-0 [@media(hover:hover)]:md:group-hover/msg:opacity-100`),children:C?(0,$.jsx)(m,{className:`h-3.5 w-3.5 animate-pulse`}):(0,$.jsx)(T,{className:`h-3.5 w-3.5`})}),(0,$.jsxs)(`div`,{className:i(`rounded-2xl px-3.5 py-2 text-sm select-text`,!o&&!Q(e)&&`cursor-pointer`,o?`bg-primary text-primary-foreground rounded-br-sm`:`bg-card ring-1 ring-foreground/10 rounded-bl-sm`),onPointerDown:j,onPointerMove:M,onClick:ee,children:[e.subject&&(0,$.jsx)(`p`,{className:i(`text-xs font-semibold mb-1`,o?`text-primary-foreground/70`:`text-muted-foreground`),children:e.subject}),(0,$.jsx)(Je,{text:_,rawBody:e.body,className:`leading-relaxed`,onOpenPath:O,onPreviewPath:k,onPreviewPathEnd:a,resolvePathTitle:(e,t)=>`${D(e)}${t?`:${t}`:``}`}),y.map(t=>(0,$.jsx)(Dt,{attachment:t,outbound:o},`${e.id}-${t.artifactId}-${t.role||``}`)),(0,$.jsxs)(`p`,{className:i(`text-xs mt-1 flex items-center gap-1.5`,o?`justify-end text-primary-foreground/60`:`justify-end text-muted-foreground`),children:[(0,$.jsxs)(`span`,{className:`opacity-40`,children:[`#`,e.id]}),(0,$.jsx)(`span`,{children:v}),x&&S&&(0,$.jsxs)(`span`,{className:i(`inline-flex items-center gap-1`,x.tone===`ok`&&`text-emerald-300`,x.tone===`warn`&&`text-amber-200`,x.tone===`danger`&&`text-red-200`),title:x.title,children:[(0,$.jsx)(S,{className:`h-3 w-3`}),x.label]})]})]}),!Q(e)&&b.length>0&&(0,$.jsxs)(`div`,{className:i(`flex flex-wrap items-center gap-0.5 -mt-1 relative z-10`,o?`justify-end pr-2`:`justify-start pl-2`),children:[!o&&(0,$.jsx)(Ot,{open:d,onToggle:()=>f(e=>!e),onReact:A}),b.map(e=>(0,$.jsxs)(`button`,{type:`button`,title:e.actors.join(`, `),onClick:()=>A(e.emoji),className:i(`inline-flex h-5 items-center gap-0.5 rounded-full border px-1.5 text-[11px] shadow-sm transition-colors`,e.mine?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-background hover:bg-muted text-foreground`),children:[(0,$.jsx)(`span`,{children:e.emoji}),e.count>1&&(0,$.jsx)(`span`,{children:e.count})]},e.emoji))]}),!Q(e)&&!o&&b.length===0&&(0,$.jsx)(`div`,{className:`absolute -bottom-2.5 left-1 z-20`,children:(0,$.jsx)(Ot,{open:d,onToggle:()=>f(e=>!e),onReact:A})})]})})});function At({agentId:e,approval:n}){let r=B(e=>e.sendPermissionDecision),[i,a]=(0,X.useState)(null);if(!n)return null;if(n.questions&&n.questions.length)return(0,$.jsx)(Nt,{agentId:e,approval:n,questions:n.questions});let o=n,s=n.choices.length?n.choices:[{id:`approve`,label:`Approve`},{id:`deny`,label:`Deny`}];async function c(t){if(!i){a(t.id);try{await r(e,o.id,t.id)}finally{a(null)}}}let l=n.kind===`plan`;return(0,$.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,$.jsx)(`div`,{className:`max-w-[92%] md:max-w-[78%] rounded-2xl rounded-bl-sm bg-card ring-1 ring-amber-500/35 px-3.5 py-3 text-sm`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[l?(0,$.jsx)(C,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-400`}):(0,$.jsx)(t,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-400`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-amber-100`,children:n.title}),n.body&&(l?(0,$.jsx)(`div`,{className:`mt-2 max-h-72 overflow-auto rounded-md bg-background/60 p-2.5 text-xs leading-relaxed`,children:(0,$.jsx)(Je,{text:n.body,rawBody:n.body,className:`leading-relaxed`})}):(0,$.jsx)(`pre`,{className:`mt-2 max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-md bg-background/80 p-2 font-mono text-xs leading-relaxed text-muted-foreground`,children:n.body})),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:s.map(e=>(0,$.jsxs)(J,{size:`sm`,variant:e.id===`deny`||e.id===`abort`?`outline`:`default`,disabled:!!i,onClick:()=>void c(e),className:`h-7 px-2 text-xs`,children:[i===e.id&&(0,$.jsx)(M,{className:`mr-1.5 h-3 w-3 animate-spin`}),e.label]},e.id))})]})]})})})}function jt(e){return e?e.otherActive&&e.other.trim()?!0:e.labels.length>0:!1}function Mt(e){let t=[...e.labels];return e.otherActive&&e.other.trim()&&t.push(e.other.trim()),t.join(`, `)}function Nt({agentId:e,approval:t,questions:n}){let r=B(e=>e.sendPermissionDecision),[a,o]=(0,X.useState)(0),[s,c]=(0,X.useState)({}),[l,u]=(0,X.useState)(null),d=n[Math.min(a,n.length-1)],f=s[a];if(!d)return null;let p=!!d.multiSelect,m=n.length,h=a===m-1,g=jt(f),_=n.every((e,t)=>jt(s[t])),v=!!l;function y(e){c(t=>{let n=t[a]??{labels:[],other:``,otherActive:!1};return{...t,[a]:{...n,...e}}})}function b(e){if(p){let t=f?.labels.includes(e);y({labels:t?(f?.labels??[]).filter(t=>t!==e):[...f?.labels??[],e]})}else y({labels:[e],otherActive:!1})}function S(){y(p?{otherActive:!f?.otherActive}:{labels:[],otherActive:!0})}async function C(){if(!(!_||v)){u(`answer`);try{let i={};n.forEach((e,t)=>{let n=s[t];n&&(i[e.question]=Mt(n))}),await r(e,t.id,`answer`,i)}finally{u(null)}}}async function w(){if(!v){u(`dismiss`);try{await r(e,t.id,`deny`)}finally{u(null)}}}let T=!!f?.otherActive;return(0,$.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,$.jsxs)(`div`,{className:`w-full max-w-[92%] md:max-w-[78%] rounded-2xl rounded-bl-sm bg-card ring-1 ring-amber-500/35 px-3.5 py-3 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(x,{className:`h-4 w-4 shrink-0 text-amber-400`}),(0,$.jsx)(`div`,{className:`text-sm font-medium text-amber-100`,children:t.title}),m>1&&(0,$.jsxs)(q,{variant:`outline`,className:`ml-auto h-5 px-1.5 text-[10px] text-muted-foreground`,children:[a+1,` / `,m]})]}),(0,$.jsxs)(`div`,{className:`mt-3`,children:[d.header&&(0,$.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-amber-300/80`,children:d.header}),(0,$.jsx)(`div`,{className:`mt-0.5 text-sm text-foreground whitespace-pre-wrap break-words`,children:d.question}),p&&(0,$.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:`Select all that apply`}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:[d.options.map(e=>{let t=!!f?.labels.includes(e.label);return(0,$.jsxs)(`button`,{type:`button`,disabled:v,onClick:()=>b(e.label),className:i(`flex items-start gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors`,t?`border-amber-500/60 bg-amber-500/10`:`border-border bg-background/60 hover:bg-background`,v&&`opacity-60`),children:[(0,$.jsx)(`span`,{className:i(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border text-amber-300`,p?`rounded`:`rounded-full`,t?`border-amber-400 bg-amber-400/20`:`border-muted-foreground/40`),children:t&&(0,$.jsx)(j,{className:`h-3 w-3`})}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),e.description&&(0,$.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.label)}),(0,$.jsxs)(`button`,{type:`button`,disabled:v,onClick:S,className:i(`flex items-start gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors`,T?`border-amber-500/60 bg-amber-500/10`:`border-border bg-background/60 hover:bg-background`,v&&`opacity-60`),children:[(0,$.jsx)(`span`,{className:i(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border text-amber-300`,p?`rounded`:`rounded-full`,T?`border-amber-400 bg-amber-400/20`:`border-muted-foreground/40`),children:T&&(0,$.jsx)(j,{className:`h-3 w-3`})}),(0,$.jsx)(`span`,{className:`text-sm text-foreground`,children:`Other…`})]}),T&&(0,$.jsx)(qe,{autoFocus:!0,rows:2,disabled:v,value:f?.other??``,onChange:e=>y({other:e.target.value,otherActive:!0}),placeholder:`Type your answer`,className:`mt-1 text-sm`})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[a>0&&(0,$.jsxs)(J,{size:`sm`,variant:`outline`,disabled:v,onClick:()=>o(e=>e-1),className:`h-7 px-2 text-xs`,children:[(0,$.jsx)(ne,{className:`mr-1 h-3 w-3`}),`Back`]}),h?(0,$.jsxs)(J,{size:`sm`,disabled:v||!_,onClick:()=>void C(),className:`h-7 px-2 text-xs`,children:[l===`answer`&&(0,$.jsx)(M,{className:`mr-1.5 h-3 w-3 animate-spin`}),`Send answer`,m>1?`s`:``]}):(0,$.jsxs)(J,{size:`sm`,disabled:v||!g,onClick:()=>o(e=>e+1),className:`h-7 px-2 text-xs`,children:[`Next`,(0,$.jsx)(L,{className:`ml-1 h-3 w-3`})]}),(0,$.jsxs)(J,{size:`sm`,variant:`ghost`,disabled:v,onClick:()=>void w(),className:`ml-auto h-7 px-2 text-xs text-muted-foreground`,children:[l===`dismiss`&&(0,$.jsx)(M,{className:`mr-1.5 h-3 w-3 animate-spin`}),`Dismiss`]})]})]})})}var Pt={online:`came online`,offline:`went offline`,shutdown:`shut down`,restarted:`restarted`,"compaction-requested":`compaction requested`,compacting:`compaction started`,compacted:`context compacted`,"compaction-stalled":`compaction stalled — may need manual intervention`,"clear-requested":`clear requested`,"clearing-context":`clear started`,"context-cleared":`context cleared`,"clear-stalled":`context clear stalled — may need manual intervention`,"shutting-down":`shutting down`},Ft=new Set(Object.keys(Pt)),It=3e3;function Lt(e){return new Date(e.occurredAt??e.createdAt).getTime()}function Rt(e){if(e.kind!==`session`)return null;let t=e.payload?.session;return!t||t.type!==`narration`&&t.type!==`reasoning`&&t.type!==`tool`?null:{id:e.id,kind:t.type,label:typeof t.label==`string`?t.label:void 0,text:e.body,ts:Lt(e),turnId:typeof t.turnId==`string`?t.turnId:void 0}}function zt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Bt(e){let t=e.filter(e=>Ft.has(e.status)).slice().sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let e of t)n.some(t=>t.id===e.id)||n.some(t=>t.status===e.status&&Math.abs(t.timestamp-e.timestamp)<=It)||n.push(e);return n}function Vt(e,t,n,r=[]){let i=[];for(let e of r){let t=e.entries.reduce((e,t)=>Math.min(e,V(t.originalCreatedAt)),1/0),n=Number.isFinite(t)?t-1:e.importedAt;i.push({ts:n,entry:{type:`import-boundary`,history:e,timestamp:n}});for(let t of e.entries)i.push({ts:V(t.originalCreatedAt),entry:{type:`imported-message`,history:e,entry:t}})}if(n){let e=new Date(n).getTime();Number.isFinite(e)&&i.push({ts:e,entry:{type:`created`,timestamp:e}})}let a=new Map;for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type===`response`&&typeof e.turnId==`string`){let n=a.get(e.turnId)??[];n.push(t.body.trim()),a.set(e.turnId,n)}}for(let t of e){let e=Rt(t);if(e){if(e.kind===`narration`&&e.turnId&&a.get(e.turnId)?.some(t=>U(t,e.text)))continue;i.push({ts:e.ts,entry:{type:`activity`,steps:[e],timestamp:e.ts}});continue}i.push({ts:Lt(t),entry:{type:`message`,msg:t}})}for(let e of Bt(t))i.push({ts:e.timestamp,entry:{type:`status`,event:e}});let o={created:0,date:1,"import-boundary":2,"imported-message":3,message:4,activity:4,status:5};i.sort((e,t)=>{let n=e.ts-t.ts;return Math.abs(n)<3e3&&o[e.entry.type]-o[t.entry.type]||n});let s=[],c=``;for(let{ts:e,entry:t}of i){if(t.type===`created`){s.push(t);continue}let n=zt(e);if(n!==c&&(s.push({type:`date`,date:n,timestamp:e}),c=n),t.type===`activity`){let e=s[s.length-1];if(e&&e.type===`activity`&&Ht(e,t)){e.steps.push(...t.steps);continue}}s.push(t)}return s}function Ht(e,t){let n=e.steps[e.steps.length-1]?.turnId,r=t.steps[0]?.turnId;return n&&r?n===r:!n&&!r}var Ut=[];function Wt(e){return B(t=>t.chatStatusEvents[e]??Ut)}function Gt(e,t){let n=(0,X.useRef)(!1);(0,X.useEffect)(()=>{if(!e)return;n.current||=(window.history.pushState({chatGuard:!0},``),!0);function r(e){(e.state?.chatGuard!==void 0||!n.current)&&(window.history.pushState({chatGuard:!0},``),t())}function i(e){e.preventDefault()}return window.addEventListener(`popstate`,r),window.addEventListener(`beforeunload`,i),()=>{window.removeEventListener(`popstate`,r),window.removeEventListener(`beforeunload`,i)}},[e,t]),(0,X.useEffect)(()=>{!e&&n.current&&(n.current=!1)},[e])}var Kt=96;function qt(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=Kt}function Jt(e,t){let n=(0,X.useRef)(null),r=(0,X.useRef)(!0),i=(0,X.useRef)(null),a=(0,X.useCallback)(()=>{let e=n.current;e&&(r.current=qt(e))},[]);return(0,X.useLayoutEffect)(()=>{let t=n.current;t&&(i.current!==e&&(i.current=e,r.current=!0),r.current&&(t.scrollTop=t.scrollHeight))},[e,...t]),{ref:n,onScroll:a}}var Yt={online:`text-emerald-400`,offline:`text-zinc-400`,shutdown:`text-zinc-400`,restarted:`text-blue-400`,"compaction-requested":`text-zinc-400`,compacting:`text-amber-400`,compacted:`text-amber-400`,"compaction-stalled":`text-red-400`,"clear-requested":`text-zinc-400`,"clearing-context":`text-amber-400`,"context-cleared":`text-amber-400`,"clear-stalled":`text-red-400`,"shutting-down":`text-zinc-400`};function Xt(e){let t=new Date,[n,r,i]=e.split(`-`).map(Number),a=new Date(n,r-1,i);if(e===zt(t.getTime()))return`Today`;let o=new Date(t);return o.setDate(o.getDate()-1),e===zt(o.getTime())?`Yesterday`:a.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`,year:a.getFullYear()===t.getFullYear()?void 0:`numeric`})}function Zt({event:e}){return(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(F,{className:i(`w-2 h-2 fill-current`,Yt[e.status]||`text-zinc-400`)}),(0,$.jsx)(`span`,{children:Pt[e.status]||e.status}),(0,$.jsx)(`span`,{className:`text-muted-foreground/60`,children:dt(e.timestamp)})]}),(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Qt({blockedLabel:e,onInterrupt:n}){return e?(0,$.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-red-500/30 px-4 py-2.5`,children:[(0,$.jsx)(t,{className:`w-3.5 h-3.5 text-red-400`}),(0,$.jsxs)(`span`,{className:`text-xs text-red-300`,children:[`blocked: `,e]})]})}):(0,$.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-foreground/10 px-4 py-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_infinite]`}),(0,$.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_0.2s_infinite]`}),(0,$.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_0.4s_infinite]`})]}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`working`}),n&&(0,$.jsxs)(`button`,{onClick:n,title:`Interrupt`,className:`ml-1 flex items-center gap-1 rounded-full px-1.5 py-0.5 text-xs text-muted-foreground hover:text-red-300 hover:bg-red-500/10 transition-colors`,children:[(0,$.jsx)(m,{className:`w-3.5 h-3.5`}),`Stop`]})]})})}var $t=`agent-relay:chat-hide-tools`,en=(()=>{let e=new Set,t=(()=>{try{return window.localStorage.getItem($t)===`on`}catch{return!1}})(),n=()=>e.forEach(e=>e());return typeof window<`u`&&window.addEventListener(`storage`,e=>{e.key===$t&&(t=e.newValue===`on`,n())}),{subscribe(t){return e.add(t),()=>e.delete(t)},get:()=>t,toggle(){t=!t;try{window.localStorage.setItem($t,t?`on`:`off`)}catch{}n()}}})();function tn(){return[(0,X.useSyncExternalStore)(en.subscribe,en.get,()=>!1),en.toggle]}function nn({steps:e,showReasoning:t}){let[n,r]=tn(),a=t?e:e.filter(e=>e.kind!==`reasoning`);if(!a.length)return null;let o=a.filter(e=>e.kind===`tool`).length;return(0,$.jsx)(`div`,{className:`flex justify-start mb-2`,children:(0,$.jsxs)(`div`,{className:`max-w-[85%] md:max-w-[75%] min-w-0 space-y-1.5`,children:[a.map(e=>e.kind===`narration`?(0,$.jsx)(`div`,{className:`text-sm leading-relaxed whitespace-pre-wrap break-words text-foreground/90 min-w-0`,children:e.text},e.id):e.kind===`reasoning`?(0,$.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground/80`,children:[(0,$.jsx)(E,{className:`w-3.5 h-3.5 mt-0.5 shrink-0 opacity-70`}),(0,$.jsx)(`span`,{className:`italic whitespace-pre-wrap break-words min-w-0`,children:e.text})]},e.id):n?null:(0,$.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground`,children:[(0,$.jsx)(k,{className:`w-3 h-3 mt-0.5 shrink-0 opacity-70`}),(0,$.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.label||`tool`}),e.text?(0,$.jsxs)(`span`,{className:`opacity-70`,children:[` — `,e.text]}):null]})]},e.id)),o>0&&(0,$.jsxs)(`button`,{onClick:r,className:`flex items-center gap-1 text-[11px] text-muted-foreground/50 hover:text-muted-foreground transition-colors text-left`,children:[(0,$.jsx)(L,{className:i(`w-3 h-3 shrink-0 transition-transform`,!n&&`rotate-90`)}),(0,$.jsx)(`span`,{children:n?`show ${o} tool step${o===1?``:`s`}`:`hide tool steps`})]})]})})}function rn({date:e}){return(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-3 my-1`,children:[(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:Xt(e)}),(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function an({timestamp:e}){let t=new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`});return(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground/60`,children:[`created `,t]}),(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function on({history:e}){let t=e.sourceAgentLabel||e.sourcePeerId,n=e.entries.length;return(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-dashed border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(z,{className:`h-3 w-3`}),(0,$.jsxs)(`span`,{children:[`forked history from `,t]}),(0,$.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[n,` `,n===1?`entry`:`entries`]})]}),(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function sn({entry:e,sourceLabel:t}){let n=e.message,r=K(n),a=e.originalFrom===W;return(0,$.jsx)(`div`,{className:i(`flex mb-3 opacity-80`,a?`justify-end`:`justify-start`),children:(0,$.jsx)(`div`,{className:`max-w-[85%] md:max-w-[75%]`,children:(0,$.jsxs)(`div`,{className:i(`rounded-2xl border border-dashed px-3.5 py-2 text-sm select-text`,a?`border-primary/25 bg-primary/10 text-foreground rounded-br-sm`:`border-border bg-card/70 rounded-bl-sm`),children:[(0,$.jsxs)(`div`,{className:i(`mb-1 text-[10px] uppercase tracking-normal`,a?`text-primary/70`:`text-muted-foreground`),children:[`forked history · `,a?`you`:t||e.originalFrom]}),(0,$.jsx)(Je,{text:r,rawBody:n.body,className:`leading-relaxed`}),(0,$.jsxs)(`p`,{className:i(`mt-1 flex items-center justify-end gap-1.5 text-xs`,a?`text-primary/60`:`text-muted-foreground`),children:[(0,$.jsxs)(`span`,{className:`opacity-40`,children:[`#`,e.originalMessageId]}),(0,$.jsx)(`span`,{children:dt(e.originalCreatedAt)})]})]})})})}function cn({scrollRef:e,timeline:t}){let[n,r]=(0,X.useState)(!0),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!0),d=(0,X.useMemo)(()=>{for(let e=t.length-1;e>=0;e--){let n=t[e];if(!(!n||n.type!==`message`)&&n.msg.from===`user`)return{id:n.msg.id,body:K(n.msg)}}return null},[t]);if((0,X.useEffect)(()=>{let t=e.current;if(!d||!t){r(!0);return}let n=t.querySelector(`[data-msg-id="${d.id}"]`);if(!n){r(!0);return}let i=new IntersectionObserver(([e])=>{if(e&&(r(e.isIntersecting),!e.isIntersecting)){let n=e.rootBounds?.top??t.getBoundingClientRect().top;u(e.boundingClientRect.top<n)}},{root:t,threshold:0});i.observe(n);let a=()=>{let e=n.getBoundingClientRect(),r=t.getBoundingClientRect();u(e.top<r.top)};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{i.disconnect(),t.removeEventListener(`scroll`,a)}},[d?.id,e]),n||!d||!d.body.trim())return null;let f=a?.id===d.id?a.value:!1,p=s?.id===d.id?s.value:!1;function m(){let t=e.current;!t||!d||t.querySelector(`[data-msg-id="${d.id}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`})}let h=l?`↑`:`↓`;return p?(0,$.jsx)(`div`,{className:`sticky top-0 z-10 -mx-3 md:-mx-4 -mt-3 md:-mt-4 bg-background`,children:(0,$.jsxs)(`button`,{type:`button`,className:`w-full flex items-center justify-center gap-1.5 py-1 text-[11px] text-primary/60 hover:text-primary border-b border-primary/10 transition-colors`,onClick:()=>c({id:d.id,value:!1}),children:[(0,$.jsx)(`span`,{children:`Your prompt`}),(0,$.jsx)(re,{className:`w-3 h-3`})]})}):(0,$.jsxs)(`div`,{className:`sticky top-0 z-10 -mx-3 md:-mx-4 -mt-3 md:-mt-4 px-2 md:px-3 pt-2 pb-1.5 bg-background border-b border-primary/10`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground mb-0.5`,children:[(0,$.jsx)(`span`,{className:`font-medium text-primary/70`,children:`Your prompt`}),(0,$.jsxs)(`button`,{type:`button`,className:`ml-auto hover:text-foreground transition-colors`,onClick:m,children:[h,` scroll to original`]}),(0,$.jsx)(`button`,{type:`button`,className:`hover:text-foreground transition-colors`,onClick:()=>c({id:d.id,value:!0}),title:`Minimize`,children:(0,$.jsx)(D,{className:`w-3 h-3`})})]}),(0,$.jsx)(`p`,{className:i(`text-sm text-foreground leading-snug cursor-pointer`,!f&&`line-clamp-2`),onClick:()=>o({id:d.id,value:!f}),children:d.body})]})}var ln=[];function un({threads:e,onBack:t,showBackButton:r}){let i=B(e=>e.selectedInboxThread),a=B(e=>e.agentsById),o=B(e=>e.inboxDrafts),s=de(),c=B(e=>e.sendChatMessage),l=B(e=>e.openFilesAt),u=B(e=>e.openFilesForAgent),d=B(e=>e.openAgentDetail),f=B(e=>e.chatSending),m=B(e=>e.markInboxThreadRead),h=B(e=>e.markInboxThreadUnread),g=B(e=>e.setReplyDraft),_=B(e=>e.exportThread),y=B(e=>e.doAgentAction),b=B(e=>e.workspaceAction),x=B(e=>e.openWorkspaceFocus),S=B(e=>e.forkFromAgent),C=B(e=>e.chatHistoryImports),w=B(e=>e.threadHistory[e.selectedInboxThread]??ln),T=B(e=>e.openConfirm),E=B(e=>e.showError),D=B(e=>e.orchestrators),O=B(e=>e.fetchOrchestrators),k=B(e=>e.showReasoning),j=B(e=>e.voiceTtsEnabled),M=B(e=>e.setVoiceTtsEnabled),ee=B(e=>e.voiceInputMode);(0,X.useRef)(null);let N=(0,X.useRef)(null),[P,te]=(0,X.useState)(`idle`),ne=(0,X.useRef)([]),[F,I]=(0,X.useState)([]),[re,ie]=(0,X.useState)(!1),[L,ae]=(0,X.useState)(null),[oe,se]=(0,X.useState)(null),[ce,R]=(0,X.useState)(``),z=(0,X.useRef)(null),le=(0,X.useRef)(0),V=Wt(i),H=(0,X.useMemo)(()=>e.find(e=>e.peer===i)||null,[e,i]),he=(0,X.useMemo)(()=>{let e=H?.messages??[];if(w.length===0)return e;let t=new Map;for(let e of w)Te(e)===i&&!Se(e)&&t.set(e.id,e);for(let n of e)t.set(n.id,n);return[...t.values()].sort((e,t)=>e.id-t.id)},[H?.messages,w,i]),U=a[i]||null,ge=typeof U?.meta?.lifecycleAction==`string`&&U.meta.lifecycleAction.startsWith(`finalizing-`),{terminalOpen:_e,terminalTarget:ve,terminalOpening:ye,openTerminal:xe,closeTerminal:Ce}=Qe(U?.id),we=typeof U?.meta?.spawnRequestId==`string`?U.meta.spawnRequestId:``,W=(0,X.useMemo)(()=>C.filter(e=>e.targetAgentId===i||!!(we&&e.targetSpawnRequestId===we)),[we,C,i]),De=be(U),K=De?.pendingApproval,Oe=H||(W.length>0?{peer:i,messages:[],importedHistory:W}:null),q=o[i]||``,ke=W.reduce((e,t)=>e+t.entries.length,0),Ae=Jt(i,[he.length,V.length,ke,K?.id,U?.status]),je=typeof U?.meta?.tmuxSession==`string`&&U.meta.tmuxSession.trim()?U.meta.tmuxSession:null,Me=je?D.find(e=>e.managedAgents?.some(e=>e.agentId===U.id||e.tmuxSession===je))??null:null,Ne=!!(je&&Me?.status===`online`&&U?.providerCapabilities?.terminal?.live?.read),Pe=U?.providerCapabilities?.model?.provider??(typeof U?.meta?.provider==`string`?U.meta.provider:void 0),Fe=!!(Ne&&(U?.providerCapabilities?.terminal?.live?.write||Pe===`claude`)),Ie=U?.providerCapabilities?.terminal?.attach?.create===!0,Le=Ne||Ie,Re=Ee(U,`compact`),ze=Ee(U,`clearContext`),Be=Ee(U,`shutdown`),Ve=Ee(U,`interrupt`),He=()=>{U&&y(U,`interrupt`)},[We,Ge]=(0,X.useState)(0),[Ke,qe]=(0,X.useState)(!1),Je=U?.providerCapabilities?.liveSession?.slashCommands===!0,Y=U?.providerCapabilities?.model?.provider??(typeof U?.meta?.provider==`string`?U.meta.provider:void 0),Ze=Je&&!Ke&&/^\/\S*$/.test(q)?vt(Y).filter(e=>e.name.toLowerCase().startsWith(q.toLowerCase())):[],$e=Ze.length?Math.min(We,Ze.length-1):0;function et(e){g(i,`${e.name} `),Ge(0)}function tt(e){g(i,e),Ke&&qe(!1),Ge(0)}let at=F.some(e=>e.uploading),ot=F.filter(e=>e.artifact);Gt(q.trim().length>0||F.length>0,(0,X.useCallback)(()=>{},[])),ne.current=F,(0,X.useEffect)(()=>()=>{ft(ne.current)},[]),(0,X.useEffect)(()=>{U?.meta?.tmuxSession&&D.length===0&&O()},[U?.id,U?.meta?.tmuxSession,D.length]),(0,X.useEffect)(()=>()=>{z.current!==null&&window.clearTimeout(z.current)},[]);let st=(0,X.useMemo)(()=>Vt(he,V,U?.createdAt,W),[he,V,U?.createdAt,W]),Z=(0,X.useCallback)(()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null)},[]),Q=(0,X.useCallback)(async e=>{let t=rt(D,e);if(!t)return null;try{let r=await n(`GET`,`/orchestrators/${encodeURIComponent(t.id)}/files/stat?path=${encodeURIComponent(e)}`);return{orchestratorId:t.id,path:r.path,type:r.type}}catch{return null}},[D]),ct=(0,X.useCallback)((e,t,n)=>{if(!it()||!n)return;let r=++le.current;Q(e).then(e=>{le.current===r&&e&&(Z(),se({...e,line:t||0,anchor:n}),R(``))})},[Z,Q]),lt=(0,X.useCallback)(()=>{le.current+=1,Z(),z.current=window.setTimeout(()=>{se(null)},250)},[Z]),ut=(0,X.useCallback)((e,t)=>{Q(e).then(n=>{if(!n){E(`File Not Found`,e);return}if(it()){le.current+=1,Z(),se(null),ae({...n,line:t||0}),R(``);return}n.type===`directory`?l({orchestratorId:n.orchestratorId,path:n.path,overlay:!0}):l({orchestratorId:n.orchestratorId,path:nt(n.path),selectedPath:n.path,line:t,overlay:!0})})},[Z,l,Q,E]);function dt(){ae(null),R(``)}async function pt(e){let t=Array.from(e).filter(e=>e.size>0);if(!t.length)return;let n=t.map(e=>({id:`${Date.now()}-${e.name}-${Math.random().toString(16).slice(2)}`,fileName:e.name,size:e.size,previewUrl:e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,uploading:!0}));I(e=>[...e,...n]);for(let e=0;e<t.length;e+=1){let r=t[e],i=n[e];try{let e=await v(`/artifacts`,r,{filename:r.name,sensitivity:`normal`});I(t=>t.map(t=>t.id===i.id?{...t,artifact:e,uploading:!1}:t))}catch(e){I(t=>t.map(t=>t.id===i.id?{...t,error:e.message,uploading:!1}:t))}}}function mt(e){I(t=>{let n=t.find(t=>t.id===e);return n?.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.id!==e)})}function ht(){ft(F),I([])}function gt(){if(!q.trim()&&ot.length===0||!i||f||at||ge)return;let e=ot.map(e=>({artifactId:e.artifact.id,kind:e.artifact.kind,role:`media`,title:e.artifact.filename||e.fileName}));c(q,{peer:i,lastMessage:H?.lastMessage||null},e),ht()}function _t(e){if(Ze.length){if(e.key===`ArrowDown`){e.preventDefault(),Ge(e=>Math.min(e+1,Ze.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),Ge(e=>Math.max(e-1,0));return}if(e.key===`Escape`){e.preventDefault(),qe(!0);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=Ze[$e];t&&et(t);return}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),gt())}function bt(e){let t=Array.from(e.clipboardData.files).filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),pt(t))}async function xt(){if(!fe||P!==`idle`||!i)return;ue.bargeIn();let e=new pe;try{await e.start(),N.current=e,te(`recording`)}catch(e){N.current=null,te(`idle`),E(`Microphone unavailable`,e?.message||`Could not access the microphone.`)}}async function St(){let e=N.current;if(!(!e||P!==`recording`)){N.current=null,te(`transcribing`);try{let t=await e.stop();if(!t)return;let n=await me(t);if(!n)return;let r=q?`${q} ${n}`:n;if(ee===`autosend`&&!f&&!at){let e=ot.map(e=>({artifactId:e.artifact.id,kind:e.artifact.kind,role:`media`,title:e.artifact.filename||e.fileName}));c(r,{peer:i,lastMessage:H?.lastMessage||null},e),ht()}else g(i,r)}catch(e){E(`Transcription failed`,e?.message||`Could not transcribe audio.`)}finally{te(`idle`)}}}return i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-w-0`,children:[(0,$.jsxs)(`div`,{className:`@container/chat flex h-full min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(yt,{selectedInboxThread:i,agent:U,now:s,blockedState:De,thread:H,exportableThread:Oe,importedHistory:W,showBackButton:r,onBack:t,openAgentDetail:d,openWorkspaceFocus:x,voiceTtsEnabled:j,setVoiceTtsEnabled:M,canOpenTerminal:Le,terminalOpening:ye,handleOpenTerminal:xe,canInterrupt:Ve,interruptAgent:He,canCompact:Re,canClearContext:ze,canShutdown:Be,openConfirm:T,workspaceAction:b,doAgentAction:y,openFilesForAgent:u,forkFromAgent:S,markInboxThreadUnread:h,markInboxThreadRead:m,exportThread:_}),(0,$.jsx)(`div`,{ref:Ae.ref,onScroll:Ae.onScroll,className:`flex-1 overflow-y-auto px-3 md:px-4 py-3 md:py-4`,style:{minHeight:0},children:st.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-center`,children:[(0,$.jsx)(p,{className:`w-8 h-8 text-zinc-600 mb-2`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No messages yet`})]}):(0,$.jsxs)(`div`,{children:[(0,$.jsx)(cn,{scrollRef:Ae.ref,timeline:st}),st.map(e=>e.type===`message`?(0,$.jsx)(kt,{msg:e.msg,peer:i,onOpenReferencedPath:ut,onPreviewReferencedPath:ct,onPreviewReferencedPathEnd:lt},e.msg.id):e.type===`activity`?(0,$.jsx)(nn,{steps:e.steps,showReasoning:k},`act-${e.steps[0]?.id??e.timestamp}`):e.type===`import-boundary`?(0,$.jsx)(on,{history:e.history},`import-${e.history.id}`):e.type===`imported-message`?(0,$.jsx)(sn,{entry:e.entry,sourceLabel:e.history.sourceAgentLabel||e.history.sourcePeerId},`import-${e.history.id}-${e.entry.originalMessageId}-${e.entry.position}`):e.type===`status`?(0,$.jsx)(Zt,{event:e.event},e.event.id):e.type===`date`?(0,$.jsx)(rn,{date:e.date},`d-${e.date}`):e.type===`created`?(0,$.jsx)(an,{timestamp:e.timestamp},`created`):null),K&&U&&(0,$.jsx)(At,{agentId:U.id,approval:K}),U?.status===`busy`&&!K&&(0,$.jsx)(Qt,{blockedLabel:De?.label,onInterrupt:Ve?He:void 0})]})}),(0,$.jsx)(Ct,{draft:q,placeholder:`Message ${U?G(U):i}…`,chatSending:f,disabled:ge,hasPendingUploads:at,readyAttachmentCount:ot.length,pendingAttachments:F,micAvailable:fe,micState:P,slashMatches:Ze,slashActiveIndex:$e,onDraftChange:tt,onKeyDown:_t,onPaste:bt,onUploadFiles:e=>{pt(e)},onRemovePendingAttachment:mt,onSend:gt,onAcceptSlash:et,onSlashHover:Ge,onStartPtt:()=>{xt()},onStopPtt:()=>{St()},footerText:ge?`${U?G(U):`Agent`} is wrapping up (${(U?.meta?.lifecycleAction).slice(11)}) — messaging paused`:`Enter to send · Shift+Enter for newline`})]}),L&&(0,$.jsxs)(`aside`,{className:`hidden h-full w-[min(44vw,720px)] min-w-[360px] shrink-0 flex-col border-l border-border bg-background xl:flex`,children:[(0,$.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b border-border px-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-xs font-medium text-muted-foreground`,children:`File preview`}),ce&&(0,$.jsx)(`span`,{className:`max-w-[18rem] truncate text-xs text-red-400`,children:ce}),(0,$.jsx)(J,{variant:`ghost`,size:`icon-sm`,title:`Close preview`,onClick:dt,children:(0,$.jsx)(A,{className:`h-3.5 w-3.5`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:L.type===`directory`?(0,$.jsx)(Ye,{orchestratorId:L.orchestratorId,selectedPath:L.path,onReadError:R}):(0,$.jsx)(Xe,{orchestratorId:L.orchestratorId,selectedPath:L.path,line:L.line,onReadError:R})})]})]}),oe&&(0,$.jsx)(Tt,{preview:oe,error:ce,onReadError:R,onMouseEnter:Z,onMouseLeave:lt}),ve&&(0,$.jsx)(Ue,{open:_e,onOpenChange:Ce,orchestratorId:ve.orchestratorId,session:ve.session,interactive:ve.interactive||Fe})]}):(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-center px-4`,children:[(0,$.jsx)(p,{className:`w-12 h-12 text-zinc-600 mb-3`}),(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Select an agent to start chatting`})]})}function dn(){let e=B(e=>e.inboxDrafts),t=B(e=>e.agentsById),n=B(e=>e.set);(0,X.useEffect)(()=>{let r=Object.keys(e);if(r.length===0)return;let i=r.filter(e=>!t[e]&&e!==`user`);if(i.length===0)return;let a=setTimeout(()=>{let e=B.getState().agentsById,t={...B.getState().inboxDrafts},r=!1;for(let n of i)e[n]||(delete t[n],r=!0);r&&n({inboxDrafts:t})},3e4);return()=>clearTimeout(a)},[])}function fn(){let e=He(),t=B(e=>e.selectedInboxThread),n=B(e=>e.set),r=pt(),i=!!t;dn(),(0,X.useEffect)(()=>{t&&(r.some(e=>e.id===t)||n({selectedInboxThread:``}))},[t,r,n]);function a(){n({selectedInboxThread:``})}return(0,$.jsxs)(`div`,{className:`flex -m-4 md:-m-6`,style:{height:`calc(100dvh - var(--header-h) - var(--sat))`},children:[(0,$.jsxs)(`div`,{className:`hidden md:flex w-full`,children:[(0,$.jsx)(`div`,{className:`w-1/3 min-w-[240px] max-w-xs flex flex-col overflow-hidden`,children:(0,$.jsx)(mt,{threads:e})}),(0,$.jsx)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:(0,$.jsx)(un,{threads:e},t||`empty`)})]}),(0,$.jsx)(`div`,{className:`md:hidden flex w-full overflow-hidden`,children:i?(0,$.jsx)(pn,{children:(0,$.jsx)(un,{threads:e,onBack:a,showBackButton:!0},t||`empty`)}):(0,$.jsx)(`div`,{className:`w-full flex flex-col overflow-hidden`,children:(0,$.jsx)(mt,{threads:e})})})]})}function pn({children:e}){let t=Ze();return(0,$.jsx)(`div`,{className:`fixed inset-x-0 top-0 z-40 flex flex-col bg-background pt-[var(--sat)]`,style:{height:t?`${t}px`:`100dvh`},children:e})}export{fn as ChatView};
2
+ //# sourceMappingURL=chat-Dn3TEhl0.js.map