PageSourceSearch

https://app.aeqi.ai/assets/CodeFactoryPage-CxZAI0VO.js

js aeqi.ai collected 2026-10-05 15:20:08 UTC 59,513 bytes, 16 lines download raw bytes

1import{r as c,j as s,L as Ge,g as vt,e as Nt}from"./react-vendor-DhKRNgCF.js";import{b as Ct,e as Q}from"./main-5X1ljm9O.js";import{a as ye,w as le}from"./searchParamState-C2u9qTxi.js";import{u as Ue}from"./useRelativeNow-Dtb36nP1.js";import{u as St}from"./usePaneTitle-D6ZwULRI.js";import{C as At}from"./ConnectAccountSheet-DRIpaEfT.js";import{s as Tt,u as Rt,a as Ye,b as Et,c as Qe,d as Lt,e as Mt,f as Pt,g as Ot}from"./codeApp-v0zXQoP6.js";import{a3 as ve,B as O,af as he,e as J,i as Ve,o as Pe,X as $t,u as Wt,A as V,a1 as zt,L as Dt,R as qt,v as Ft,x as Bt,b1 as ue,g as Ne,cd as Y,t as fe,a as Ht,bH as It,q as Oe,h as Gt,j as Ut,al as Yt,P as Qt}from"./index-x-ynt_mA.js";import{C as Vt}from"./sessionsRoom.module-CAYZGxnU.js";import{P as pe}from"./Popover-BqGzTl2s.js";import{S as ee}from"./Select-B9HKEdju.js";import{S as Ke}from"./SegmentedControl-DmfR_PrG.js";import{e as Kt}from"./engines-Du4ErJ4k.js";import{b as xe}from"./Dialog-FeH18WmV.js";import{I as te}from"./Icon-pU9snwy7.js";import{I as $e}from"./id-card-Bb8C47f3.js";import{d1 as Ce,ec as Xt,e4 as Zt,s as Xe,dN as Jt}from"./AppLayoutEntry-DAXBezYD.js";import{B as F}from"./Banner-BC3mpD28.js";import{F as Ze}from"./folder-Ch_gGmO7.js";import{u as es,a as ts,w as ss,b as ns,c as as,d as os,F as rs,t as D}from"./FilesTab-CrY2li5P.js";import{w as is}from"./keys-BjRLFhcH.js";import{R as ls,C as cs,l as ds}from"./RichMarkdown-fw79h-Z9.js";import{E as R}from"./toastStore-BQAR76Tw.js";import{D as we}from"./DocumentFrame-xaXGXvA9.js";import{F as Je}from"./zap-B2F61PrC.js";import{E as us}from"./MonoCopy-DXX06BmX.js";import{R as Se}from"./rotate-cw-BNWnmuEm.js";import{b as hs}from"./Thread-DOeLJ9-G.js";import{U as fs}from"./upload-D-uDlmLx.js";import{u as ps,w as ms}from"./CompanyWebsiteDoor-X2nRAjU5.js";import{b as gs}from"./companies-CPJyzNEm.js";import{d as _s,r as xs}from"./toolSummary-BdclhoJ5.js";import{a as ws}from"./hooks-5BqVeAIM.js";import{T as bs}from"./Tabs-Dz6f0Mgb.js";import{U as ks}from"./AccountControl-DTzTxKrK.js";import{I as js}from"./IconButton-8wJ0YnPU.js";import{P as ys}from"./plus-BM42xh30.js";import{S as vs}from"./SessionConversation-CBYuYU7N.js";import{I as Ns}from"./Inline-BtpmlJyj.js";import"./vite-runtime-DdPMya_n.js";import"./accounts-D-c0jl-F.js";import"./useQuery-CMqcCWeO.js";import"./Radio-CJP2kS2c.js";import"./Choice.module-Bk7p_3H-.js";import"./Composer-IoQlzAQs.js";import"./Tag-DxRsYABe.js";import"./x-COoA-pMz.js";import"./Tooltip-B2TEhq0J.js";import"./shallow-BK8nZ_ih.js";import"./index-xSlEmCXn.js";import"./manager-BNENNOSM.js";import"./pageBus-DSNqaLgn.js";import"./chat-B9LPukPq.js";import"./sound-Dle_CNNu.js";import"./pages-D2KDqFxa.js";import"./useNav-B2qM7j19.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"./MessageWorkBar-BmNRqGvo.js";import"./spend-Ata5sTWt.js";import"./users-BOathvLc.js";import"./lightbulb-C9VNfYnD.js";import"./globe-D7GuNYFS.js";import"./search-6-T2OhHv.js";import"./trash-2-4srfkZr9.js";import"./roleSeniority--NJ924F_.js";import"./CopyButton-BTGNyXUH.js";import"./useClipboard-jXMCbKUC.js";import"./copy-BvQ7faF_.js";import"./square-DKfaxd9K.js";import"./rotate-ccw-DoE4lz1e.js";import"./billingRoutes-C5Hvwmu4.js";import"./circle-dot-DhMzzO6r.js";import"./threadRowKey-vUStF55W.js";import"./lock-C7xbDgT3.js";/* empty css               */import"./Meter-Bb0oVAP5.js";import"./trial-Cqrutr3v.js";import"./settings-Cz_bZVxX.js";import"./settle-CAm2px29.js";import"./firstRun-DgUs7tFn.js";import"./Stat-In2LDOuF.js";import"./ideas-4udUJ06Z.js";import"./file-CtwElvLU.js";import"./blockText-B6vOdbAJ.js";import"./markdown-BFdK-L47.js";import"./clock-BmzCUZh9.js";import"./file-text-DM5CSq9U.js";import"./shield-check-CHcpQPKo.js";import"./arrow-up-BX7NVLmo.js";import"./Textarea-DnCrElM_.js";import"./chevron-left-Cc64uDN7.js";import"./hosting-CyfPFIAi.js";import"./publicWebsite-RVWLlX5L.js";import"./siteFrame-D__E9OjP.js";import"./user-plus-DEKY5dqb.js";import"./HarnessBadge-BxUiFV9e.js";import"./detailRoom.module-DFks5Fjw.js";/**
2 * @license lucide-react v0.460.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Cs=ve("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
7 * @license lucide-react v0.460.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Ss=ve("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
12 * @license lucide-react v0.460.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const As=ve("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Ts={outside_roots:"That folder is outside everywhere this company keeps its work, so nobody can be pointed at it.",not_found:"There is no folder at that path on this box.",already_added:"That folder is already one of this company's workspaces.",too_many:"This company already has as many workspaces as one runtime keeps. Remove one before adding another.",no_work
16dir:"That folder is not one of this company's workspaces.",unknown_workspace:"This company has no workspace by that name.",forbidden:"You do not have access to this company's code.",human_only:"Only a person can do this. An agent working for you cannot.",account_in_use:"An agent is still running on that account, so it cannot be changed right now.",account_not_usable:"This company's account cannot run this — it is the wrong engine for this screen, or it is open to agents only.",sign_in_failed:"This company's coding account could not be opened. Reconnect it and try again.",engine_not_installed:"That coding engine is not installed on this box yet.",binary_unavailable:"The coding engine is not available on this box yet.",unknown_engine:"That coding engine is not one this box runs.",bad_mode:"That permission mode is not one the engines take.",bad_effort:"That effort is not one the engines take.",busy:"That session is still working on the last message.",internal:"Something on this box failed part-way through. Try again."};function se(e){return(e.code?Ts[e.code]:void 0)??e.error}const H="auto",et=[{id:H,label:"Auto"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"Extra"},{id:"max",label:"Max"}],ie="bypassPermissions",be="manual",tt=[{id:"auto",label:"Auto",description:"Claude handles permission decisions"},{id:"manual",label:"Manual",description:"Always ask before making changes"},{id:"acceptEdits",label:"Accept edits",description:"Automatically accept all file edits"},{id:"plan",label:"Plan",description:"Create a plan before making changes"},{id:ie,label:"Bypass permissions",description:"Accepts all permissions"}];function Rs(e,t=[]){if(!e||e===H)return"Auto";const n=t.find(o=>o.id===e);if(n)return n.label;const a=e.lastIndexOf("/");return a===-1?e:e.slice(a+1)||e}function Es(e){var t;return!e||e===H?null:((t=et.find(n=>n.id===e))==null?void 0:t.label)??e}function Ls(e){var n;const t=e??be;return((n=tt.find(a=>a.id===t))==null?void 0:n.label)??t}function Ms(e,t,n,a=[]){const o=[e===null?null:Rs(e,a),t===null?null:Ls(t),Es(n)].filter(r=>!!r);return o.length>0?o.join(" · "):"Run settings"}function We(e){return!e||e===H?void 0:e}const Ps="_trigger_11v25_1",Os="_value_11v25_10",$s="_panel_11v25_17",Ws="_hint_11v25_25",zs="_models_11v25_32",Ds="_effort_11v25_38",qs="_effortLabel_11v25_44",Fs="_section_11v25_50",Bs="_sectionLabel_11v25_56",Hs="_modes_11v25_62",Is="_rowTitle_11v25_68",Gs="_rowNote_11v25_72",$={trigger:Ps,value:Os,panel:$s,hint:Ws,models:zs,effort:Ds,effortLabel:qs,section:Fs,sectionLabel:Bs,modes:Hs,rowTitle:Is,rowNote:Gs};function Us({model:e,effort:t,mode:n,models:a,showModels:o=!0,showEffort:r=!0,onChange:i,onModeChange:d,disabled:l=!1}){const[u,h]=c.useState(!1),f=n===ie,p=m=>{m===ie&&h(!1),d(m)};return s.jsx(pe,{open:u,onOpenChange:h,placement:"top-start",portal:!0,trigger:s.jsx(O,{type:"button",variant:f?"secondary":"quiet",tone:f?"critical":void 0,size:"sm",className:$.trigger,disabled:l,title:"What the next message runs on, and how much it may do without asking.",trailing:s.jsx(he,{size:14,strokeWidth:1.75,"aria-hidden":!0}),children:s.jsx("span",{className:$.value,children:Ms(o?e:null,n,t,a)})}),children:s.jsxs("div",{className:$.panel,children:[s.jsx("p",{className:$.hint,children:"This rides on your next message. Nothing is saved here."}),n!==null&&s.jsxs("div",{className:$.section,children:[s.jsx("span",{className:$.sectionLabel,children:"Mode"}),s.jsx("div",{className:$.modes,role:"listbox","aria-label":"What this agent may do without asking",children:tt.map(m=>s.jsxs(ee.Option,{selected:n===m.id,onClick:()=>p(m.id),children:[s.jsx("span",{className:$.rowTitle,children:m.label}),s.jsx("span",{className:$.rowNote,children:m.description})]},m.id))})]}),s.jsxs("div",{className:$.section,children:[s.jsx("span",{className:$.sectionLabel,children:"Model"}),o?s.jsx("div",{className:$.models,role:"listbox","aria-label":"Model for the next message",children:a.map(m=>s.jsx(ee.Option,{selected:e===m.id,onClick:()=>i({model:m.id,effort:t}),children:m.id===H?"Auto (the account's own default)":m.label},m.id))}):s.jsx("span",{className:$.rowNote,children:"This agent takes its model from its own configuration."})]}),r&&s.jsxs("div",{className:$.effort,children:[s.jsx("span",{className:$.effortLabel,children:"Thinking"}),s.jsx(Ke,{options:et.map(m=>({id:m.id,label:m.label})),value:t,onChange:m=>i({model:e,effort:m}),"aria-label":"Thinking effort for the next message"})]})]})})}const Ys="_factory_wpqd7_13 _roomPage_p195d_12",Qs="_workbench_wpqd7_19",Vs="_rail_wpqd7_35",Ks="_railHead_wpqd7_48",Xs="_railSearch_wpqd7_55",Zs="_railSection_wpqd7_62",Js="_rail
16Label_wpqd7_69",en="_railNote_wpqd7_80",tn="_agentTrigger_wpqd7_90",sn="_agentPanel_wpqd7_96",nn="_agentSearch_wpqd7_104",an="_agentRowTitle_wpqd7_108",on="_agentRowNote_wpqd7_116",rn="_agentRowState_wpqd7_117",ln="_agentNote_wpqd7_118",cn="_agentBlocker_wpqd7_119",dn="_autonomyLink_wpqd7_139",un="_railList_wpqd7_145",hn="_railGroup_wpqd7_155",fn="_railDay_wpqd7_163",pn="_row_wpqd7_173",mn="_rowName_wpqd7_195",gn="_rowSeat_wpqd7_207",_n="_engineMark_wpqd7_223",xn="_rowWhen_wpqd7_234",wn="_center_wpqd7_247",bn="_conversation_wpqd7_254",kn="_pane_wpqd7_262",jn="_paneStrip_wpqd7_275",yn="_paneBody_wpqd7_279",vn="_paneHint_wpqd7_288",Nn="_paneOpen_wpqd7_307",b={factory:Ys,workbench:Qs,rail:Vs,railHead:Ks,railSearch:Xs,railSection:Zs,railLabel:Js,railNote:en,agentTrigger:tn,agentPanel:sn,agentSearch:nn,agentRowTitle:an,agentRowNote:on,agentRowState:rn,agentNote:ln,agentBlocker:cn,autonomyLink:dn,railList:un,railGroup:hn,railDay:fn,row:pn,rowName:mn,rowSeat:gn,engineMark:_n,rowWhen:xn,center:wn,conversation:bn,pane:kn,paneStrip:jn,paneBody:yn,paneHint:vn,paneOpen:Nn},Cn=["claude-code","opencode","hermes"],st="auto",nt={"claude-code":[{id:"claude-fable-5-1",label:"Fable 5.1"},{id:"claude-opus-5",label:"Opus 5"},{id:"claude-sonnet-5",label:"Sonnet 5"},{id:"claude-haiku-4-5",label:"Haiku 4.5"}],opencode:[{id:"opencode-go/glm-5.2",label:"GLM 5.2"},{id:"opencode/deepseek-v4-flash-free",label:"DeepSeek V4 Flash (free)"},{id:"opencode/claude-sonnet-5",label:"Sonnet 5"},{id:"opencode/gpt-6",label:"GPT-6"},{id:"opencode/qwen4-coder",label:"Qwen4 Coder"}],hermes:[]};function Sn(e,t){const n=nt[e]??[],a=(t??"").trim(),o=a&&!n.some(r=>r.id===a);return[{id:st,label:"Auto"},...o?[{id:a,label:Ae(a)}]:[],...n]}function Ae(e){const t=e.lastIndexOf("/");return(t===-1?e:e.slice(t+1))||e}function An(e){const t=(e??"").trim();if(!t)return null;for(const n of Cn){const a=(nt[n]??[]).find(o=>o.id===t);if(a)return a.label}return Ae(t)}const ze={native:"AE","claude-code":"CC",opencode:"OC",hermes:"HM",pi:"PI"};function at(e){return ze[e]??ze.native}function ot(e){return Kt(e).label}function rt(e){return e.engine==="native"}const _e={native:{model:!1,effort:!1,mode:!1},"claude-code":{model:!0,effort:!0,mode:!0},opencode:{model:!0,effort:!1,mode:!0},hermes:{model:!1,effort:!1,mode:!0},pi:{model:!1,effort:!1,mode:!1}};function Te(e){return e?_e[e.engine]??_e.native:_e.native}function Tn(e){const t=Te(e);return t.model||t.effort||t.mode}function Rn(e){const t={id:st,label:"Auto"};if(!e)return[t];if(e.engine==="claude-code"||e.engine==="opencode")return Sn(e.engine,e.model);const n=(e.model??"").trim();return n?[t,{id:n,label:Ae(n)}]:[t]}function En(e){return e?e.account?`Runs on ${e.account.label}`:rt(e)?"Runs on aeqi's own provider":null:null}function ke(e){return e.available?null:(e.why_unavailable??"").trim()||"This agent has nothing to run on yet. Connect an account for it first."}function Ln(e){if(!e||!rt(e))return null;const t=(e.autonomy??"").trim();return t?`Company autonomy: ${t}`:null}const Mn=6;function Pn(e,t){var o;const n=t.trim().toLowerCase();return n?[e.name,ot(e.engine),((o=e.account)==null?void 0:o.label)??""].join(" ").toLowerCase().includes(n):!0}function On(e,t){return t.trim()?e.filter(n=>Pn(n,t)):e}function $n(e){const t=e.filter(n=>n.available);return t.length===e.length||t.length===0?e:[...t,...e.filter(n=>!n.available)]}function Wn(e,t){const n=t.find(a=>a.id===e);return n||(t.find(a=>a.available)??t[0]??null)}function it({agent:e,model:t,effort:n,onChange:a,permission:o,settingsPath:r,settingsSearch:i,disabled:d=!1}){const l=Te(e),u=Ln(e);return s.jsxs(s.Fragment,{children:[Tn(e)&&s.jsx(Us,{model:t,effort:n,mode:l.mode?o.mode:null,models:Rn(e),showModels:l.model,showEffort:l.effort,disabled:d,onChange:a,onModeChange:o.choose}),u&&s.jsx(Ge,{className:b.autonomyLink,to:Ct(r,i,{scope:"company",section:"general"}),title:"How much this company's own agents may do without asking. Set for the company, not for one message.",children:s.jsx(J,{children:u})}),s.jsx(xe.Confirm,{open:o.confirming,onClose:o.cancelBypass,onConfirm:o.confirmBypass,title:"Turn off permission prompts?",message:"This agent will run every tool without asking — including shell commands and file writes — in this workspace, for the rest of this session.",confirmLabel:"By
16pass permissions",destructive:!0})]})}function zn({agent:e,onConnect:t}){const n=En(e);return e?n?s.jsx(O,{type:"button",variant:"quiet",size:"sm",disabled:!0,leading:s.jsx(te,{icon:$e,size:"sm"}),title:"The company account this agent's turns run on. Change it where the agent is.",children:n}):s.jsx(O,{type:"button",variant:"secondary",size:"sm",leading:s.jsx(te,{icon:$e,size:"sm"}),onClick:t,children:"Connect an account"}):null}function lt(e){const t=c.useRef(new Map),n=c.useRef(new Set),[a,o]=c.useState(()=>t.current.get(e)??be),[r,i]=c.useState(!1);c.useEffect(()=>{o(t.current.get(e)??be),i(!1)},[e]);const d=c.useCallback(f=>{t.current.set(e,f),o(f)},[e]),l=c.useCallback(f=>{if(f===ie&&!n.current.has(e)){i(!0);return}d(f)},[e,d]),u=c.useCallback(()=>{n.current.add(e),i(!1),d(ie)},[e,d]),h=c.useCallback(()=>i(!1),[]);return{mode:a,confirming:r,choose:l,confirmBypass:u,cancelBypass:h}}const Dn="_floor_8xa9t_160",qn={floor:Dn};function Fn({companyId:e,agent:t,onSend:n,sending:a=!1,placeholder:o="Describe a task or ask a question",notice:r,wellChips:i,settingsPath:d,settingsSearch:l}){const u=Ve(_=>_.entities),[h,f]=c.useState(H),[p,m]=c.useState(H),g=c.useRef((t==null?void 0:t.id)??null);g.current!==((t==null?void 0:t.id)??null)&&(g.current=(t==null?void 0:t.id)??null,h!==H&&f(H));const w=lt((t==null?void 0:t.id)??"new"),v=Te(t).mode,y=c.useCallback(async _=>{const k=_.text.trim();k&&await n({text:k,model:We(h),effort:We(p),...v?{mode:w.mode}:{}})},[n,h,p,v,w.mode]);return s.jsxs("div",{className:qn.floor,children:[r,s.jsx(Vt,{agentId:(t==null?void 0:t.id)??null,sessionId:null,connectedSessionId:null,base:Q(u,e),onSend:y,mode:"dock",streaming:a,disabled:a||!t||!t.available,placeholder:o,attachMenuPlacement:"top-start",wellChips:i,leadingControls:s.jsx(it,{agent:t,model:h,effort:p,permission:w,settingsPath:d,settingsSearch:l,disabled:a,onChange:_=>{f(_.model),m(_.effort)}})})]})}const Bn=12;function Hn(e){return e!==void 0&&e!==""&&!e.startsWith("<")}function De(e){if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:Z(t)}function Z(e){const t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),a=`${e.getDate()}`.padStart(2,"0");return`${t}-${n}-${a}`}function U(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n.setHours(0,0,0,0),n}function In(e,t=new Date){var d;const n=new Map,a=new Map;let o=0,r=null;for(const l of e){o+=Number.isFinite(l.messages)?l.messages:0;const u=De(l.started_at)??De(l.updated_at);u&&n.set(u,(n.get(u)??0)+1);const h=l.updated_at||l.started_at||"";h&&(!r||h>r)&&(r=h);const f=(d=l.model)==null?void 0:d.trim();if(Hn(f)){const p=a.get(f);p?(p.count+=1,h>p.newest&&(p.newest=h)):a.set(f,{count:1,newest:h})}}const i=[...n.entries()].map(([l,u])=>({day:l,sessions:u})).sort((l,u)=>l.day.localeCompare(u.day));return{sessions:e.length,messages:o,activeDays:i.length,currentStreak:Gn(n,t),longestStreak:Un(i),lastActive:r,favoriteModel:Yn(a),days:i}}function Gn(e,t){const n=Z(t);let a=U(t,0);if(!e.has(n)&&(a=U(t,-1),!e.has(Z(a))))return 0;let o=0;for(;e.has(Z(a));)o+=1,a=U(a,-1);return o}function Un(e){let t=0,n=0,a=null;for(const o of e){const r=new Date(`${o.day}T00:00:00`);n=a&&Z(U(a,1))===o.day?n+1:1,n>t&&(t=n),a=r}return t}function Yn(e){let t=null,n={count:0,newest:""};for(const[a,o]of e)(o.count>n.count||o.count===n.count&&o.newest>n.newest)&&(t=a,n=o);return t?An(t):null}function Qn(e,t=new Date,n=Bn){const a=new Map(e.map(u=>[u.day,u.sessions])),o=e.reduce((u,h)=>Math.max(u,h.sessions),0),r=U(t,0),i=U(r,-(n*7-1)),d=U(i,-i.getDay()),l=[];for(let u=d;u<=r;u=U(u,1)){const h=Z(u),f=a.get(h)??0;l.push({day:h,sessions:f,level:Vn(f,o)})}return l}function Vn(e,t){if(e<=0||t<=0)return 0;const n=e/t;return n<=.25?1:n<=.5?2:n<=.75?3:4}function Kn(e,t){return e.map(n=>({messages:n.message_count??0,started_at:n.created_at,updated_at:n.last_active,model:t}))}const Xn="_home_wmohk_11",Zn="_column_wmohk_27",Jn="_greeting_wmohk_39",ea="_mark_wmohk_51",ta="_subtitle_wmohk_58",sa="_usage_wmohk_66",na="_stats_wmohk_73",aa="_stat_wmohk_73",oa="_statValue_wmohk_87",ra="_statLabel_wmohk_98",ia="_grid_wmohk_111",la="_cell_wmohk_122",ca="_reading_wmohk_143",da="_chips_wmohk_152",P={home:Xn,column:Zn,greeting:Jn,mark:ea,subtitle:ta,usage:sa,stats:na,stat:aa,statValue:o
16a,statLabel:ra,grid:ia,cell:la,reading:ca,chips:da};function K({label:e,value:t}){return s.jsxs("div",{className:P.stat,children:[s.jsx("span",{className:P.statValue,children:t}),s.jsx("span",{className:P.statLabel,children:e})]})}function qe(e){return e===0?"—":`${e} ${e===1?"day":"days"}`}function ua({sessions:e,now:t}){const n=c.useMemo(()=>In(e,t??new Date),[e,t]),a=c.useMemo(()=>Qn(n.days,t??new Date),[n.days,t]);return n.sessions===0?s.jsx(Pe,{padding:"md",className:P.usage,"aria-label":"Your work in this folder",children:s.jsx("p",{className:P.reading,children:"Nothing has run here with this agent yet. Your first message opens the first session."})}):s.jsxs(Pe,{padding:"md",className:P.usage,"aria-label":"Your work in this folder",children:[s.jsxs("div",{className:P.stats,children:[s.jsx(K,{label:"Sessions",value:`${n.sessions}`}),s.jsx(K,{label:"Messages",value:$t(n.messages)}),s.jsx(K,{label:"Active days",value:`${n.activeDays}`}),s.jsx(K,{label:"Current streak",value:qe(n.currentStreak)}),s.jsx(K,{label:"Longest streak",value:qe(n.longestStreak)}),s.jsx(K,{label:"Favourite model",value:n.favoriteModel??"—"})]}),s.jsx("div",{className:P.grid,role:"img","aria-label":`${n.activeDays} active days in 12 weeks`,children:a.map(o=>s.jsx("span",{className:P.cell,"data-level":o.level,title:`${o.day} — ${o.sessions} ${o.sessions===1?"session":"sessions"}`},o.day))}),n.lastActive&&s.jsxs("p",{className:P.reading,children:["Last active ",Ce(n.lastActive),"."]})]})}function ha(e){const t=e==null?void 0:e.trim();if(!t)return null;const n=t.indexOf(" ");return n===-1?t:t.slice(0,n)}function fa({workspaces:e,workspace:t,onWorkspace:n}){const[a,o]=c.useState(!1),r=e.find(i=>i.id===t);return s.jsx(pe,{open:a,onOpenChange:o,placement:"bottom-start",portal:!0,trigger:s.jsx(O,{type:"button",variant:"quiet",size:"sm",disabled:e.length===0,leading:s.jsx(te,{icon:Ze,size:"sm"}),trailing:s.jsx(he,{size:14,strokeWidth:1.75,"aria-hidden":!0}),title:"The folder this agent works in. Your first message opens a session here.",children:(r==null?void 0:r.name)??"No workspace"}),children:s.jsx("div",{role:"listbox","aria-label":"Workspace for the new session",children:e.map(i=>s.jsx(ee.Option,{selected:i.id===t,onClick:()=>{n(i.id),o(!1)},children:i.name},i.id))})})}function pa({companyId:e,agent:t,workspaces:n,workspace:a,onWorkspace:o,sessions:r,onCreated:i,onConnect:d,settingsPath:l,settingsSearch:u,now:h}){const[f,p]=c.useState(null),[m,g]=c.useState(!1),w=ha(Wt(k=>{var x;return(x=k.user)==null?void 0:x.name})),v=t?ke(t):null,y=c.useMemo(()=>Kn(r,(t==null?void 0:t.model)??null),[r,t==null?void 0:t.model]),_=c.useCallback(async k=>{if(!t){p("Pick an agent first — somebody has to do the work.");return}if(!a){p("Pick a workspace first — an agent has to work somewhere.");return}p(null),g(!0);try{const x=await Tt(t.id,{workspace:a,text:k.text,model:k.model,effort:k.effort,mode:k.mode});if(!x.ok){p(se(x));return}i(x.session_id,a)}catch{p(`Could not reach ${t.name}. Check your connection and try again.`)}finally{g(!1)}},[t,a,i]);return s.jsx("div",{className:P.home,children:s.jsxs("div",{className:P.column,children:[s.jsxs("h2",{className:P.greeting,children:[s.jsx("span",{className:P.mark,"aria-hidden":!0,children:"✳"}),s.jsx("span",{children:w?`What's up next, ${w}?`:"What's up next?"})]}),s.jsx("p",{className:P.subtitle,children:t?`Pick a folder and say what you need. Your first message opens a session with ${t.name}.`:"Pick an agent in the rail, then a folder. Your first message opens a session."}),s.jsx(ua,{sessions:y,now:h}),s.jsx(Fn,{companyId:e,agent:t,onSend:_,sending:m,settingsPath:l,settingsSearch:u,notice:f?s.jsx(F,{tone:"critical",children:f}):v?s.jsx(F,{tone:"neutral",children:v}):null,wellChips:s.jsxs("div",{className:P.chips,children:[s.jsx(zn,{agent:t,onConnect:d}),s.jsx(fa,{workspaces:n,workspace:a,onWorkspace:o})]})})]})})}const ma=new Set(["Write","Edit","MultiEdit","NotebookEdit","write_file","edit_file"]),ga=["file_path","notebook_path","path"],_a=new Set(["png","jpg","jpeg","gif","webp","avif","bmp","ico"]);function ct(e){const t=e.slice(e.lastIndexOf("/")+1).toLowerCase(),n=t.lastIndexOf(".");return n>0?t.slice(n+1):""}function Re(e){const t=ct(e);return t==="html"||t==="htm"?"html":t==="md"||t==="markdown"?"markdown":t==="pdf"?"pdf":_a.has(t)?"image":"code"}function xa(e){const t=Re(e);if(t==="pdf")return"application/pdf";if(t!=="image")return"text/plain";const n=ct(e);return n==="jpg"||n==="jpeg"?"image/jpeg":n==="ico"?"image/x-icon":`image/${n}`}function wa(e,t){const n=e.replace(/\/+$/,""),a=t.trim();return a.startsWith("/")?!n||a===n?null:a.startsWith(`${n}/`)?a.slice(n.length+1):null:a.replace(/^\.\//,"")}const ba="_tab_zh1vu_3",ka="_split_zh1vu_15",ja="_list_zh1vu_22",ya="_handle_zh1vu_34",va="_viewer_zh1vu_38",Na="_bar_zh1vu_50",Ca="_path_zh1vu_58",Sa="_sheet_zh1vu_75",Aa="_prose_zh1vu_83",Ta="_document_zh1vu_90",Ra="_picture_zh1vu_95",Ea="_image_zh1vu_105",z={tab:ba,split:ka,list:ja,handle:ya,viewer:va,bar:Na,path:Ca,sheet:Sa,prose:Aa,document:Ta,picture:Ra,image:Ea}
16,La={no_workdir:{title:"This workspace has no folder to read",description:"Nothing has given this workspace a folder on disk yet."},outside_workdir:{title:"That file is outside the working directory",description:"Claude can only read the folder the workspace names."},forbidden:{title:"You cannot read this workspace's files",description:"Ask an operator with access to this company's workspaces."},not_found:{title:"This file is no longer there",description:"Claude wrote it during this session, and something has since removed it."},too_long:{title:"This file is too big to open here",description:"A preview serves up to 8 MB. Open it from the workspace instead."}};function Ma({workspaceId:e,artifact:t,path:n,onObjectUrl:a}){const o=Re(t.full),r=es(e,n,{enabled:!!n}),i=r.data,d=i!=null&&i.ok?i.bytes:null,l=ts(d,xa(t.full)),u=o==="image"||o==="pdf",h=c.useMemo(()=>u?null:ss(d),[u,d]);if(c.useEffect(()=>(a==null||a(l),()=>a==null?void 0:a(null)),[l,a]),!n)return s.jsx(R,{title:"This file is outside the workspace",description:`Claude wrote ${t.full}, which is not under the folder this workspace names — so nothing here can open it.`});if(r.isPending)return s.jsx(V,{variant:"card",height:320,label:`Opening ${t.name}`});if(r.isError)return s.jsx(R,{variant:"error",title:"We couldn’t load this artifact",error:r.error,onRetry:()=>void r.refetch()});if(!i)return null;if(!i.ok){const f=La[i.code];return s.jsx(R,{title:f.title,description:f.description})}return o==="image"?l?s.jsx("div",{className:`${z.picture} aeqi-surface-recessed`,children:s.jsx("img",{className:z.image,src:l,alt:t.name})}):s.jsx(V,{variant:"card",height:320,label:`Drawing ${t.name}`}):o==="pdf"?l?s.jsx(we,{src:l,title:t.name,className:z.document}):s.jsx(V,{variant:"card",height:320,label:`Opening ${t.name}`}):h===null?s.jsx(R,{title:"This file is not text",description:`${t.name} has an extension this app reads as text, and its bytes are not.`}):o==="html"?s.jsx(we,{srcDoc:h,sandbox:"allow-scripts",title:t.name,className:z.document}):o==="markdown"?s.jsx("div",{className:`${z.sheet} ${z.prose} aeqi-surface-recessed`,children:h.trim()?s.jsx(ls,{body:h}):s.jsx(F,{tone:"neutral",children:"This file is empty."})}):s.jsx("div",{className:`${z.sheet} aeqi-surface-recessed`,children:s.jsx(cs,{code:h,language:ds(t.full)})})}const Pa=168,Oa=420,Fe=232,$a={no_workdir:"Nothing has given this workspace a folder on disk yet.",outside_workdir:"Claude can only read the folder the workspace names.",forbidden:"Ask an operator with access to this company's workspaces."};function Wa({artifact:e,selected:t,onSelect:n}){return s.jsx(qt,{size:"sm",selected:t,onClick:n,title:e.name,secondary:`${e.tool}${e.at?` · ${Ce(e.at)}`:""}`})}function za({workspaceId:e,artifacts:t=[]}){var k,x;const[,n]=ye(),[a,o]=c.useState(null),[r,i]=c.useState(Fe),[d,l]=c.useState(null),u=zt();Ue();const h=ns(e,""),f=(k=h.data)!=null&&k.ok?h.data.root:"",p=((x=t[0])==null?void 0:x.full)??null,m=c.useRef(null);c.useEffect(()=>{p!==m.current&&(m.current=p,o(p))},[p]);const g=c.useMemo(()=>t.find(N=>N.full===a)??t[0]??null,[t,a]),w=g?wa(f,g.full):null,v=c.useCallback(N=>{i(E=>Math.min(Oa,Math.max(Pa,E+N)))},[]),y=c.useCallback(()=>{w&&u.invalidateQueries({queryKey:is.raw(e,w)})},[u,e,w]),_=c.useCallback(()=>{w&&(n("file",w),n("pane",null))},[w,n]);return t.length===0?s.jsx(R,{title:"Nothing made yet",description:"Files Claude writes in this session show up here — a page, a note, a picture, a script — and open as what they are."}):h.isPending?s.jsx(V,{variant:"card",height:280,label:"Finding the workspace folder"}):h.isError?s.jsx(R,{variant:"error",title:"We couldn’t load this workspace's folder",error:h.error,onRetry:()=>void h.refetch()}):h.data&&!h.data.ok?s.jsx(R,{title:"These files cannot be opened",description:$a[h.data.code]}):s.jsx("div",{className:z.tab,ref:N=>{N==null||N.style.setProperty("--artifacts-list-w",`${r}px`)},children:s.jsxs("div",{className:z.split,children:[s.jsx("div",{className:z.list,children:s.jsx(Dt,{"aria-label":"Files this session made",children:t.map(N=>s.jsx(Wa,{artifact:N,selected:(g==null?void 0:g.full)===N.full,onSelect:()=>o(N.full)},N.full))})}),s.jsx(Xt,{orientation:"vertical",onResize:v,onReset:()=>i(Fe),ariaLabel:"Resize the artifact list",className:z.handle}),s.jsx("div",{className:z.viewer,children:g&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:z.bar,children:[s.jsx("span",{className:z.path,title:g.full,children:w??g.full}),s.jsx(O,{variant:"quiet",size:"sm",disabled:!w,onClick:_,leading:s.jsx(Je,{size:13,strokeWidth:2,"aria-hidden":!0}),children:"Open in Files"}),s.jsx(O,{variant:"quiet",size:"sm",disabled:!d,onClick:()=>{d&&window.open(d,"_blank","noopener")},leading:s.jsx(us,{size:13,strokeWidth:2,"aria-hidden":!0}),children:Re(g.full)==="html"?"Open source":"Open in new tab"}),s.jsx(O,{variant:"quiet",size:"sm",disabled:!w,onClick:y,leading:s.jsx(Se,{size:13,strokeWidth:2,"aria-hidden":!0}),children:"Refresh"})]}),s.jsx(Ma,{workspaceId:e,artifact:g,path:w,onObjectUrl:l},g.full)]})})]})})}const Da="_tab_1gffu_1",qa="_bar_1gffu_12",Fa="_count_1gffu_20",Ba="_files_1gffu_26",Ha="_file_1gffu_26",Ia="_path_1gffu_48",Ga="_diff_1gffu_59",Ua="_push_1gffu_63",Ya="_pushHead_1gffu_74",Qa="_pushWhat_1gffu_82",Va="_branch_1gffu_89",Ka="_pushNote_1gffu_98",T={tab:Da,bar:qa,count:Fa,files:Ba,file:Ha,path:Ia,diff:Ga,push:Ua,pushHead:Ya,pushWhat:Qa,branch:Va,pushNote:Ka};function Xa({workspaceId:e,sessionId:t=null,branch:n,dirtyFiles:a}){const o=as(e,t),r=o.data;if(!n)return null;const i=n.name;if(!i)return s.jsx("div",{className:T.push,children:s.jsx("span",{className:T.pushNote,children:"This workspace has no branch checked out, so there is nothing to push."})});const d=n.protected===!0,l=n.ahead??null,u=n.upstream??null;return s.jsxs("div",{className:T.push,children:[s.jsxs("div",{className:T.pushHead,children:[s.jsxs("div",{className:T.pushWhat,children:[s.jsx("span",{className:T.branch,children:i}),d?s.jsx(J,{children:"Protected"}):s.jsx(J,{children:Za(l,u)})]}),s.jsx(O,{variant:"secondary",size:"sm",disabled:d,loading:o.isPending,onClick:()=>void o.mutate(void 0),leading:s.jsx(fs,{size:13,strokeWidth:2,"aria-hidden":!0}),children:"Push"})]}),d&&s.jsxs("span",{className:T.pushNote,children:[i," is a protected branch. Work on a branch of your own and open a proposal for it."]}),!d&&a>0&&s.jsxs("span",{className:T.pushNote,children:["A push sends commits, not the working tree. The"," ",a===1?"change":`${a} changes`," above must be committed first."]}),o.isError&&s.jsx(F,{tone:"critical",children:"The runtime could not be reached, so nothing was pushed."}),(r==null?void 0:r.ok)===!1&&s.jsx(F,{tone:Ja(r.code),children:r.error}),(r==null?void 0:r.ok)===!0&&s.jsxs(F,{tone:"good",children:[r.branch," is on ",r.remote,r.detail?` — ${r.detail}`:""]})]})}function Za(e,t){return t?e===null?`Tracking ${t}`:e===0?"Up to date":e===1?"1 commit":`${e} commits`:"Not pushed yet"}function Ja(e){return e==="push_failed"?"critical":"warning"}const eo=1500,to={modified:"Modified",added:"Added",deleted:"Deleted",renamed:"Renamed",untracked:"Untracked"}
16,so={no_workdir:"This workspace has no folder to read",outside_workdir:"That path is outside the working directory",forbidden:"You cannot read this workspace's changes"};function no({workspaceId:e,sessionId:t=null,changeSignal:n=0}){var h;const a=os(e,{sessionId:t}),o=a.refetch,r=c.useRef(null),i=c.useRef(o);c.useEffect(()=>{i.current=o},[o]),c.useEffect(()=>{if(r.current===n)return;const f=r.current===null;if(r.current=n,f)return;const p=setTimeout(()=>void i.current(),eo);return()=>clearTimeout(p)},[n]);const d=s.jsx(O,{variant:"secondary",size:"sm",onClick:()=>void o(),loading:a.isFetching,leading:s.jsx(Se,{size:13,strokeWidth:2,"aria-hidden":!0}),children:"Refresh"});if(a.isPending)return s.jsx(V,{variant:"card",height:240,label:"Reading the changes"});if(a.isError)return s.jsx(R,{variant:"error",title:"We couldn’t load this workspace's changes",error:a.error,onRetry:()=>void o()});if(a.data&&!a.data.ok)return s.jsx(R,{title:so[a.data.code]});if(!((h=a.data)!=null&&h.ok))return null;const l=a.data;if(l.git===!1)return s.jsxs("div",{className:T.tab,children:[s.jsx("div",{className:T.bar,children:d}),s.jsx(R,{title:"This folder is not a git repository",description:"There is nothing to compare against, so no changes can be listed."})]});const u=s.jsx(Xa,{workspaceId:e,sessionId:t,branch:l.branch,dirtyFiles:l.files.length});return l.files.length===0&&l.diff.trim()===""?s.jsxs("div",{className:T.tab,children:[s.jsx("div",{className:T.bar,children:d}),u,s.jsx(R,{title:"No changes yet",description:"Nothing in this workspace has been edited."})]}):s.jsxs("div",{className:T.tab,children:[s.jsxs("div",{className:T.bar,children:[s.jsxs("span",{className:T.count,children:[l.files.length," ",l.files.length===1?"file":"files"]}),d]}),u,s.jsx("ul",{className:T.files,children:l.files.map(f=>s.jsxs("li",{className:T.file,children:[s.jsx("span",{className:T.path,children:f.path}),s.jsx(J,{children:to[f.status]})]},f.path))}),s.jsx("div",{className:T.diff,children:s.jsx(hs.Diff,{diff:l.diff,defaultOpen:!0})})]})}const ao="_tab_1dzxv_1",oo="_bar_1dzxv_11",ro="_url_1dzxv_19",io="_open_1dzxv_36",lo="_frame_1dzxv_40",oe={tab:ao,bar:oo,url:ro,open:io,frame:lo};function co({companyId:e}){var d;const[t,n]=c.useState(0),a=gs(e),o=ps(e,{enabled:!!a});if(o.isPending)return s.jsx(V,{variant:"card",height:320,label:"Finding the site"});if(o.isError)return s.jsx(R,{variant:"error",title:"We couldn’t load this company's websites",error:o.error,onRetry:()=>void o.refetch()});const r=ms(a??void 0,(d=o.data)==null?void 0:d.websites);if(!r)return s.jsx(R,{title:"No website is deployed yet",description:"Nothing has published an address for this company, so there is nothing to preview."});if(!r.staging)return s.jsx(R,{title:"No staging build is deployed yet",description:`Hosting serves ${r.live.domain} but nothing behind dev.${r.live.domain} — ask the agents to publish a staging build.`});const i=r.staging;return s.jsxs("div",{className:oe.tab,children:[s.jsxs("div",{className:oe.bar,children:[s.jsx("span",{className:oe.url,children:i.url}),s.jsx(O,{variant:"quiet",size:"sm",onClick:()=>n(l=>l+1),leading:s.jsx(Se,{size:13,strokeWidth:2,"aria-hidden":!0}),children:"Reload"}),s.jsx(Ft,{className:oe.open,children:s.jsx(Bt,{href:i.url,external:!0,children:"Open"})})]}),s.jsx(we,{src:i.url,title:`${i.domain} (staging)`,className:oe.frame},t)]})}function uo(e,t){const n=xs(e,t);for(const a of ga){const o=n.fields[a];if(typeof o=="string"&&o.trim())return o.trim()}return null}function ho(e){if(e.kind==="tool"){const{name:t,input_args:n,input_preview:a}=e.event;if(!ma.has(t))return null;const o=uo(n,a);return o?{full:o,tool:t}:null}if(e.kind==="file_changed"){const{path:t,operation:n,workspaceId:a}=e.event;return t.trim()?{full:t.trim(),tool:n==="created"?"wrote":"edited",workspaceId:a}:null}return null}function fo(e,t={}){const n=new Set,a=[];for(let o=e.length-1;o>=0;o-=1){const r=e[o],i=r.segments??[];for(let d=i.length-1;d>=0;d-=1){const l=ho(i[d]);if(!l||n.has(l.full)||t.workspaceId&&l.workspaceId&&l.workspaceId!==t.workspaceId)continue;n.add(l.full);const{name:u,dir:h}=_s(l.full);a.push({full:l.full,name:u,dir:h,tool:l.tool,at:r.timestamp?new Date(r.timestamp).toISOString():void 0,workspaceId:l.workspaceId})}}return a}function po(e,t={}){const{messages:n}=ws(e),a=t.workspaceId;return c.useMemo(()=>fo(n,{workspaceId:a}),[n,a])}const dt=["files","artifacts","changes","preview"],Be={files:"Files",artifacts:"Artifacts",changes:"Changes",preview:"Preview"};function mo(e){return!!e&&dt.includes(e)}const go={files:rs,artifacts:za,changes:no,preview:co};function _o({companyId:e,workspaceId:t,changeSignal:n,artifacts:a,sessionId:o=null}){const[r,i]=ye(),d=po(o,{workspaceId:t??void 0}),l=c.useMemo(()=>xo(d,a),[d,a]),u=c.useId(),h=r.get("pane"),f=mo(h)?h:"files",p=go[f];return s.jsxs("aside",{className:b.pane,"data-zone":"pane","aria-label":"Workbench",children:[s.jsx(bs,{id:u,size:"sm","aria-label":"Workbench tabs",className:b.paneStrip,value:f,onChange:m=>i("pane",m==="files"?null:m),tabs:dt.map(m=>({id:m,label:Be[m],count:m==="artifacts"&&l.length>0?l.length:void 0,panelId:`${u}-panel-${m}`}))}),s.jsx("div",{className:b.paneBody,id:`${u}-panel-${f}`,role:"tabpanel","aria-labelledby":`${u}-tab-${f}`,tabIndex:0,children:t?s.jsx(p,{companyId:e,workspaceId:t,sessionId:o,changeSignal:n??d.length,artifacts:l}):s.jsx("p",{className:b.paneHint,children:`Pick a workspace to see its ${Be[f]}.`})})]})}function xo(e,t=[]){if(e.length===0)return t;if(t.length===0)return e;const n=new Set(e.map(a=>a.full));return[...e,...t.filter(a=>!n.has(a.full))]}function wo(e){const t=ot(e.engine);return e.account?`${t} · ${e.account.label}`:t}function bo({agents:e,agent:t,onAgent:n,loading:a=!1,listError:o=null,onRetry:r,onConnect:i}){const[d,l]=c.useState(!1),[u,h]=c.useState(""),f=e.length>=Mn,p=On(e,f?u:""),m=t?ke(t):null;return s.jsxs("div",{className:b.railSection,children:[s.jsx("p",{className:b.railLabel,children:"Talking to"}),o?s.jsxs(F,{tone:"critical",children:[o," ",r&&s.jsxs(ue,{onClick:r,children:["Retry ",s.jsx("span",{"aria-hidden":!0,
16children:"→"})]})]}):a&&e.length===0?s.jsx(Ne,{size:"sm"}):e.length===0?s.jsxs("div",{className:b.railNote,children:[s.jsx(Y,{children:"Hire an agent or connect an account."}),s.jsxs(ue,{onClick:i,children:["Connect an account ",s.jsx("span",{"aria-hidden":!0,children:"→"})]})]}):s.jsx(pe,{open:d,onOpenChange:l,placement:"bottom-start",portal:!0,trigger:s.jsx(O,{type:"button",variant:"quiet",size:"sm",className:b.agentTrigger,leading:s.jsx(te,{icon:ks,size:"sm"}),trailing:s.jsx(he,{size:14,strokeWidth:1.75,"aria-hidden":!0}),title:"The agent your next message goes to. Its sessions fill the rail below.",children:(t==null?void 0:t.name)??"Pick an agent"}),children:s.jsxs("div",{className:b.agentPanel,children:[f&&s.jsx(fe,{variant:"search",className:b.agentSearch,value:u,onChange:h,placeholder:"Search agents",ariaLabel:"Search agents",shortcut:!1}),s.jsxs("div",{role:"listbox","aria-label":"Agent to talk to",children:[p.length===0&&s.jsx("p",{className:b.agentNote,children:"No agent matches."}),p.map(g=>{const w=ke(g);return s.jsxs(ee.Option,{selected:g.id===(t==null?void 0:t.id),disabled:!g.available,onClick:()=>{n(g.id),l(!1)},children:[s.jsxs("span",{className:b.agentRowTitle,children:[s.jsx("span",{className:b.engineMark,"aria-hidden":!0,children:at(g.engine)}),g.name]}),s.jsx("span",{className:b.agentRowNote,children:wo(g)}),w&&s.jsx("span",{className:b.agentRowState,children:w})]},g.id)})]}),s.jsx(ee.Option,{noIndicator:!0,onClick:()=>{i(),l(!1)},children:"Connect an account…"})]})}),m&&s.jsx(Y,{className:b.agentBlocker,children:m})]})}const ko={today:"Today",yesterday:"Yesterday","earlier this week":"Earlier this week",older:"Older"};function de(e){return e.last_active||e.created_at||""}function jo(e){return{id:e.id,title:Xe(e),at:de(e),messages:e.message_count??0}}function yo(e,t){const n=t.trim().toLowerCase();return n?[Xe(e),e.first_message??""].join(" ").toLowerCase().includes(n):!0}function vo(e,t=""){const n=["today","yesterday","earlier this week","older"],a=new Map,o=e.filter(r=>yo(r,t)).sort((r,i)=>de(i).localeCompare(de(r)));for(const r of o){const i=Zt(de(r)),d=jo(r),l=a.get(i);l?l.push(d):a.set(i,[d])}return n.filter(r=>{var i;return(((i=a.get(r))==null?void 0:i.length)??0)>0}).map(r=>({bucket:r,label:ko[r],rows:a.get(r)??[]}))}const No="_managed_1pa49_3",Co="_managedRow_1pa49_10",So="_managedName_1pa49_22",Ao="_managedPath_1pa49_34",To="_progress_1pa49_42",X={managed:No,managedRow:Co,managedName:So,managedPath:Ao,progress:To};function Ro({rows:e,busyId:t,onRemove:n}){return e.length===0?s.jsx(R,{title:"Nothing added yet",description:"The folders above are the ones this box was set up with. Anything you add appears here."}):s.jsx("div",{className:X.managed,children:e.map(a=>s.jsxs("div",{className:X.managedRow,children:[s.jsx("span",{className:X.managedName,children:a.name}),s.jsx(ue,{danger:!0,disabled:t===a.id,"aria-label":`Remove ${a.name}`,onClick:()=>n(a.id),children:"Remove"}),s.jsx("span",{className:X.managedPath,children:a.path}),s.jsx(Y,{className:X.managedPath,children:Eo(a)})]},a.id))})}function Eo(e){return e.present?e.source==="git"&&e.url?`Cloned from ${e.url}`:"A folder on this box":"This folder is no longer on the box. Removing it only clears the row."}const je="",Lo={apps:"Where this company's own apps stand",clones:"Repositories cloned into this company",project:"A project this box was set up with",website:"This company's website"};function Mo(e){const t=new Map;for(const n of e)t.set(n.path,Po(n));return t}function Po(e){const t={entries:[],roots:[],truncated:!1};return e.failed?{state:"failed",refusal:null,...t}:e.pending||!e.body?{state:"loading",refusal:null,...t}:e.body.ok?{state:"ready",entries:e.body.entries,roots:e.body.roots,refusal:null,truncated:e.body.truncated}:{state:"refused",refusal:se(e.body),...t}}function Oo(e,t){const n=t.find(a=>a.path===e.path);return n?Lo[n.kind]:null}function $o(e){const t=e.lastIndexOf("/");return t<=0?null:e.slice(0,t)}function Wo(e,t){if(!e)return[];const n=t.filter(r=>e===r.path||ut(e,r.path)).reduce((r,i)=>r===null||i.path.length<r.path.length?i:r,null);if(!n)return[];const a=[n.path];let o=n.path.length;for(;;){const r=e.indexOf("/",o+1);if(r===-1)return a;a.push(e.slice(0,r)),o=r}}function zo(e,t){return e.toLowerCase().includes(t)}function ut(e,t){return e.startsWith(`${t}/`)}function Do(e){return e.filter(t=>!e.some(n=>ut(t.path,n.path)))}function qo(e,t,n=""){const a=e.get(je),r=(a&&a.state==="ready"?Do(a.entries):[]).map(d=>ft(d,0,e,t)),i=n.trim().toLowerCase();return i?r.map(d=>pt(d,i)).filter(ht):r}function ht(e){return e!==null}function ft(e,t,n,a){const o=a.has(e.path),r=o?n.get(e.path):void 0,i=r&&r.state==="ready"?r.entries.map(d=>ft(d,t+1,n,a)):[];return{entry:e,depth:t,expanded:o,state:Fo(o,r),refusal:(r==null?void 0:r.refusal)??null,truncated:(r==null?void 0:r.truncated)??!1,children:i}}function Fo(e,t){return e?t?t.state!=="ready"?t.state:t.entries.length===0?"empty":"ready":"loading":"closed"}function pt(e,t){if(zo(e.entry.name,t))return e;const n=e.children.map(a=>pt(a,t)).filter(ht);return n.length===0?null:{...e,expanded:!0,children:n}}function Bo(e){const t=[],n=a=>{for(const o of a)t.push(o.entry.path),n(o.children)};return n(e),t}function Ho(e,t){const n=(a,o)=>{for(const r of a){if(r.entry.path===t)return o;const i=n(r.children,r.entry.path);if(i!==null)return i}return null};return n(e,null)}
16function Io(e,t,n){if(e.length===0)return null;const a=t===null?-1:e.indexOf(t);return a===-1?n>0?e[0]:e[e.length-1]:e[Math.min(e.length-1,Math.max(0,a+n))]}const Go="_explorer_3u5j3_4",Uo="_filter_3u5j3_11",Yo="_tree_3u5j3_18",Qo="_rowWrap_3u5j3_34",Vo="_twisty_3u5j3_41",Ko="_rowMain_3u5j3_46",Xo="_rootNote_3u5j3_70",Zo="_marks_3u5j3_80",Jo="_here_3u5j3_90",G={explorer:Go,filter:Uo,tree:Yo,rowWrap:Qo,twisty:Vo,rowMain:Ko,rootNote:Xo,marks:Zo,here:Jo},He="Already a workspace";function mt({selected:e,onSelect:t,currentWorkspaceId:n=null,allowWorkspaces:a=!0,disabled:o=!1,label:r="Folders this company can reach",initialFilter:i=""}){const[d,l]=c.useState(()=>new Set),[u,h]=c.useState(i),[f,p]=c.useState(null),m=c.useRef(null),g=c.useMemo(()=>[je,...d],[d]),w=Rt(g),v=c.useMemo(()=>Mo(w),[w]),y=c.useMemo(()=>qo(v,d,u),[v,d,u]),_=c.useMemo(()=>Bo(y),[y]),k=w[0],x=v.get(je),N=c.useMemo(()=>(x==null?void 0:x.roots)??[],[x]),E=f??e??_[0]??null,S=c.useRef(!1);c.useEffect(()=>{if(S.current||N.length===0)return;S.current=!0;const j=Wo(e,N);j.length>0&&l(new Set(j))},[N,e]);const q=c.useCallback(j=>{var B;p(j);const M=((B=m.current)==null?void 0:B.querySelectorAll("[data-explorer-row]"))??[];for(const W of M)if(W.dataset.explorerRow===j){W.focus();return}},[]),L=c.useCallback((j,M)=>{l(B=>{const W=new Set(B);return M??!W.has(j)?W.add(j):W.delete(j),W})},[]),C=c.useCallback(j=>{if(o||_.length===0)return;const M=E,B=W=>{const ne=Io(_,M,W);ne&&q(ne)};switch(j.key){case"ArrowDown":j.preventDefault(),B(1);return;case"ArrowUp":j.preventDefault(),B(-1);return;case"Home":j.preventDefault(),q(_[0]);return;case"End":j.preventDefault(),q(_[_.length-1]);return;case"ArrowRight":{if(!M)return;j.preventDefault(),d.has(M)?B(1):L(M,!0);return}case"ArrowLeft":{if(!M)return;if(j.preventDefault(),d.has(M)){L(M,!1);return}const W=Ho(y,M);W&&q(W);return}default:return}},[o,_,E,d,y,L,q]);return(x==null?void 0:x.state)==="loading"?s.jsx(V,{variant:"card",height:220,label:"Reading the folders"}):(x==null?void 0:x.state)==="failed"?s.jsx(R,{variant:"error",title:"We couldn’t load the folders on this box",error:k==null?void 0:k.error,onRetry:()=>k==null?void 0:k.refetch()}):(x==null?void 0:x.state)==="refused"?s.jsx(F,{tone:"critical",children:x.refusal}):(x==null?void 0:x.state)==="ready"&&x.entries.length===0?s.jsx(R,{title:"This company has no folders on the box yet",description:"Nothing has been set up here for an agent to stand in. Clone a repository and it appears here."}):s.jsxs("div",{className:G.explorer,children:[s.jsx(fe,{variant:"search",className:G.filter,value:u,onChange:h,placeholder:"Filter folders",ariaLabel:"Filter the folders in view",shortcut:!1}),s.jsxs("div",{className:G.tree,ref:m,role:"group","aria-label":r,onKeyDown:C,tabIndex:-1,children:[y.length===0?s.jsx("p",{className:D.note,children:s.jsx("span",{className:D.noteText,children:"No folder in view matches. Open a folder to look inside it."})}):y.map(j=>s.jsx(gt,{node:j,roots:N,selected:e,cursor:E,currentWorkspaceId:n,allowWorkspaces:a,disabled:o,onToggle:L,onSelect:t,onCursor:p},j.entry.path)),(x==null?void 0:x.truncated)&&s.jsx("p",{className:D.note,children:s.jsxs("span",{className:D.noteText,children:["Only the first ",x.entries.length," folders are listed — this box holds more."]})})]})]})}function gt(e){const{node:t,roots:n,allowWorkspaces:a}=e,{entry:o,depth:r,expanded:i}=t,d=o.workspace_id!==null,l=a||!d,u=Oo(o,n);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`${D.row} ${G.rowWrap}`,"aria-current":o.path===e.selected?"true":void 0,"data-cursor":o.path===e.cursor?"true":void 0,children:[s.jsx(_t,{depth:r}),s.jsx(js,{className:G.twisty,variant:"bare",size:"sm",tabIndex:-1,disabled:e.disabled,"aria-expanded":i,"aria-label":i?`Close ${o.name}`:`Look inside ${o.name}`,onClick:()=>e.onToggle(o.path),children:s.jsx(Ht,{className:D.chevron,"data-open":i?"true":void 0,size:13,strokeWidth:2,"aria-hidden":!0})}),s.jsxs(Jt,{className:G.rowMain,quiet:!0,"data-explorer-row":o.path,"data-already":l?void 0:"true",tabIndex:o.path===e.cursor?0:-1,disabled:e.disabled,title:l?void 0:`${He} — open it to look inside`,onFocus:()=>e.onCursor(o.path),onClick:()=>{e.onCursor(o.path),l?e.onSelect(o):e.onToggle(o.path,!0)},children:[i?s.jsx(Je,{className:D.glyph,size:13,strokeWidth:2,"aria-hidden":!0}):s.jsx(Ze,{className:D.glyph,size:13,strokeWidth:2,"aria-hidden":!0}),s.jsx("span",{className:D.name,children:o.name}),u&&s.jsx(Y,{className:G.rootNote,children:u}),s.jsxs("span",{className:G.marks,children:[o.git&&s.jsxs(J,{children:[s.jsx(Ss,{size:10,strokeWidth:2,"aria-hidden":!0})," git"]}),d&&(o.workspace_id===e.currentWorkspaceId?s.jsx(It,{className:G.here,size:13,strokeWidth:2.5,"aria-label":"Open now"}):s.jsx(J,{children:l?"workspace":He}))]})]})]}),i&&s.jsx(er,{...e})]})}function er(e){const{node:t}=e,n=t.depth+1;return t.state==="loading"?s.jsx(re,{depth:n,children:"Looking inside…"}):t.state==="failed"?s.jsx(re,{depth:n,children:"This folder could not be read."}):t.state==="refused"?s.jsx(re,{depth:n,children:t.refusal??"This folder was refused."}):t.state==="empty"?s.jsx(re,{depth:n,children:"There are no folders inside this one."}):s.jsxs(s.Fragment,{children:[t.children.map(a=>c.createElement(gt,{...e,key:a.entry.path,node:a})),t.truncated&&s.jsxs(re,{depth:n,children:["Only the first ",t.children.length," folders are listed here."]})]})}function re({depth:e,children:t}){return s.jsxs("p",{className:D.note,children:[s.jsx(_t,{depth:e}),s.jsx("span",{className:D.noteText,children:t})]})}function _t({depth:e}){return e===0?null:s.jsx("span",{className:D.guides,"aria-hidden":!0,
16children:Array.from({length:e},(t,n)=>s.jsx("span",{className:D.guide},n))})}const ce="Repository URL",Ie="Folder on the box";function tr({onClose:e,added:t,onAdded:n}){const[a,o]=c.useState(ce),[r,i]=c.useState(""),[d,l]=c.useState(null),[u,h]=c.useState(null),[f,p]=c.useState(null),m=c.useRef(null),g=Ye(),w=Et(),v=Qe(),y=Lt(u),_=y.data&&y.data.ok?y.data:null,k=c.useCallback(async C=>{await v(),n(C),e()},[v,n,e]);c.useEffect(()=>{if(_){if(_.state==="failed"){p(_.error??"The clone did not finish, and the runtime did not say why."),h(null);return}_.state==="done"&&_.workspace&&k(_.workspace)}},[_,k]);const x=a===ce,N=u!==null,E=(x?r:d??"").trim(),S=g.isPending||N,q=async()=>{var j;if(!E){p(x?"Paste the https:// address of the repository.":"Pick the folder Claude should work in."),x&&((j=m.current)==null||j.focus());return}p(null);const C=await g.mutateAsync(x?{url:E}:{path:E});if(!C.ok){p(se(C));return}if("workspace"in C){await k(C.workspace.id);return}h(C.job_id)},L=async C=>{p(null);const j=await w.mutateAsync(C);j.ok||p(se(j))};return s.jsx(xe,{open:!0,onClose:e,title:"Add workspace",description:"A workspace is a folder Claude stands in. Adding one never touches the others.",size:"md",footer:s.jsx(xe.Actions,{onCancel:e,cancelLabel:"Close",confirmLabel:x?"Clone":"Open",onConfirm:()=>void q(),loading:S}),children:s.jsxs(Oe,{gap:"3",children:[s.jsx(Ke,{"aria-label":"Where the workspace comes from",size:"md",fullWidth:!0,options:[{id:ce,label:ce},{id:Ie,label:Ie}],value:a,onChange:o}),x?s.jsxs(Oe,{gap:"2",children:[s.jsx(fe,{ref:m,label:"Repository address",value:r,disabled:S,"data-dialog-autofocus":"true",placeholder:"https://github.com/owner/repository",onChange:C=>i(C.target.value)}),s.jsx(Y,{children:"Public repositories clone as they are. A private one on GitHub uses this company’s GitHub connection — connect it in Integrations first. SSH addresses will not work here."})]}):s.jsx(mt,{selected:d,onSelect:C=>l(C.path),allowWorkspaces:!1,disabled:S,label:"Folders this company can open"}),N&&s.jsxs("div",{className:X.progress,children:[s.jsx(Ne,{size:"sm"}),s.jsx(Y,{children:(_==null?void 0:_.state)==="running"?"Cloning. A large repository can take a few minutes — this sheet can stay open.":"Starting the clone…"})]}),f&&s.jsx(F,{tone:"critical",children:f}),s.jsx(Ro,{rows:t,busyId:w.isPending?w.variables??null:null,onRemove:C=>void L(C)})]})})}const sr="_control_pj5wm_4",nr="_trigger_pj5wm_8",ar="_label_pj5wm_17",or="_name_pj5wm_26",rr="_where_pj5wm_34",ir="_panel_pj5wm_43",lr="_foot_pj5wm_52",cr="_pickedPath_pj5wm_62",dr="_hint_pj5wm_70",I={control:sr,trigger:nr,label:ar,name:or,where:rr,panel:ir,foot:lr,pickedPath:cr,hint:dr};function ur({workspaces:e,added:t,workspace:n,onWorkspace:a}){const[o,r]=c.useState(!1),[i,d]=c.useState(!1),[l,u]=c.useState(null),[h,f]=c.useState(null),p=Ye(),m=Qe(),g=e.find(_=>_.id===n)??null,w=g?$o(g.path):null,v=_=>{if(f(null),_.workspace_id!==null){a(_.workspace_id),u(null),r(!1);return}u(_)},y=async()=>{if(!l)return;f(null);const _=await p.mutateAsync({path:l.path});if(!_.ok){f(se(_));return}"workspace"in _&&(await m(),a(_.workspace.id),u(null),r(!1))};return s.jsxs("div",{className:I.control,children:[s.jsx(pe,{open:o,onOpenChange:r,placement:"bottom-start",portal:!0,block:!0,trigger:s.jsx(O,{type:"button",variant:"quiet",size:"sm",className:I.trigger,leading:s.jsx(te,{icon:Cs,size:"sm"}),trailing:s.jsx(he,{size:14,strokeWidth:1.75,"aria-hidden":!0}),title:"The folder the agent works in. Every folder this company can reach is in here.",children:s.jsxs("span",{className:I.label,children:[s.jsx("span",{className:I.name,children:(g==null?void 0:g.name)??"Pick a folder"}),s.jsx("span",{className:I.where,children:w??"Nothing is open yet"})]})}),children:s.jsxs("div",{className:I.panel,children:[s.jsx(mt,{selected:(l==null?void 0:l.path)??(g==null?void 0:g.path)??null,onSelect:v,currentWorkspaceId:n,disabled:p.isPending,label:"Workspaces and folders this company can reach"}),h&&s.jsx(F,{tone:"critical",children:h}),s.jsx("div",{className:I.foot,children:l?s.jsxs(s.Fragment,{children:[s.jsx(Y,{className:I.pickedPath,children:l.path}),s.jsx(O,{type:"button",variant:"primary",size:"sm",loading:p.isPending,onClick:()=>void y(),children:"Open here"})]}):s.jsx(Y,{className:I.hint,children:"Pick a folder. One that is not a workspace yet opens from here."})}),s.jsx(ee.Option,{noIndicator:!0,onClick:()=>{r(!1),d(!0)},children:"Clone a repository…"})]})}),i&&s.jsx(tr,{onClose:()=>d(!1),added:t,onAdded:a})]})}function hr({agents:e,agent:t,onAgent:n,agentsLoading:a=!1,agentsError:o=null,onRetryAgents:r,onConnect:i,workspaces:d,added:l,workspace:u,onWorkspace:h,sessions:f,loading:p,listError:m,onRetry:g,selectedId:w,hrefForSession:v,onNewSession:y}){const[_,k]=c.useState(""),x=vo(f,_),N=t?at(t.engine):null;return s.jsxs("aside",{className:b.rail,"data-zone":"rail","aria-label":"Code sessions",children:[s.jsx(bo,{agents:e,agent:t,onAgent:n,loading:a,listError:o,onRetry:r,onConnect:i}),s.jsxs("div",{className:b.railSection,children:[s.jsx("p",{className:b.railLabel,children:"Working in"}),s.jsx(ur,{workspaces:d,added:l,workspace:u,onWorkspace:h})]}),s.jsxs("div",{className:b.railHead,children:[s.jsx(fe,{variant:"search",className:b.railSearch,value:_,onCh
16ange:k,placeholder:"Search",ariaLabel:"Search code sessions",shortcut:!1}),s.jsx(O,{type:"button",variant:"primary",size:"sm",leading:s.jsx(ys,{size:14,strokeWidth:2.5,"aria-hidden":!0}),disabled:d.length===0||!t,onClick:y,children:"New session"})]}),m&&s.jsxs(F,{tone:"critical",children:[m," ",s.jsxs(ue,{onClick:g,children:["Retry ",s.jsx("span",{"aria-hidden":!0,children:"→"})]})]}),s.jsx("div",{className:b.railList,children:p&&f.length===0?s.jsx(Ne,{size:"sm"}):x.length===0?s.jsx(R,{title:_.trim()?"No sessions match":"No sessions here yet",description:_.trim()?"Clear the search to see every session this agent has in this folder.":t?`Your first message opens one with ${t.name} in this folder.`:"Pick an agent above and your first message opens one."}):x.map(E=>s.jsxs("div",{className:b.railGroup,children:[s.jsx("p",{className:b.railDay,children:E.label}),E.rows.map(S=>s.jsx(fr,{row:S,mark:N,href:v(S.id),current:S.id===w},S.id))]},E.bucket))})]})}function fr({row:e,mark:t,href:n,current:a}){const o=Ce(e.at),r=`${e.messages} ${e.messages===1?"message":"messages"}`;return s.jsxs(Ge,{className:b.row,to:n,"data-session-row":e.id,"aria-current":a||void 0,"aria-label":[e.title,o,r].filter(Boolean).join(", "),children:[s.jsx("span",{className:b.rowName,children:e.title}),s.jsxs("span",{className:b.rowSeat,children:[t&&s.jsx("span",{className:b.engineMark,"aria-hidden":!0,children:t}),r]}),s.jsx("span",{className:b.rowWhen,children:o})]})}function pr({companyId:e,sessionId:t,session:n,agent:a,onPatchSession:o,onSessionAdded:r,sessionsHref:i,hrefForSession:d,settingsPath:l,settingsSearch:u}){const[h,f]=c.useState(H),[p,m]=c.useState(H),g=lt(t),w=Gt(y=>y.hydrateInbox),v=c.useMemo(()=>a?new Map([[a.id,a.name]]):new Map,[a]);return s.jsx("div",{className:b.conversation,children:s.jsx(vs,{companyId:e,sessionId:t,session:n,agentNameById:v,sessionsHref:i,hrefForSession:d,onPatchSession:o,onSessionAdded:r,onAnswered:()=>void w(),composerLeadingControls:s.jsx(it,{agent:a,model:h,effort:p,permission:g,settingsPath:l,settingsSearch:u,onChange:y=>{f(y.model),m(y.effort)}})},t)})}const mr=100;function gr(e,t,n){const[a,o]=c.useState([]),[r,i]=c.useState(!1),[d,l]=c.useState(null),[u,h]=c.useState(0);return c.useEffect(()=>{if(!t||!n){o([]),i(!1),l(null);return}let f=!0;return i(!0),l(null),Ut.getSessions(t,e,{limit:mr,workspace:n}).then(p=>{if(!f)return;const m=(p.sessions||[]).filter(g=>g==null?void 0:g.id);o(m)}).catch(p=>{f&&(o([]),l(Yt(p)?null:"We couldn't read this agent's sessions."))}).finally(()=>{f&&i(!1)}),()=>{f=!1}},[e,t,n,u]),{sessions:a,setSessions:o,loading:r,listError:d,retry:c.useCallback(()=>h(f=>f+1),[])}}function hl({companyId:e,sessionId:t}){var Me;const n=vt(),a=Nt();Ue();const[o,r,i,d]=ye(),l=Ve(A=>A.entities),[u,h]=c.useState(!0),[f,p]=c.useState(!1),m=Mt(),g=Pt(),w=g.data,v=c.useMemo(()=>w&&w.ok?$n(w.agents):[],[w]),y=g.isError?"We couldn't read this company's agents.":w&&!w.ok?se(w):null,_=Ot(),k=_.data,x=c.useMemo(()=>k&&k.ok?k.workspaces:[],[k]),N=c.useMemo(()=>k&&k.ok?k.added:[],[k]),E=o.get("agent"),S=Wn(E,v),q=o.get("workspace"),L=x.some(A=>A.id===q)?q:((Me=x[0])==null?void 0:Me.id)??null;c.useEffect(()=>{S&&E!==S.id&&r("agent",S.id)},[S,E,r]),c.useEffect(()=>{L&&q!==L&&r("workspace",L)},[L,q,r]);const{sessions:C,setSessions:j,loading:M,listError:B,retry:W}=gr(e,(S==null?void 0:S.id)??null,L),ne=c.useMemo(()=>t?C.find(A=>A.id===t)??null:null,[C,t]),Ee=c.useCallback(A=>Q(l,e,"code",A)+i,[e,l,i]),xt=Q(l,e,"code")+i,wt=c.useCallback(()=>{n(Q(l,e,"code")+i)},[e,l,n,i]),bt=c.useCallback((A,ae)=>
16{const me=Q(l,e,"code",A);n(me+le(i,"workspace",ae))},[e,l,n,i]),kt=c.useCallback(A=>{r("agent",A),t&&n(Q(l,e,"code")+le(i,"agent",A))},[e,l,n,t,r,i]),Le=c.useCallback(A=>{d({workspace:A,file:null}),t&&n(Q(l,e,"code")+le(le(i,"workspace",A),"file",null))},[e,l,n,t,d,i]);St({label:"Code",readout:M?void 0:C.length});const jt=c.useCallback((A,ae)=>j(me=>me.map(ge=>ge.id===A?{...ge,...ae}:ge)),[j]),yt=g.isPending?null:v.length===0?s.jsx(R,{title:"Nobody to code with yet",description:"Hire an agent or connect an account. Connecting one gives it an agent of its own, and that agent appears here.",action:s.jsx(O,{type:"button",variant:"primary",size:"sm",onClick:()=>p(!0),children:"Connect an account"})}):t&&!L&&_.isPending?null:t?s.jsx(pr,{companyId:e,sessionId:t,session:ne,agent:S,onPatchSession:jt,onSessionAdded:A=>j(ae=>[A,...ae]),sessionsHref:xt,hrefForSession:Ee,settingsPath:a.pathname,settingsSearch:i}):s.jsx(pa,{companyId:e,agent:S,workspaces:x,workspace:L,onWorkspace:Le,sessions:C,onCreated:bt,onConnect:()=>p(!0),settingsPath:a.pathname,settingsSearch:i});return s.jsxs("div",{className:b.factory,"data-instrument":"",children:[s.jsx(Qt,{variant:"register",title:"Code",hideTitle:!0,count:M?"…":B?"—":C.length,actions:s.jsx(Ns,{gap:"2",children:s.jsx(O,{type:"button",variant:"secondary",size:"sm",leading:s.jsx(te,{icon:As,size:"sm"}),"aria-pressed":u,onClick:()=>h(A=>!A),children:u?"Hide workbench":"Workbench"})})}),_.isSuccess&&x.length===0&&s.jsx(F,{tone:"neutral",children:"This company has no workspace for an agent to work in yet. Use Add above the rail to clone a repository or open a folder already on the box."}),s.jsxs("div",{className:u?`${b.workbench} ${b.paneOpen}`:b.workbench,children:[s.jsx(hr,{agents:v,agent:S,onAgent:kt,agentsLoading:g.isPending,agentsError:y,onRetryAgents:()=>void g.refetch(),onConnect:()=>p(!0),workspaces:x,added:N,workspace:L,onWorkspace:Le,sessions:C,loading:M,listError:B,onRetry:W,selectedId:t,hrefForSession:Ee,onNewSession:wt}),s.jsx("div",{className:b.center,children:yt}),u&&s.jsx(_o,{companyId:e,workspaceId:L,sessionId:t})]}),s.jsx(At,{open:f,onClose:()=>p(!1),onConnected:()=>void m()})]})}export{hl 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.