PageSourceSearch

https://app.aeqi.ai/assets/CompanySessionsTab-CtapT0Gy.js

js aeqi.ai collected 2026-10-05 15:20:02 UTC 21,127 bytes, 1 lines download raw bytes

1import{j as s,g as mt,r as u}from"./react-vendor-DhKRNgCF.js";import{u as pt}from"./shallow-BK8nZ_ih.js";import{w as ht,R as Pe,e as Re,c3 as gt,L as z,V as se,P as ft,B,i as T,h as vt,cm as St,j as yt,s as wt,b1 as jt,g as xt,aX as bt}from"./index-x-ynt_mA.js";import{C as ze,e as P}from"./main-5X1ljm9O.js";import{s as Nt}from"./threadRowKey-vUStF55W.js";import{s as kt}from"./index-xSlEmCXn.js";import{S as At}from"./SessionConversation-CBYuYU7N.js";import{e3 as Ct,d2 as Et,s as _t,cr as Rt,e4 as Lt,dL as It,d8 as $t,ak as Mt,e5 as Tt,n as Pt}from"./AppLayoutEntry-DAXBezYD.js";import{s as l}from"./sessionsRoom.module-CAYZGxnU.js";import{I as zt}from"./IconButton-8wJ0YnPU.js";import{A as Bt}from"./archive-DiAaF2wu.js";import{P as Ft}from"./plus-BM42xh30.js";import{P as E}from"./Popover-BqGzTl2s.js";import{F as Ht}from"./FilterMask-DZkxhHRI.js";import{A as Ot}from"./arrow-down-up-C4BfGhT5.js";import{U as Dt}from"./users-BOathvLc.js";import{u as Wt}from"./useSessionsListing-COoOFwFU.js";import{a as Kt,u as Ut}from"./searchParamState-C2u9qTxi.js";import{u as qt}from"./useRelativeNow-Dtb36nP1.js";import{u as ne}from"./chat-B9LPukPq.js";import{u as Gt}from"./usePaneTitle-D6ZwULRI.js";import{B as Le}from"./Banner-BC3mpD28.js";import{E as Vt}from"./toastStore-BQAR76Tw.js";import{b as Qt}from"./Dialog-FeH18WmV.js";import"./vite-runtime-DdPMya_n.js";import"./Inline-BtpmlJyj.js";import"./manager-BNENNOSM.js";import"./pageBus-DSNqaLgn.js";import"./sound-Dle_CNNu.js";import"./pages-D2KDqFxa.js";import"./Composer-IoQlzAQs.js";import"./Thread-DOeLJ9-G.js";import"./copy-BvQ7faF_.js";import"./clock-BmzCUZh9.js";import"./file-text-DM5CSq9U.js";import"./shield-check-CHcpQPKo.js";import"./Tag-DxRsYABe.js";import"./x-COoA-pMz.js";import"./arrow-up-BX7NVLmo.js";import"./Textarea-DnCrElM_.js";import"./Tooltip-B2TEhq0J.js";import"./chevron-left-Cc64uDN7.js";import"./Icon-pU9snwy7.js";import"./hooks-5BqVeAIM.js";import"./useQuery-CMqcCWeO.js";import"./useNav-B2qM7j19.js";import"./MessageWorkBar-BmNRqGvo.js";import"./spend-Ata5sTWt.js";import"./toolSummary-BdclhoJ5.js";import"./zap-B2F61PrC.js";import"./lightbulb-C9VNfYnD.js";import"./globe-D7GuNYFS.js";import"./search-6-T2OhHv.js";import"./RichMarkdown-fw79h-Z9.js";import"./blockText-B6vOdbAJ.js";import"./markdown-BFdK-L47.js";import"./useClipboard-jXMCbKUC.js";import"./trash-2-4srfkZr9.js";import"./user-plus-DEKY5dqb.js";import"./HarnessBadge-BxUiFV9e.js";import"./engines-Du4ErJ4k.js";import"./AccountControl-DTzTxKrK.js";import"./detailRoom.module-DFks5Fjw.js";/* empty css               */import"./Meter-Bb0oVAP5.js";import"./trial-Cqrutr3v.js";import"./settings-Cz_bZVxX.js";import"./settle-CAm2px29.js";import"./keys-BjRLFhcH.js";import"./firstRun-DgUs7tFn.js";import"./Stat-In2LDOuF.js";import"./companies-CPJyzNEm.js";import"./ideas-4udUJ06Z.js";import"./SegmentedControl-DmfR_PrG.js";import"./ideasLibraryHelpers-BBgb6II3.js";import"./ideaTree-DRM6g2M9.js";import"./useComposerDraft-B2BbnBPk.js";import"./mouse-pointer-click-Dd8KYm2K.js";import"./DecisionCard-BzOhHKuH.js";import"./referenceCopy-BpL3fcsZ.js";import"./useDriveThumbnail-DFZBPd_8.js";import"./roleSeniority--NJ924F_.js";import"./CopyButton-BTGNyXUH.js";import"./square-DKfaxd9K.js";import"./rotate-ccw-DoE4lz1e.js";import"./billingRoutes-C5Hvwmu4.js";import"./circle-dot-DhMzzO6r.js";const Yt={awaiting_input:"Awaiting you",stalled:"Stalled",working:"Working",idle:"Idle"};function Xt(e){return e==="awaiting_input"||e==="stalled"}function Ie(e){return e<60?`${Math.max(0,Math.floor(e))}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h`}function Jt(e){const{activity:n,silent_secs:a,running_secs:o,headline:c}=e;if(n==="stalled")return a===void 0?null:`silent ${Ie(a)}`;if(n==="working"){const v=o===void 0?null:Ie(o),p=[Ct(c),v].filter(Boolean);return p.length>0?p.join(" · "):null}return null}function Zt(e){const n=Jt(e);return e.activity==="working"&&n?n:[Yt[e.activity],n].filter(Boolean).join(" · ")}function es(e){const n=[Zt(e)],{background_agents:a,undelivered:o}=e;return a>0&&n.push(`${a} subagent${a===1?"":"s"}`),o>0&&n.push(`${o} held`),n.join(" · ")}const ts="view";function $e(e,n){return ht(e,n,{[ts]:null})}function ss({row:e,avatarSrc:n,streaming:a,href:o,onWarm:c,onArchive:v}){var i,S;const p=!!e.executing||!!a||((i=e.supervision)==null?void 0:i.activity)==="working",g=((S=e.supervision)==null?void 0:S.activity)==="stalled",m=!!e.awaiting||p||g,x=e.supervision?es(e.supervision):e.secondary,w=e.unread??0,j=()=>c(e),b=[e.primary,x,e.time,e.channel?`via ${e.channel}`:null,w>0?`${w} unread`:null,a?"streaming":p?"running now":null,e.awaiting?"awaiting your reply":null,e.internal?"agent workspace":null,e.archived?"archived":null,e.status&&!a&&!e.awaiting?`status ${e.status}
1`:null].filter(Boolean);return s.jsx(Pe,{className:e.internal?`${l.row} ${l.rowInternal}`:l.row,href:o,"data-session-row":e.id,"data-internal":e.internal||void 0,"data-unread":w>0||void 0,"aria-label":b.join(", "),onMouseEnter:j,onFocus:j,leading:e.agentName?s.jsx(gt,{name:e.agentName,src:n,size:"sm",decorative:!0}):s.jsx("span",{className:l.rowSealBlank,"aria-hidden":"true"}),title:s.jsxs("span",{className:w>0?l.rowTitleUnread:void 0,children:[e.primary,e.channel&&s.jsx(Re,{className:l.rowChannel,children:e.channel})]}),secondary:x||void 0,meta:s.jsxs("span",{className:l.rowWhen,children:[w>0&&s.jsx("span",{className:l.rowUnread,"aria-hidden":"true"}),m&&s.jsx(Re,{tone:"live",still:!p,stale:g}),e.time]}),action:v?s.jsx(zt,{variant:"quiet",size:"sm",className:l.rowArchive,"aria-label":`Archive: ${e.primary}`,title:"Archive this session",onClick:k=>{k.preventDefault(),k.stopPropagation(),v(e)},children:s.jsx(Bt,{"aria-hidden":"true"})}):void 0})}function ns(e){const n=[];for(const a of e){const o=n[n.length-1];o&&o.group===a.group?o.rows.push(a):n.push({group:a.group,rows:[a]})}return n}function is({needsYou:e,working:n,recent:a,standing:o,runs:c,renderRow:v,rowHref:p}){const g=o.reduce((m,x)=>m+x.runs,0)+c.length;return s.jsxs("div",{className:l.register,"data-sessions-register":!0,children:[e.length>0&&s.jsx("section",{className:l.zone,"data-zone":"needs-you","aria-label":"Needs you",children:s.jsx(z,{children:s.jsx(se,{label:"Needs you",note:e.length,children:e.map(v)})})}),n.length>0&&s.jsx("section",{className:l.zone,"data-zone":"working","aria-label":"Working now",children:s.jsx(z,{children:s.jsx(se,{label:"Working now",note:n.length,children:n.map(v)})})}),a.length>0&&s.jsx("section",{className:l.zone,"data-zone":"recent","aria-label":"Recent",children:s.jsx(z,{children:ns(a).map(m=>s.jsx(se,{label:m.group,children:m.rows.map(v)},m.group))})}),g>0&&s.jsx("section",{className:l.zone,"data-zone":"runs","aria-label":"Agent work runs",children:s.jsxs(ze,{className:l.runsFold,label:"Agent work runs",meta:g,children:[o.map(m=>s.jsx(rs,{room:m,renderRow:v,rowHref:p},m.key)),c.length>0&&s.jsx(z,{children:c.map(v)})]})})]})}function rs({room:e,renderRow:n,rowHref:a}){const o=e.runs===1?"1 run":`${e.runs} runs`;return s.jsxs("div",{className:l.cadence,"data-cadence":e.key,children:[s.jsx(Pe,{size:"sm",href:a(e.latest),"data-session-row":e.latest.id,"data-unread":e.unread>0||void 0,"aria-label":`${e.label}, latest run ${e.latest.time}, ${o}${e.unread>0?`, ${e.unread} unread`:""}`,title:s.jsx("span",{className:e.unread>0?l.rowTitleUnread:void 0,children:e.label}),secondary:o,meta:s.jsxs("span",{className:l.rowWhen,children:[e.unread>0&&s.jsx("span",{className:l.rowUnread,"aria-hidden":"true"}),e.latest.time]})}),e.runs>1&&s.jsx(ze,{className:l.cadenceHistory,label:"All runs",meta:e.runs,children:s.jsx(z,{children:e.rows.map(n)})})]})}function as(e){return/s$/i.test(e)&&e.length>1?e.slice(0,-1):e}function os(e){return e.map(n=>{const a=[...n.rows].sort((o,c)=>c.sortKey-o.sortKey);return{key:n.key,label:as(n.label),runs:n.count,latest:a[0]??n.rows[0],rows:a,unread:a.reduce((o,c)=>o+(c.unread??0),0)}})}function Me(e){return e.awaiting?!0:e.supervision?Xt(e.supervision.activity):!1}const ls=3;function cs(e){const n=e.trim();return n?/s$/i.test(n)?n:`${n}s`:"Cadence runs"}function us(e,n=ls){const a=new Map;for(const p of e){const g=p.primary.trim().toLowerCase(),m=a.get(g);m?m.push(p):a.set(g,[p])}const o=[],c=[],v=new Set;for(const p of e){const g=p.primary.trim().toLowerCase(),m=a.get(g)??[p];m.length>=n?v.has(g)||(v.add(g),o.push({key:g,label:cs(m[0].primary),count:m.length,rows:m})):c.push(p)}return{cadences:o,workspace:c}}function ds(e){const n=new Map;return e.forEach(a=>{if(!a.agent_id)return;const o=n.get(a.agent_id)??[];o.push(a),n.set(a.agent_id,o)}),n}function ms(e){const n=e.get("status");return{query:e.get("q")??"",sort:e.get("sort")==="oldest"?"oldest":"recent",status:n==="archived"||n==="all"?n:"open",agent:e.get("agent")||"all",work:e.get("work")!=="off"}}const ps=/^[ \t]*(?:`{3,}|~{3,}).*$/gm,hs=/^[ \t]*(?:={2,}|-{2,}|\*{3,}|_{3,})[ \t]*$/gm,gs=/^[ \t]*(?:>[ \t]?|#{1,6}[ \t]+|(?:[-*+]|\d{1,9}[.)])[ \t]+)+/gm,fs=/!\[([^\]]*)\]\([^)]*\)/g,vs=/\[([^\]]*)\]\([^)]*\)/g,Ss=/\[([^\]]*)\]\[[^\]]*\]/g,ys=/<((?:https?|mailto):[^>\s]+)>/g,ws=/`+([^`]*)`+/g,js=/~~([^~]+)~~/g,xs=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,bs=/(^|[^\w*])\*(?=\S)([^*\n]*\S)\*/gm,Ns=/(^|[^\w_])_(?=\S)([^_\n]*\S)_/gm,ks=/\\([\\`*_{}[\]()#+\-.!>~])/g,As=/\s+/g;function Cs(e){return e?e.replace(ps,"").replace(hs,"").replace(gs,"").replace(fs,"$1").replace(vs,"$1").replace(Ss,"$1").replace(ys,"$1").replace(ws,"$1").replace(js,"$1").replace(xs,"$2").replace(bs,"$1$2").replace(Ns,"$1$2").replace(ks,"$1").replace(As," ").trim():""}function ie(e){return e.status==="closed"||e.status==="archived"}function Be(e){return e.is_participant!==!1}function Fe(e){return e.gateway_transport==="email"}function Es(e){if(!Fe(e))return null;const n=e.gateway_sender_transport_id||e.gateway_peer_id;return n?`E-Mail · ${n}`:"E-Mail"}function He(e){return Be(e)||Fe(e)}function _s(e,n,a){return He(e)?!0:(n||e.session_type!=="task")&&a(e.quest_id)}function Rs({sessions:e,agentFilter:n,agentNameById:a,namePatches:o,query:c,transcriptHitIds:v,showWork:p,sort:g,status:m,supervisionBySession:x,inProject:w}){const j={status:m},b=c.trim().toLowerCase();return e.filter(i=>_s(i,p,w)).filter(i=>n!=="all"&&i.agent_id!==n?!1:j.status==="all"?!0:j.status==="archived"?ie(i):!ie(i)).map(i=>{var y;const S=i.last_active||i.created_at,k=S?Date.parse(S):0,f=Et(i),h=i.agent_name||(i.agent_id?a.get(i.agent_id)??null:null)||(f==null?void 0:f.display_name)||null,F=o[i.id]?{...i,name:o[i.id]}:i,$=_t(h?{...F,agent_name:h}:F),R=Cs(Rt(i.first_message??""))||null,H=$.trim().toLowerCase(),A=(R==null?void 0:R.toLowerCase())??"",q=R&&!H.startsWith(A)&&!A.startsWith(H)?R:null,O=[h,q].filter(
1Boolean).join(" · ");return{id:i.id,primary:$,secondary:O,channel:Es(i)??$t(i.gateway_transport)??void 0,wrapPrimary:!0,time:It(S??null)||"—",status:i.awaiting?"awaiting":i.status,awaiting:!!i.awaiting,executing:!!i.executing,supervision:(y=x.get(i.id))==null?void 0:y.supervision,unread:i.unread,archived:ie(i),group:Lt(S??null),sortKey:Number.isFinite(k)?k:0,internal:!He(i),agentId:i.agent_id??void 0,agentName:h??void 0}}).filter(i=>!b||v.has(i.id)?!0:`${i.primary} ${i.secondary??""} ${i.status??""} ${i.id}`.toLowerCase().includes(b)).sort((i,S)=>!!i.internal!=!!S.internal?i.internal?1:-1:g==="recent"?S.sortKey-i.sortKey:i.sortKey-S.sortKey)}const Ls=[{id:"open",label:"Open"},{id:"archived",label:"Archived"},{id:"all",label:"All"}],Is=[{id:"recent",label:"Recent"},{id:"oldest",label:"Oldest first"}],Te="Search sessions…";function $s({loading:e,count:n,query:a,onQueryChange:o,status:c,onStatusChange:v,sort:p,onSortChange:g,agentOptions:m,agentFilter:x,onAgentChange:w,showWork:j,onShowWorkChange:b,workSessionCount:i,onNewSession:S,newSessionDisabled:k}){return s.jsx(ft,{variant:"register",className:l.topBar,"aria-label":"Session controls",title:"Sessions",hideTitle:!0,count:e?"…":n,search:{value:a,onChange:o,placeholder:Te,ariaLabel:Te},controls:s.jsxs(s.Fragment,{children:[s.jsx(E.Filter,{label:"Filter sessions by status",size:"compact",activeCount:c==="open"?0:1,children:()=>s.jsx(Ht,{title:"status",listLabel:"Session status",options:Ls.filter(f=>f.id!=="open").map(f=>({id:f.id,label:f.label})),selected:c==="open"?new Set:new Set([c]),onChange:f=>v(f.size===1?[...f][0]:null)})}),s.jsx(E.Filter,{label:"Sort sessions",size:"compact",triggerTitle:"Sort",glyph:s.jsx(Ot,{size:13,strokeWidth:1.5,"aria-hidden":!0}),activeCount:p==="recent"?0:1,children:({close:f})=>s.jsx(E.Section,{title:"Sort",listLabel:"Sort sessions",children:Is.map(h=>s.jsx(E.Row,{as:"radio",active:p===h.id,label:h.label,onClick:()=>{g(h.id),f()}},h.id))})}),s.jsx(E.Filter,{label:"Scope sessions",size:"compact",triggerTitle:"Scope",glyph:s.jsx(Dt,{size:13,strokeWidth:1.5,"aria-hidden":!0}),activeCount:(x==="all"?0:1)+(j?0:1),children:({close:f})=>s.jsxs(s.Fragment,{children:[s.jsx(E.Section,{title:"Scope",listLabel:"Session scope",children:m.map(h=>s.jsx(E.Row,{as:"radio",active:x===h.id,label:h.label,onClick:()=>{w(h.id),f()}},h.id))}),s.jsx(E.Section,{title:"Include",listLabel:"Include work runs",children:s.jsx(E.Row,{as:"switch",active:j,count:i>0?i:void 0,label:"Agent work runs",onClick:()=>b(!j)})})]})})]}),actions:k?void 0:s.jsx(B,{type:"button",variant:"primary",size:"sm",onClick:S,leading:s.jsx(Ft,{size:14,strokeWidth:2.5,"aria-hidden":!0}),children:"New session"})})}function Oe({needsRuntime:e,onAddRuntime:n,onHireAgent:a}){return s.jsx("div",{className:l.invite,children:e?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:l.inviteTitle,children:"Your company needs a place to run."}),s.jsx("p",{className:l.inviteHint,children:"Set it up and the teammate who runs your company opens the first conversation to get you going."}),s.jsx(B,{variant:"primary",size:"md",className:l.inviteCta,onClick:n,children:"Set up your company"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:l.inviteTitle,children:"No agents yet."}),s.jsx("p",{className:l.inviteHint,children:"Your company is running. Hire your first agent and they open the first conversation with you."}),s.jsx(B,{variant:"primary",size:"md",className:l.inviteCta,onClick:a,children:"Hire your first agent"})]})})}Oe.displayName="DayOneInvite";function gi({companyId:e,itemId:n}){const a=mt();qt();const o=T(t=>t.entities),c=T(t=>t.agents),v=T(t=>t.agentsLoaded),p=T(t=>t.agentsError),g=ne(t=>t.setSessionsForAgent),m=ne(t=>t.sessionNamePatches),[x,w,j]=Kt(),b=x.get("project"),{sort:i,status:S,agent:k,work:f}=ms(x),[h,F]=Ut(),$={status:S},R=t=>w("sort",t==="recent"?null:t),H=t=>w("work",t?null:"off"),A=u.useMemo(()=>new Map(c.map(t=>[t.id,t.name])),[c]),q=u.useMemo(()=>new Map(c.map(t=>[t.id,t.avatar||void 0])),[c]),O=u.useMemo(()=>{const t=c.filter(r=>r.company_id===e||r.id===e);return t.length>0?t:c},[c,e]),{sessions:y,setSessions:D,loading:G,scope:De,hasMore:We,loadingMore:re,olderError:Ke,loadOlderSessions:Ue,listError:ae,retry:qe}=Wt(e),[_,V]=u.useState(null),[oe,le]=u.useState(!1),[ce,ue]=u.useState(null),[de,Q]=u.useState([]);u.useEffect(()=>{const t=h.trim();if(!t){Q([]);return}let r=!0;const d=window.setTimeout(()=>{Nt(t).then(N=>r&&Q(N)).catch(()=>r&&Q([]))},220);return()=>{r=!1,window.clearTimeout(d)}},[h,e]);const me=u.useMemo(()=>new Set(de.map(t=>t.sessionId)),[de]),pe=u.useMemo(()=>{const r=[...new Set(y.map(d=>
1d.agent_id).filter(Boolean))].map(d=>({id:d,label:A.get(d)??"Unknown agent"})).sort((d,N)=>d.label.localeCompare(N.label));return[{id:"all",label:"All agents"},...r]},[A,y]),W=pe.some(t=>t.id===k)?k:"all";u.useEffect(()=>{ds(y).forEach((t,r)=>g(r,t))},[y,g]);const Ge=u.useMemo(()=>y.filter(t=>t.session_type==="task"&&!Be(t)).length,[y]),he=Mt(t=>t.sessions),ge=u.useMemo(()=>Tt(he),[he]),fe=T(t=>t.quests),ve=u.useMemo(()=>{const t=new Map;for(const r of fe)t.set(r.id,r.project_id??null);return t},[fe]),Se=u.useMemo(()=>t=>{if(!b)return!0;const r=t?ve.get(t)??null:null;return b==="unassigned"?r===null:r===b},[b,ve]),C=u.useMemo(()=>Rs({sessions:y,agentFilter:W,agentNameById:A,namePatches:m,query:h,transcriptHitIds:me,showWork:f,sort:i,status:S,supervisionBySession:ge,inProject:Se}),[y,W,A,m,h,me,f,i,S,ge,Se]),L=n??null,Ve=y.find(t=>t.id===L)??null,Qe=u.useMemo(()=>C.map(t=>t.id),[C]),ye=ne(pt(t=>Qe.filter(r=>t.streamingSessions[r]))),we=u.useMemo(()=>new Set(ye),[ye]),Ye=u.useCallback((t,r)=>{kt.prefetch(t,e,r)},[e]),Xe=u.useCallback(t=>{const r=y.find(d=>d.id===t);return(r==null?void 0:r.agent_name)||(r!=null&&r.agent_id?A.get(r.agent_id)??null:null)},[A,y]),Y=u.useCallback(t=>$e(P(o,e,"sessions",t),j),[o,j,e]),Je=u.useMemo(()=>$e(P(o,e,"sessions"),j),[e,o,j]),Ze=u.useCallback(()=>{vt.getState().fetchInbox()},[]),X=St(),je=u.useRef(null);u.useEffect(()=>{if(L)return;const t=r=>{var Ee,U,_e;if(r.metaKey||r.ctrlKey||r.altKey)return;const d=r.target,N=d==null?void 0:d.tagName;if(N==="INPUT"||N==="TEXTAREA"||N==="SELECT"||d!=null&&d.isContentEditable||X!==null&&bt.getState().focusedId!==X)return;let M=0;if(r.key==="ArrowDown"||r.key==="j"?M=1:(r.key==="ArrowUp"||r.key==="k")&&(M=-1),M===0)return;const te=je.current;if(!te||!(!d||d===document.body)&&!te.contains(d))return;const I=Array.from(te.querySelectorAll("[data-session-row]"));if(I.length===0)return;r.preventDefault();const Ae=I.indexOf(document.activeElement),Ce=Ae===-1?M===1?0:I.length-1:Math.min(I.length-1,Math.max(0,Ae+M));(Ee=I[Ce])==null||Ee.focus(),(_e=(U=I[Ce])==null?void 0:U.scrollIntoView)==null||_e.call(U,{block:"nearest"})};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[L,X]);const et=u.useCallback(()=>{a(P(o,e))},[e,o,a]);Gt({label:L?"Sessions":void 0,readout:L||G?void 0:C.length});const K=h.trim()!==""||$.status!=="open"||W!=="all"||!f||b!==null,J=!K&&y.length>0&&C.length===0,tt=K?"No sessions match":J?"No open sessions":"No sessions yet",st=K?"Adjust search or filters to bring conversations back.":J?"Every session here is archived. Start a new one, or bring the archive back.":"Start your first session — say what you need and the team takes it from there.",nt=v&&!p&&O.length===0,xe=!K&&nt,Z=Pt(xe?e:null),it=!Z.isLoading&&!Z.error&&!Z.hasRuntime,be=C.filter(t=>!t.internal),rt=t=>{var r;return!!t.executing||we.has(t.id)||((r=t.supervision)==null?void 0:r.activity)==="working"},Ne=be.filter(t=>Me(t)),ee=C.filter(t=>!Me(t)&&rt(t)),at=be.filter(t=>!Ne.includes(t)&&!ee.includes(t)),ot=C.filter(t=>t.internal&&!ee.includes(t)),{cadences:ke,workspace:lt}=us(ot),ct=u.useMemo(()=>os(ke),[ke]),ut=u.useCallback(async()=>{if(_){le(!0),ue(null);try{const t=await yt.closeSession(_.id);if(!(t!=null&&t.ok))throw new Error("close refused");D(r=>r.map(d=>d.id===_.id?{...d,status:"closed"}:d)),V(null)}catch{ue("Could not archive this session.")}finally{le(!1)}}},[_,D]),dt=t=>s.jsx(ss,{row:t,avatarSrc:t.agentId?q.get(t.agentId):void 0,streaming:we.has(t.id),href:Y(t.id),onWarm:r=>Ye(r.id,Xe(r.id)),onArchive:t.archived?void 0:V},t.id);return L?s.jsx("div",{className:[l.room,l.roomConversation,"company-sessions","company-sessions-page"].join(" "),children:s.jsx(At,{companyId:e,sessionId:L,session:Ve,agentNameById:A,sessionsHref:Je,hrefForSession:Y,onPatchSession:(t,r)=>D(d=>d.map(N=>N.id===t?{...N,...r}:N)),onSessionAdded:t=>D(r=>[t,...r]),onAnswered:Ze})}):s.jsxs("div",{className:[l.room,"company-sessions","company-sessions-page"].join(" "),children:[s.jsx($s,{loading:G,count:C.length,query:h,onQueryChange:F,status:$.status,onStatusChange:t=>w("status",t),sort:i,onSortChange:R,agentOptions:pe,agentFilter:W,onAgentChange:t=>
1w("agent",t==="all"?null:t),showWork:f,onShowWorkChange:H,workSessionCount:Ge,onNewSession:et,newSessionDisabled:O.length===0}),s.jsx("div",{className:l.listPage,ref:je,children:s.jsxs("div",{className:wt.pageList,children:[ae&&s.jsxs(Le,{tone:"critical",children:["We couldn’t load sessions."," ",s.jsxs(jt,{onClick:qe,children:["Retry ",s.jsx("span",{"aria-hidden":!0,children:"→"})]})]}),De==="mine"&&s.jsx(Le,{tone:"neutral",children:"Showing the rooms you’re in. The company-wide register needs the director role."}),G&&y.length===0?s.jsx("div",{className:l.loading,children:s.jsx(xt,{size:"sm"})}):C.length===0?s.jsx(s.Fragment,{children:ae?null:xe?s.jsx(Oe,{needsRuntime:it,onAddRuntime:()=>a(P(o,e,"runtime")),onHireAgent:()=>a(P(o,e,"agents"))}):s.jsx(Vt,{title:tt,description:st,action:J?s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>w("status","archived"),children:"Show archived"}):void 0})}):s.jsx(is,{needsYou:Ne,working:ee,recent:at,standing:ct,runs:lt,renderRow:dt,rowHref:t=>Y(t.id)}),We&&C.length>0&&s.jsx("div",{className:l.loadMore,children:s.jsx(B,{variant:"quiet",size:"sm",onClick:Ue,disabled:re,children:re?"Loading…":Ke?"Couldn’t load older — retry":"Load older"})})]})}),s.jsx(Qt.Confirm,{open:_!==null,onClose:()=>oe?void 0:V(null),onConfirm:ut,title:"Archive this session?",confirmLabel:"Archive",cancelLabel:"Cancel",loading:oe,message:s.jsxs("div",{className:l.dismissDialogBody,children:[s.jsxs("p",{children:[_==null?void 0:_.primary," leaves this register. Its transcript is kept — the Archived filter brings it back."]}),ce&&s.jsx("p",{role:"alert",children:ce})]})})]})}export{gi as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.