@wrongstack/webui 0.309.0 → 0.309.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentRosterView-CbgKjnxJ.js → AgentRosterView-CBiLW8dV.js} +1 -1
- package/dist/assets/{AnalyticsDashboard-BXnPG2xB.js → AnalyticsDashboard-Grpp3QKX.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-Ch-jf06O.js → AudienceMemoryPanel-DU3hUuUl.js} +1 -1
- package/dist/assets/{ChangesView-5lcal8q4.js → ChangesView-DOrw4udd.js} +1 -1
- package/dist/assets/ChronicleDashboard-DlCuQRB8.js +1 -0
- package/dist/assets/CodeEditor-CU6zP0r8.js +2 -0
- package/dist/assets/CodeMap-BkJqVDg2.js +1 -0
- package/dist/assets/{ConfirmModal-KzK0LoJw.js → ConfirmModal-BJOVE-JI.js} +1 -1
- package/dist/assets/{CronJobsPanel-aLru0Rd_.js → CronJobsPanel-B3UJP0mn.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-BXpB_M2Z.js → DeadCodeScanPanel-_iUu5-90.js} +1 -1
- package/dist/assets/{DebugDashboard-hnhGaWr-.js → DebugDashboard-NTiN0je2.js} +1 -1
- package/dist/assets/{DesignGalleryView-CXHgaI2Q.js → DesignGalleryView-BG2Nr8wy.js} +1 -1
- package/dist/assets/{GoalView-BB5t68cb.js → GoalView-Dakf9ZR8.js} +1 -1
- package/dist/assets/KanbanView-BR07PhbR.js +3 -0
- package/dist/assets/{MailboxDetailView-jPxF6ia3.js → MailboxDetailView-D31IhaK_.js} +1 -1
- package/dist/assets/{MemoryDrawer-e8UxQq-s.js → MemoryDrawer-6n0Etoz4.js} +1 -1
- package/dist/assets/MemoryManager-7DSVhxZf.js +1 -0
- package/dist/assets/{ModelPicker-nyXP3xsj.js → ModelPicker-C72kprRH.js} +1 -1
- package/dist/assets/OfficeMapPanel-Ce7myLNH.css +1 -0
- package/dist/assets/OfficeMapPanel-Dc8-4CiU.js +4 -0
- package/dist/assets/{ProcessMonitor-Epj6RrOA.js → ProcessMonitor-BGLc3yNM.js} +1 -1
- package/dist/assets/{PromptJournalView-CMlGmjig.js → PromptJournalView-CxDiqUkN.js} +1 -1
- package/dist/assets/{QueuePanel-D67eiPuQ.js → QueuePanel-B2f1HbN0.js} +1 -1
- package/dist/assets/{RefreshDebugView-CWAwHE9i.js → RefreshDebugView-D8F95QxF.js} +1 -1
- package/dist/assets/{RequirementIntakeView-DPj065HL.js → RequirementIntakeView-BRolSCpk.js} +1 -1
- package/dist/assets/{SageTabs-BtRa8OZC.js → SageTabs-DblSyqzB.js} +2 -2
- package/dist/assets/{SddFlowGraph-DMSN4LTZ.js → SddFlowGraph-YOPsSaFc.js} +1 -1
- package/dist/assets/SddHub-IusMUP2D.js +2 -0
- package/dist/assets/{SessionInspectView-BdlOiPzO.js → SessionInspectView-B633Bi0X.js} +1 -1
- package/dist/assets/SessionList-BCE6NSCu.js +1 -0
- package/dist/assets/{SessionsDashboard-BiR0zh-a.js → SessionsDashboard-N__p7_i5.js} +1 -1
- package/dist/assets/SetupScreen-B06asuJC.js +1 -0
- package/dist/assets/SkillDetailView-BxpQcgfh.js +3 -0
- package/dist/assets/{SpecsView-2PqHEXH9.js → SpecsView-Ddbow1sn.js} +1 -1
- package/dist/assets/TechStackView-HTZUTbuu.js +2 -0
- package/dist/assets/{TerminalPanel-CLUB8F2H.js → TerminalPanel-Bi3CmRvI.js} +1 -1
- package/dist/assets/{Toaster-BlD1m8P2.js → Toaster-COVFFUKo.js} +1 -1
- package/dist/assets/{activity-DYwBIByU.js → activity-7Sj9fdO-.js} +2 -2
- package/dist/assets/{activity-CA5G03Kw.js → activity-B-LcgiXm.js} +2 -2
- package/dist/assets/{activity-CezOSNBd.js → activity-B7hiQ_IX.js} +2 -2
- package/dist/assets/{activity-C6pIBHte.js → activity-Cq0Lqtgz.js} +2 -2
- package/dist/assets/{activity-CxnlCaZu.js → activity-DVuAYnoi.js} +2 -2
- package/dist/assets/{activity-l8lDAw8a.js → activity-Dt0RpmkN.js} +2 -2
- package/dist/assets/{activity-CkGBp_I-.js → activity-JmCi-KcX.js} +2 -2
- package/dist/assets/{button-DvpRpKkt.js → button-DAT5OnLL.js} +1 -1
- package/dist/assets/{chat-store-c0pGYczr.js → chat-store-CtIMb3sU.js} +1 -1
- package/dist/assets/{codemap-activity-store-BH7Mh4k9.js → codemap-activity-store-CA_14DHd.js} +1 -1
- package/dist/assets/codemap-index-store-BlPxA13l.js +1 -0
- package/dist/assets/{dialog-BJjDUqb3.js → dialog-BMrjwjA6.js} +1 -1
- package/dist/assets/{empty-state-Cefmzojx.js → empty-state-Bf05Z1d2.js} +1 -1
- package/dist/assets/{i18n-DbJfY4tY.js → i18n-CYYBUSJB.js} +2 -2
- package/dist/assets/{index-DQn-Lz9q.js → index-cUeJ0FkT.js} +55 -54
- package/dist/assets/{input-BtoHcCl9.js → input-Ccsxvwz6.js} +1 -1
- package/dist/assets/{mailbox-store-bF96Ih2G.js → mailbox-store-BWD7JeF9.js} +1 -1
- package/dist/assets/{markdown-CIRD7kOg.js → markdown-Kp5uSgOw.js} +23 -23
- package/dist/assets/{roster-ws-DycHs92J.js → roster-ws-lMIf13ag.js} +1 -1
- package/dist/assets/{session-store-CKdsROPD.js → session-store-D4PNeAGe.js} +1 -1
- package/dist/assets/{shared-B3czc2Dj.js → shared-Y6T3EEnd.js} +1 -1
- package/dist/assets/stores-BUtRik4k.js +7 -0
- package/dist/assets/{ui-store-xx1NssJI.js → ui-store-DxMnhARg.js} +1 -1
- package/dist/assets/useWebSocket-Ew1Bbjci.js +29 -0
- package/dist/assets/{utils-tsZEnrBH.js → utils-B5X3DKef.js} +1 -1
- package/dist/assets/{vector-memory-panel-C6iWDhkJ.js → vector-memory-panel-CnBqV6GK.js} +1 -1
- package/dist/assets/{vendor-C_zEzV4N.js → vendor-DLS502Zs.js} +3 -3
- package/dist/assets/{view-navigation-CZKugncK.js → view-navigation-Hd631M1W.js} +1 -1
- package/dist/assets/{ws-client-CBfMQmW9.js → ws-client-DYrfK01f.js} +1 -1
- package/dist/components/AgentOfficeView/model.d.ts +20 -0
- package/dist/components/AgentOfficeView.d.ts +10 -0
- package/dist/index.css +114 -7
- package/dist/index.html +22 -22
- package/dist/index.js +317 -70
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/office-map-store.d.ts +6 -0
- package/package.json +15 -15
- package/dist/assets/ChronicleDashboard-BH9k5NjB.js +0 -1
- package/dist/assets/CodeEditor-BrQMwzOp.js +0 -2
- package/dist/assets/CodeMap-B5e0v0jn.js +0 -1
- package/dist/assets/KanbanView-bZtgy3zZ.js +0 -3
- package/dist/assets/MemoryManager-BXYIA9wG.js +0 -1
- package/dist/assets/OfficeMapPanel-CBfE7Kli.js +0 -4
- package/dist/assets/OfficeMapPanel-D6yTfGIT.css +0 -1
- package/dist/assets/SddHub-CuqWpqSd.js +0 -2
- package/dist/assets/SessionList-CvvH8SI2.js +0 -1
- package/dist/assets/SetupScreen-B8s5fvr8.js +0 -1
- package/dist/assets/SkillDetailView-DbXp7-E5.js +0 -3
- package/dist/assets/TechStackView-Dnws9pc9.js +0 -2
- package/dist/assets/codemap-index-store-BFm1TzVW.js +0 -1
- package/dist/assets/stores-C0xX0jn4.js +0 -7
- package/dist/assets/useWebSocket-D9Dy4-9x.js +0 -29
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$n as t,Ai as n,Ba as r,Ci as i,Cr as a,Ga as o,Gn as s,Ji as c,Kr as l,La as u,Mi as d,Mn as f,Ni as p,Nt as m,Or as h,Pa as g,Pi as _,Qn as v,Ua as y,Vn as b,Vt as x,Wr as S,Xi as C,Xr as w,Zn as T,_ as E,_r as D,a as ee,an as O,bi as k,c as A,ca as j,cr as M,d as te,dt as N,er as P,f as ne,h as re,i as ie,in as ae,ir as oe,ja as se,kr as ce,l as le,lt as ue,m as de,ma as F,mt as fe,o as pe,p as me,pt as I,r as he,ra as L,s as R,sn as z,ti as B,u as ge,ut as _e,v as ve,vi as ye,xt as be,yt as V}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{s as xe}from"./ws-client-DYrfK01f.js";import{t as H}from"./utils-B5X3DKef.js";import{t as Se}from"./session-store-D4PNeAGe.js";import{E as Ce,S as we,f as U,j as Te,k as Ee,p as De}from"./stores-BUtRik4k.js";import{r as Oe}from"./mailbox-store-BWD7JeF9.js";import{d as ke}from"./markdown-Kp5uSgOw.js";import{S as Ae,_ as je,d as Me,f as Ne,g as Pe,l as Fe,u as Ie}from"./index-cUeJ0FkT.js";var W=e(o(),1);function Le(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Re(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function G(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function K(e,t){for(let n of t){let t=G(e[n]);if(t)return t}}function q(e,t){for(let n of t){let t=Re(e[n]);if(t!==void 0)return t}}function ze(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function Be(e){return e?e.split(/\r?\n/).length:0}function Ve(e){let t=0,n=0;for(let r of e.split(/\r?\n/))r.startsWith(`+++`)||r.startsWith(`---`)||(r.startsWith(`+`)&&(t+=1),r.startsWith(`-`)&&(n+=1));return t||n?{added:t,removed:n}:null}function He(e){let t=e.split(/\r?\n/,1)[0]?.trim()??e;return t.length>72?`${t.slice(0,69)}…`:t}function Ue(e){let t=e.toLowerCase().replace(/[.:/-]+/g,`_`);return/^(read|view|open_file|read_file)|file_read/.test(t)?`read`:/^(write|create|save)|file_write/.test(t)?`write`:/edit|update|patch|replace|apply_patch/.test(t)?`edit`:/bash|shell|terminal|exec|command|powershell|cmd/.test(t)?`terminal`:/fetch|browser|browse|http|url|web/.test(t)?`web`:/search|grep|find|glob|query/.test(t)?`search`:/memory|recall|remember/.test(t)?`memory`:`other`}function We(e,t){let n=(Array.isArray(e.fileTargets)?e.fileTargets:[]).flatMap(e=>{let t=Le(e),n=K(t,[`filePath`,`file_path`,`path`]);return n?[{filePath:n,operation:G(t.operation),line:q(t,[`line`,`startLine`,`start_line`]),endLine:q(t,[`endLine`,`end_line`])}]:[]});if(n.length>0)return n;let r=K(t,[`file_path`,`filePath`,`path`,`filename`,`target_file`,`targetFile`]);return r?[{filePath:r,line:q(t,[`line`,`start_line`,`startLine`,`offset`]),endLine:q(t,[`end_line`,`endLine`])}]:[]}function Ge(e,t){let n=e?.line??q(t,[`line`,`start_line`,`startLine`,`offset`]),r=e?.endLine??q(t,[`end_line`,`endLine`]),i=q(t,[`limit`,`line_count`,`lineCount`]);return r===void 0&&n!==void 0&&i!==void 0&&i>0&&(r=n+i-1),n!==void 0&&r!==void 0?{start:n,end:r,label:`L${n}–${r}`}:n===void 0?{}:{start:n,label:`L${n}`}}function Ke(e,t,n,r,i,a){let o=Ge(a,n),s=a?.filePath??K(n,[`file_path`,`filePath`,`path`,`filename`]),c=s?ze(s):void 0;if(e===`read`)return{target:s,summary:i===void 0?o.label?`${o.label} queued to read`:`Reading file`:`${i.toLocaleString()} lines read`,lineLabel:o.label};if(e===`write`){let e=K(n,[`content`,`text`,`data`]),t=q(r,[`inputLines`])??(e?Be(e):void 0);return{target:s,summary:t===void 0?`Writing file`:`${t.toLocaleString()} lines written`,lineLabel:o.label}}if(e===`edit`){let e=K(n,[`patch`,`diff`]),t=e?Ve(e):null,i=K(n,[`old_string`,`oldString`,`search`]),a=K(n,[`new_string`,`newString`,`replacement`]),c=q(r,[`addedLines`]),l=q(r,[`removedLines`]),u=q(r,[`oldLines`]),d=q(r,[`newLines`]);return{target:s,summary:t||c!==void 0||l!==void 0?`+${t?.added??c??0} / −${t?.removed??l??0} lines`:i!==void 0||a!==void 0||u!==void 0||d!==void 0?`${i?Be(i):u??0} → ${a?Be(a):d??0} lines`:o.label?`${o.label} updated`:`Updating file`,lineLabel:o.label}}if(e===`terminal`){let e=K(n,[`command`,`cmd`,`script`,`shell`])??t;return{summary:He(e),target:e}}if(e===`web`){let e=K(n,[`url`,`href`,`uri`]),t=K(n,[`query`,`q`,`search`]);return{target:e??t,summary:e?`Fetched ${e}`:t?`Looked up “${t}”`:`Went online`}}if(e===`search`){let e=K(n,[`query`,`pattern`,`q`,`search`])??c;return{target:s??e,summary:e?`Searched “${e}”`:`Searching project`}}if(e===`memory`){let e=K(n,[`query`,`text`,`key`]);return{target:e,summary:e?`Recalled “${e}”`:`Checking memory`}}return{target:s,summary:c?`${t} · ${c}`:t}}function qe(e,t){let n=G(t.name)??G(t.toolName);if(n)return n;if(e.kind===`agent:tool`)return e.target??void 0;if(e.kind.startsWith(`tool:`))return e.source}function Je(e,t,n){return G(t.agentId)??G(t.subagentId)??(e.kind===`agent:tool`?e.source:void 0)??(e.source!==n&&e.source!==`filesystem`?e.source:void 0)??`leader`}function Ye(e){return G(e.parentSessionId)??G(e.sessionId)}function Xe(e,t){return e.kind===`tool:started`||e.kind===`tool:progress`?`running`:t.ok===!1?`failed`:`succeeded`}function Ze(e){if(![`tool:started`,`tool:progress`,`tool:executed`,`agent:tool`].includes(e.kind))return null;let t=Le(e.data),n=qe(e,t);if(!n)return null;let r=Je(e,t,n),i=t.input,a=Le(i),o=We(t,a),s=Re(t.outputLines),c=Ue(n),l=Ke(c,n,a,t,s,o[0]),u=G(t.id),d=Math.floor(e.timestamp/2e3),f=Xe(e,t),p=Re(t.durationMs);return{id:u?`${r}:${u}`:`${r}:${n}:${d}`,agentId:r,agentName:G(t.agentName),sessionId:Ye(t),toolName:n,kind:c,status:f,startedAt:f===`running`?e.timestamp:Math.max(0,e.timestamp-(p??0)),...f===`running`?{}:{completedAt:e.timestamp},durationMs:p,target:l.target,summary:l.summary,lineLabel:l.lineLabel,outputLines:s,outputBytes:Re(t.outputBytes),outputTokens:Re(t.outputTokens),input:i,output:G(t.output),fileTargets:o,raw:e.raw??t}}function Qe(e,t,n){return e?.length?rt(e.map(e=>({id:`snapshot:${n??`session`}:${t}:${e.id}`,kind:`tool:executed`,timestamp:e.completedAt,source:t,target:e.name,label:e.name,data:{...e,agentId:t,sessionId:n},flowGroup:`agent:${t}`})),t,n):[]}function $e(e){return e?.length?e.map(e=>({id:e.id,direction:e.direction,from:e.from,to:e.to,type:e.type,subject:e.subject,body:``,priority:`normal`,timestamp:new Date(e.at).toISOString(),timestampMs:e.at,unread:e.direction===`incoming`})).sort((e,t)=>t.timestampMs-e.timestampMs).slice(0,12):[]}function et(e,t,n=3e4){let r=new Map;e.forEach((e,t)=>{for(let n of[e.agent.serverId,e.agent.mailboxId,e.agent.name]){let e=J(n);e&&!r.has(e)&&r.set(e,t)}});let i=new Set,a=[];for(let o of e){let e=o.mail[0];if(!e||i.has(e.id)||t-e.timestampMs>n)continue;let s=r.get(J(e.from)),c=r.get(J(e.to));s!==void 0&&c!==void 0&&s!==c&&(i.add(e.id),a.push({id:e.id,mail:e,fromIndex:s,toIndex:c}))}return a}function tt(e,t){return e.toLowerCase()===t.toLowerCase()}function J(e){return e?.trim().toLowerCase()??``}function nt(e,t,n){let r=new Set([t.serverId,t.mailboxId,t.name].map(J).filter(e=>e.length>0)),i=n?`@session:${J(n)}`:``,a=J(t.role),o=J(t.serverId)===`leader`||J(t.serverId).startsWith(`leader@`)||a===`lead`||a===`leader`;return e.flatMap(e=>{let t=J(e.from),n=J(e.to),a=r.has(t),s=n===`*`||n===`all`||i.length>0&&n===i,c=(e.audience!==`leaders`||o)&&(r.has(n)||o&&s);if(!c&&!a)return[];let l=Date.parse(e.timestamp);return[{...e,direction:c?`incoming`:`outgoing`,timestampMs:Number.isFinite(l)?l:0,unread:c&&!Object.keys(e.readBy??{}).some(e=>r.has(J(e)))}]}).sort((e,t)=>t.timestampMs-e.timestampMs).slice(0,8)}function rt(e,t,n){let r=new Map;for(let i=e.length-1;i>=0;--i){let a=e[i];if(!a)continue;let o=Ze(a);if(!o||!tt(o.agentId,t)||n&&o.sessionId&&o.sessionId!==n)continue;let s=r.get(o.id);r.set(o.id,s?{...s,...o,startedAt:Math.min(s.startedAt,o.startedAt),fileTargets:o.fileTargets.length>0?o.fileTargets:s.fileTargets,input:o.input??s.input,output:o.output??s.output,raw:o.raw??s.raw}:o)}let i=[...r.values()].sort((e,t)=>(t.completedAt??t.startedAt)-(e.completedAt??e.startedAt));return i.filter((e,t)=>e.input!==void 0||e.fileTargets.length>0||e.output!==void 0||!i.some((n,r)=>r!==t&&n.toolName===e.toolName&&(n.input!==void 0||n.fileTargets.length>0||n.output!==void 0)&&Math.abs((n.completedAt??n.startedAt)-(e.completedAt??e.startedAt))<2500))}function it(e,t,n){let r=Ue(t),i={read:`Reading a file`,write:`Writing a file`,edit:`Updating code`,terminal:`Running a command`,web:`Working online`,search:`Searching project`,memory:`Checking memory`,other:t};return{id:`${e}:live:${t}`,agentId:e,sessionId:n,toolName:t,kind:r,status:`running`,startedAt:Date.now(),summary:i[r],fileTargets:[]}}var Y=ue(),at={read:O,write:B,edit:B,terminal:x,web:ye,search:S,memory:v,other:d};function ot(e,t=46){if(!e||e.length<=t)return e;let n=e.split(/[\\/]/).slice(-2).join(`/`);return n.length<=t?`…/${n}`:`…${e.slice(-(t-1))}`}function st(e){return e===void 0?`—`:e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(+(e<1e4))} s`}function ct(e){if(e===void 0)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function X({label:e,value:t}){return(0,Y.jsxs)(`div`,{className:`agent-office__detail-row`,children:[(0,Y.jsx)(`span`,{children:e}),(0,Y.jsx)(`strong`,{children:t})]})}function lt({selected:e,onClose:t}){let{t:n}=r(),{call:i,agentName:a}=e,o=at[i.kind],s=ct(i.input),c=ct(i.output);return(0,Y.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${i.toolName} details`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,Y.jsx)(`div`,{className:H(`agent-office__detail-icon`,`is-${i.kind}`),children:(0,Y.jsx)(o,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.toolCall`)}),(0,Y.jsx)(`h2`,{children:i.toolName})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`activity:agentOffice.closeDetails`),children:(0,Y.jsx)(N,{})})]}),(0,Y.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,Y.jsx)(`span`,{className:H(`agent-office__status-dot`,i.status===`running`&&`is-active`,i.status===`failed`&&`is-failed`)}),(0,Y.jsx)(`strong`,{children:i.summary}),(0,Y.jsx)(`span`,{children:i.status})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.execution`)}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.agent`),value:a}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.started`),value:new Date(i.startedAt).toLocaleTimeString()}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.duration`),value:st(i.durationMs)}),i.sessionId&&(0,Y.jsx)(X,{label:n(`activity:agentOffice.session`),value:ot(i.sessionId,28)})]}),(i.target||i.fileTargets.length>0)&&(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.target`)}),i.target&&(0,Y.jsx)(`code`,{className:`agent-office__target-code`,children:i.target}),i.fileTargets.map((e,t)=>(0,Y.jsxs)(`div`,{className:`agent-office__file-target`,children:[(0,Y.jsx)(w,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:e.filePath}),(e.line||e.endLine)&&(0,Y.jsxs)(`strong`,{children:[`L`,e.line??1,e.endLine?`–${e.endLine}`:``]})]},`${e.filePath}:${t}`))]}),(i.outputLines!==void 0||i.outputBytes!==void 0||i.outputTokens!==void 0)&&(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.resultSize`)}),(0,Y.jsxs)(`div`,{className:`agent-office__metric-grid`,children:[i.outputLines!==void 0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:i.outputLines.toLocaleString()}),(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.lines`)})]}),i.outputBytes!==void 0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:i.outputBytes.toLocaleString()}),(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.bytes`)})]}),i.outputTokens!==void 0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`strong`,{children:[`≈`,i.outputTokens.toLocaleString()]}),(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.tokens`)})]})]})]}),s&&(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.input`)}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:s})})]}),c&&(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.outputPreview`)}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:c})})]})]})}function ut({selected:e,onClose:t}){let{t:n}=r(),{mail:i,agentName:a}=e;return(0,Y.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${i.subject} details`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,Y.jsx)(`div`,{className:`agent-office__detail-icon is-mail`,children:(0,Y.jsx)(P,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:i.direction===`incoming`?`INCOMING MAIL`:`OUTGOING MAIL`}),(0,Y.jsx)(`h2`,{children:i.subject})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`activity:agentOffice.closeMailDetails`),children:(0,Y.jsx)(N,{})})]}),(0,Y.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,Y.jsx)(`span`,{className:H(`agent-office__status-dot`,i.unread&&`is-active`)}),(0,Y.jsxs)(`strong`,{children:[i.from,` → `,i.to]}),(0,Y.jsx)(`span`,{children:i.type}),i.audience===`leaders`&&(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(oe,{className:`h-3 w-3`}),` `,n(`activity:mailbox.audienceLeaders`)]})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:mailbox.messages`)}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.agent`),value:a}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.started`),value:new Date(i.timestampMs).toLocaleTimeString()}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.priority`),value:i.priority}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.route`),value:`${i.from} → ${i.to}`})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:i.subject}),(0,Y.jsx)(`div`,{className:`agent-office__mail-body`,children:i.body})]})]})}function dt({selected:e,onClose:t}){let{t:n}=r();return(0,Y.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${e.agentName} task details`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,Y.jsx)(`div`,{className:`agent-office__detail-icon is-task`,children:(0,Y.jsx)(M,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.currentTask`)}),(0,Y.jsx)(`h2`,{children:e.agentName})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`activity:agentOffice.closeTaskDetails`),children:(0,Y.jsx)(N,{})})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.task`)}),e.taskId&&(0,Y.jsx)(X,{label:`ID`,value:e.taskId}),(0,Y.jsx)(`div`,{className:`agent-office__task-body`,children:e.task})]})]})}function ft({selected:e,onClose:t}){let{t:n}=r(),i=e.todos.filter(e=>e.status!==`completed`).length;return(0,Y.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${e.officeLabel} briefing`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,Y.jsx)(`div`,{className:`agent-office__detail-icon is-briefing`,children:(0,Y.jsx)(T,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:e.instructionActive?n(`activity:agentOffice.activeInstruction`):n(`activity:agentOffice.officeBriefing`)}),(0,Y.jsx)(`h2`,{children:e.officeLabel})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`activity:agentOffice.closeOfficeBriefing`),children:(0,Y.jsx)(N,{})})]}),(0,Y.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,Y.jsx)(`span`,{className:H(`agent-office__status-dot`,(e.instructionActive||i>0)&&`is-active`)}),(0,Y.jsx)(`strong`,{children:e.telemetryConnected?n(`activity:agentOffice.activeTodos`):n(`activity:agentOffice.telemetryWaiting`)}),(0,Y.jsx)(`span`,{children:e.telemetryConnected?i:`—`})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:e.instructionActive?n(`activity:agentOffice.activeInstruction`):n(`activity:agentOffice.leaderPrompt`)}),e.promptAt!==void 0&&(0,Y.jsx)(X,{label:n(`activity:agentOffice.promptReceived`),value:new Date(e.promptAt).toLocaleString()}),(0,Y.jsx)(`div`,{className:`agent-office__task-body`,children:e.prompt??(e.telemetryConnected?n(`activity:agentOffice.noPrompt`):n(`activity:agentOffice.telemetryWaiting`))})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.todos`)}),(0,Y.jsx)(`div`,{className:`agent-office__todo-detail-list`,children:e.telemetryConnected?e.todos.length>0?e.todos.map(e=>(0,Y.jsxs)(`div`,{className:H(`agent-office__todo-detail`,`is-${e.status}`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.content}),(0,Y.jsx)(`small`,{children:n(`activity:agentOffice.todoStatus.${e.status}`)})]})]},e.id)):(0,Y.jsx)(`span`,{className:`agent-office__history-empty`,children:n(`activity:agentOffice.noActiveTodos`)}):(0,Y.jsx)(`span`,{className:`agent-office__history-empty`,children:n(`activity:agentOffice.todoTelemetryWaiting`)})})]})]})}function pt({selected:e,onClose:t}){return e.kind===`tool`?(0,Y.jsx)(lt,{selected:e,onClose:t}):e.kind===`mail`?(0,Y.jsx)(ut,{selected:e,onClose:t}):e.kind===`task`?(0,Y.jsx)(dt,{selected:e,onClose:t}):(0,Y.jsx)(ft,{selected:e,onClose:t})}function mt(e){return e==null||!Number.isFinite(e)?`0`:e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function ht(e,t){if(!e)return`never`;let n=Date.parse(e);if(!Number.isFinite(n))return`never`;let r=Math.max(0,Math.round((t-n)/1e3));return r<60?`${r}s ago`:r<3600?`${Math.round(r/60)}m ago`:r<86400?`${Math.round(r/3600)}h ago`:`${Math.round(r/86400)}d ago`}function gt(e,t){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));return r<60?`${r}s`:r<3600?`${Math.round(r/60)}m`:`${Math.round(r/3600)}h`}function _t(e){if(!e)return;let t=e.split(`/`);return t[t.length-1]?.slice(0,18)}function vt(e,t=56){if(!e)return;let n=e.replace(/\s+/g,` `).trim();if(n)return n.length<=t?n:t<=1?`…`:`${n.slice(0,t-1).trimEnd()}…`}function yt(e,t){if(e.length===0)return{positions:new Map,columns:0,rows:0,columnWidth:380};let n=Math.max(1,...e.map(e=>e.agentCount)),r=Math.max(380,Math.min(3,n)*190+80),i=e=>270+Math.max(1,...e.map(e=>Math.ceil(Math.max(1,e.agentCount)/3)))*150,a=Math.max(320,t.width),o=Math.max(240,t.height),s=1,c=-1/0,l=1/0;for(let t=1;t<=e.length;t+=1){let n=[];for(let r=0;r<e.length;r+=t)n.push(i(e.slice(r,r+t)));let u=n.length,d=Math.max(660,Math.min(t,e.length)*r),f=320+n.reduce((e,t)=>e+t,0)+Math.max(0,u-1)*100,p=Math.min(a/d,o/f),m=Math.abs(Math.log(d/f/(a/o)));(p>c+1e-9||Math.abs(p-c)<=1e-9&&m<l)&&(s=t,c=p,l=m)}let u=new Map,d=370;for(let t=0;t<e.length;t+=s){let n=e.slice(t,t+s);n.forEach((e,t)=>{u.set(e.id,{x:600+(t-(n.length-1)/2)*r,y:d})}),d+=i(n)+100}return{positions:u,columns:s,rows:Math.ceil(e.length/s),columnWidth:r}}function bt(e,t,n,r=640){let i=Math.min(3,n),a=Math.floor(t/i),o=t%i;return{x:e-(Math.min(i,n-a*i)-1)*190/2+o*190,y:r+a*150}}function xt(e){return e===`tui`?`tui`:e===`repl`||e===`cli`?`repl`:`webui`}function St(e){return e===`tui`?`TUI`:e===`repl`?`REPL`:`WebUI`}function Ct(e){switch(e){case`running`:case`active`:return`active`;case`idle`:return`idle`;case`completed`:return`completed`;case`failed`:case`error`:return`error`;case`stopped`:return`offline`;default:return`idle`}}function wt(e){if(e)return e.split(`/`).filter(Boolean).pop()??e}function Tt(e){let t=wt(e)??e??``;return t.length>10?`…${t.slice(-8)}`:t}function Et(e,t){let n=wt(t);if(n)return e.find(e=>wt(e.sessionId)===n)}function Dt(e,t){let n=Ct(t.status);return{officeId:`${e}__agent-${t.id}`,serverId:t.id,name:t.name??t.id,status:n,iteration:t.iteration??0,toolCalls:t.toolCalls??0,costUsd:t.costUsd??0,tokensIn:t.tokensIn??0,tokensOut:t.tokensOut??0,ctxPct:t.ctxPct,model:t.model,currentTool:t.currentTool,currentTask:t.description,taskId:t.taskId,presenceSource:`fleet`}}function Ot(e,t){return e===`cli`?`CLI`:e===`repl`?`REPL`:St(t)}function kt(e,t,n=[],r=new Map,i=Date.now()){let a=new Set,o=[];for(let n of e){let e=xt(n.clientType),r=Ot(n.clientType,e),i=`client-${n.pid??n.sessionId}`,s=[],c=!1;for(let e of n.agents){a.add(e.id);let n=t.get(e.id),r=Ct(n?.status??e.status);(r===`active`||r===`streaming`)&&(c=!0),s.push({officeId:`${i}__agent-${e.id}`,serverId:e.id,name:n?.name??e.name??e.id,status:r,iteration:n?.iteration??e.iterations??0,toolCalls:n?.toolCalls??e.toolCalls??0,costUsd:n?.costUsd??e.costUsd??0,tokensIn:n?.tokensIn??e.tokensIn??0,tokensOut:n?.tokensOut??e.tokensOut??0,ctxPct:n?.ctxPct??e.ctxPct,model:n?.model??e.model,lastActivityAt:e.lastActivityAt,currentTool:n?.currentTool??e.currentTool,currentTask:e.currentTask??n?.description,taskId:e.taskId??n?.taskId,recentTools:e.recentTools,recentMail:e.recentMail,activity:e.activity,presenceSource:`registry`})}let l=n.status===`closing`||n.status===`stale`||n.status===`lost`?`offline`:c?`active`:`idle`,u=n.agents.find(e=>e.id===`leader`);o.push({id:i,type:e,label:`${r} · ${n.pid?`PID ${n.pid}`:Tt(n.sessionId)}`,sublabel:[`session ${Tt(n.sessionId)}`,n.gitBranch?`⎇ ${n.gitBranch}`:``,n.workingDir?n.workingDir.split(/[\\/]/).filter(Boolean).pop():``].filter(Boolean).join(` · `),status:l,sessionId:n.sessionId,pid:n.pid,branch:n.gitBranch,workingDir:n.workingDir,startedAt:n.startedAt,lastHeartbeatAt:n.lastHeartbeatAt,latestPrompt:u?.latestPrompt,latestPromptAt:u?.latestPromptAt,activeInstruction:u?.status===`running`||u?.status===`streaming`?u.latestPrompt??u.currentTask:void 0,todos:u?.todos,agents:s})}for(let e of n.filter(e=>e.online)){let t=Et(o,e.sessionId);if(!t)continue;let n=e.name.trim().toLowerCase(),r=t.agents.find(t=>t.serverId===e.agentId||t.name.trim().toLowerCase()===n);r&&(a.add(e.agentId),r.mailboxId=e.agentId,r.role=e.role,r.currentTask=r.currentTask??e.currentTask,r.currentTool=r.currentTool??e.currentTool)}let s=[...t.values()].filter(e=>!a.has(e.id)),c,l=()=>{if(c)return c;let e=o.find(e=>e.type===`webui`);return e?(c=e,e):(c={id:`client-self`,type:`webui`,label:`This WebUI`,sublabel:`Web UI`,status:`idle`,agents:[]},o.push(c),c)};for(let e of s){let t=Et(o,e.sessionId)??l(),n=Dt(t.id,e);(n.status===`active`||n.status===`streaming`)&&t.status!==`offline`&&(t.status=`active`),t.agents.push(n),a.add(e.id)}for(let[e,t]of r){if(a.has(e)||i-t.finishedAt>9e5)continue;let n=Et(o,t.agent.sessionId);n&&n.agents.push(Dt(n.id,t.agent))}return o.length===0&&o.push({id:`client-self`,type:`webui`,label:`This WebUI`,sublabel:`Web UI · connecting…`,status:`idle`,agents:[]}),o}function At(e){return e.startsWith(`tool`)?`hsl(var(--warning))`:e.startsWith(`mailbox`)?`hsl(var(--info))`:e.startsWith(`provider`)?`hsl(var(--primary))`:e.startsWith(`agent`)||e.startsWith(`subagent`)?`hsl(var(--success))`:e.includes(`error`)?`hsl(var(--destructive))`:`hsl(var(--primary))`}var jt=new Set([`completed`,`failed`,`timeout`,`stopped`]);function Mt(e){let t=(0,W.useRef)(new Map).current;return(0,W.useMemo)(()=>{let n=Date.now(),r=new Set;for(let i of e.values())if(r.add(i.id),jt.has(i.status)){let e=t.get(i.id);e?e.agent=i:t.set(i.id,{agent:i,finishedAt:i.completedAt??n})}else t.delete(i.id);for(let[e,n]of[...t.entries()])!r.has(e)&&!jt.has(n.agent.status)&&t.set(e,{agent:{...n.agent,status:`stopped`},finishedAt:n.finishedAt});for(let[e,r]of t)n-r.finishedAt>9e5&&t.delete(e);return{map:t,now:n}},[e,t])}var Nt=[`bot`,`cactus`,`duck`,`radio`],Pt={leader:`plum`,builder:`ocean`,researcher:`mint`,reviewer:`rose`,planner:`amber`,operator:`graphite`},Ft={leader:0,builder:1,researcher:2,reviewer:3,planner:4,operator:5},It={read:O,write:B,edit:B,terminal:x,web:ye,search:S,memory:v,other:d},Lt={leader:j,builder:d,researcher:O,reviewer:L,planner:M,operator:x};function Rt(e){if(e.serverId===`leader`||e.serverId.startsWith(`leader@`))return`leader`;let t=[e.role,e.name,e.currentTask].filter(Boolean).join(` `).toLowerCase();return/review|critic|audit|security|test|qa|verify|checker/.test(t)?`reviewer`:/research|analyst|explor|investig|search|hunter|recon/.test(t)?`researcher`:/plan|architect|design|coordinat|strateg|spec/.test(t)?`planner`:/build|implement|code|develop|engineer|refactor|fix|frontend|backend/.test(t)?`builder`:`operator`}function zt(e,t){let n=2166136261;for(let t=0;t<e.length;t+=1)n^=e.charCodeAt(t),n=Math.imul(n,16777619);let r=n>>>0;return{palette:Pt[t],layout:r%4,clutter:Math.floor(r/4)%3,avatar:Ft[t],motion:Math.floor(r/31)%4,charm:Nt[Math.floor(r/47)%Nt.length]}}function Bt(e,t=22){let n=e.split(`/`).filter(Boolean).pop()??e;return n.length>t?`${n.slice(0,t-1)}…`:n}function Vt(e,t=46){if(!e||e.length<=t)return e;let n=e.split(/[\\/]/).slice(-2).join(`/`);return n.length<=t?`…/${n}`:`…${e.slice(-(t-1))}`}function Ht(e,t,n=12e4){let{agent:r,client:i,current:a,history:o,mail:s}=e,c=r.status===`active`||r.status===`streaming`,l=a?.startedAt??o[0]?.completedAt??o[0]?.startedAt,u=[l,s[0]?.timestampMs].filter(e=>e!==void 0),d=Date.parse(i.startedAt??``),f=Number.isFinite(d)?d:0,p=u.length>0?Math.max(...u,f):f>0?f:void 0,m=p===void 0?1/0:Math.max(0,t-p);if(!c||a!==void 0||m<n)return{waiting:!1,idleMs:m,reason:`no-work`,anchor:``,anchorId:void 0,anchorAt:p};if(i.todos===void 0&&r.toolCalls===0)return{waiting:!0,idleMs:m,reason:`telemetry`,anchor:r.currentTask??``,anchorId:void 0,anchorAt:p};let h=s[0],g=h!==void 0&&h.direction===`outgoing`&&(l===void 0||h.timestampMs>l)?h:void 0;return g===void 0?{waiting:!0,idleMs:m,reason:`no-work`,anchor:r.currentTask||o[0]?.summary||``,anchorId:void 0,anchorAt:p}:{waiting:!0,idleMs:m,reason:`mail-reply`,anchor:g.subject,anchorId:g.id,anchorAt:p}}function Ut(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<5)return`now`;if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m`:`${Math.floor(r/60)}h`}function Wt(e,t){if(!e)return`—`;let n=Date.parse(e);if(!Number.isFinite(n))return`—`;let r=Math.max(0,Math.floor((t-n)/1e3));return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function Gt(e){let t=new Set,n=new Set,r=new Set,i=0,a=0,o={files:0,reads:0,writes:0,edits:0,linesAdded:0,linesRemoved:0,terminalCalls:0,incomingMail:0,outgoingMail:0};for(let s of e){let e=s.agent.activity;for(let n of e?.filesTouched??[])t.add(n);o.reads+=e?.reads??0,o.writes+=e?.writes??0,o.edits+=e?.edits??0,o.linesAdded+=e?.linesAdded??0,o.linesRemoved+=e?.linesRemoved??0,o.terminalCalls+=e?.terminalCalls??0,i+=e?.mailReceived??0,a+=e?.mailSent??0;for(let e of s.mail)(e.direction===`incoming`?n:r).add(e.id)}return o.files=t.size,o.incomingMail=Math.max(i,n.size),o.outgoingMail=Math.max(a,r.size),o}function Kt(e,t,n){return n.map((n,r)=>({...it(e.serverId,n.name,t.sessionId),id:`${e.serverId}:log:${n.at}:${r}`,kind:Ue(n.name),status:n.ok?`succeeded`:`failed`,startedAt:Math.max(0,n.at-n.durationMs),completedAt:n.at,durationMs:n.durationMs,summary:n.ok?`${n.name} completed`:`${n.name} failed`}))}function qt(...e){let t=[];for(let n of e.flat()){let e=n.completedAt??n.startedAt;t.some(t=>(t.id===n.id||t.toolName===n.toolName)&&Math.abs((t.completedAt??t.startedAt)-e)<2500)||t.push(n)}return t.sort((e,t)=>(t.completedAt??t.startedAt)-(e.completedAt??e.startedAt))}function Jt(...e){let t=new Map;for(let n of e.flat())t.set(n.id,n);return[...t.values()].sort((e,t)=>t.timestampMs-e.timestampMs).slice(0,12)}function Yt({kind:e,active:t}){let n=It[e];return(0,Y.jsxs)(`span`,{className:H(`agent-office__tool-glyph`,`is-${e}`,t&&`is-active`),children:[e===`read`&&(0,Y.jsx)(w,{className:`agent-office__file-underlay`,"aria-hidden":`true`}),(0,Y.jsx)(n,{"aria-hidden":`true`})]})}function Xt({active:e,failed:t,role:n,variant:r,motion:i}){let a=Lt[n];return(0,Y.jsxs)(`div`,{className:H(`agent-office__avatar`,`is-${n}`,`is-avatar-${r}`,`is-motion-${i}`,e&&`is-active`,!e&&!t&&`is-idle`,t&&`is-failed`),"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{className:`agent-office__avatar-chair`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-body`}),(0,Y.jsxs)(`span`,{className:`agent-office__avatar-head`,children:[(0,Y.jsx)(`span`,{className:`agent-office__avatar-hair`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-face`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-mouth`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-headset`})]}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-arm`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-prop`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-role-badge`,children:(0,Y.jsx)(a,{})})]})}function Zt({call:e,compact:t=!1,onSelect:n}){let r=e.status===`running`;return(0,Y.jsxs)(`button`,{type:`button`,className:H(`agent-office__parcel`,`is-${e.kind}`,t&&`is-compact`,r&&`is-running`,e.status===`failed`&&`is-failed`),onClick:n,"aria-label":`${e.toolName}: ${e.summary}`,children:[(0,Y.jsx)(Yt,{kind:e.kind,active:r}),(0,Y.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,Y.jsxs)(`span`,{className:`agent-office__parcel-topline`,children:[(0,Y.jsx)(`strong`,{children:e.toolName}),e.lineLabel&&(0,Y.jsx)(`span`,{className:`agent-office__line-chip`,children:e.lineLabel})]}),!t&&e.target&&(0,Y.jsx)(`span`,{className:`agent-office__parcel-target`,children:Vt(e.target)}),(0,Y.jsx)(`span`,{className:`agent-office__parcel-summary`,children:e.summary})]}),(0,Y.jsx)(`span`,{className:`agent-office__parcel-state`,"aria-hidden":`true`,children:r?(0,Y.jsx)(`span`,{className:`agent-office__pulse-dot`}):e.status===`failed`?(0,Y.jsx)(N,{}):(0,Y.jsx)(L,{})})]})}function Qt({mail:e,compact:t=!1,onSelect:n}){let r=e.direction===`incoming`;return(0,Y.jsxs)(`button`,{type:`button`,className:H(`agent-office__mail-parcel`,t&&`is-compact`,r?`is-incoming`:`is-outgoing`,e.unread&&`is-unread`),onClick:n,"aria-label":`${r?`Incoming`:`Outgoing`} mail: ${e.subject}`,children:[(0,Y.jsx)(`span`,{className:`agent-office__mail-icon`,children:r?(0,Y.jsx)(a,{"aria-hidden":`true`}):(0,Y.jsx)(ae,{"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,Y.jsx)(`strong`,{children:r?`${e.from} →`:`→ ${e.to}`}),(0,Y.jsx)(`span`,{className:`agent-office__parcel-summary`,children:e.subject})]}),(0,Y.jsx)(P,{"aria-hidden":`true`})]})}function $t({office:e,now:t}){let{t:n}=r(),{client:i,agents:a,stats:o}=e,s=i.lastHeartbeatAt?Date.parse(i.lastHeartbeatAt):NaN,c=Number.isFinite(s)&&t-s<2e4,u=Number.isFinite(s)&&!c,d=a.some(({agent:e})=>e.presenceSource===`registry`),f=c?`VERIFIED`:u?`DELAYED`:d?`REGISTRY`:`LOCAL`,p=a.some(({agent:e})=>e.recentTools!==void 0||e.activity!==void 0),m=a.some(({agent:e})=>e.toolCalls>0&&e.recentTools===void 0&&e.activity===void 0);return(0,Y.jsxs)(`header`,{className:`agent-office__client-header`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__client-title`,children:[(0,Y.jsx)(`span`,{className:`agent-office__client-icon`,children:(0,Y.jsx)(j,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{className:`agent-office__client-copy`,children:[(0,Y.jsx)(`strong`,{children:i.label}),(0,Y.jsx)(`span`,{children:i.sublabel||i.sessionId})]}),(0,Y.jsxs)(`div`,{className:`agent-office__client-presence`,children:[(0,Y.jsxs)(`span`,{className:`agent-office__client-agent-count`,children:[a.length,` `,n(`activity:agentOffice.agents`)]}),(0,Y.jsxs)(`span`,{className:H(`agent-office__presence-chip`,!u&&`is-live`,u&&`is-legacy`),children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),` `,f]}),(0,Y.jsxs)(`span`,{className:`agent-office__presence-chip`,children:[(0,Y.jsx)(_,{"aria-hidden":`true`}),` `,Wt(i.startedAt,t),` UP`]}),(0,Y.jsxs)(`span`,{className:H(`agent-office__presence-chip`,m?`is-legacy`:p&&`is-telemetry`),children:[(0,Y.jsx)(g,{"aria-hidden":`true`}),m?`RECONNECT`:p?`TOOLS LIVE`:`READY`]})]})]}),(0,Y.jsxs)(`fieldset`,{className:`agent-office__client-stats`,"aria-label":n(`activity:agentOffice.sessionActivityTotals`),children:[(0,Y.jsxs)(`span`,{title:n(`activity:agentOffice.uniqueFilesTouched`),children:[(0,Y.jsx)(l,{}),` `,(0,Y.jsx)(`strong`,{children:o.files}),` `,n(`activity:agentOffice.files`)]}),(0,Y.jsxs)(`span`,{title:n(`activity:agentOffice.fileReads`),children:[(0,Y.jsx)(O,{}),` `,(0,Y.jsx)(`strong`,{children:o.reads}),` `,n(`activity:agentOffice.read`)]}),(0,Y.jsxs)(`span`,{title:n(`activity:agentOffice.filesWritten`),children:[(0,Y.jsx)(B,{}),` `,(0,Y.jsx)(`strong`,{children:o.writes}),` `,n(`activity:agentOffice.write`)]}),(0,Y.jsxs)(`span`,{title:n(`activity:agentOffice.filesEdited`),children:[(0,Y.jsx)(B,{}),` `,(0,Y.jsx)(`strong`,{children:o.edits}),` `,n(`activity:agentOffice.edit`)]}),(0,Y.jsxs)(`span`,{className:`agent-office__client-delta`,title:n(`activity:agentOffice.linesAddedAndRemoved`),children:[(0,Y.jsxs)(`strong`,{children:[`+`,o.linesAdded]}),` / `,(0,Y.jsxs)(`b`,{children:[`−`,o.linesRemoved]})]}),(0,Y.jsxs)(`span`,{title:n(`activity:agentOffice.terminalCommands`),children:[(0,Y.jsx)(x,{}),` `,(0,Y.jsx)(`strong`,{children:o.terminalCalls}),` `,n(`activity:agentOffice.term`)]}),(0,Y.jsxs)(`span`,{title:n(`activity:agentOffice.incomingAndOutgoingMail`),children:[(0,Y.jsx)(P,{}),` `,(0,Y.jsx)(`strong`,{children:o.incomingMail}),`↓ `,(0,Y.jsx)(`strong`,{children:o.outgoingMail}),`↑`]})]})]})}function en({office:e,now:t,onSelect:n}){let{t:i}=r(),{client:a}=e,o=a.todos!==void 0,s=a.todos??[],l=s.filter(e=>e.status!==`completed`),u=s.length-l.length,d=!!a.activeInstruction,f=a.activeInstruction??a.latestPrompt,p=a.latestPromptAt!==void 0&&t-a.latestPromptAt<3e4,m=()=>n({kind:`briefing`,officeLabel:a.label,prompt:f,promptAt:a.latestPromptAt,instructionActive:d,telemetryConnected:o,todos:s});return(0,Y.jsxs)(`section`,{className:`agent-office__briefing`,"aria-label":i(`activity:agentOffice.officeBriefing`),children:[(0,Y.jsxs)(`button`,{type:`button`,className:H(`agent-office__prompt-card`,d&&`is-active`,p&&`is-fresh`,!o&&`is-waiting`),onClick:m,children:[(0,Y.jsx)(`span`,{className:`agent-office__briefing-icon is-prompt`,children:(0,Y.jsx)(T,{"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`agent-office__briefing-copy`,children:[(0,Y.jsx)(`span`,{children:i(d?`activity:agentOffice.activeInstruction`:`activity:agentOffice.leaderPrompt`)}),(0,Y.jsx)(`strong`,{children:f??i(o?`activity:agentOffice.noPrompt`:`activity:agentOffice.telemetryWaiting`)})]}),d&&(0,Y.jsxs)(`span`,{className:`agent-office__instruction-live`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),` `,i(`activity:agentOffice.live`)]}),a.latestPromptAt!==void 0&&(0,Y.jsx)(`time`,{dateTime:new Date(a.latestPromptAt).toISOString(),children:Ut(a.latestPromptAt,t)})]}),(0,Y.jsxs)(`button`,{type:`button`,className:H(`agent-office__todo-board`,l.length>0&&`has-active`,!o&&`is-waiting`),onClick:m,children:[(0,Y.jsxs)(`span`,{className:`agent-office__todo-heading`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),` `,i(`activity:agentOffice.activeTodos`)]}),(0,Y.jsx)(`strong`,{children:o?i(`activity:agentOffice.todoProgress`,{done:u,total:s.length}):i(`activity:agentOffice.syncWaiting`)})]}),(0,Y.jsxs)(`span`,{className:`agent-office__todo-preview`,children:[o?l.length>0?l.slice(0,3).map(e=>(0,Y.jsxs)(`span`,{className:H(`agent-office__todo-line`,`is-${e.status}`),children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:e.activeForm||e.content})]},e.id)):(0,Y.jsxs)(`span`,{className:`agent-office__todo-empty`,children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),s.length>0?i(`activity:agentOffice.allTodosDone`):i(`activity:agentOffice.noActiveTodos`)]}):(0,Y.jsxs)(`span`,{className:`agent-office__todo-empty is-waiting`,children:[(0,Y.jsx)(g,{"aria-hidden":`true`}),i(`activity:agentOffice.todoTelemetryWaiting`)]}),l.length>3&&(0,Y.jsx)(`span`,{className:`agent-office__todo-more`,children:i(`activity:agentOffice.moreTodos`,{count:l.length-3})})]})]})]})}function tn({active:e}){let{t}=r();return(0,Y.jsxs)(`div`,{className:`agent-office__parcel agent-office__parcel--empty`,children:[(0,Y.jsx)(`span`,{className:`agent-office__tool-glyph`,children:(0,Y.jsx)(F,{"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,Y.jsx)(`strong`,{children:t(e?`activity:agentOffice.thinking`:`activity:agentOffice.waiting`)}),(0,Y.jsx)(`span`,{children:t(e?`activity:agentOffice.preparing`:`activity:agentOffice.deskReady`)})]})]})}function nn({model:e,now:t,onSelect:n,routedMailIds:i}){let{t:a}=r(),o=U(e=>e.waitThresholdMs),{agent:s,client:c,current:l,display:u,history:f,mail:p}=e,m=s.status===`active`||s.status===`streaming`,h=s.status===`error`,v=p[0],y=Rt(s),b=zt(`${c.sessionId}:${s.serverId}:${s.name}`,y),x=Ht(e,t,o),S=x.reason===`mail-reply`?p.some(e=>e.id===x.anchorId):!!s.currentTask,C=Number.isFinite(x.idleMs)?Ut(t-x.idleMs,t):`—`,w=x.waiting?x.reason===`mail-reply`?a(`activity:agentOffice.waitingForReply`,{subject:x.anchor||a(`activity:agentOffice.waitingMailFallback`),duration:C}):x.reason===`telemetry`?a(`activity:agentOffice.waitingTelemetry`):a(`activity:agentOffice.waitingNoWork`,{duration:C,last:x.anchor||a(`activity:agentOffice.waitingNothingYet`)}):void 0,T=v&&t-v.timestampMs<3e4&&!i?.has(v.id)&&x.anchorId!==v.id,E=f.slice(0,6),D=E[0]?.completedAt??E[0]?.startedAt??u?.completedAt??u?.startedAt,ee=l?`is-tool-${l.kind}`:void 0,O=l?l.summary:u?u.summary:x.waiting?w??a(`activity:agentOffice.waiting`):a(m?`activity:agentOffice.preparing`:`activity:agentOffice.waiting`);return(0,Y.jsxs)(`article`,{className:H(`agent-office__lane`,`is-desk-${b.palette}`,`is-layout-${b.layout}`,`is-clutter-${b.clutter}`,m&&`is-active`,h&&`is-failed`,x.waiting&&`is-waiting`),children:[(0,Y.jsxs)(`div`,{className:`agent-office__identity`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__identity-line`,children:[(0,Y.jsx)(`span`,{className:H(`agent-office__status-dot`,m&&`is-active`,h&&`is-failed`)}),(0,Y.jsx)(`strong`,{title:s.name,children:s.name}),(0,Y.jsxs)(`span`,{className:`agent-office__agent-verified`,title:s.presenceSource===`registry`?`Verified by live session registry`:`Verified by local fleet state`,children:[(0,Y.jsx)(L,{"aria-hidden":`true`}),s.presenceSource===`registry`?`LIVE`:`LOCAL`]})]}),x.waiting&&S&&(0,Y.jsxs)(`button`,{type:`button`,className:H(`agent-office__wait-badge`,`is-${x.reason}`),title:w,"aria-label":w,onClick:()=>{if(x.reason===`mail-reply`){let e=p.find(e=>e.id===x.anchorId);e&&n({kind:`mail`,mail:e,agentName:s.name});return}s.currentTask&&n({kind:`task`,task:s.currentTask,taskId:s.taskId,agentName:s.name})},children:[(0,Y.jsx)(_,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:C})]}),x.waiting&&!S&&(0,Y.jsxs)(`span`,{role:`status`,className:H(`agent-office__wait-badge`,`is-${x.reason}`),title:w,"aria-label":w,children:[(0,Y.jsx)(_,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:C})]}),(0,Y.jsx)(`span`,{className:`agent-office__role`,children:s.role??(s.serverId===`leader`||s.serverId.startsWith(`leader@`)?a(`activity:agentOffice.leadAgent`):a(`activity:agentOffice.agent`))}),(0,Y.jsxs)(`div`,{className:`agent-office__agent-meta`,children:[(0,Y.jsx)(`span`,{children:c.branch?`⎇ ${c.branch}`:c.type.toUpperCase()}),(0,Y.jsx)(`span`,{children:a(`activity:agentOffice.callsCount`,{count:s.toolCalls})}),s.model&&(0,Y.jsx)(`span`,{className:`agent-office__model-chip`,title:s.model,children:Bt(s.model)})]}),s.currentTask&&(0,Y.jsxs)(`button`,{type:`button`,className:`agent-office__agent-task`,onClick:()=>n({kind:`task`,task:s.currentTask??``,taskId:s.taskId,agentName:s.name}),children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:a(`activity:agentOffice.currentTask`)}),(0,Y.jsx)(`small`,{children:s.currentTask})]})]}),!s.currentTask&&m&&(0,Y.jsxs)(`div`,{className:`agent-office__agent-task is-missing`,children:[(0,Y.jsx)(g,{"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:a(`activity:agentOffice.currentTask`)}),(0,Y.jsx)(`small`,{children:c.todos===void 0?a(`activity:agentOffice.telemetryWaiting`):a(`activity:agentOffice.taskNotReported`)})]})]}),v&&(0,Y.jsxs)(`button`,{type:`button`,className:H(`agent-office__identity-mail`,v.unread&&`is-unread`),onClick:()=>n({kind:`mail`,mail:v,agentName:s.name}),"aria-label":`${p.length} mail messages. Latest: ${v.subject}`,children:[(0,Y.jsx)(P,{"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsxs)(`strong`,{children:[p.length,` MAIL`]}),(0,Y.jsx)(`small`,{children:v.subject})]})]})]}),(0,Y.jsxs)(`div`,{className:H(`agent-office__scene`,ee),children:[(0,Y.jsxs)(`div`,{className:`agent-office__window`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{})]}),(0,Y.jsxs)(`div`,{className:`agent-office__plant`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`b`,{})]}),(0,Y.jsxs)(`div`,{className:`agent-office__desk-zone`,"aria-hidden":`true`,children:[(0,Y.jsx)(Xt,{active:m,failed:h,role:y,variant:b.avatar,motion:b.motion}),(0,Y.jsx)(`span`,{className:`agent-office__monitor`,children:u?(0,Y.jsx)(Yt,{kind:u.kind,active:l!==void 0}):(0,Y.jsx)(d,{})}),(0,Y.jsxs)(`span`,{className:`agent-office__activity-fx`,children:[(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`b`,{})]}),(0,Y.jsx)(`span`,{className:`agent-office__desk`}),(0,Y.jsx)(`span`,{className:`agent-office__desk-lamp`}),(0,Y.jsxs)(`span`,{className:`agent-office__desk-clutter`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`b`,{})]}),(0,Y.jsxs)(`span`,{className:H(`agent-office__desk-charm`,`is-${b.charm}`),children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`b`,{})]}),(0,Y.jsxs)(`span`,{className:H(`agent-office__mug`,`is-${y}`),children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`b`,{"aria-hidden":`true`})]})]}),T&&(0,Y.jsx)(`div`,{className:H(`agent-office__mail-flyby`,`is-${v.direction}`),children:(0,Y.jsx)(Qt,{mail:v,compact:!0,onSelect:()=>n({kind:`mail`,mail:v,agentName:s.name})},v.id)}),(0,Y.jsxs)(`div`,{className:H(`agent-office__conveyor`,l&&`is-moving`),children:[(0,Y.jsxs)(`div`,{className:`agent-office__belt`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{})]}),(0,Y.jsx)(`div`,{className:`agent-office__current-action`,children:u?(0,Y.jsx)(Zt,{call:u,onSelect:()=>n({kind:`tool`,call:u,agentName:s.name})},u.id):(0,Y.jsx)(tn,{active:m})})]})]}),(0,Y.jsxs)(`div`,{className:`agent-office__history`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__history-heading`,children:[(0,Y.jsx)(`span`,{children:a(`activity:agentOffice.recent`)}),D!==void 0&&(0,Y.jsx)(`span`,{children:Ut(D,t)})]}),(0,Y.jsx)(`div`,{className:`agent-office__history-list`,children:E.length>0?E.map(e=>(0,Y.jsx)(Zt,{call:e,compact:!0,onSelect:()=>n({kind:`tool`,call:e,agentName:s.name})},`tool:${e.id}`)):(0,Y.jsx)(`span`,{className:`agent-office__history-empty`,children:s.toolCalls>0&&s.recentTools===void 0&&s.activity===void 0?a(`activity:agentOffice.telemetryReconnect`):a(`activity:agentOffice.noCalls`)})})]}),(0,Y.jsxs)(`div`,{className:`agent-office__desk-metrics`,children:[(0,Y.jsxs)(`span`,{className:`agent-office__metric`,title:`${a(`activity:agentOffice.tokens`)}: in ${Te(s.tokensIn)} / out ${Te(s.tokensOut)}`,children:[(0,Y.jsx)(`strong`,{children:Te(s.tokensIn+s.tokensOut)}),(0,Y.jsx)(`small`,{children:`TOK`})]}),(0,Y.jsxs)(`span`,{className:`agent-office__metric`,title:a(`activity:agentOffice.cost`),children:[(0,Y.jsx)(`strong`,{children:Ee(s.costUsd)}),(0,Y.jsx)(`small`,{children:`COST`})]}),(0,Y.jsxs)(`span`,{className:`agent-office__metric`,title:a(`activity:agentOffice.contextUsed`),children:[(0,Y.jsx)(`strong`,{children:s.ctxPct===void 0?`—`:`${Math.round(s.ctxPct)}%`}),(0,Y.jsx)(`small`,{children:`CTX`}),s.ctxPct!==void 0&&(0,Y.jsx)(`i`,{className:H(`agent-office__ctx-bar`,s.ctxPct>=80&&`is-high`),children:(0,Y.jsx)(`b`,{style:{width:`${Math.min(100,Math.max(0,s.ctxPct))}%`}})})]}),(0,Y.jsxs)(`span`,{className:`agent-office__metric agent-office__metric-action`,title:O,children:[(0,Y.jsx)(g,{"aria-hidden":`true`}),(0,Y.jsx)(`small`,{children:O})]})]})]})}function rn(e){return e.agent.status===`active`||e.agent.status===`streaming`||e.agent.status===`error`}function an({agents:e,now:t,onSelect:i}){let{t:a}=r();return(0,Y.jsxs)(`section`,{className:`agent-office__lounge`,"aria-label":a(`activity:agentOffice.breakRoom`),children:[(0,Y.jsxs)(`header`,{className:`agent-office__lounge-heading`,children:[(0,Y.jsx)(n,{"aria-hidden":`true`}),(0,Y.jsx)(`strong`,{children:a(`activity:agentOffice.breakRoom`)}),(0,Y.jsx)(`span`,{children:a(`activity:agentOffice.onBreak`,{count:e.length})})]}),(0,Y.jsx)(`div`,{className:`agent-office__lounge-seats`,children:e.map(e=>{let{agent:n,history:r,mail:o}=e,s=Rt(n),c=Lt[s],l=o.filter(e=>e.unread).length,u=r[0]?.completedAt??r[0]?.startedAt,d=o[0],f=()=>{n.currentTask?i({kind:`task`,task:n.currentTask,taskId:n.taskId,agentName:n.name}):d&&i({kind:`mail`,mail:d,agentName:n.name})},p=!!n.currentTask||!!d;return(0,Y.jsxs)(`button`,{type:`button`,className:H(`agent-office__lounge-seat`,`is-${s}`),onClick:f,disabled:!p,children:[(0,Y.jsx)(`span`,{className:`agent-office__lounge-avatar`,children:(0,Y.jsx)(c,{"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`agent-office__lounge-copy`,children:[(0,Y.jsx)(`strong`,{children:n.name}),(0,Y.jsx)(`small`,{children:n.role??a(`activity:agentOffice.agent`)})]}),(0,Y.jsxs)(`span`,{className:`agent-office__lounge-meta`,children:[u!==void 0&&(0,Y.jsx)(`span`,{children:Ut(u,t)}),l>0&&(0,Y.jsxs)(`span`,{className:`agent-office__lounge-mail`,children:[(0,Y.jsx)(P,{"aria-hidden":`true`}),` `,l]})]})]},e.key)})})]})}function on(){let{t:e}=r(),t=De(e=>e.liveSessions),i=De(e=>e.aggregate),a=Ce(e=>e.agents),o=Oe(e=>e.agents),s=Oe(e=>e.messages),c=xe(e=>e.toolEvents),l=Se(e=>e.projectName),u=Mt(a),[d,f]=(0,W.useState)(null),p=(0,W.useMemo)(()=>kt(t,a,o,u.map,u.now),[t,a,o,u]),m=(0,W.useMemo)(()=>p.flatMap(e=>e.agents.map(t=>{let n=qt(rt(c,t.serverId,e.sessionId),Qe(t.recentTools,t.serverId,e.sessionId),Kt(t,e,a.get(t.serverId)?.toolLog??[])),r=t.status===`active`||t.status===`streaming`,i=n.find(e=>e.status===`running`);!i&&r&&t.currentTool&&(i=it(t.serverId,t.currentTool,e.sessionId));let o=i??n[0],l=n.filter(e=>e.status!==`running`).slice(0,6),u=Jt($e(t.recentMail),nt(s,t,e.sessionId));return{key:t.officeId,client:e,agent:t,calls:n,current:i,display:o,history:l,mail:u}})),[p,a,s,c]),h=(0,W.useMemo)(()=>p.map(e=>{let t=m.filter(t=>t.client.id===e.id);return{client:e,agents:t,stats:Gt(t)}}).filter(e=>e.agents.length>0),[p,m]),v=m.filter(({agent:e})=>e.status===`active`||e.status===`streaming`).length,y=l||t.find(e=>e.projectName)?.projectName||e(`activity:office.fleetHq`),b=Date.now();return(0,Y.jsxs)(`div`,{className:`agent-office`,children:[(0,Y.jsxs)(`header`,{className:`agent-office__header`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__title`,children:[(0,Y.jsx)(`span`,{className:`agent-office__brand-mark`,children:(0,Y.jsx)(j,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.liveProjectOffice`)}),(0,Y.jsx)(`h1`,{children:y})]})]}),(0,Y.jsxs)(`div`,{className:`agent-office__live-pill`,children:[(0,Y.jsx)(`span`,{}),` `,e(`activity:agentOffice.live`)]}),(0,Y.jsxs)(`div`,{className:`agent-office__summary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(F,{}),(0,Y.jsx)(`strong`,{children:m.length}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.agents`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(_e,{}),(0,Y.jsx)(`strong`,{children:v}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.working`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(g,{}),(0,Y.jsx)(`strong`,{children:i.toolCalls.toLocaleString()}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.toolCalls`)})]})]})]}),(0,Y.jsx)(`main`,{className:`agent-office__floor`,children:m.length>0?h.map(t=>{let r=t.agents.filter(rn),i=t.agents.filter(e=>!rn(e)),a=et(r,b),o=new Set(a.map(e=>e.id));return(0,Y.jsxs)(`section`,{className:`agent-office__client-office`,children:[(0,Y.jsx)($t,{office:t,now:b}),(0,Y.jsx)(en,{office:t,now:b,onSelect:f}),r.length>0&&(0,Y.jsxs)(`div`,{className:`agent-office__column-headings`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.team`)}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.liveDesk`)}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.lastActions`)})]}),(0,Y.jsxs)(`div`,{className:`agent-office__client-desks`,children:[r.map(e=>(0,Y.jsx)(nn,{model:e,now:b,onSelect:f,routedMailIds:o},e.key)),a.length>0&&(0,Y.jsx)(`div`,{className:`agent-office__mail-routes`,"aria-hidden":`true`,children:a.map(e=>(0,Y.jsx)(`div`,{className:`agent-office__mail-route`,style:{"--from":`${(e.fromIndex+.5)/r.length*100}%`,"--to":`${(e.toIndex+.5)/r.length*100}%`},children:(0,Y.jsx)(`span`,{className:`agent-office__mail-route-parcel`,children:(0,Y.jsx)(P,{"aria-hidden":`true`})})},e.id))}),r.length===0&&(0,Y.jsxs)(`div`,{className:`agent-office__desks-empty`,children:[(0,Y.jsx)(n,{"aria-hidden":`true`}),e(`activity:agentOffice.desksEmpty`)]})]}),i.length>0&&(0,Y.jsx)(an,{agents:i,now:b,onSelect:f})]},t.client.id)}):(0,Y.jsxs)(`div`,{className:`agent-office__empty-state`,children:[(0,Y.jsx)(`span`,{children:(0,Y.jsx)(I,{"aria-hidden":`true`})}),(0,Y.jsx)(`h2`,{children:e(`activity:agentOffice.readyTitle`)}),(0,Y.jsx)(`p`,{children:e(`activity:agentOffice.readyBody`)})]})}),(0,Y.jsxs)(`footer`,{className:`agent-office__footer`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`agent-office__status-dot is-active`}),` `,e(`activity:agentOffice.liveEvent`)]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(ce,{}),` `,e(`activity:agentOffice.connectedSessions`,{count:t.length})]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(_,{}),` `,e(`activity:agentOffice.detailHint`)]})]}),d&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,className:`agent-office__detail-backdrop`,onClick:()=>f(null),"aria-label":e(`activity:agentOffice.closeToolDetails`)}),(0,Y.jsx)(pt,{selected:d,onClose:()=>f(null)})]})]})}function sn(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/100);return t<600?`${(t/10).toFixed(1)}s`:`${Math.floor(t/600)}m ${Math.round(t%600/10)}s`}var cn={user:{Icon:be,labelKey:`activity:message.roleYou`,avatarBg:`bg-primary`,avatarColor:`text-primary-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-primary/20`,bubbleBg:`bg-transparent`,bubbleBorder:`border-primary/40`,textColor:`text-foreground`},assistant:{Icon:F,labelKey:`activity:message.roleAssistant`,avatarBg:`bg-accent`,avatarColor:`text-accent-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-accent/20`,bubbleBg:`bg-card`,bubbleBorder:`border-border`,textColor:`text-foreground`},tool:{Icon:m,labelKey:`activity:message.roleTool`,avatarBg:`bg-secondary`,avatarColor:`text-secondary-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-secondary/20`,bubbleBg:`bg-muted/80`,bubbleBorder:`border-border`,textColor:`text-foreground`},system:{Icon:F,labelKey:`activity:transcript.kindSystem`,avatarBg:`bg-muted`,avatarColor:`text-muted-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-muted/20`,bubbleBg:`bg-muted/50`,bubbleBorder:`border-border`,textColor:`text-muted-foreground`},error:{Icon:C,labelKey:`activity:transcript.kindError`,avatarBg:`bg-destructive`,avatarColor:`text-destructive-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-destructive/20`,bubbleBg:`bg-destructive/5`,bubbleBorder:`border-destructive/20`,textColor:`text-destructive`}};function ln({entry:e}){let{t}=r();return e.role===`error`?(0,Y.jsx)(Me,{text:e.text}):e.role===`tool`?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 tool-details`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground`,children:[(0,Y.jsx)(m,{className:`h-3 w-3`}),(0,Y.jsx)(`span`,{className:`font-mono`,children:e.tool??t(`activity:watch.toolFallback`)}),e.durationMs!==void 0&&(0,Y.jsxs)(`span`,{className:`ml-auto text-[10px] text-muted-foreground font-normal tabular-nums`,children:[(0,Y.jsx)(p,{className:`h-3 w-3 inline mr-0.5 align-text-bottom`}),sn(e.durationMs)]})]}),e.input!==void 0&&e.input!==null&&(0,Y.jsx)(`div`,{className:`p-3 bg-muted/50 rounded-lg overflow-x-auto`,children:(0,Y.jsx)(Fe,{input:e.input})}),e.output!==void 0&&e.output!==null?(0,Y.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:typeof e.output==`string`?(0,Y.jsx)(Ie,{remarkPlugins:[ke],rehypePlugins:je,components:Pe,children:e.output}):(0,Y.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs bg-card rounded-lg p-2 border border-border overflow-x-auto`,children:JSON.stringify(e.output,null,2)})}):e.text?(0,Y.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:(0,Y.jsx)(Ie,{remarkPlugins:[ke],rehypePlugins:je,components:Pe,children:e.text})}):null,e.isError&&(0,Y.jsxs)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-destructive`,children:t(`activity:watch.toolFailed`)}),e.text&&(0,Y.jsx)(`pre`,{className:`mt-1 text-xs whitespace-pre-wrap text-destructive/80`,children:e.text})]})]}):(0,Y.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:(0,Y.jsx)(Ie,{remarkPlugins:[ke],rehypePlugins:je,components:Pe,children:e.text})})}function un({entry:e,isContinuation:t=!1}){let{t:n}=r(),i=cn[e.role],a=i.Icon;return(0,Y.jsxs)(`div`,{className:`group flex gap-3 animate-message msg-bubble rounded-lg transition-shadow`,children:[t?(0,Y.jsx)(`div`,{className:`flex-shrink-0 w-8`}):(0,Y.jsx)(`div`,{className:H(`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center`,i.avatarBg,i.avatarColor,i.avatarRing),children:(0,Y.jsx)(a,{className:`h-4 w-4`})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0 flex-1`,children:[!t&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:H(`text-xs font-medium`,i.textColor),children:e.role===`tool`&&e.tool?e.tool:n(i.labelKey)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}),e.role===`tool`&&e.durationMs!==void 0&&(0,Y.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`· `,sn(e.durationMs)]})]}),(0,Y.jsx)(`div`,{className:H(`rounded-2xl px-4 py-3 border`,e.role===`user`&&`rounded-br-md`,e.role===`assistant`&&`rounded-bl-md`,e.role===`tool`&&`rounded-bl-sm`,e.role===`system`&&`rounded-bl-sm opacity-70`,e.role===`error`&&`rounded-bl-sm`,i.bubbleBg,i.bubbleBorder),children:(0,Y.jsx)(`div`,{className:H(`text-sm leading-relaxed markdown-content`,i.textColor),children:(0,Y.jsx)(ln,{entry:e})})}),e.text&&e.role!==`error`&&(0,Y.jsx)(`div`,{className:`opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,Y.jsx)(Ne,{text:e.text,label:n(`common:action.copy`)})})]})]})}var dn=[`steer`,`ask`,`assign`,`note`],fn=2500;function pn({sessionId:e,limit:t=200}){let[n,i]=(0,W.useState)(null),{t:a}=r(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(`steer`),[g,_]=(0,W.useState)(`high`),[v,b]=(0,W.useState)([]),[x,S]=(0,W.useState)(!1),C=(0,W.useRef)(null),w=(0,W.useRef)(!0),T=(0,W.useRef)(!0),E=De(e=>e.liveSessions),D=(0,W.useMemo)(()=>E.find(t=>t.sessionId===e),[E,e]),ee=(0,W.useMemo)(()=>{let e=D;return e?`${e.status}|${e.agents.map(e=>`${e.id}:${e.status}:${e.toolCalls??0}:${e.iterations??0}`).join(`,`)}`:``},[D]),O=D?.status===`active`||(D?.agents.some(e=>e.status===`running`||e.status===`streaming`)??!1),k=(0,W.useMemo)(()=>{if(!D)return null;let e=D.agents.find(e=>e.status===`running`||e.status===`streaming`);return e?.currentTool?`🔧 ${e.currentTool}`:e?a(`activity:sessionWatch.working`,{name:e.name??e.id}):null},[D,a]),A=(0,W.useMemo)(()=>{if(!D)return null;let e=D.agents.find(e=>e.partialText&&(e.status===`streaming`||e.status===`running`))??D.agents.find(e=>e.partialText);return e?.partialText?{label:e.id===`leader`?a(`activity:sessionWatch.claude`):e.name||e.id,text:e.partialText}:null},[D,a]),j=(0,W.useCallback)(async()=>{try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}/events?limit=${t}`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();T.current&&(i(r),s(null))}catch(e){T.current&&s(e instanceof Error?e.message:String(e))}},[e,t]),M=(0,W.useCallback)(async()=>{try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/mailbox`);if(!t.ok)return;let n=await t.json();T.current&&Array.isArray(n.thread)&&b(n.thread)}catch{}},[e]);(0,W.useEffect)(()=>{T.current=!0,i(null),s(null),b([]),j(),M();let e=setInterval(()=>{document.hidden||(j(),M())},fn);return()=>{T.current=!1,clearInterval(e)}},[j,M]),(0,W.useEffect)(()=>{ee&&j()},[ee,j]),(0,W.useEffect)(()=>{w.current&&C.current&&(C.current.scrollTop=C.current.scrollHeight)},[n,A]);let te=()=>{let e=C.current;e&&(w.current=e.scrollHeight-e.scrollTop-e.clientHeight<40)},N=async()=>{let t=c.trim();if(!(!t||u)){d(!0),p(null);try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}/message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t,type:m,priority:g})});if(!n.ok)throw Error(`HTTP ${n.status}`);l(``),p(O?y.t(`activity:sessionWatch.sentRunning`):y.t(`activity:sessionWatch.sentIdle`)),M()}catch(e){p(y.t(`activity:sessionWatch.sentFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{d(!1)}}},P=async()=>{if(!x){S(!0),p(null);try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({reason:y.t(`activity:sessionWatch.interruptReason`)})});if(!t.ok)throw Error(`HTTP ${t.status}`);p(y.t(`activity:sessionWatch.interruptSent`)),M()}catch(e){p(y.t(`activity:sessionWatch.interruptFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{S(!1)}}},ne=n?.entries??[];return(0,Y.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5 shrink-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:H(`h-1.5 w-1.5 rounded-full`,O?`bg-success animate-pulse`:`bg-muted-foreground`)}),a(`activity:sessionWatch.liveStream`)]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,Y.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[a(`activity:sessionWatch.events`,{count:n.total}),` · `,n.status]}),O&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void P(),disabled:x,title:a(`activity:sessionWatch.interruptTitle`),className:`rounded border border-destructive/40 bg-destructive/15 px-1.5 py-0.5 text-[10px] text-destructive hover:bg-destructive/25 disabled:opacity-40 transition-colors`,children:a(x?`activity:sessionWatch.interrupting`:`activity:sessionWatch.interrupt`)})]})]}),k&&(0,Y.jsxs)(`div`,{className:`mb-1.5 shrink-0 text-[10px] text-foreground truncate`,children:[`▶ `,k]}),o&&(0,Y.jsxs)(`div`,{className:`text-[11px] text-destructive mb-1 shrink-0`,children:[`· `,o]}),(0,Y.jsxs)(`div`,{ref:C,onScroll:te,className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain space-y-1.5 pr-1`,children:[ne.length===0&&!o&&(0,Y.jsx)(`div`,{className:`text-[11px] text-muted-foreground italic`,children:a(`activity:sessionWatch.loading`)}),ne.map((e,t)=>(0,Y.jsx)(un,{entry:e,isContinuation:t>0&&ne[t-1].role===e.role},`${e.ts}-${t}`)),A&&(0,Y.jsxs)(`div`,{className:`flex gap-3 animate-message`,children:[(0,Y.jsx)(`div`,{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center bg-accent text-accent-foreground ring-2 ring-offset-2 ring-offset-background ring-accent/20`,children:(0,Y.jsx)(F,{className:`h-4 w-4 animate-pulse`})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 max-w-[85%] min-w-0`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground px-1`,children:A.label}),(0,Y.jsx)(`div`,{className:`rounded-2xl rounded-bl-md px-4 py-3 bg-card border border-border`,children:(0,Y.jsxs)(`span`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap break-words`,children:[A.text,(0,Y.jsx)(`span`,{className:`animate-pulse text-primary`,children:`▋`})]})})]})]})]}),v.length>0&&(0,Y.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border shrink-0 max-h-28 overflow-y-auto space-y-1`,children:[(0,Y.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:a(`activity:mailbox.messages`)}),v.slice(-6).map(e=>{let t=e.completed?a(`activity:sessionWatch.done`):e.readByLeader?a(`activity:sessionWatch.read`):a(`activity:sessionWatch.delivered`);return(0,Y.jsxs)(`div`,{className:`text-[10px] leading-snug`,children:[(0,Y.jsx)(`span`,{className:H(`font-semibold mr-1.5`,e.fromLeader?`text-accent`:`text-primary`),children:e.fromLeader?a(`activity:sessionWatch.agent`):a(`activity:sessionWatch.you`)}),(0,Y.jsx)(`span`,{className:`text-foreground whitespace-pre-wrap break-words`,children:e.body}),!e.fromLeader&&(0,Y.jsx)(`span`,{className:H(`ml-1.5 text-[9px]`,e.completed?`text-success`:e.readByLeader?`text-primary`:`text-muted-foreground`),children:t})]},e.id)})]}),(0,Y.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border shrink-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,Y.jsx)(`select`,{value:m,onChange:e=>h(e.target.value),title:a(`activity:sessionWatch.msgType.${m}Hint`),className:`rounded bg-muted border border-border px-1.5 py-0.5 text-[10px] text-foreground focus:outline-none focus:ring-1 focus:ring-ring`,children:dn.map(e=>(0,Y.jsx)(`option`,{value:e,children:a(`activity:sessionWatch.msgType.${e}Label`)},e))}),(0,Y.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),title:a(`activity:sessionWatch.priority`),className:`rounded bg-muted border border-border px-1.5 py-0.5 text-[10px] text-foreground focus:outline-none focus:ring-1 focus:ring-ring`,children:[(0,Y.jsx)(`option`,{value:`high`,children:`high`}),(0,Y.jsx)(`option`,{value:`normal`,children:`normal`}),(0,Y.jsx)(`option`,{value:`low`,children:`low`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-end gap-1.5`,children:[(0,Y.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),N())},rows:2,placeholder:a(`activity:sessionWatch.placeholder`,{label:a(`activity:sessionWatch.msgType.${m}Label`)}),className:`flex-1 resize-none rounded-md bg-muted border border-border px-2 py-1 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void N(),disabled:u||!c.trim(),className:`shrink-0 rounded-md bg-primary text-primary-foreground px-2.5 py-1.5 text-xs hover:bg-primary/90 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:u?`…`:a(`activity:sessionWatch.send`)})]}),f&&(0,Y.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:f}),(0,Y.jsx)(`div`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:a(`activity:sessionWatch.sendHint`)})]})]})}var Z={primary:`hsl(var(--primary))`,info:`hsl(var(--info))`,success:`hsl(var(--success))`,warning:`hsl(var(--warning))`,destructive:`hsl(var(--destructive))`,muted:`hsl(var(--muted-foreground))`},mn=.12;function hn(e){return Math.min(100,Math.max(0,e??0))}function gn({status:e,small:t,activity:n=0}){let r=t?`w-2 h-2`:`w-3 h-3`,i=t?4+n*4:6+n*6,a={idle:`bg-muted-foreground`,active:`bg-success`,streaming:`bg-primary`,completed:`bg-primary`,error:`bg-destructive`,offline:`bg-muted-foreground/60`},o={idle:Z.muted,active:Z.success,streaming:Z.primary,completed:Z.primary,error:Z.destructive,offline:Z.muted};return(0,Y.jsx)(`span`,{className:H(`rounded-full`,r,n>0&&`animate-pulse`,a[e]),style:{boxShadow:n>0?`0 0 ${i}px ${o[e]}`:void 0}})}function Q(){let e={opacity:0,width:1,height:1,minWidth:0,border:`none`,background:`transparent`};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{type:`target`,position:E.Top,style:e,isConnectable:!1}),(0,Y.jsx)(R,{type:`source`,position:E.Bottom,style:e,isConnectable:!1})]})}function _n({data:e}){let{t}=r();return(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-border/60 pt-1.5 text-[10px] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,children:e.agentCount??0}),` `,t(`activity:office.agentsSuffix`)]}),e.startedAt&&(0,Y.jsx)(`span`,{children:t(`activity:office.upPrefix`,{time:gt(e.startedAt,Date.now())})})]})}function vn({data:e}){let{t}=r(),n=e.status===`active`||e.status===`streaming`,i=e.status===`error`,a=e.status===`offline`,o=e.color||Z.info;return(0,Y.jsxs)(`div`,{className:H(`rounded-xl border-2 p-4 min-w-[180px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-primary/15`,i&&`border-destructive/50 bg-destructive/10`,a&&`border-border/70 bg-muted/35 opacity-60`,!n&&!i&&!a&&`border-primary/30 bg-primary/10`),children:[(0,Y.jsx)(Q,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,Y.jsx)(`div`,{className:H(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-primary/15`:`bg-primary/10`),children:(0,Y.jsx)(s,{className:`h-5 w-5`,style:{color:o}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:o},children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.webuiClient`)})]}),(0,Y.jsx)(gn,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,Y.jsx)(`div`,{className:`mb-2 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,Y.jsx)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(fe,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{children:t(`activity:office.disconnected`)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{className:`h-3 w-3 text-success`}),(0,Y.jsx)(`span`,{children:t(`activity:office.connected`)})]})}),n&&(0,Y.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-full bg-primary/20`,children:(0,Y.jsx)(`div`,{className:`h-full animate-pulse bg-primary`,style:{width:`60%`}})}),(0,Y.jsx)(_n,{data:e})]})}function yn({data:e}){let{t}=r(),n=e.status===`active`||e.status===`streaming`,i=e.status===`error`,a=e.color||Z.success;return(0,Y.jsxs)(`div`,{className:H(`rounded-xl border-2 p-4 min-w-[180px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-success/15`,i&&`border-destructive/50 bg-destructive/10`,!n&&!i&&`border-success/30 bg-success/10`),children:[(0,Y.jsx)(Q,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,Y.jsx)(`div`,{className:H(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-success/15`:`bg-success/10`),children:(0,Y.jsx)(m,{className:`h-5 w-5`,style:{color:a}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:a},children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.tuiClient`)})]}),(0,Y.jsx)(gn,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,Y.jsx)(`div`,{className:`mb-2 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,Y.jsx)(m,{className:`h-3 w-3 text-success`}),(0,Y.jsx)(`span`,{children:t(`activity:office.terminal`)})]}),(0,Y.jsx)(_n,{data:e})]})}function bn({data:e}){let{t}=r(),n=e.status===`active`||e.status===`streaming`,i=e.color||Z.warning;return(0,Y.jsxs)(`div`,{className:H(`rounded-xl border-2 p-4 min-w-[160px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-warning/15`,!n&&`border-warning/30 bg-warning/10`),children:[(0,Y.jsx)(Q,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,Y.jsx)(`div`,{className:H(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-warning/15`:`bg-warning/10`),children:(0,Y.jsx)(m,{className:`h-5 w-5`,style:{color:i}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:i},children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.repl`)})]}),(0,Y.jsx)(gn,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,Y.jsx)(`div`,{className:`mb-1 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,Y.jsx)(_n,{data:e})]})}function xn({data:e}){let{t}=r(),n=e.status===`active`||e.status===`streaming`,a=e.color||Z.primary;return(0,Y.jsxs)(`div`,{className:`relative min-w-[200px] rounded-xl border-2 border-border/70 bg-card/90 p-4 shadow-lg backdrop-blur-sm transition-all`,children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 rounded-full bg-primary px-2 py-0.5 text-[11px] font-bold text-primary-foreground`,children:t(`activity:office.coordinator`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3 mt-2`,children:[(0,Y.jsx)(`div`,{className:H(`flex items-center justify-center w-12 h-12 rounded-xl`,n?`bg-primary/15`:`bg-primary/10`),children:(0,Y.jsx)(i,{className:`h-6 w-6`,style:{color:a}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-bold truncate`,style:{color:a},children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e.sublabel||t(`activity:office.fleetSummary`)})]}),(0,Y.jsx)(gn,{status:e.status,activity:e.vizActivity??0})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] mb-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsxs)(`div`,{className:`font-mono`,children:[(0,Y.jsx)(`span`,{className:`text-success`,children:e.agentsActive||0}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,Y.jsx)(`span`,{className:`text-primary`,children:e.agentsTotal||0})]}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:officeMap.agents`)})]}),(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsx)(`div`,{className:`font-mono text-warning`,children:(e.toolCalls||0).toLocaleString()}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.toolCallsLabel`)})]}),(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsx)(`div`,{className:`font-mono text-foreground`,children:mt(e.tokensIn)}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.tokensLabel`)})]}),(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsxs)(`div`,{className:`font-mono text-success`,children:[`$`,(e.costUsd||0).toFixed(3)]}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.cost`)})]})]}),n&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-primary`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-primary`}),t(`activity:office.coordinatingFleet`)]})]})}function Sn({data:e}){let{t}=r(),n=e.status===`active`||e.status===`streaming`,i=e.status===`error`,a=e.status===`completed`,o=e.color||Z.primary,s=hn(e.ctxPct);return(0,Y.jsxs)(`div`,{className:H(`w-[170px] min-w-0 max-w-[170px] overflow-hidden rounded-lg border p-3 transition-all backdrop-blur-sm`,n&&`border-primary/50 bg-primary/10 shadow-lg shadow-primary/10`,i&&`border-destructive/50 bg-destructive/10`,a&&`border-border/70 bg-muted/35`,!n&&!i&&!a&&`border-primary/30 bg-primary/10`),children:[(0,Y.jsx)(Q,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,Y.jsx)(F,{className:`h-4 w-4 shrink-0`,style:{color:o}}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-bold truncate`,style:{color:o},children:e.label}),e.model&&(0,Y.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:_t(e.model)})]}),(0,Y.jsx)(gn,{status:e.status,small:!0,activity:e.vizActivity??0})]}),e.currentTask&&(0,Y.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 items-center gap-1 overflow-hidden text-[11px] text-primary`,children:[(0,Y.jsx)(`span`,{className:H(`h-1.5 w-1.5 shrink-0 rounded-full bg-primary`,n&&`animate-pulse`)}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:e.currentTask,children:vt(e.currentTask,72)})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-0.5 text-[11px] mb-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`iter`}),(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,children:e.iteration||0})]}),(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`tools`}),(0,Y.jsx)(`span`,{className:`font-mono text-warning`,children:e.toolCalls||0})]}),(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`tok`}),(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,children:mt((e.tokensIn||0)+(e.tokensOut||0))})]}),(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`cost`}),(0,Y.jsxs)(`span`,{className:`font-mono text-success`,children:[`$`,(e.costUsd||0).toFixed(3)]})]})]}),s>0&&(0,Y.jsxs)(`div`,{className:`mb-1`,children:[(0,Y.jsxs)(`div`,{className:`mb-0.5 flex justify-between text-[10px] text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:`ctx`}),(0,Y.jsxs)(`span`,{className:H(`font-mono`,s>=90?`text-destructive`:s>=70?`text-warning`:`text-muted-foreground`),children:[s,`%`]})]}),(0,Y.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{className:H(`h-full`,s>=90?`bg-destructive`:s>=70?`bg-warning`:`bg-primary`),style:{width:`${s}%`}})})]}),e.lastActivityAt&&(0,Y.jsxs)(`div`,{className:H(`flex items-center gap-1 text-[10px]`,n?`text-muted-foreground/70`:`text-muted-foreground`),children:[a&&(0,Y.jsx)(`span`,{className:`text-success`,children:t(`activity:office.donePrefix`)}),i&&(0,Y.jsx)(`span`,{className:`text-destructive`,children:t(`activity:office.failedPrefix`)}),(0,Y.jsx)(`span`,{children:t(`activity:office.seenPrefix`,{time:ht(e.lastActivityAt,Date.now())})})]})]})}function Cn({data:e}){let{t}=r();return(0,Y.jsxs)(`div`,{className:H(`rounded-lg border border-dashed p-3 min-w-[120px] transition-all opacity-40`,`border-border/70 bg-muted/30`),children:[(0,Y.jsx)(Q,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Y.jsx)(se,{className:`h-4 w-4 text-muted-foreground`}),(0,Y.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,Y.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.label})}),(0,Y.jsx)(gn,{status:e.status,small:!0,activity:e.vizActivity??0})]}),(0,Y.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:office.availableDesk`)})]})}function wn({data:e}){let{t}=r(),n=e.color||Z.warning,i=(e.unreadCount||0)>0;return(0,Y.jsxs)(`div`,{className:H(`rounded-xl border-2 p-4 min-w-[160px] transition-all backdrop-blur-sm`,i&&`border-warning/50 bg-warning/10 shadow-lg shadow-warning/10`,!i&&`border-warning/30 bg-warning/6`),children:[(0,Y.jsx)(Q,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,Y.jsx)(`div`,{className:H(`flex items-center justify-center w-10 h-10 rounded-lg`,i?`bg-warning/18`:`bg-warning/10`),children:(0,Y.jsx)(P,{className:`h-5 w-5`,style:{color:n}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-xs font-bold`,style:{color:n},children:t(`activity:office.mailboxHub`)}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:i?t(`activity:office.unreadSuffix`,{count:e.unreadCount||0}):t(`activity:office.allClear`)})]}),i&&(0,Y.jsx)(`div`,{className:`flex h-5 w-5 items-center justify-center rounded-full bg-warning text-[10px] font-bold text-background`,children:e.unreadCount})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px]`,children:[(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-warning`,children:[(0,Y.jsx)(ae,{className:`h-3 w-3`}),(0,Y.jsx)(`span`,{children:e.messageCount||0})]}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.total`)})]}),(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-success`,children:[(0,Y.jsx)(a,{className:`h-3 w-3`}),(0,Y.jsx)(`span`,{children:e.unreadCount||0})]}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.unreadLabel`)})]})]}),e.sublabel&&(0,Y.jsxs)(`div`,{className:`mt-2 truncate border-t border-border/60 pt-1.5 text-[11px] text-muted-foreground`,children:[`✉ `,e.sublabel]})]})}var Tn={webui:vn,tui:yn,repl:bn,coordinator:xn,agent:Sn,mailbox:wn,desk:Cn};function En({broadcastOpen:e,labels:t,onArrange:n,onBroadcastToggle:r,onFeedToggle:i,showFeed:a}){return(0,Y.jsxs)(le,{position:`top-right`,className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:n,title:t.arrangeTitle,className:`flex items-center gap-1.5 rounded-md border border-border/70 bg-card/90 px-2.5 py-1.5 text-xs text-foreground shadow-sm transition-colors hover:bg-accent`,children:[(0,Y.jsx)(D,{className:`h-3.5 w-3.5`}),t.arrange]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:i,title:t.feedTitle,className:H(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border text-xs transition-colors`,a?`border-primary/35 bg-primary/10 text-primary`:`border-border/70 bg-card/90 text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,Y.jsx)(z,{className:`h-3.5 w-3.5`}),t.feed]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:r,title:t.broadcastTitle,className:H(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border text-xs transition-colors`,e?`border-warning/35 bg-warning/10 text-warning`:`border-border/70 bg-card/90 text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,Y.jsx)(ae,{className:`h-3.5 w-3.5`}),t.broadcast]})]})}function Dn(){return(0,Y.jsx)(A,{className:`rounded-lg border border-border/70 bg-card/90`,nodeColor:e=>{switch(e.data.kind){case`coordinator`:return Z.primary;case`webui`:return Z.info;case`tui`:return Z.success;case`repl`:case`mailbox`:return Z.warning;default:return Z.primary}},maskColor:`hsl(var(--background) / 0.72)`})}function On({closeTitle:e,label:t,onClose:n,sessionId:r,streamTitle:i}){return(0,Y.jsxs)(`div`,{className:`absolute inset-y-0 right-0 z-30 flex w-[min(680px,92%)] flex-col border-l border-border bg-background shadow-2xl`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2.5 shrink-0 bg-card`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Y.jsx)(F,{className:`h-4 w-4 text-primary shrink-0`}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-bold text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:i})]})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,title:e,className:`text-muted-foreground hover:text-foreground text-xl leading-none shrink-0`,children:`×`})]}),(0,Y.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:(0,Y.jsx)(pn,{sessionId:r,limit:500})})]})}var kn={wire:({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a,data:o,selected:s})=>{let c=o?.color||Z.primary,l=U(e=>e.animateEdges),u=o?.animated&&l?Math.max(.15,o?.intensity??.6):0,[d,f,p]=ve({sourceX:e,sourceY:t,sourcePosition:i??E.Bottom,targetX:n,targetY:r,targetPosition:a??E.Top,curvature:.28}),m=5+u*7,h=5+u*4,g=m+h,_=`${Math.max(.5,1.6-u).toFixed(2)}s`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d,fill:`none`,stroke:c,strokeWidth:s?2.5:1.4,strokeOpacity:s?.9:.28,className:`react-flow__edge-path`}),u>.05&&(0,Y.jsx)(`path`,{d,fill:`none`,stroke:c,strokeWidth:2.2,strokeOpacity:.45+u*.5,strokeDasharray:`${m} ${h}`,strokeLinecap:`round`,style:{filter:`drop-shadow(0 0 ${2+u*4}px ${c})`},children:(0,Y.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:g,to:`0`,dur:_,repeatCount:`indefinite`})}),o?.label&&u>.1&&(0,Y.jsx)(pe,{children:(0,Y.jsx)(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${f}px, ${p}px)`},className:`pointer-events-none max-w-[220px] truncate whitespace-nowrap rounded-full border border-border/70 bg-card/90 px-1.5 py-0.5 text-[8px] font-medium text-foreground backdrop-blur-sm`,children:o.label})})]})}};function An(){let{t:e}=r(),{clientCounts:t,currentSession:n,totalAgents:a,activeAgents:o,aggregate:c}=De(u(e=>({clientCounts:e.clientCounts,currentSession:e.currentSession,totalAgents:e.totalAgents,activeAgents:e.activeAgents,aggregate:e.aggregate}))),l=t.tui+t.webui+t.repl,d=e=>e?.toLocaleString()??`0`;return(0,Y.jsxs)(`div`,{className:`absolute left-4 top-20 z-10 rounded-xl border border-border/70 bg-card/90 p-3 text-foreground shadow-xl backdrop-blur`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Y.jsx)(g,{className:`h-3.5 w-3.5 text-success`}),(0,Y.jsx)(`span`,{className:`text-[10px] font-bold uppercase text-muted-foreground`,children:e(`activity:office.sessionStats`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5 text-[10px]`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(V,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.clients`)})]}),(0,Y.jsxs)(`span`,{className:`font-mono text-foreground`,children:[o,` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),` `,(0,Y.jsx)(`span`,{className:`text-success`,children:l})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 pl-4 text-[9px]`,children:[t.tui>0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(m,{className:`h-2.5 w-2.5 text-success`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:hud.tui`)}),(0,Y.jsx)(`span`,{className:`font-mono text-success`,children:t.tui})]}),t.webui>0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(s,{className:`h-2.5 w-2.5 text-primary`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:hud.webui`)}),(0,Y.jsx)(`span`,{className:`font-mono text-primary`,children:t.webui})]}),t.repl>0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(m,{className:`h-2.5 w-2.5 text-warning`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:hud.repl`)}),(0,Y.jsx)(`span`,{className:`font-mono text-warning`,children:t.repl})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(F,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.agents`)})]}),(0,Y.jsxs)(`span`,{className:`font-mono text-foreground`,children:[o,` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),` `,(0,Y.jsx)(`span`,{className:`text-primary`,children:a})]})]}),n.model&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(i,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.model`)})]}),(0,Y.jsx)(`span`,{className:`max-w-[120px] truncate font-mono text-primary`,title:n.model,children:n.model.split(`/`).pop()?.slice(0,16)})]}),n.mode&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(_e,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.mode`)})]}),(0,Y.jsx)(`span`,{className:H(`font-mono uppercase text-[9px] px-1.5 py-0.5 rounded`,n.mode===`auto`&&`bg-primary/10 text-primary`,n.mode===`suggest`&&`bg-success/10 text-success`,n.mode===`off`&&`bg-muted text-muted-foreground`,![`auto`,`suggest`,`off`].includes(n.mode||``)&&`bg-muted text-muted-foreground`),children:n.mode})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(h,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.toolCallsLabel`)})]}),(0,Y.jsx)(`span`,{className:`font-mono text-warning`,children:d(c.toolCalls)})]}),(0,Y.jsxs)(`div`,{className:`mt-1.5 space-y-1 border-t border-border/70 pt-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:`IN`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.input`)})]}),(0,Y.jsx)(`span`,{className:`font-mono text-[9px] text-foreground`,children:d(c.tokensIn)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e(`activity:hud.out`)}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.output`)})]}),(0,Y.jsx)(`span`,{className:`font-mono text-[9px] text-foreground`,children:d(c.tokensOut)})]})]}),(0,Y.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-4 border-t border-border/70 pt-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(k,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.cost`)})]}),(0,Y.jsx)(`span`,{className:`font-mono font-medium text-success`,children:(e=>e==null?`$0.0000`:`$${e.toFixed(4)}`)(c.costUsd)})]})]})]})}function jn({events:e,now:t}){let{t:n}=r(),i=e.slice(0,14);return(0,Y.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 z-10 pointer-events-none px-3 pb-3`,children:(0,Y.jsxs)(`div`,{className:`pointer-events-auto mx-auto max-w-3xl rounded-lg border border-border/70 bg-card/90 px-3 py-2 shadow-xl backdrop-blur`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px] uppercase text-primary`,children:[(0,Y.jsx)(g,{className:`h-3 w-3`}),n(`activity:office.liveActivity`)]}),i.length===0?(0,Y.jsx)(`div`,{className:`text-[11px] italic text-muted-foreground`,children:n(`activity:office.waitingActivity`)}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-0.5 max-h-32 overflow-hidden`,children:i.map(e=>{let r=Math.max(0,Math.round((t-e.timestamp)/1e3));return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] leading-tight`,children:[(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{backgroundColor:At(e.kind)}}),(0,Y.jsx)(`span`,{className:`flex-1 truncate text-foreground`,children:e.label}),(0,Y.jsx)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:r<1?n(`activity:office.now`):`${r}s`})]},e.id)})})]})})}function Mn(){let{t:e}=r();return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`absolute bottom-4 left-4 z-10 rounded-lg border border-border/70 bg-card/90 p-3 text-[10px] shadow-xl backdrop-blur`,children:[(0,Y.jsx)(`div`,{className:`mb-2 font-bold text-foreground`,children:e(`activity:office.legendStatus`)}),(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-success`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendActive`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendIdle`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-destructive`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendError`)})]})]})]}),(0,Y.jsxs)(`div`,{className:`absolute bottom-4 right-4 z-10 rounded-lg border border-border/70 bg-card/90 p-3 text-[10px] shadow-xl backdrop-blur`,children:[(0,Y.jsx)(`div`,{className:`mb-2 font-bold text-foreground`,children:e(`activity:office.legendConnections`)}),(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-warning`,children:`✉`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendMail`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-primary`,children:`→`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendTask`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-success`,children:`●`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendStatusConn`)})]})]})]})]})}function Nn({draft:e,isSending:t,result:n,onClose:i,onDraftChange:a,onSend:o}){let{t:s}=r();return(0,Y.jsxs)(`div`,{className:`absolute right-4 top-16 z-30 w-80 rounded-xl border border-warning/35 bg-card/95 p-3 shadow-2xl backdrop-blur`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold text-warning`,children:[(0,Y.jsx)(ae,{className:`h-3.5 w-3.5`}),` `,s(`activity:office.broadcastToAll`)]}),(0,Y.jsx)(`button`,{type:`button`,onClick:i,className:`text-base leading-none text-muted-foreground hover:text-foreground`,children:`×`})]}),(0,Y.jsx)(`textarea`,{value:e,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),o())},rows:3,placeholder:s(`activity:office.broadcastPlaceholder`),className:`w-full resize-none rounded-md border border-border/70 bg-background/70 px-2 py-1 text-[11px] text-foreground placeholder:text-muted-foreground focus:border-warning/45 focus:outline-none`}),(0,Y.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:s(`activity:office.broadcastSendHint`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:o,disabled:t||!e.trim(),className:`rounded-md border border-warning/35 bg-warning/12 px-2.5 py-1 text-[11px] text-warning transition-colors hover:bg-warning/18 disabled:cursor-not-allowed disabled:opacity-40`,children:t?`…`:s(`activity:office.broadcast`)})]}),n&&(0,Y.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:n})]})}function $({k:e,v:t,accent:n}){return(0,Y.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e}),(0,Y.jsx)(`span`,{className:H(`font-mono truncate text-right`,n??`text-foreground/80`),children:t})]})}function Pn({selectedNode:e,selectedAgentTranscript:n,mailboxMessages:a,onClose:o,onOpenWatch:c}){let{t:l}=r(),u=e.data,d=Date.now(),f=u.kind===`agent`,p=u.kind===`webui`||u.kind===`tui`||u.kind===`repl`,h=(u.tokensIn||0)+(u.tokensOut||0),g=hn(u.ctxPct);return(0,Y.jsxs)(`div`,{className:H(`absolute top-20 right-4 bg-background border border-border rounded-lg p-4 shadow-xl z-20`,u.kind===`agent`?`w-[28rem] max-w-[calc(100%-2rem)]`:u.sessionId?`w-80`:`w-64`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u.kind===`webui`&&(0,Y.jsx)(s,{className:`h-4 w-4 text-info`}),u.kind===`tui`&&(0,Y.jsx)(m,{className:`h-4 w-4 text-success`}),u.kind===`coordinator`&&(0,Y.jsx)(i,{className:`h-4 w-4 text-primary`}),u.kind===`agent`&&(0,Y.jsx)(F,{className:`h-4 w-4 text-primary`}),u.kind===`mailbox`&&(0,Y.jsx)(P,{className:`h-4 w-4 text-warning`}),(0,Y.jsx)(`span`,{className:`text-sm font-bold text-foreground`,children:u.label})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[u.sessionId&&(0,Y.jsx)(`button`,{type:`button`,title:l(`activity:office.openFullView`),onClick:()=>c({sessionId:u.sessionId,label:u.label}),className:`text-muted-foreground hover:text-primary`,children:(0,Y.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`text-muted-foreground hover:text-foreground text-lg leading-none`,children:`×`})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,Y.jsx)($,{k:`Status`,v:String(u.status).toUpperCase(),accent:H(u.status===`active`&&`text-success`,u.status===`streaming`&&`text-primary`,u.status===`error`&&`text-destructive`,u.status===`idle`&&`text-muted-foreground`,u.status===`offline`&&`text-muted-foreground/70`)}),f&&(0,Y.jsxs)(Y.Fragment,{children:[u.model&&(0,Y.jsx)($,{k:`Model`,v:_t(u.model),accent:`text-primary`}),u.currentTask&&(0,Y.jsxs)(`div`,{className:`pt-1`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:l(`activity:agentOffice.currentTask`)}),(0,Y.jsx)(`div`,{className:`mt-1 max-h-32 overflow-y-auto whitespace-pre-wrap break-words font-mono text-[10px] text-primary`,children:u.currentTask})]}),(0,Y.jsx)($,{k:`Iterations`,v:u.iteration||0,accent:`text-primary`}),(0,Y.jsx)($,{k:`Tool calls`,v:u.toolCalls||0,accent:`text-warning`}),(0,Y.jsx)($,{k:`Tokens in`,v:mt(u.tokensIn)}),(0,Y.jsx)($,{k:`Tokens out`,v:mt(u.tokensOut)}),(0,Y.jsx)($,{k:`Tokens total`,v:mt(h)}),g>0&&(0,Y.jsx)($,{k:`Context`,v:`${g}%`,accent:g>=90?`text-destructive`:g>=70?`text-warning`:`text-foreground/70`}),(0,Y.jsx)($,{k:`Cost`,v:`$${(u.costUsd||0).toFixed(4)}`,accent:`text-success`}),u.lastActivityAt&&(0,Y.jsx)($,{k:`Last seen`,v:ht(u.lastActivityAt,d),accent:`text-muted-foreground`}),(0,Y.jsx)(`div`,{className:`pt-2`,children:(0,Y.jsx)(Ae,{entries:n,agentName:u.label,compact:!0,maxHeightClassName:`max-h-64`})})]}),p&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)($,{k:`Surface`,v:St(u.kind),accent:`text-foreground/80`}),u.branch&&(0,Y.jsx)($,{k:`Branch`,v:`⎇ ${u.branch}`,accent:`text-foreground/70`}),u.pid!=null&&(0,Y.jsx)($,{k:`PID`,v:u.pid}),u.workingDir&&(0,Y.jsx)($,{k:`Dir`,v:u.workingDir,accent:`text-muted-foreground`}),(0,Y.jsx)($,{k:`Agents`,v:u.agentCount??0,accent:`text-primary`}),u.startedAt&&(0,Y.jsx)($,{k:`Uptime`,v:gt(u.startedAt,d),accent:`text-foreground/70`})]}),u.kind===`mailbox`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)($,{k:`Total messages`,v:u.messageCount||0,accent:`text-warning`}),(0,Y.jsx)($,{k:`Unread`,v:u.unreadCount||0,accent:`text-warning`}),a.length>0&&(0,Y.jsxs)(`div`,{className:`mt-1 space-y-1 border-t border-border pt-2`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:l(`activity:office.recent`)}),[...a].sort((e,t)=>Date.parse(t.timestamp)-Date.parse(e.timestamp)).slice(0,6).map(e=>{let t=!e.completed&&(e.readByCount??0)===0;return(0,Y.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[10px]`,children:[(0,Y.jsx)(`span`,{className:H(`mt-1 h-1.5 w-1.5 shrink-0 rounded-full`,t?`bg-warning`:e.completed?`bg-success`:`bg-muted`)}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-foreground/80`,children:e.subject||l(`activity:office.noSubject`)}),(0,Y.jsxs)(`div`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:[e.from,` → `,e.to,` · `,ht(e.timestamp,d),e.audience===`leaders`?` · ${l(`activity:mailbox.audienceLeaders`)}`:``]})]})]},e.id)})]})]}),u.kind===`coordinator`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)($,{k:`Connections`,v:u.connections||0,accent:`text-primary`}),(0,Y.jsx)($,{k:`Iterations`,v:u.iteration||0,accent:`text-primary`})]}),(f||p)&&u.sessionId&&(0,Y.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 h-72`,children:(0,Y.jsx)(pn,{sessionId:u.sessionId})})]})]})}function Fn(){let{t:e}=r(),{fitView:t}=re(),n=(0,W.useRef)(null),[i,a]=(0,W.useState)({width:1280,height:720});(0,W.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let{width:t,height:n}=e.getBoundingClientRect();t<1||n<1||a(e=>Math.abs(e.width-t)<2&&Math.abs(e.height-n)<2?e:{width:t,height:n})};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[]);let o=xe(e=>e.events),s=Ce(e=>e.agents),c=Ce(e=>e.agentTranscripts),l=Ce(e=>e.leaderId),u=De(e=>e.liveSessions),d=Oe(e=>e.messages),f=Oe(e=>e.agents),p=Se(e=>e.session),m=Mt(s),h=(0,W.useMemo)(()=>kt(u,s,f,m.map,m.now),[u,s,f,m]),g=U(e=>e.showHud),_=U(e=>e.showLegend),v=U(e=>e.showMinimap),y=U(e=>e.showControls),b=U(e=>e.showFeed),x=U(e=>e.setShowFeed),S=U(e=>e.background),[C,w,T]=de([]),[E,D,O]=me([]),[k,A]=(0,W.useState)(null),[M,N]=(0,W.useState)(null),[P,ae]=(0,W.useState)(!1),[oe,se]=(0,W.useState)(``),[ce,le]=(0,W.useState)(!1),[ue,F]=(0,W.useState)(null),fe=(0,W.useMemo)(()=>{if(k?.data.kind!==`agent`)return we;let e=k.data.serverId??(k.id.includes(`__agent-`)?k.id.split(`__agent-`).pop():k.id.replace(/^agent-/,``));return e?c.get(e)??we:we},[c,k]),pe=(0,W.useCallback)(async()=>{let e=oe.trim();if(!(!e||ce)){le(!0),F(null);try{let t=await fetch(`/api/fleet/broadcast`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e})});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();se(``),F(`Delivered to ${n.delivered??0}/${n.targets??0} session(s)`)}catch(e){F(`Failed: ${e instanceof Error?e.message:String(e)}`)}finally{le(!1)}}},[oe,ce]),I=(0,W.useRef)(new Map),L=4e3,R=(0,W.useRef)(new Map),z=(0,W.useRef)(new Map),B=(0,W.useRef)(new Map),ge=(0,W.useRef)(new Map),_e=(0,W.useRef)(``);(0,W.useEffect)(()=>{let n=[],r=[],a=Date.now(),o=yt(h.map(e=>({id:e.id,agentCount:e.agents.length})),i),c=d.filter(e=>!e.completed&&(e.readByCount??0)===0).length,u=d.length?[...d].sort((e,t)=>Date.parse(t.timestamp)-Date.parse(e.timestamp))[0]:void 0;n.push({id:`mailbox`,type:`mailbox`,position:{x:830,y:50},data:{label:e(`activity:office.mailboxHub`),kind:`mailbox`,status:c>0?`active`:`idle`,unreadCount:c,messageCount:d.length,sublabel:u?`${u.from} → ${u.to}: ${u.subject}`:void 0,color:Z.warning}});let f=0,p=0,m=0,g=0,_=0;for(let e of h)for(let t of e.agents)p+=1,(t.status===`active`||t.status===`streaming`)&&(f+=1),m+=t.toolCalls,g+=t.costUsd,_+=t.tokensIn+t.tokensOut;let v=l?s.get(l):null,y=f>0;n.push({id:`coordinator`,type:`coordinator`,position:{x:370,y:50},data:{label:e(`activity:office.fleetHqLabel`),sublabel:e(`activity:office.clientsSuffix`,{count:h.length}),kind:`coordinator`,status:v?.status===`failed`?`error`:y?`active`:`idle`,connections:h.length,agentsActive:f,agentsTotal:p,toolCalls:m,costUsd:g,tokensIn:_,color:Z.primary}});let b={tui:Z.success,webui:Z.info,repl:Z.warning};for(let t of h){let i=o.positions.get(t.id)??{x:600,y:370},s=i.x,l=i.y,u=b[t.type],d=t.status===`active`;if(n.push({id:t.id,type:t.type,position:{x:s,y:l},data:{label:t.label,sublabel:t.sublabel,kind:t.type,status:t.status,sessionId:t.sessionId,pid:t.pid,branch:t.branch,workingDir:t.workingDir,startedAt:t.startedAt,agentCount:t.agents.length,color:u}}),r.push({id:`${t.id}->coordinator`,source:t.id,target:`coordinator`,type:`wire`,animated:d,data:{color:u,animated:d,label:e(`activity:office.controlLabel`),flowType:`task`}}),r.push({id:`mailbox->${t.id}`,source:`mailbox`,target:t.id,type:`wire`,animated:c>0,data:{color:Z.warning,animated:c>0,label:c>0?`${c}`:void 0,flowType:`mail`}}),t.agents.length===0){n.push({id:`desk-${t.id}`,type:`desk`,position:{x:s,y:l+270},data:{label:e(`activity:office.idleDesk`),kind:`agent`,status:`idle`,color:Z.muted}});continue}t.agents.forEach((i,o)=>{let c=i.status===`active`||i.status===`streaming`,u=ge.current.get(i.serverId);if(u&&(i.toolCalls>u.toolCalls||i.iteration>u.iteration)||c){I.current.set(i.officeId,a+L);let e=z.current.get(i.officeId)??0;z.current.set(i.officeId,Math.min(1,e+(1-e)*.5));for(let e of[`${t.id}->${i.officeId}`,`${t.id}->coordinator`]){let t=R.current.get(e)??0;R.current.set(e,Math.min(1,t+.5))}}ge.current.set(i.serverId,{toolCalls:i.toolCalls,iteration:i.iteration}),n.push({id:i.officeId,type:`agent`,position:bt(s,o,t.agents.length,l+270),data:{label:i.name,kind:`agent`,status:i.status,serverId:i.serverId,sessionId:t.sessionId,currentTask:i.currentTask,iteration:i.iteration,toolCalls:i.toolCalls,costUsd:i.costUsd,tokensIn:i.tokensIn,tokensOut:i.tokensOut,ctxPct:i.ctxPct,model:i.model,lastActivityAt:i.lastActivityAt,color:Z.primary}}),r.push({id:`${t.id}->${i.officeId}`,source:t.id,target:i.officeId,type:`wire`,animated:c,data:{color:Z.primary,animated:c,label:c?vt(i.currentTask,48)??e(`activity:office.taskFallback`):void 0,flowType:`task`}})})}let x=new Set(h.flatMap(e=>e.agents.map(e=>e.serverId)));for(let e of[...ge.current.keys()])x.has(e)||ge.current.delete(e);for(let[e,t]of[...I.current])t<=a&&I.current.delete(e);let S=n.map(e=>{let t=I.current.get(e.id),n=z.current.get(e.id)??0;return t&&t>a&&e.data.status!==`error`&&e.data.status!==`offline`?{...e,data:{...e.data,status:`active`,vizActivity:n}}:{...e,data:{...e.data,vizActivity:n}}}),C=r.map(e=>{let t=R.current.get(e.id)??0;return t>.05?{...e,animated:!0,data:{...e.data,animated:!0,intensity:t}}:e}),T=new Map;for(let e of S)T.set(e.id,{...e.position});B.current=T,w(S),D(C);let E=[`${Math.round(i.width)}x${Math.round(i.height)}`,`${o.columns}x${o.rows}`,h.map(e=>`${e.id}:${e.agents.length}`).join(`|`),S.map(e=>e.id).sort().join(`|`)].join(`:`);if(E!==_e.current){_e.current=E;let e=setTimeout(()=>t({padding:mn,duration:300}),50);return()=>clearTimeout(e)}},[h,l,s,d,p,i,L,w,D,t]);let ve=h.flatMap(e=>e.agents.map(t=>({clientId:e.id,clientType:e.type,officeId:t.officeId,serverId:t.serverId}))),ye=h.map(e=>e.id),be=new Map;for(let e of ve)(!be.has(e.serverId)||e.clientType===`webui`)&&be.set(e.serverId,e.officeId);function V(e){return be.get(e)??`agent-${e}`}function H(e){let t=e.split(`__agent-`)[0];return t&&t!==e?`${t}->${e}`:`coordinator->${e}`}function Te(e){switch(e.kind){case`mailbox:send`:case`mailbox:deliver`:return{nodes:[`mailbox`],edges:e.kind===`mailbox:send`?ye.map(e=>`mailbox->${e}`):[],status:`active`};case`agent:spawned`:{let t=V(e.source);return{nodes:[`coordinator`,t],edges:[H(t)],status:`active`}}case`agent:tool`:case`tool:started`:case`tool:progress`:{let t=V(e.source);return{nodes:[`coordinator`,t],edges:[H(t)],status:e.kind===`tool:progress`||e.kind===`tool:started`?`streaming`:`active`}}case`tool:executed`:{let t=V(e.target??e.source);return{nodes:[t],edges:[H(t)],status:`active`}}case`provider:call`:case`provider:delta`:case`provider:response`:return{nodes:[`coordinator`],edges:[],status:e.kind===`provider:delta`?`streaming`:`active`};case`iteration:start`:case`iteration:end`:return{nodes:[`coordinator`],edges:ve.map(e=>H(e.officeId)),status:e.kind===`iteration:start`?`streaming`:`active`};case`agent:text`:{let t=V(e.source);return{nodes:[t],edges:[H(t)],status:`streaming`}}case`agent:status`:{let t=V(e.source);return{nodes:[`coordinator`,t],edges:[H(t)],status:e.data&&typeof e.data==`object`&&`status`in e.data&&String(e.data.status)===`failed`?`error`:`completed`}}case`agent:ctx`:return{nodes:[V(e.source)],edges:[],status:`active`};case`budget:extended`:return{nodes:[`coordinator`,V(e.source)],edges:[],status:`active`};case`context:compacted`:case`context:repaired`:return{nodes:[`coordinator`],edges:[],status:`active`};case`error`:return{nodes:e.source?[V(e.source)]:[],edges:[],status:`error`};case`cost:update`:return{nodes:[`coordinator`],edges:[],status:`active`};case`fleet:snapshot`:{let t=e.data?.sessions??[],n=[`coordinator`];for(let e of t)if(e.agents)for(let t of e.agents){let e=V(t.id);n.includes(e)||n.push(e)}return{nodes:n,edges:[],status:`active`}}default:return{nodes:[],edges:[],status:`idle`}}}(0,W.useEffect)(()=>{if(o.length===0)return;let e=o[0];if(!e)return;let{nodes:t,edges:n,status:r}=Te(e),i=Date.now();t.length>0&&(t.forEach(e=>{I.current.set(e,i+L);let t=z.current.get(e)??0;z.current.set(e,Math.min(1,t+(1-t)*.5))}),w(e=>e.map(e=>t.includes(e.id)?{...e,data:{...e.data,status:r,vizActivity:z.current.get(e.id)??0}}:e))),n.length>0&&(n.forEach(e=>{let t=R.current.get(e)??0;R.current.set(e,Math.min(1,t+.5))}),D(e=>e.map(e=>n.includes(e.id)?{...e,animated:!0,data:{...e.data,animated:!0,intensity:R.current.get(e.id)??1}}:e)))},[o,w,D,L,s]),(0,W.useEffect)(()=>{let e=setInterval(()=>{let e=new Map,t=!1;for(let[n,r]of R.current){let i=r*.85;i<.05?(R.current.delete(n),e.set(n,{intensity:0,animated:!1}),t=!0):(R.current.set(n,i),e.set(n,{intensity:i,animated:!0}),t=!0)}t&&D(t=>t.map(t=>{let n=e.get(t.id);return n?{...t,animated:n.animated,data:{...t.data,animated:n.animated,intensity:n.intensity}}:t}));let n=new Map,r=!1;for(let[e,t]of z.current){let i=t*.9;i<.03?(z.current.delete(e),n.set(e,0),r=!0):(z.current.set(e,i),n.set(e,i),r=!0)}r&&w(e=>e.map(e=>{let t=n.get(e.id);return t===void 0?e:{...e,data:{...e.data,vizActivity:t}}}))},1e3);return()=>clearInterval(e)},[D,w]);let Ee=(0,W.useCallback)(e=>D(t=>te({...e,type:`wire`},t)),[D]),ke=(0,W.useCallback)((e,t)=>{A(t)},[]),Ae=(0,W.useCallback)(()=>{A(null)},[]);(0,W.useEffect)(()=>{if(!M)return;let e=e=>{e.key===`Escape`&&N(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[M]);let je=(0,W.useCallback)(()=>{w(e=>e.map(e=>{let t=B.current.get(e.id);return t?{...e,position:{...t}}:e})),setTimeout(()=>t({padding:mn,duration:300}),50)},[w,t]),[,Me]=(0,W.useState)(0);return(0,W.useEffect)(()=>{let e=setInterval(()=>{document.hidden||Me(e=>e+1)},2e3);return()=>clearInterval(e)},[]),(0,Y.jsxs)(`div`,{ref:n,className:`relative h-full w-full overflow-hidden bg-[hsl(var(--surface-2)/0.55)]`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03]`,style:{backgroundImage:`
|
|
2
|
+
linear-gradient(hsl(var(--foreground) / 0.1) 1px, transparent 1px),
|
|
3
|
+
linear-gradient(90deg, hsl(var(--foreground) / 0.1) 1px, transparent 1px)
|
|
4
|
+
`,backgroundSize:`40px 40px`}}),g&&(0,Y.jsx)(An,{}),(0,Y.jsx)(`div`,{className:`absolute top-3 left-1/2 -translate-x-1/2 z-10`,children:(0,Y.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-card/90 px-4 py-2 shadow-xl backdrop-blur`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-bold text-foreground`,children:[(0,Y.jsx)(j,{className:`h-4 w-4 text-primary`}),e(`activity:office.fleetHq`),(0,Y.jsx)(`span`,{className:`ml-2 h-2 w-2 animate-pulse rounded-full bg-success`}),(0,Y.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:e(`activity:office.live`)})]})})}),_&&(0,Y.jsx)(Mn,{}),(0,Y.jsxs)(ne,{nodes:C,edges:E,onNodesChange:T,onEdgesChange:O,onConnect:Ee,onNodeClick:ke,onPaneClick:Ae,nodeTypes:Tn,edgeTypes:kn,fitView:!0,fitViewOptions:{padding:mn},minZoom:.15,maxZoom:1.5,defaultEdgeOptions:{type:`wire`},proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(En,{broadcastOpen:P,labels:{arrange:e(`activity:office.arrange`),arrangeTitle:e(`activity:office.arrangeTitle`),broadcast:e(`activity:office.broadcast`),broadcastTitle:e(`activity:office.broadcastTitle`),feed:e(`activity:office.feed`),feedTitle:e(`activity:office.feedTitle`)},onArrange:je,onBroadcastToggle:()=>ae(e=>!e),onFeedToggle:()=>x(!b),showFeed:b}),S!==`none`&&(0,Y.jsx)(he,{variant:S===`lines`?ie.Lines:S===`cross`?ie.Cross:ie.Dots,gap:20,size:1,color:`hsl(var(--border) / 0.35)`}),y&&(0,Y.jsx)(ee,{className:`rounded-lg border border-border/70 bg-card/90 [&>button]:bg-card [&>button]:text-foreground`}),v&&(0,Y.jsx)(Dn,{})]}),b&&(0,Y.jsx)(jn,{events:o,now:Date.now()}),P&&(0,Y.jsx)(Nn,{draft:oe,isSending:ce,result:ue,onClose:()=>ae(!1),onDraftChange:se,onSend:()=>void pe()}),k&&(0,Y.jsx)(Pn,{selectedNode:k,selectedAgentTranscript:fe,mailboxMessages:d,onClose:Ae,onOpenWatch:N}),M&&(0,Y.jsx)(On,{closeTitle:e(`activity:office.closeEsc`),label:M.label,onClose:()=>N(null),sessionId:M.sessionId,streamTitle:e(`activity:office.fullOperationStream`)})]})}function In(){let{t:e}=r(),t=U(e=>e.viewMode),n=U(e=>e.setViewMode),i=[{id:`office`,label:e(`activity:agentOffice.office`),description:e(`activity:agentOffice.officeDescription`),icon:f},{id:`topology`,label:e(`activity:agentOffice.topology`),description:e(`activity:agentOffice.topologyDescription`),icon:b}],a=(e,t)=>{let r;if(e.key===`ArrowLeft`&&(r=(t-1+i.length)%i.length),e.key===`ArrowRight`&&(r=(t+1)%i.length),e.key===`Home`&&(r=0),e.key===`End`&&(r=i.length-1),r===void 0)return;e.preventDefault();let a=i[r];a&&(n(a.id),e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)[r]?.focus())};return(0,Y.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[(0,Y.jsx)(`nav`,{"aria-label":`${e(`activity:agentOffice.office`)} / ${e(`activity:agentOffice.topology`)}`,className:`relative z-[60] shrink-0 border-b border-border bg-card/95 px-3 pt-2 shadow-[0_8px_28px_hsl(var(--shadow-color)/0.1)] backdrop-blur-xl sm:px-5`,children:(0,Y.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`mx-auto grid w-full max-w-3xl grid-cols-2 gap-1`,children:i.map((e,r)=>{let i=e.icon,o=t===e.id;return(0,Y.jsxs)(`button`,{id:`office-map-tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":o,"aria-controls":`office-map-view-panel`,tabIndex:o?0:-1,onClick:()=>n(e.id),onKeyDown:e=>a(e,r),className:H(`group relative flex min-w-0 items-center gap-2.5 border-b-2 px-3 py-2.5 text-left transition-all duration-200 sm:gap-3 sm:px-5`,o?`border-primary bg-primary/[0.07] text-foreground`:`border-transparent text-muted-foreground hover:border-border hover:bg-accent/60 hover:text-foreground`),children:[(0,Y.jsx)(`span`,{className:H(`grid h-8 w-8 shrink-0 place-items-center rounded-lg border transition-colors`,o?`border-primary/35 bg-primary/15 text-primary`:`border-border bg-background/70 text-muted-foreground group-hover:text-foreground`),children:(0,Y.jsx)(i,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`strong`,{className:`block truncate font-display text-xs font-semibold sm:text-sm`,children:e.label}),(0,Y.jsx)(`small`,{className:`hidden truncate font-mono text-[9px] font-normal text-muted-foreground sm:block`,children:e.description})]}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:H(`ml-auto h-1.5 w-1.5 shrink-0 rounded-full transition-all`,o?`bg-primary shadow-[0_0_0_4px_hsl(var(--primary)/0.12)]`:`bg-border`)})]},e.id)})})}),(0,Y.jsx)(`div`,{id:`office-map-view-panel`,role:`tabpanel`,"aria-labelledby":`office-map-tab-${t}`,className:`relative min-h-0 flex-1`,children:t===`office`?(0,Y.jsx)(on,{}):(0,Y.jsx)(ge,{children:(0,Y.jsx)(Fn,{})})})]})}export{In as OfficeMapPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Bt as n,Ga as r,Nt as i,lt as a,qt as o}from"./vendor-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Bt as n,Ga as r,Nt as i,lt as a,qt as o}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as s}from"./useWebSocket-Ew1Bbjci.js";import{t as c}from"./utils-B5X3DKef.js";import{R as l}from"./stores-BUtRik4k.js";import{n as u,o as d,r as f,t as p}from"./dialog-BMrjwjA6.js";var m=e(r(),1),h=a();function g({open:e,onClose:r,className:a}){let{t:g}=t(),[_,v]=(0,m.useState)([]),y=s(),b=l(e=>e.wsConnected),x=(0,m.useRef)(null),S=(0,m.useRef)(null);(0,m.useEffect)(()=>{if(!(!e||!b||!y.client?.isConnected))return y.client.send?.({type:`process.list`}),x.current=y.client.on?.(`process.list`,e=>{let t=e?.payload;t?.processes&&v(t.processes)})??null,S.current=setInterval(()=>{y.client.send?.({type:`process.list`})},3e3),()=>{x.current?.(),S.current&&clearInterval(S.current)}},[e,b,y.client]);let C=_.filter(e=>e.status===`running`),w=(0,m.useCallback)(e=>{e.background&&!window.confirm(g(`activity:process.confirmKillBackground`,{pid:e.pid,defaultValue:`Terminate detached background process ${e.pid}?`}))||y.client.send?.({type:`process.kill`,payload:{pid:e.pid}})},[g,y.client]),T=(0,m.useCallback)(()=>{window.confirm(g(`activity:process.confirmKillAll`,{count:C.length,defaultValue:`Terminate all ${C.length} running processes?`}))&&y.client.send?.({type:`process.killAll`})},[C.length,g,y.client]);return(0,h.jsx)(p,{open:e,onOpenChange:e=>{e||r()},children:(0,h.jsxs)(u,{className:c(`max-w-lg gap-0 p-0 overflow-hidden flex flex-col max-h-[75dvh] pt-[10dvh]`,a),showCloseButton:!1,children:[(0,h.jsx)(d,{className:`sr-only`,children:g(`activity:process.heading`)}),(0,h.jsx)(f,{className:`sr-only`,children:g(`activity:process.subtitle`,{active:C.length,total:_.length})}),(0,h.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b shrink-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,h.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-warning/10 text-warning`,children:(0,h.jsx)(i,{className:`h-4 w-4`})}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h2`,{className:`text-sm font-semibold`,children:g(`activity:process.heading`)}),(0,h.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:g(`activity:process.subtitle`,{active:C.length,total:_.length})})]})]}),(0,h.jsx)(`div`,{className:`flex items-center gap-1`,children:C.length>0&&(0,h.jsxs)(`button`,{type:`button`,onClick:T,className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,children:[(0,h.jsx)(n,{className:`h-3 w-3 fill-current`}),g(`activity:process.killAll`)]})})]}),(0,h.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:_.length===0?(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,h.jsx)(i,{className:`h-10 w-10 opacity-15`}),(0,h.jsx)(`p`,{className:`text-sm font-medium`,children:g(`activity:process.emptyTitle`)}),(0,h.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:g(`activity:process.emptyBody`)})]}):(0,h.jsx)(`div`,{className:`divide-y`,children:_.map(e=>{let t=e.status===`running`?Math.floor((Date.now()-e.startedAt)/1e3):null,r=t?t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`:null,i=e.protected===!0,a=e.background===!0;return(0,h.jsxs)(`div`,{className:c(`flex items-center justify-between px-4 py-3 text-xs transition-colors`,e.status===`running`?`bg-background hover:bg-muted/30`:`bg-muted/20 text-muted-foreground`),children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,h.jsx)(`span`,{className:c(`led shrink-0`,e.status===`running`?i?`text-info`:`text-success led-pulse`:`text-muted-foreground`)}),(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground shrink-0`,children:g(`activity:process.pidLabel`,{pid:e.pid})}),(0,h.jsx)(`span`,{className:`font-medium truncate`,children:e.tool}),i&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1 py-0.5 rounded text-[9px] bg-info/10 text-info font-medium shrink-0`,title:g(`activity:process.protectedTitle`),children:[(0,h.jsx)(o,{className:`h-2.5 w-2.5`}),g(`activity:process.protected`)]}),a&&(0,h.jsx)(`span`,{className:`inline-flex items-center px-1 py-0.5 rounded text-[9px] bg-success/10 text-success font-medium shrink-0`,title:g(`activity:process.backgroundTitle`),children:g(`activity:process.background`)})]}),(0,h.jsx)(`code`,{className:`text-[10px] text-muted-foreground/70 truncate block mt-0.5 font-mono`,children:e.command})]})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0 ml-3`,children:[r&&(0,h.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:r}),e.status===`running`&&!i&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>w(e),className:`p-1.5 rounded-md hover:bg-destructive/10 hover:text-destructive transition-colors`,title:g(`activity:process.killTitle`,{pid:e.pid}),children:(0,h.jsx)(n,{className:`h-3.5 w-3.5 fill-current`})})]})]},e.pid)})})})]})})}export{g as ProcessMonitor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Ot as r,Qr as i,
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Ot as r,Qr as i,lt as a,na as o,sn as s,ta as c,yn as l}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as u}from"./ws-client-DYrfK01f.js";import{t as d}from"./utils-B5X3DKef.js";var f=e(n(),1),p=a(),m=200,h=new Set([`raw_user`,`refined_user`]),g=[`raw_user`,`refined_user`];function _(e,t){return e(`activity:promptJournal.cat.${t}`,t)}function v(){let{t:e}=t(),n=u(),[a,o]=(0,f.useState)([]),[c,v]=(0,f.useState)(!0),[b,x]=(0,f.useState)(null),[S,C]=(0,f.useState)(!0),[w,T]=(0,f.useState)({category:``,session:``,limit:m}),[E,D]=(0,f.useState)(new Set),O=(0,f.useCallback)(()=>{if(!n.isConnected){C(!1);return}C(!0),x(null),n.send({type:`prompts.journal`,payload:{filter:{...w.category?{category:w.category}:{},limit:w.limit}}})},[n,w.category,w.limit]);(0,f.useEffect)(()=>{let e=e=>{let t=e.payload;v(t.enabled);let n=(t.entries??[]).filter(e=>h.has(e.category));o(n),x(t.error??null),C(!1)};return n.on(`prompts.journal`,e),O(),()=>n.off(`prompts.journal`,e)},[n,O]);let k=(0,f.useMemo)(()=>{let e=w.session.trim().toLowerCase(),t=a.filter(t=>!e||t.sessionId.toLowerCase().includes(e)),n=new Map;for(let e of[...t].reverse()){let t=e.timestamp.slice(0,10),r=n.get(t)??[];r.push(e),n.set(t,r)}return[...n.entries()]},[a,w.session]),A=(0,f.useMemo)(()=>{let e=0;for(let t of a)e+=t.metadata.tokenEstimate??0;return{count:a.length,tokens:e}},[a]),j=e=>{D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},M=(0,f.useMemo)(()=>g.filter(e=>a.some(t=>t.category===e)),[a]);return(0,p.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:[(0,p.jsxs)(`div`,{className:`border-b border-border/70 px-4 py-3 sm:px-6`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(s,{className:`h-5 w-5 text-primary`}),(0,p.jsx)(`h1`,{className:`text-base font-semibold`,children:e(`activity:promptJournal.title`)})]}),(0,p.jsxs)(`button`,{type:`button`,onClick:O,disabled:S,className:`inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50`,children:[(0,p.jsx)(l,{className:d(`h-3.5 w-3.5`,S&&`animate-spin`)}),e(`activity:promptJournal.refresh`)]})]}),(0,p.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:promptJournal.subtitle`)}),c&&A.count>0&&(0,p.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,p.jsx)(`span`,{children:e(`activity:promptJournal.statEntries`,{count:A.count})}),(0,p.jsx)(`span`,{children:e(`activity:promptJournal.statTokens`,{count:A.tokens.toLocaleString()})})]})]}),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/70 px-4 py-2 sm:px-6`,children:[(0,p.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,p.jsx)(`span`,{children:e(`activity:promptJournal.filterCategory`)}),(0,p.jsxs)(`select`,{value:w.category,onChange:e=>T(t=>({...t,category:e.target.value})),className:`rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:ring-1 focus:ring-primary`,children:[(0,p.jsx)(`option`,{value:``,children:e(`activity:promptJournal.filterAll`)}),M.map(t=>(0,p.jsx)(`option`,{value:t,children:_(e,t)},t))]})]}),(0,p.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,p.jsx)(`span`,{children:e(`activity:promptJournal.filterSession`)}),(0,p.jsx)(`input`,{type:`text`,value:w.session,onChange:e=>T(t=>({...t,session:e.target.value})),placeholder:`sess_…`,className:`w-40 rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:ring-1 focus:ring-primary`})]}),(0,p.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,p.jsx)(`span`,{children:e(`activity:promptJournal.filterLimit`)}),(0,p.jsxs)(`select`,{value:w.limit,onChange:e=>T(t=>({...t,limit:Number(e.target.value)})),className:`rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:ring-1 focus:ring-primary`,children:[(0,p.jsx)(`option`,{value:50,children:`50`}),(0,p.jsx)(`option`,{value:200,children:`200`}),(0,p.jsx)(`option`,{value:1e3,children:`1000`})]})]})]}),(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 px-4 py-3 sm:px-6`,children:[S&&(0,p.jsx)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:e(`activity:promptJournal.loading`)}),!S&&b&&(0,p.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-10 text-sm text-destructive`,children:[(0,p.jsx)(r,{className:`h-4 w-4`}),b]}),!S&&!b&&!c&&(0,p.jsx)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:e(`activity:promptJournal.disabled`)}),!S&&!b&&c&&k.length===0&&(0,p.jsxs)(`div`,{className:`py-10 text-center`,children:[(0,p.jsx)(i,{className:`mx-auto h-8 w-8 text-muted-foreground/50`}),(0,p.jsx)(`div`,{className:`mt-2 text-sm font-medium text-foreground`,children:e(`activity:promptJournal.emptyTitle`)}),(0,p.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:promptJournal.emptyHint`)})]}),!S&&!b&&c&&k.length>0&&(0,p.jsx)(`div`,{className:`space-y-5`,children:k.map(([e,t])=>(0,p.jsxs)(`section`,{children:[(0,p.jsxs)(`h2`,{className:`sticky top-0 z-10 border-b border-border/60 bg-background/90 py-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground backdrop-blur`,children:[e,(0,p.jsx)(`span`,{className:`ml-2 font-normal normal-case text-muted-foreground/60`,children:t.length})]}),(0,p.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.map(e=>(0,p.jsx)(y,{entry:e,expanded:E.has(e.id),onToggle:()=>j(e.id)},e.id))})]},e))})]})]})}function y({entry:e,expanded:n,onToggle:r}){let{t:i}=t(),a=e.timestamp.slice(11,19),s=e.metadata,l=e.content.trim().slice(0,240),u=e.rawContent!==void 0&&e.rawContent!==e.content;return(0,p.jsxs)(`li`,{className:`rounded-lg border border-border/70 bg-card/60`,children:[(0,p.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left hover:bg-accent/40`,children:[n?(0,p.jsx)(o,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`}):(0,p.jsx)(c,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`}),(0,p.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,p.jsx)(`span`,{className:`tabular text-muted-foreground`,children:a}),(0,p.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 font-medium text-primary`,children:_(i,e.category)}),(0,p.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:e.role}),(0,p.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:e.sessionId})]}),!n&&l&&(0,p.jsx)(`div`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap break-words text-xs text-foreground/80`,children:l})]}),(0,p.jsxs)(`span`,{className:`shrink-0 text-[11px] tabular text-muted-foreground`,children:[`~`,s.tokenEstimate,` `,i(`activity:promptJournal.tokens`)]})]}),n&&(0,p.jsxs)(`div`,{className:`border-t border-border/60 px-3 py-2 pl-9`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:i(`activity:promptJournal.refinedBody`)}),(0,p.jsx)(`pre`,{className:`mt-1 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 text-xs text-foreground`,children:e.content}),u&&(0,p.jsxs)(`div`,{className:`mt-2`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:i(`activity:promptJournal.rawInput`)}),(0,p.jsx)(`pre`,{className:`mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/30 p-2 text-xs text-muted-foreground`,children:e.rawContent})]})]})]})}export{v as PromptJournalView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-CtIMb3sU.js";import{Aa as n,Ba as r,Ca as i,Ga as a,dt as o,jt as s,lt as c,ra as l,ur as u}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as d}from"./utils-B5X3DKef.js";import"./stores-BUtRik4k.js";import{n as f,o as p,r as m,t as h}from"./dialog-BMrjwjA6.js";var g=e(a(),1),_=c(),v={btw:{label:`btw`,titleKey:`btwTitle`,tone:`bg-primary/10 text-primary border-primary/30`},steer:{label:`steer`,titleKey:`steerTitle`,tone:`bg-warning/10 text-warning border-warning/35`},queue:{label:`queue`,titleKey:`queueTitle`,tone:`bg-info/10 text-info border-info/30`}};function y({open:e,onClose:a,className:c}){let{t:y}=r(),b=t(e=>e.queue),x=t(e=>e.removeQueued),S=t(e=>e.clearQueue),[C,w]=(0,g.useState)(`oldest`),T=(0,g.useCallback)(e=>{x(e)},[x]),E=(0,g.useMemo)(()=>{let e=b.map((e,t)=>({item:e,sourceIdx:t}));return e.sort((e,t)=>C===`newest`?t.item.addedAt-e.item.addedAt:e.item.addedAt-t.item.addedAt),e},[b,C]),D=b.length>0&&b.every(e=>e.alreadyDispatched);return(0,_.jsx)(h,{open:e,onOpenChange:e=>{e||a()},children:(0,_.jsxs)(f,{className:d(`max-w-lg gap-0 overflow-hidden border-border/80 bg-card p-0 pt-[10dvh] flex flex-col max-h-[70dvh]`,c),showCloseButton:!1,children:[(0,_.jsx)(p,{className:`sr-only`,children:y(`activity:queue.heading`)}),(0,_.jsx)(m,{className:`sr-only`,children:y(`activity:queue.subtitle`,{count:b.length})}),(0,_.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 bg-card/95 px-4 py-3 shrink-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,_.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-md border border-primary/20 bg-primary/10 text-primary`,children:(0,_.jsx)(u,{className:`h-4 w-4`})}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h2`,{className:`text-sm font-semibold`,children:y(`activity:queue.heading`)}),(0,_.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:y(`activity:queue.subtitle`,{count:b.length})})]})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,_.jsxs)(`button`,{type:`button`,onClick:()=>w(e=>e===`newest`?`oldest`:`newest`),className:d(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors font-medium`,`text-muted-foreground hover:bg-muted hover:text-foreground`),title:y(C===`newest`?`activity:queue.sortNewestTitle`:`activity:queue.sortOldestTitle`),"data-testid":`queue-sort-toggle`,children:[C===`newest`?(0,_.jsx)(n,{className:`h-3 w-3`}):(0,_.jsx)(i,{className:`h-3 w-3`}),y(C===`newest`?`activity:queue.newest`:`activity:queue.oldest`)]}),b.length>0&&!D&&(0,_.jsxs)(`button`,{type:`button`,onClick:()=>S(),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,title:y(`activity:queue.clearDispatchedTitle`),"data-testid":`queue-clear-all`,children:[(0,_.jsx)(s,{className:`h-3 w-3`}),y(`activity:queue.clear`)]})]})]}),(0,_.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:b.length===0?(0,_.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-10 w-10 opacity-15`}),(0,_.jsx)(`p`,{className:`text-sm font-medium`,children:y(`activity:queue.emptyTitle`)}),(0,_.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:y(`activity:queue.emptyBody`)})]}):(0,_.jsx)(`ul`,{className:`divide-y divide-border/60`,"data-testid":`queue-list`,children:E.map(({item:e,sourceIdx:t},n)=>{let r=v[e.mode],i=e.alreadyDispatched===!0;return(0,_.jsxs)(`li`,{className:d(`flex items-start justify-between gap-3 px-4 py-3 text-xs transition-colors`,i?`bg-muted/30 text-muted-foreground hover:bg-muted/40`:`hover:bg-muted/35`),"data-testid":`queue-item`,"data-dispatched":i?`true`:void 0,children:[(0,_.jsxs)(`div`,{className:`flex items-start gap-3 min-w-0 flex-1`,children:[(0,_.jsxs)(`span`,{className:`mt-1 text-[10px] font-mono text-muted-foreground shrink-0 w-5 text-right tabular-nums`,children:[n+1,`.`]}),(0,_.jsx)(`span`,{className:d(`shrink-0 inline-flex items-center justify-center rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,r.tone,i&&`opacity-60`),title:y(`activity:queue.${r.titleKey}`),"data-testid":`queue-mode-${e.mode}`,children:r.label}),(0,_.jsx)(`p`,{className:`text-sm leading-relaxed min-w-0 break-words flex-1`,children:e.text.length>120?`${e.text.slice(0,117)}…`:e.text}),i&&(0,_.jsxs)(`span`,{className:`shrink-0 mt-0.5 inline-flex items-center gap-1 text-[10px] font-semibold uppercase text-success`,title:y(`activity:queue.dispatchedTitle`),"data-testid":`queue-dispatched-${t}`,children:[(0,_.jsx)(l,{className:`h-3 w-3`}),y(`activity:queue.dispatchedLabel`)]})]}),!i&&(0,_.jsx)(`button`,{type:`button`,onClick:()=>T(t),className:`ml-1 p-1.5 rounded-md shrink-0 hover:bg-destructive/10 hover:text-destructive transition-colors`,title:y(`activity:queue.removeTitle`),"data-testid":`queue-remove-${t}`,children:(0,_.jsx)(o,{className:`h-3.5 w-3.5`})})]},`${e.addedAt}-${t}`)})})}),b.length>0&&(0,_.jsx)(`div`,{className:`border-t border-border/70 bg-muted/20 px-4 py-2.5 shrink-0`,children:(0,_.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-center`,children:y(`activity:queue.footer`)})})]})})}export{y as QueuePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-CtIMb3sU.js";import{Ba as n,Ga as r,Ji as i,Ot as a,Pa as o,hn as s,lt as c,pn as l,rn as u,xi as d}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as f}from"./session-store-D4PNeAGe.js";import{n as p}from"./ui-store-DxMnhARg.js";var m=e(r(),1),h=c();function g(){let e=f(e=>e.session),{t:r}=n(),c=f.getState().session?.id,g=f(e=>e.projectName),x=f(e=>e.cwd),S=f(e=>e.mode),C=f(e=>e.contextMode),w=f(e=>e.lastVisitedAt),T=t(e=>e.messages),E=t(e=>e.queue.length),D=t(e=>e.boundSessionId),O=p(e=>e.currentView),k=p(e=>e.dockSection),[A,j]=(0,m.useState)([]),M=(0,m.useMemo)(()=>{if(typeof window>`u`)return 0;let e=0;for(let t of[`wrongstack-session`,`wrongstack-chat`,`wrongstack-ui`,`wrongstack-config`]){let n=window.localStorage.getItem(t);typeof n==`string`&&(e+=n.length)}return e},[T.length]),N=typeof window<`u`&&!!window.__wrongstackSessionRehydrated,P=typeof window<`u`&&!!window.__wrongstackChatRehydrated;function F(e,t){j(n=>[{ts:Date.now(),note:e,ok:t},...n].slice(0,20))}function I(){F(r(`activity:refresh.simulatedF5`),!0)}let L=D!==null&&c!==void 0&&D!==c;return(0,h.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,h.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5 sm:space-y-6`,children:[(0,h.jsx)(`header`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`h1`,{className:`flex min-w-0 items-center gap-2 text-xl font-bold sm:text-2xl`,children:[(0,h.jsx)(l,{className:`h-6 w-6 shrink-0 text-primary sm:h-7 sm:w-7`}),r(`activity:refresh.heading`)]}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:r(`activity:refresh.subtitle`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:I,className:`inline-flex h-9 w-full items-center justify-center rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 sm:w-auto`,children:r(`activity:refresh.recordProbe`)})]})}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(o,{className:`w-5 h-5`}),r(`activity:refresh.latestSession`)]}),(0,h.jsx)(_,{label:r(`activity:refresh.restoredLocal`),ok:N,extra:c?r(`activity:refresh.sessionIdExtra`,{id:c}):r(`activity:refresh.noSessionYet`)}),(0,h.jsx)(_,{label:r(`activity:refresh.activePointer`),ok:!!e?.id,extra:e?y(e):`null`}),(0,h.jsx)(_,{label:r(`activity:refresh.lastVisited`),ok:w>0,extra:w>0?new Date(w).toISOString():r(`activity:refresh.never`)})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(d,{className:`w-5 h-5`}),r(`activity:refresh.persistedEnv`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`projectName`,value:g||`∅`}),(0,h.jsx)(v,{label:`cwd`,value:x||`∅`,mono:!0}),(0,h.jsx)(v,{label:`mode`,value:S,mono:!0}),(0,h.jsx)(v,{label:`contextMode`,value:C,mono:!0})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(s,{className:`w-5 h-5`}),r(`activity:refresh.transcriptRehydrate`)]}),(0,h.jsx)(_,{label:r(`activity:refresh.localTranscript`),ok:P&&(T.length>0||D===null),extra:T.length===0?r(`activity:refresh.noMessages`):r(`activity:refresh.messagesExtra`,{count:T.length,queued:E})}),(0,h.jsx)(_,{label:r(`activity:refresh.noBleed`),ok:!L,extra:L?r(`activity:refresh.bleedExtra`,{bound:D??`∅`,active:c??`∅`}):r(`activity:refresh.transcriptBinds`),warn:L}),T.length>0&&(0,h.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border/70 bg-card/65 p-3 text-xs font-mono`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`first:`}),` `,b(T[0])]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`last:`}),` `,b(T[T.length-1]??T[0])]})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(u,{className:`w-5 h-5`}),r(`activity:refresh.uiWorkspace`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`currentView`,value:O,mono:!0}),(0,h.jsx)(v,{label:`dockSection`,value:k??r(`activity:refresh.noneValue`),mono:!0})]}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`activity:refresh.payloadSize`,{count:M})})]}),(0,h.jsxs)(`section`,{className:`space-y-2`,children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold`,children:r(`activity:refresh.probeLog`)}),A.length===0?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`activity:refresh.noProbes`)}):(0,h.jsx)(`ul`,{className:`space-y-1 text-xs font-mono`,children:A.map((e,t)=>(0,h.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.ok?(0,h.jsx)(i,{className:`w-4 h-4 text-success shrink-0`}):(0,h.jsx)(a,{className:`w-4 h-4 text-warning shrink-0`}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()}),(0,h.jsx)(`span`,{children:e.note})]},`${e.ts}-${t}`))})]})]})})}function _({label:e,extra:t,ok:n,warn:r}){return(0,h.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${r?`border-warning/40 bg-warning/10 text-warning`:n?`border-success/40 bg-success/10 text-success`:`border-border bg-muted/40 text-muted-foreground`}`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium`,children:[n&&!r?(0,h.jsx)(i,{className:`h-4 w-4 shrink-0`}):(0,h.jsx)(a,{className:`h-4 w-4 shrink-0`}),(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]}),(0,h.jsx)(`div`,{className:`text-xs font-mono mt-1 break-all`,children:t})]})}function v({label:e,value:t,mono:n}){return(0,h.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border/70 bg-card/75 p-3 shadow-sm`,children:[(0,h.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:e}),(0,h.jsx)(`p`,{className:`mt-1 text-sm break-all `+(n?`font-mono`:`font-medium`),children:t})]})}function y(e){let t=e.title?.trim();return t?`${e.id} — "${t}" (${e.provider}/${e.model})`:`${e.id} (${e.provider}/${e.model})`}function b(e){let t=(e.content??``).trim().replace(/\s+/g,` `);return`[${e.role}] ${t.length>100?`${t.slice(0,99)}…`:t}`}export{g as RefreshDebugView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,lt as r}from"./vendor-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,lt as r}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as i}from"./utils-B5X3DKef.js";import{t as a}from"./button-DAT5OnLL.js";import{t as o}from"./input-Ccsxvwz6.js";import{o as s}from"./index-cUeJ0FkT.js";var c=e(n(),1),l=r(),u=[`feature`,`bug_fix`,`refactor`,`performance`,`security`,`ui_change`,`api_change`,`infrastructure`,`migration`,`testing`,`documentation`,`maintenance`,`other`,`unspecified`],d=[`unspecified`,`low`,`medium`,`high`,`critical`],f={draft:`bg-muted text-muted-foreground`,collecting_information:`bg-warning/15 text-warning`,submitted:`bg-success/15 text-success`,cancelled:`bg-destructive/15 text-destructive`,archived:`bg-muted text-muted-foreground`};function p(e){let t=Date.now()-e;if(t<6e4)return`just now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function m(){let{t:e}=t(),[n,r]=(0,c.useState)(null),[m,h]=(0,c.useState)([]),[g,_]=(0,c.useState)(!0),[v,y]=(0,c.useState)(null),[b,x]=(0,c.useState)(``),[S,C]=(0,c.useState)(``),[w,T]=(0,c.useState)(`unspecified`),[E,D]=(0,c.useState)(`unspecified`),[O,k]=(0,c.useState)(!1),[A,j]=(0,c.useState)(null),[M,N]=(0,c.useState)(null),P=(0,c.useCallback)(async()=>{_(!0),y(null);try{let e=await fetch(`/api/requirement-intakes`);if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error?.message??`List failed (HTTP ${e.status})`)}let t=await e.json();r(t.projectId),h(t.intakes)}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}},[]);(0,c.useEffect)(()=>{P()},[P]);let F=(0,c.useCallback)(async()=>{let e=b.trim();if(!e){j(`Describe the request first — it is preserved verbatim.`);return}if(!n){j(`No project identity available yet.`);return}k(!0),j(null),N(null);try{let t=await fetch(`/api/projects/${encodeURIComponent(n)}/requirement-intakes`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectId:n,requestedBy:`webui`,originalRequest:e,...S.trim()?{title:S.trim()}:{},...w===`unspecified`?{}:{requestType:w},...E===`unspecified`?{}:{priority:E}})}),r=await t.json().catch(()=>null);if(!t.ok||!r?.record)throw Error(r?.error?.message??`Create failed (HTTP ${t.status})`);let i=await fetch(`/api/requirement-intakes/${r.record.id}/submit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!i.ok){let e=await i.json().catch(()=>null);throw Error(e?.error?.message??`Submit failed (HTTP ${i.status})`)}N(`Intake recorded and submitted (${r.record.id}).`),x(``),C(``),T(`unspecified`),D(`unspecified`),await P()}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}},[b,S,w,E,n,P]);return(0,l.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,l.jsxs)(`header`,{className:`border-b border-border/70 px-5 py-3`,children:[(0,l.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e(`activity:reqIntake.requirementsIntake`)}),(0,l.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:e(`activity:reqIntake.collectAndPreserveSoftwareDevelopmentRequests`)})]}),(0,l.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5`,children:[v?(0,l.jsxs)(`div`,{role:`alert`,className:`mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:[v,(0,l.jsx)(`button`,{type:`button`,className:`ml-2 underline underline-offset-2`,onClick:()=>void P(),children:e(`activity:reqIntake.retry`)})]}):null,(0,l.jsxs)(`section`,{"aria-label":e(`activity:reqIntake.fileANewIntake`),className:`mb-6 rounded-lg border border-border/70 bg-card/60 p-4`,children:[(0,l.jsx)(`div`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:e(`activity:reqIntake.fileANewRequest`)}),(0,l.jsxs)(`div`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`label`,{htmlFor:`intake-request`,className:`mb-1 block text-xs text-foreground`,children:[e(`activity:reqIntake.requestText`),` `,(0,l.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,l.jsx)(`textarea`,{id:`intake-request`,value:b,onChange:e=>x(e.target.value),placeholder:e(`activity:reqIntake.describeTheFeatureBugFixRefactorOrChange`),rows:4,className:i(`w-full resize-y rounded-md border border-border/70 bg-background px-3 py-2`,`text-sm text-foreground placeholder:text-muted-foreground/70`,`focus:outline-none focus:ring-2 focus:ring-ring`)}),/\[VIBE\]/i.test(b)?(0,l.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 rounded bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary`,children:[(0,l.jsx)(`span`,{children:`🌊`}),(0,l.jsxs)(`span`,{children:[(0,l.jsx)(`strong`,{children:`VIBE Protocol Detected:`}),` Three-Stage Verification (Spec-Synthesizer → Coder → Auditor) is active.`]})]}):null,(0,l.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e(`activity:reqIntake.storedVerbatimAsTheRecordApos`)})]}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`intake-title`,className:`mb-1 block text-xs text-foreground`,children:e(`activity:reqIntake.titleOptional`)}),(0,l.jsx)(o,{id:`intake-title`,value:S,onChange:e=>C(e.target.value),placeholder:e(`activity:reqIntake.shortDisplayTitle`)})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`intake-type`,className:`mb-1 block text-xs text-foreground`,children:e(`activity:reqIntake.type`)}),(0,l.jsx)(`select`,{id:`intake-type`,value:w,onChange:e=>T(e.target.value),className:i(`w-full rounded-md border border-border/70 bg-background px-2 py-2`,`text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring`),children:u.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`intake-priority`,className:`mb-1 block text-xs text-foreground`,children:e(`activity:reqIntake.priority`)}),(0,l.jsx)(`select`,{id:`intake-priority`,value:E,onChange:e=>D(e.target.value),className:i(`w-full rounded-md border border-border/70 bg-background px-2 py-2`,`text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring`),children:d.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))})]})]}),A?(0,l.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:A}):null,M?(0,l.jsx)(`div`,{role:`status`,className:`rounded-md border border-success/30 bg-success/10 px-3 py-2 text-xs text-success`,children:M}):null,(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,l.jsx)(a,{variant:`secondary`,size:`sm`,disabled:O,onClick:()=>{x(``),j(null),N(null)},children:e(`activity:reqIntake.clear`)}),(0,l.jsx)(a,{size:`sm`,disabled:O||!b.trim(),onClick:()=>void F(),children:O?`Filing…`:`File + submit`})]})]})]}),(0,l.jsxs)(`section`,{"aria-label":e(`activity:reqIntake.intakeRecords`),className:`space-y-2`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,l.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:e(`activity:reqIntake.records`)}),(0,l.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[m.length,` total`]})]}),g?(0,l.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:e(`activity:reqIntake.loading`)}):m.length===0?(0,l.jsx)(`div`,{className:`rounded-md border border-dashed border-border/70 py-10 text-center text-xs text-muted-foreground`,children:e(`activity:reqIntake.noIntakeRecordsYetFileThe`)}):(0,l.jsx)(`ul`,{className:`space-y-2`,children:m.map(e=>(0,l.jsxs)(`li`,{className:`rounded-md border border-border/70 bg-card/60 p-3`,children:[(0,l.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,l.jsxs)(`div`,{className:`min-w-0`,children:[(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,title:e.title,children:e.title}),(0,l.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-muted-foreground`,children:e.id})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5`,children:[e.isVibeMode?(0,l.jsx)(s,{variant:`outline`,className:`border-primary/40 bg-primary/10 text-[10px] text-primary`,children:`🌊 VIBE`}):null,(0,l.jsx)(s,{variant:`secondary`,className:`text-[10px]`,children:e.requestType}),(0,l.jsx)(s,{className:i(`text-[10px]`,f[e.status]??`bg-muted text-muted-foreground`),children:e.status})]})]}),(0,l.jsxs)(`div`,{className:`mt-1.5 text-[11px] text-muted-foreground`,children:[e.priority,` · updated `,p(e.updatedAt)]})]},e.id))})]})]})]})}export{m as RequirementIntakeView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryManager-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Vn as r,bt as i,dr as a,lt as o}from"./vendor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryManager-7DSVhxZf.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-DLS502Zs.js","assets/monaco-BCqJp2xW.js","assets/monaco-Bowa0-zp.css","assets/markdown-Kp5uSgOw.js","assets/vendor-BMdWcCR4.css","assets/i18n-CYYBUSJB.js","assets/activity-B7hiQ_IX.js","assets/chat-CzaGXz_W.js","assets/commandPalette-BovBiPec.js","assets/common-BBHmIHQW.js","assets/settings-DfID_cS9.js","assets/setup-DfcCCvUO.js","assets/toasts-DOfXc7Rt.js","assets/useWebSocket-Ew1Bbjci.js","assets/chat-store-CtIMb3sU.js","assets/utils-B5X3DKef.js","assets/ws-client-DYrfK01f.js","assets/session-store-D4PNeAGe.js","assets/codemap-activity-store-CA_14DHd.js","assets/stores-BUtRik4k.js","assets/mailbox-store-BWD7JeF9.js","assets/ui-store-DxMnhARg.js","assets/view-navigation-Hd631M1W.js","assets/codemap-index-store-BlPxA13l.js","assets/Toaster-COVFFUKo.js","assets/dialog-BMrjwjA6.js","assets/button-DAT5OnLL.js","assets/input-Ccsxvwz6.js","assets/index-cUeJ0FkT.js","assets/ConfirmModal-BJOVE-JI.js","assets/ModelPicker-C72kprRH.js","assets/index-D2tx76V0.css","assets/roster-ws-lMIf13ag.js","assets/shared-Y6T3EEnd.js","assets/MemoryDrawer-6n0Etoz4.js","assets/AudienceMemoryPanel-DU3hUuUl.js","assets/vector-memory-panel-CnBqV6GK.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Vn as r,bt as i,dr as a,lt as o}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{s}from"./monaco-BCqJp2xW.js";import{t as c}from"./utils-B5X3DKef.js";import{C as l,E as u,T as d,w as f}from"./index-cUeJ0FkT.js";var p=e(n(),1),m=o(),h=(0,p.lazy)(()=>s(()=>import(`./MemoryManager-7DSVhxZf.js`).then(e=>({default:e.MemoryManager})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),g=(0,p.lazy)(()=>s(()=>import(`./AudienceMemoryPanel-DU3hUuUl.js`).then(e=>({default:e.AudienceMemoryPanel})),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35]))),_=(0,p.lazy)(()=>s(()=>import(`./vector-memory-panel-CnBqV6GK.js`).then(e=>({default:e.VectorMemoryPanel})),__vite__mapDeps([38,1,2,3,4,5,6,27,17,28])));function v({label:e}){return(0,m.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background text-xs text-muted-foreground`,"aria-busy":`true`,children:(0,m.jsxs)(`span`,{className:`font-mono uppercase tracking-wide`,children:[e,`…`]})})}var y=[{value:`all`,label:`activity:memoryManager.tabAllMemories`,hint:`activity:memoryManager.tabAllMemoriesHint`,Icon:a},{value:`audience`,label:`activity:memoryManager.tabAudience`,hint:`activity:memoryManager.tabAudienceHint`,Icon:i},{value:`vector`,label:`activity:memoryManager.tabVectorMemory`,hint:`activity:memoryManager.tabVectorMemoryHint`,Icon:r}];function b({defaultValue:e=`all`}={}){let{t:n}=t();return(0,m.jsxs)(l,{defaultValue:e,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,children:[(0,m.jsx)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-border/70 bg-card/55 px-4 py-2 sm:px-5`,role:`presentation`,children:(0,m.jsx)(d,{"aria-label":n(`activity:memoryManager.lensesAria`),className:`h-9 bg-muted/40 p-1 shadow-none`,children:y.map(({value:e,label:t,hint:r,Icon:i})=>(0,m.jsxs)(u,{value:e,className:c(`h-7 gap-2 px-3 text-[11px] font-semibold uppercase tracking-wide`,`data-[state=active]:bg-background data-[state=active]:text-foreground`,`data-[state=active]:shadow-[0_0_0_1px_hsl(var(--border)/0.7)]`),children:[(0,m.jsx)(i,{className:`size-3.5`}),(0,m.jsx)(`span`,{children:n(t)}),(0,m.jsx)(`span`,{className:`hidden font-mono text-[9px] font-normal normal-case text-muted-foreground sm:inline`,children:n(r)})]},e))})}),(0,m.jsx)(f,{value:`all`,className:`mt-0 flex-1 overflow-hidden ring-offset-0 focus-visible:ring-0`,children:(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)(v,{label:n(`activity:memoryManager.loadingSage`)}),children:(0,m.jsx)(h,{})})}),(0,m.jsx)(f,{value:`audience`,className:`mt-0 flex-1 overflow-hidden ring-offset-0 focus-visible:ring-0`,children:(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)(v,{label:n(`activity:memoryManager.loadingAudience`)}),children:(0,m.jsx)(g,{})})}),(0,m.jsx)(f,{value:`vector`,className:`mt-0 flex-1 overflow-y-auto px-4 pb-6 pt-4 ring-offset-0 focus-visible:ring-0 sm:px-5`,children:(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)(v,{label:n(`activity:memoryManager.loadingVectorMemory`)}),children:(0,m.jsx)(_,{})})})]})}export{b as SageTabs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Mr as i,Ot as a,Pr as o,Qt as s,Ut as c,_ as l,a as u,c as d,dt as f,f as p,h as m,i as h,lt as g,mn as _,or as v,qi as y,r as b,ra as x,s as S,u as C,ua as w,vr as T,ya as E}from"./vendor-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Mr as i,Ot as a,Pr as o,Qt as s,Ut as c,_ as l,a as u,c as d,dt as f,f as p,h as m,i as h,lt as g,mn as _,or as v,qi as y,r as b,ra as x,s as S,u as C,ua as w,vr as T,ya as E}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as D}from"./utils-B5X3DKef.js";var O=e(r(),1),k=g();function A({pct:e}){let{t:n}=t(),r=(0,O.useId)(),i=2*Math.PI*26,a=i-Math.max(0,Math.min(100,e))/100*i;return(0,k.jsxs)(`div`,{className:`relative h-16 w-16 shrink-0`,children:[(0,k.jsxs)(`svg`,{viewBox:`0 0 64 64`,className:`h-16 w-16 -rotate-90`,role:`img`,"aria-label":n(`activity:progressring.progress`),children:[(0,k.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`hsl(var(--muted))`,strokeWidth:`6`}),(0,k.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`url(#${r})`,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:i,strokeDashoffset:a,style:{transition:`stroke-dashoffset 0.6s cubic-bezier(0.16,1,0.3,1)`}}),(0,k.jsx)(`defs`,{children:(0,k.jsxs)(`linearGradient`,{id:r,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,k.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--primary))`}),(0,k.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--info))`})]})})]}),(0,k.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm font-bold text-foreground`,children:[Math.round(e),`%`]})]})}var j={pending:{label:`Pending`,icon:y,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`},queued:{label:`Ready`,icon:y,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--primary))`},in_progress:{label:`Running`,icon:v,spin:!0,text:`text-warning`,ring:`border-warning/45 bg-warning/10`,dot:`bg-warning`,hex:`hsl(var(--warning))`},blocked:{label:`Blocked`,icon:y,text:`text-destructive`,ring:`border-destructive/30 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},review:{label:`Review`,icon:y,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--info))`},failed:{label:`Failed`,icon:f,text:`text-destructive`,ring:`border-destructive/45 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},completed:{label:`Done`,icon:x,text:`text-success`,ring:`border-success/35 bg-success/10`,dot:`bg-success`,hex:`hsl(var(--success))`},cancelled:{label:`Cancelled`,icon:E,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`}};function M(e){return j[e]??j.pending}var N={critical:{text:`text-destructive`,chip:`bg-destructive/10 text-destructive`},high:{text:`text-warning`,chip:`bg-warning/12 text-warning`},medium:{text:`text-primary`,chip:`bg-primary/10 text-primary`},low:{text:`text-muted-foreground`,chip:`bg-muted text-muted-foreground`}};function P(e){return N[e]??N.medium}var F={running:`border-primary/35 bg-primary/10 text-primary`,paused:`border-warning/35 bg-warning/10 text-warning`,stopped:`border-border/70 bg-muted text-muted-foreground`,completed:`border-success/35 bg-success/10 text-success`,failed:`border-destructive/35 bg-destructive/10 text-destructive`,deadlocked:`border-destructive/35 bg-destructive/10 text-destructive`,idle:`border-border bg-muted text-muted-foreground`},I=[`bg-warning`,`bg-primary`,`bg-success`,`bg-destructive`,`bg-secondary`,`bg-muted-foreground`,`bg-accent`],L={started:{icon:n,color:`text-warning`},completed:{icon:x,color:`text-success`},failed:{icon:f,color:`text-destructive`},retrying:{icon:_,color:`text-warning`},wave:{icon:T,color:`text-primary`},deadlock:{icon:a,color:`text-destructive`},verification_failed:{icon:s,color:`text-destructive`},conflict:{icon:i,color:`text-warning`},split:{icon:c,color:`text-primary`},supervisor:{icon:w,color:`text-primary`}};function R(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t[1]?.[0]??``)).toUpperCase()||`·`}function z(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?t%60?`${n}m ${t%60}s`:`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function B(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m`:`${Math.floor(r/60)}h`}var V=300,H=128,U=240,W={pending:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`},queued:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},in_progress:{ring:`border-warning/45`,chip:`bg-warning/12 text-warning`,dot:`bg-warning`},blocked:{ring:`border-destructive/30`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},review:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},failed:{ring:`border-destructive/45`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},completed:{ring:`border-success/35`,chip:`bg-success/12 text-success`,dot:`bg-success`},cancelled:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`}};function G({data:e}){let n=e.task,{t:r}=t(),i=W[n.displayStatus],a=n.displayStatus===`in_progress`,s=n.displayStatus===`completed`?x:n.displayStatus===`failed`?f:a?v:y;return(0,k.jsxs)(`div`,{className:D(`sdd-node-enter group relative rounded-lg border bg-card/95 px-2.5 py-2 text-left shadow-lg backdrop-blur`,i.ring,a&&`sdd-node-running`,n.displayStatus===`completed`&&`sdd-node-complete`,n.displayStatus===`failed`&&`sdd-node-failed`,e.onTaskClick&&`hover:brightness-125`),style:{width:U,animationDelay:`${Math.min(e.index*45,600)}ms`},children:[e.onTaskClick&&(0,k.jsx)(`button`,{type:`button`,"aria-label":r(`activity:sdd.openTask`,{title:n.title,defaultValue:`Open task: ${n.title}`}),className:`absolute inset-0 z-10 cursor-pointer rounded-lg`,onClick:()=>e.onTaskClick?.(n.id)}),(0,k.jsx)(S,{type:`target`,position:l.Left,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsx)(S,{type:`source`,position:l.Right,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsx)(s,{className:D(`h-3.5 w-3.5`,a&&`animate-spin`,i.chip.split(` `).find(e=>e.startsWith(`text`)))}),(0,k.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:n.shortId}),(0,k.jsx)(`span`,{className:D(`font-mono text-[10px] font-bold uppercase`,P(n.priority).text),children:n.priority[0]}),(0,k.jsx)(`span`,{className:D(`ml-auto rounded px-1.5 py-px text-[9px] font-medium`,i.chip),children:r(`activity:sdd.status.${n.displayStatus}`)})]}),(0,k.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:n.title}),(n.agentName||n.worktreeBranch)&&(0,k.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[n.agentName&&(0,k.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,k.jsx)(`span`,{className:D(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,a?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:R(n.agentName)}),(0,k.jsx)(`span`,{className:`max-w-[88px] truncate text-[10px] text-muted-foreground`,children:n.agentName})]}),n.retries?(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,k.jsx)(_,{className:`h-2.5 w-2.5`}),n.retries]}):null,n.worktreeBranch&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 text-[9px] text-muted-foreground`,title:n.worktreeBranch,children:[(0,k.jsx)(o,{className:`h-2.5 w-2.5`}),(0,k.jsx)(`span`,{className:`max-w-[70px] truncate`,children:n.worktreeBranch.replace(/^.*\//,``)})]})]})]})}function K({data:e}){return(0,k.jsx)(`div`,{className:`whitespace-nowrap text-[11px] font-bold uppercase text-muted-foreground`,children:e.label})}var q={task:G,colLabel:K};function J(e,t,n){let r=new Map(e.map(e=>[e.shortId,e])),i=[],a=0;t.forEach((e,t)=>{i.push({id:`__col_${t}`,position:{x:t*V,y:-52},data:{label:e.label},draggable:!1,selectable:!1,type:`colLabel`,style:{pointerEvents:`none`}}),e.taskIds.forEach((e,o)=>{let s=r.get(e);s&&i.push({id:s.id,position:{x:t*V,y:o*H},data:{task:s,index:a++,onTaskClick:n},type:`task`,draggable:!0})})});let o=[];for(let t of e)for(let e of t.deps){let n=r.get(e);if(!n)continue;let i=n.displayStatus===`completed`&&(t.displayStatus===`in_progress`||t.displayStatus===`queued`);o.push({id:`${n.id}->${t.id}`,source:n.id,target:t.id,animated:i,className:i?`sdd-edge-flow`:void 0,style:{stroke:M(t.displayStatus).hex,strokeWidth:i?2.2:1.4,opacity:t.displayStatus===`pending`?.4:.85}})}return{nodes:i,edges:o}}function Y({tasks:e,columns:t,onTaskClick:n}){let{fitView:r}=m(),{nodes:i,edges:a}=(0,O.useMemo)(()=>J(e,t,n),[e,t,n]),o=e.length;return(0,O.useEffect)(()=>{let e=setTimeout(()=>r({padding:.18,duration:400}),60);return()=>clearTimeout(e)},[o,r]),(0,k.jsxs)(p,{nodes:i,edges:a,nodeTypes:q,fitView:!0,fitViewOptions:{padding:.18},minZoom:.2,maxZoom:1.6,proOptions:{hideAttribution:!0},nodesConnectable:!1,elementsSelectable:!!n,children:[(0,k.jsx)(b,{variant:h.Dots,gap:22,size:1,color:`hsl(var(--border))`}),(0,k.jsx)(u,{showInteractive:!1,className:`!bottom-2 !left-2`}),(0,k.jsx)(d,{pannable:!0,zoomable:!0,nodeStrokeWidth:2,maskColor:`hsl(var(--background) / 0.65)`,nodeColor:e=>{let t=e.data?.task?.displayStatus;return t?M(t).hex:`hsl(var(--muted-foreground))`},className:`!bottom-2 !right-2 !h-24 !w-40 overflow-hidden rounded-md border border-border/70 bg-card`})]})}function X({tasks:e,columns:t,onTaskClick:n}){return(0,k.jsx)(C,{children:(0,k.jsx)(Y,{tasks:e,columns:t,onTaskClick:n})})}export{R as a,P as c,F as i,M as l,I as n,B as o,L as r,z as s,X as t,A as u};
|