@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 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Bn as n,Dr as r,Ea as i,En as a,Ga as o,Hr as s,Kr as c,La as l,Pa as u,Pr as d,Pt as f,Vn as p,Zt as m,_ as h,a as g,an as ee,bn as _,c as v,dt as y,f as b,g as te,h as ne,i as x,jn as S,li as re,lt as C,m as ie,mi as w,n as ae,na as T,or as oe,p as se,pa as E,r as ce,s as le,ta as D,u as ue,vr as de,zn as fe}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as O}from"./utils-B5X3DKef.js";import{i as pe,r as me,t as he}from"./codemap-activity-store-CA_14DHd.js";import{t as ge}from"./codemap-index-store-BlPxA13l.js";var k=e(o(),1),_e=4096,A=new Map;function j(e){let t=A.get(e);if(t!==void 0)return t;let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).toLocaleLowerCase();for(;A.size>=_e;){let e=A.keys().next().value;if(e===void 0)break;A.delete(e)}return A.set(e,n),n}function M(e){return e.level===`packages`?`packages`:e.level===`files`?`files:${e.package}`:`symbols:${e.file}`}function ve(e){return e.level===`packages`?`/api/codemap/packages`:e.level===`files`?`/api/codemap/files?package=${encodeURIComponent(e.package)}`:`/api/codemap/symbols?file=${encodeURIComponent(e.file)}`}function ye(e,t,n){let r=new Map(e.nodes.map(e=>[e.id,e])),i=[];for(let a of e.edges){let e=n===`incoming`?a.target===t?a.source:void 0:a.source===t?a.target:void 0;if(!e)continue;let o=r.get(e);o&&i.push({node:o,edge:a})}return i.sort((e,t)=>t.edge.weight-e.edge.weight||e.node.label.localeCompare(t.node.label))}function be(e,t){let n=new Set([t]);for(let r of e.edges)r.source===t&&n.add(r.target),r.target===t&&n.add(r.source);return n}function xe(e,t){let n=new Map(e.nodes.map(e=>[e.id,0]));for(let r of e.edges)!t.has(r.source)||!t.has(r.target)||(n.set(r.source,(n.get(r.source)??0)+r.weight),r.target!==r.source&&n.set(r.target,(n.get(r.target)??0)+r.weight));return n}function N(e){let t=new Set(e.nodes.map(e=>e.id)),n=xe(e,t),r=new Map(e.nodes.map(e=>[e.id,0])),i=new Map;for(let n of e.edges){if(!t.has(n.source)||!t.has(n.target)||n.source===n.target)continue;r.set(n.target,(r.get(n.target)??0)+1);let e=i.get(n.source)??[];e.push(n.target),i.set(n.source,e)}let a=new Map,o=e.nodes.filter(e=>(r.get(e.id)??0)===0).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).map(e=>e.id);o.length===0&&e.nodes[0]&&o.push(e.nodes[0].id);for(let e of o)a.set(e,0);let s=new Set,c=0;for(;c<o.length;){let e=o[c++];if(!s.has(e)){s.add(e);for(let t of i.get(e)??[])a.set(t,Math.max(a.get(t)??0,Math.min((a.get(e)??0)+1,7))),r.set(t,(r.get(t)??1)-1),(r.get(t)??0)<=0&&o.push(t)}}let l=e.nodes.filter(e=>!a.has(e.id)).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0));l.forEach((e,t)=>{a.set(e.id,t%Math.min(4,Math.max(1,l.length)))});let u=new Map;for(let t of e.nodes){let e=a.get(t.id)??0,n=u.get(e)??[];n.push(t),u.set(e,n)}for(let e of u.values())e.sort((e,t)=>Number(e.external)-Number(t.external)||(n.get(t.id)??0)-(n.get(e.id)??0)||e.label.localeCompare(t.label));let d=Math.max(1,...[...u.values()].map(e=>e.length))*160,f=[];for(let[e,t]of[...u.entries()].sort(([e],[t])=>e-t)){let n=(d-t.length*160)/2;t.forEach((t,r)=>{f.push({node:t,position:{x:e*386,y:n+r*160}})})}return f}function Se(e,t){if(e.nodes.length===0)return[];let n=xe(e,new Set(e.nodes.map(e=>e.id))),r=e.nodes.find(e=>e.id===t)??[...e.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0))[0],i=be(e,r.id);i.delete(r.id);let a=e.nodes.filter(e=>i.has(e.id)),o=e.nodes.filter(e=>e.id!==r.id&&!i.has(e.id)),s=[{node:r,position:{x:0,y:0}}],c=(e,t,n)=>{e.forEach((r,i)=>{let a=n+Math.PI*2*i/Math.max(1,e.length);s.push({node:r,position:{x:Math.cos(a)*t,y:Math.sin(a)*t}})})};c(a,Math.max(330,a.length*34),-Math.PI/2);for(let e=0;e<o.length;e+=18)c(o.slice(e,e+18),620+Math.floor(e/18)*280,-Math.PI/2+.12);return s}function Ce(e,t,n){return t===`orbit`?Se(e,n):N(e)}function P(e,t,n){if(e.length<=n)return e;let r=t?e.filter(e=>e.source===t||e.target===t):[],i=e.filter(e=>!t||e.source!==t&&e.target!==t).sort((e,t)=>t.weight-e.weight||e.source.localeCompare(t.source)||e.target.localeCompare(t.target)),a=Math.max(0,n-r.length);return[...r,...i.slice(0,a)]}function we(e,t,n){if(n===`all`)return e;let r=e.nodes;if(e.nodes.length>96){let n=new Map(e.nodes.map(e=>[e.id,e])),i=new Map;for(let t of e.edges)i.set(t.source,(i.get(t.source)??0)+t.weight),i.set(t.target,(i.get(t.target)??0)+t.weight);let a=[...e.nodes].sort((e,t)=>(i.get(t.id)??0)-(i.get(e.id)??0)||e.label.localeCompare(t.label)),o=new Set,s=e=>{n.has(e)&&o.size<96&&o.add(e)};if(t&&n.has(t)){s(t);let n=e.edges.filter(e=>e.source===t||e.target===t).sort((e,t)=>t.weight-e.weight);for(let e of n)s(e.source),s(e.target);let r=new Set(o),i=e.edges.filter(e=>r.has(e.source)||r.has(e.target)).sort((e,t)=>t.weight-e.weight);for(let e of i)s(e.source),s(e.target)}else{let e=a.filter(e=>!e.external).slice(0,72),t=a.filter(e=>e.external).slice(0,24);for(let n of[...e,...t])s(n.id)}for(let e of a)s(e.id);r=e.nodes.filter(e=>o.has(e.id))}let i=new Set(r.map(e=>e.id)),a=e.edges.filter(e=>i.has(e.source)&&i.has(e.target));return{nodes:r,edges:P(a,t,180)}}var Te=[`/src/main/java/`,`/src/main/kotlin/`,`/src/`,`/lib/`,`/internal/`,`/cmd/`,`/pkg/`,`/app/`];function Ee(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=e.package??``,r=n.startsWith(`@wrongstack/`)?`/packages/${n.slice(12)}/`:n.startsWith(`app:`)?`/apps/${n.slice(4)}/`:void 0;if(!r)return;let i=t.indexOf(r);return i>=0?t.slice(i+r.length):void 0}function F(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=Ee(e);if(n!==void 0)return n;let r=-1,i=0;for(let e of Te){let n=t.lastIndexOf(e);n>r&&(r=n,i=n+e.length)}return r>=0?t.slice(i):t.split(`/`).slice(-3).join(`/`)}function De(e){if(e.length===0)return``;let t=e.map(e=>e.split(`/`)),n=t[0]??[],r=0;for(;r<n.length-1;){let e=n[r];if(!t.every(t=>t.length-1>r&&t[r]===e))break;r++}return r===0?``:`${n.slice(0,r).join(`/`)}/`}var Oe=new WeakMap;function ke(e){let t=Oe.get(e);if(t)return t;let n={name:``,path:``,directories:[],files:[]},r=e.filter(e=>e.kind===`file`&&!e.external),i=r.map(Ee),a=i.every(e=>e!==void 0),o=a?``:De(r.map(e=>(e.file??e.label).replace(/\\/g,`/`)));for(let[e,t]of r.entries()){let r=(t.file??t.label).replace(/\\/g,`/`),s=i[e],c=(a?s??F(t):o&&r.startsWith(o)?r.slice(o.length):F(t)).split(`/`).filter(Boolean),l=c.pop()??t.label,u=n;for(let e of c){let t=u.path?`${u.path}/${e}`:e,n=u.directories.find(t=>t.name===e);n||(n={name:e,path:t,directories:[],files:[]},u.directories.push(n)),u=n}u.files.push({...t,label:l})}let s=e=>{e.directories.sort((e,t)=>e.name.localeCompare(t.name)),e.files.sort((e,t)=>e.label.localeCompare(t.label)),e.directories.forEach(s)};return s(n),Oe.set(e,n),n}function Ae(e){let t=2166136261,n=e=>{for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)};for(let t of e.nodes)n(t.id);for(let r of e.edges)n(r.source),n(r.target),n(r.refType),t^=r.weight|0,t=Math.imul(t,16777619);return`${e.nodes.length}:${e.edges.length}:${t>>>0}`}function je(e,t,n,r){for(e.has(t)&&e.delete(t),e.set(t,n);e.size>r;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function Me(e,t){if(!e||!t)return!1;let n=j(e),r=j(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function Ne(e){let t=j(e),n=t.match(/\/packages\/([^/]+)\//);if(n?.[1])return`@wrongstack/${n[1]}`;let r=t.match(/\/apps\/([^/]+)\//);return r?.[1]?`app:${r[1]}`:`(root)`}function Pe(e,t){return t.kind===`package`?Ne(e.filePath)===(t.package??t.label):Me(e.filePath,t.file)?t.kind!==`symbol`||e.symbol?.id===t.id:!1}function I(e){let t=new Map;for(let n of e){let e=j(n.filePath),r=t.get(e);r?r.push(n):t.set(e,[n])}return t}function Fe(e,t){let n=new Map;if(t.length===0||e.length===0)return n;let r=I(t),i=new Map;for(let a of e){let e;if(a.kind===`package`){let n=a.package??a.label,r=i.get(n);r||(r=t.filter(e=>Ne(e.filePath)===n),i.set(n,r)),e=r}else if(a.file){let t=j(a.file),n=r.get(t);if(!n){n=[];for(let[e,i]of r)(e.endsWith(`/${t}`)||t.endsWith(`/${e}`))&&n.push(...i)}e=a.kind===`symbol`?n.filter(e=>e.symbol?.id===a.id):n}else e=[];e.length>0&&n.set(a.id,e)}return n}function Ie(e){if(e.length===0)return``;let t=`${e.length}`;for(let n=0;n<e.length;n++){let r=e[n];t+=`|${r.id??``}:${r.toolUseId??``}:${r.filePath}:${r.type}:${r.status??``}:${r.symbol?.id??``}:${r.timestamp}`}return t}function Le(e,t){let n=t.filter(t=>t.kind===`symbol`&&!t.external&&Me(t.file,e.filePath));if(n.length===0)return;if(e.line)return[...n].sort((e,t)=>(t.line??0)-(e.line??0)).find(t=>(t.line??0)<=e.line)??n[0];let r=e.summary.toLocaleLowerCase();return n.find(e=>e.label.length>2&&(r.includes(e.label.toLocaleLowerCase())||!!(e.signature&&r.includes(e.signature.toLocaleLowerCase()))))}var L=C();function Re({historyFile:e,fileHistory:n,onClose:r}){let{t:i}=t();return(0,L.jsxs)(`div`,{className:`absolute right-0 top-0 z-50 flex h-full w-[390px] max-w-[90%] flex-col border-l bg-card shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex h-12 items-center justify-between border-b px-4`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(u,{className:`h-4 w-4 shrink-0 text-warning`}),(0,L.jsx)(`span`,{className:`truncate font-mono text-[11px] font-semibold`,title:e,children:e})]}),(0,L.jsx)(`button`,{type:`button`,onClick:r,className:`flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,"aria-label":i(`activity:codeMap.closeActivity`),children:(0,L.jsx)(y,{className:`h-3.5 w-3.5`})})]}),(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:n.length===0?(0,L.jsx)(`p`,{className:`py-12 text-center text-[10px] text-muted-foreground`,children:i(`activity:codeMap.noActivityRecordedForThisFile`)}):n.map((e,t)=>(0,L.jsxs)(`div`,{className:`mb-1 flex items-start gap-2 border p-2 text-[10px]`,children:[(0,L.jsx)(`span`,{className:O(`border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/40 text-destructive`:e.type===`read`?`border-info/40 text-info`:`border-warning/40 text-warning`),children:e.type}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.toolName&&(0,L.jsxs)(`div`,{className:`mt-1`,children:[`via `,e.toolName]}),e.agent&&(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:e.agent}),e.summary&&(0,L.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:e.summary}),e.change&&(0,L.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,L.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,L.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.change.before&&(0,L.jsx)(`span`,{className:`ml-1 truncate text-destructive/80`,title:e.change.before,children:e.change.before}),e.change.after&&(0,L.jsxs)(`span`,{className:`truncate text-success/80`,title:e.change.after,children:[`→ `,e.change.after]})]}),(0,L.jsxs)(`div`,{className:`mt-1 flex gap-2 font-mono text-[8px] uppercase text-muted-foreground`,children:[(0,L.jsx)(`span`,{children:e.status??`observed`}),(0,L.jsx)(`span`,{children:e.source??`legacy`}),e.durationMs!==void 0&&(0,L.jsxs)(`span`,{children:[e.durationMs,`ms`]}),e.watcherConfirmed&&(0,L.jsx)(`span`,{className:`text-success`,children:i(`activity:codeMap.fsVerified`)})]})]})]},`${e.timestamp}-${t}`))}),(0,L.jsxs)(`div`,{className:`border-t px-4 py-2 font-mono text-[9px] text-muted-foreground`,children:[n.length,` events · newest first`]})]})}var R={package:{icon:fe,accent:`border-l-primary`,iconStyle:`bg-primary/12 text-primary`},file:{icon:re,accent:`border-l-info`,iconStyle:`bg-info/12 text-info`},symbol:{icon:E,accent:`border-l-success`,iconStyle:`bg-success/12 text-success`}},ze={call:`hsl(var(--primary))`,import:`hsl(var(--info))`,type_ref:`hsl(var(--success))`,inherit:`hsl(var(--warning))`,implement:`hsl(var(--destructive))`},z={read:`ring-2 ring-info/60 shadow-info/20`,write:`ring-2 ring-warning/70 shadow-warning/30`,edit:`ring-2 ring-warning/80 shadow-warning/40`,delete:`ring-2 ring-destructive/70 shadow-destructive/30`,search:`ring-2 ring-primary/55 shadow-primary/20`,memory:`ring-2 ring-success/60 shadow-success/30`,index:`ring-2 ring-info/50 shadow-info/20`,execute:`ring-2 ring-primary/55 shadow-primary/25`},B=[`bg-primary text-primary-foreground`,`bg-info text-info-foreground`,`bg-success text-success-foreground`,`bg-warning text-warning-foreground`,`bg-destructive text-destructive-foreground`];function Be(e){let t=e.trim().split(/[\s:_-]+/).filter(Boolean);return(t.length>1?`${t[0]?.[0]??``}${t[1]?.[0]??``}`:e.slice(0,2)).toLocaleUpperCase()}function V(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return B[Math.abs(t)%B.length]??B[0]}function Ve(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 82% 58%)`}var H=[`/packages/`,`/apps/`,`/crates/`,`/cmd/`,`/internal/`,`/pkg/`,`/src/`];function He(e){let t=e.replace(/\\/g,`/`),n=H.reduce((e,n)=>Math.max(e,t.lastIndexOf(n)),-1);return n>=0?t.slice(n+1):t.split(`/`).slice(-3).join(`/`)}function U(e){return[e.symbol?.name,e.line?`L${e.line}`:void 0].filter(Boolean).join(` · `)}function Ue({data:e}){let{t:n}=t(),{graphNode:r,selected:i,dimmed:a,incoming:o,outgoing:s,isActive:c,activityType:l,activeOperations:u}=e,d=R[r.kind],f=d.icon,p=r.kind!==`symbol`,m=r.kind===`symbol`?`${r.symbolKind??`symbol`}${r.line?` · L${r.line}`:``}`:r.kind===`file`?F(r):`${r.fileCount??0} files · ${r.symbolCount??0} symbols`;return(0,L.jsxs)(`div`,{className:O(`group relative w-[236px] border border-l-[3px] bg-card text-card-foreground shadow-[0_8px_24px_hsl(var(--shadow-color)/0.08)] transition-[opacity,box-shadow,border-color,background-color]`,d.accent,i&&`border-primary bg-primary/5 shadow-[0_0_0_2px_hsl(var(--primary)/0.18),0_16px_36px_hsl(var(--shadow-color)/0.18)]`,r.external&&`border-dashed bg-muted/75`,a&&`opacity-25 grayscale`,c&&l&&z[l]),children:[u.length>0&&(0,L.jsxs)(`div`,{className:`absolute -top-5 left-2 z-20 flex max-w-[210px] items-center gap-1`,children:[u.slice(0,4).map(e=>{let t=e.agentName??e.agent??`External`,n=`${e.sessionId??`none`}:${e.agentId??t}`;return(0,L.jsxs)(`span`,{className:O(`flex h-6 items-center gap-1 border-2 border-background px-1.5 font-mono text-[8px] font-bold shadow-md`,V(n)),title:`${t} · ${e.type} ${U(e)}`,children:[(0,L.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-current`}),Be(t),e.symbol&&(0,L.jsx)(`span`,{className:`max-w-[80px] truncate`,children:e.symbol.name})]},e.id??`${n}:${e.filePath}`)}),u.length>4&&(0,L.jsxs)(`span`,{className:`border bg-card px-1 font-mono text-[8px] shadow`,children:[`+`,u.length-4]})]}),(0,L.jsx)(le,{type:`target`,position:h.Left,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`}),(0,L.jsxs)(`button`,{type:`button`,className:`block w-full text-left`,onClick:t=>{if(t.shiftKey&&r.file){e.onShowHistory(r.file);return}e.onSelect(r)},onDoubleClick:()=>p&&e.onOpen(r),"aria-label":`${r.kind} ${r.label}`,children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-3 p-3 pr-10`,children:[(0,L.jsx)(`span`,{className:O(`flex h-8 w-8 shrink-0 items-center justify-center border`,d.iconStyle),children:(0,L.jsx)(f,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[(0,L.jsx)(`span`,{children:r.kind}),r.external&&(0,L.jsx)(`span`,{className:`border border-border px-1 py-0.5 text-[8px] text-warning`,children:`external`}),r.lang&&(0,L.jsx)(`span`,{className:`ml-auto font-mono normal-case tracking-normal`,children:r.lang})]}),(0,L.jsx)(`div`,{className:`truncate font-mono text-[13px] font-semibold`,title:r.label,children:r.label}),(0,L.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,title:m,children:m})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 border-t bg-muted/30 px-3 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,L.jsxs)(`span`,{title:n(`activity:codeMapVisuals.incomingRelationships`),children:[`← `,o]}),(0,L.jsxs)(`span`,{title:n(`activity:codeMapVisuals.outgoingRelationships`),children:[`→ `,s]}),r.symbolCount!==void 0&&r.kind===`file`&&(0,L.jsxs)(`span`,{className:`ml-auto`,children:[r.symbolCount,` sym`]}),c&&(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-bold text-warning`,children:[(0,L.jsx)(_,{className:`h-2.5 w-2.5 animate-pulse`}),` LIVE`]})]})]}),p&&(0,L.jsx)(`button`,{type:`button`,className:`absolute right-2 top-2 z-10 flex h-7 w-7 items-center justify-center border border-transparent text-muted-foreground opacity-0 transition hover:border-border hover:bg-muted hover:text-foreground group-hover:opacity-100 focus:opacity-100`,onClick:()=>e.onOpen(r),title:r.kind===`package`?`Open file map`:`Open symbol map`,"aria-label":`Open ${r.label} map`,children:(0,L.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,L.jsx)(le,{type:`source`,position:h.Right,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`})]})}function We(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Ge(e,t){return e.graphNode===t.graphNode&&e.selected===t.selected&&e.dimmed===t.dimmed&&e.incoming===t.incoming&&e.outgoing===t.outgoing&&e.isActive===t.isActive&&e.activityType===t.activityType&&e.onSelect===t.onSelect&&e.onOpen===t.onOpen&&e.onShowHistory===t.onShowHistory&&We(e.activeOperations,t.activeOperations)}var Ke={codemap:(0,k.memo)(Ue,(e,t)=>Ge(e.data,t.data))},qe={nodes:[],edges:[]};function Je(e){return/Authentication required|Unauthorized/i.test(e)}function Ye({loading:e,error:n,graph:r,canvasNodeCount:i,flowNodes:a,flowEdges:o,onNodesChange:s,onEdgesChange:c,agentTrailCount:l}){let{t:u}=t();return(0,L.jsxs)(L.Fragment,{children:[e&&(0,L.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/75 backdrop-blur-sm`,children:[(0,L.jsx)(oe,{className:`h-7 w-7 animate-spin text-primary`}),(0,L.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-widest text-muted-foreground`,children:u(`activity:codeMap.mappingRelationships`)})]}),n&&!e&&(0,L.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,L.jsx)(p,{className:`h-10 w-10 text-destructive`}),(0,L.jsx)(`p`,{className:`font-mono text-sm text-destructive`,children:n}),!Je(n)&&(0,L.jsxs)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:[`The map needs a codebase index. Run`,` `,(0,L.jsx)(`code`,{className:`border bg-muted px-1.5 py-0.5`,children:`codebase-index`}),` `,u(`activity:codeMap.onceThenReopenThisView`)]})]}),!e&&!n&&r.nodes.length===0&&(0,L.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,L.jsx)(p,{className:`h-8 w-8 opacity-40`}),(0,L.jsx)(`p`,{className:`text-xs`,children:u(`activity:codeMap.noIndexedNodesAtThisLevel`)})]}),!e&&!n&&r.nodes.length>1&&r.edges.length===0&&(0,L.jsxs)(`div`,{className:`pointer-events-none absolute left-1/2 top-14 z-10 -translate-x-1/2 border border-warning/40 bg-warning/10 px-3 py-2 text-center shadow backdrop-blur`,children:[(0,L.jsx)(`div`,{className:`font-mono text-[9px] font-bold uppercase tracking-wider text-warning`,children:u(`activity:codeMap.noResolvedRelationsInThisScope`)}),(0,L.jsx)(`div`,{className:`mt-0.5 text-[8px] text-muted-foreground`,children:u(`activity:codeMap.theUpgradedIndexWillRebuildAnd`)})]}),!n&&r.nodes.length>0&&(0,L.jsxs)(b,{nodes:a,edges:o,onNodesChange:s,onEdgesChange:c,nodeTypes:Ke,nodesConnectable:!1,nodesDraggable:!1,edgesFocusable:!1,elementsSelectable:!1,onlyRenderVisibleElements:!0,minZoom:.08,maxZoom:2.2,proOptions:{hideAttribution:!0},children:[(0,L.jsx)(ce,{variant:x.Dots,gap:i>60?32:22,size:1,color:`hsl(var(--muted-foreground))`,className:`!opacity-25`}),(0,L.jsx)(g,{position:`bottom-left`,showInteractive:!1,className:`!border !border-border !bg-card !shadow-md [&>button]:!border-border [&>button]:!bg-card [&>button]:!fill-foreground`}),i<=48&&(0,L.jsx)(v,{position:`bottom-right`,pannable:!0,zoomable:!0,className:`!h-[112px] !w-[180px] !border !border-border !bg-card !shadow-md`,maskColor:`hsl(var(--background) / 0.72)`,nodeColor:e=>{let t=e.data?.graphNode.kind;return t===`package`?`hsl(var(--primary))`:t===`file`?`hsl(var(--info))`:`hsl(var(--success))`}})]}),(0,L.jsxs)(`div`,{className:`pointer-events-none absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-3 border bg-card/90 px-3 py-1.5 font-mono text-[8px] text-muted-foreground shadow backdrop-blur`,children:[Object.entries(ze).map(([e,t])=>(0,L.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`span`,{className:`h-0.5 w-3`,style:{backgroundColor:t}}),e.replace(`_`,` `)]},e)),(0,L.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,"data-testid":`agent-trail-count`,children:[(0,L.jsx)(`span`,{className:`w-4 border-t-2 border-dashed border-primary`}),`agent trail`,l>0?` ×${l}`:``]})]})]})}function Xe({layout:e,canvasMode:r,edgeFilter:i,canvasNodeCount:a,graphNodeCount:o,onLayoutChange:s,onCanvasModeChange:c,onEdgeFilterChange:l}){let{t:u}=t();return(0,L.jsxs)(`div`,{className:`pointer-events-none absolute left-3 right-3 top-3 z-10 flex items-center gap-2`,children:[(0,L.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,L.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`layers`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>s(`layers`),children:[(0,L.jsx)(de,{className:`h-3 w-3`}),` `,u(`activity:codeMap.layers`)]}),(0,L.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`orbit`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>s(`orbit`),children:[(0,L.jsx)(n,{className:`h-3 w-3`}),` `,u(`activity:codeMap.relations`)]})]}),(0,L.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,L.jsxs)(`button`,{type:`button`,className:O(`h-8 border-r px-2.5 font-mono text-[9px] font-bold`,r===`smart`?`bg-success text-success-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>c(`smart`),title:u(`activity:codeMap.keepTheFullTreeShowTheStrongestRelationsAndSelectedNeighbourhood`),children:[`SMART `,a,`/`,o]}),(0,L.jsx)(`button`,{type:`button`,className:O(`h-8 px-2.5 font-mono text-[9px] font-bold`,r===`all`?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>c(`all`),title:u(`activity:codeMap.renderEveryNodeAndRelationInThisScope`),children:u(`activity:codeMap.all`)})]}),(0,L.jsx)(`div`,{className:`pointer-events-auto ml-auto flex max-w-[60%] overflow-x-auto border bg-card/95 shadow-md backdrop-blur`,children:[`all`,`import`,`call`,`type_ref`,`inherit`,`implement`].map(e=>(0,L.jsx)(`button`,{type:`button`,className:O(`h-8 whitespace-nowrap border-r px-2.5 font-mono text-[9px] last:border-r-0`,i===e?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>l(e),children:e===`all`?`ALL LINKS`:e.replace(`_`,` `).toUpperCase()},e))})]})}function Ze({scope:e,graph:n,agentPresences:a,edgeWeight:o,connectedNodeCount:s,navigate:c}){let{t:l}=t();return(0,L.jsxs)(`header`,{className:`flex h-[62px] shrink-0 items-center gap-4 border-b bg-card px-4`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-[220px] items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center border border-primary bg-primary/10 text-primary`,children:(0,L.jsx)(p,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`font-display text-sm font-semibold tracking-tight`,children:l(`activity:codeMap.codeAtlas`)}),(0,L.jsx)(`p`,{className:`text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:l(`activity:codeMap.architectureIntelligence`)})]})]}),(0,L.jsxs)(`nav`,{className:`flex min-w-0 flex-1 items-center gap-1 font-mono text-[10px]`,"aria-label":l(`activity:codeMap.codeMapBreadcrumb`),children:[e.level!==`packages`&&(0,L.jsx)(`button`,{type:`button`,className:`mr-1 flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,onClick:()=>{e.level===`symbols`?c({level:`files`,package:e.package??`(root)`}):c({level:`packages`})},"aria-label":l(`activity:codeMap.back`),children:(0,L.jsx)(i,{className:`h-3.5 w-3.5`})}),(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-1.5 py-1 text-muted-foreground hover:text-foreground`,onClick:()=>c({level:`packages`}),children:[(0,L.jsx)(r,{className:`h-3 w-3`}),` workspace`]}),e.level!==`packages`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(D,{className:`h-3 w-3 text-muted-foreground`}),(0,L.jsx)(`button`,{type:`button`,className:`max-w-[220px] truncate px-1.5 py-1 hover:text-primary`,onClick:()=>c({level:`files`,package:e.package??`(root)`}),children:e.package??`(root)`})]}),e.level===`symbols`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(D,{className:`h-3 w-3 text-muted-foreground`}),(0,L.jsx)(`span`,{className:`truncate px-1.5 py-1 text-primary`,children:F({id:``,label:e.file,kind:`file`,file:e.file,package:e.package})})]})]}),(0,L.jsxs)(`div`,{className:`hidden items-center gap-5 xl:flex`,children:[(0,L.jsxs)(`div`,{className:O(`flex h-8 items-center gap-2 border px-2.5`,a.length>0?`border-success/50 bg-success/10 text-success`:`text-muted-foreground`),children:[(0,L.jsx)(_,{className:O(`h-3 w-3`,a.length>0&&`animate-pulse`)}),(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`font-mono text-[10px] font-bold`,children:[a.length,` LIVE`]}),(0,L.jsx)(`div`,{className:`text-[7px] uppercase tracking-wider`,children:`agents`})]})]}),(0,L.jsxs)(`div`,{className:`text-right`,children:[(0,L.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:n.nodes.length}),(0,L.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`nodes`})]}),(0,L.jsxs)(`div`,{className:`text-right`,children:[(0,L.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:n.edges.length}),(0,L.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`links`})]}),(0,L.jsxs)(`div`,{className:`text-right`,children:[(0,L.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:o}),(0,L.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`references`})]}),(0,L.jsxs)(`div`,{className:`text-right`,children:[(0,L.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:s}),(0,L.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`connected`})]})]})]})}function Qe({activity:e}){return(0,L.jsx)(`span`,{className:O(`shrink-0 border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/50 bg-destructive/10 text-destructive`:e.type===`read`?`border-info/50 bg-info/10 text-info`:e.type===`search`||e.type===`index`?`border-primary/50 bg-primary/10 text-primary`:`border-warning/50 bg-warning/10 text-warning`),children:e.filePath.startsWith(`(tool:`)?e.toolName:e.type})}function W({activity:e,onLocate:n,showAgent:r=!1}){let{t:i}=t(),a=e.agentName??e.agent??`External process`,o=`${e.sessionId??`none`}:${e.agentId??a}`;return(0,L.jsxs)(`button`,{type:`button`,className:`group flex w-full items-start gap-2 border-b px-3 py-2 text-left last:border-b-0 hover:bg-muted/70`,onClick:()=>!e.filePath.startsWith(`(`)&&n(e),title:`Locate ${e.filePath}`,children:[r&&(0,L.jsx)(`span`,{className:O(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center font-mono text-[8px] font-black`,V(o)),children:Be(a)}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(Qe,{activity:e}),r&&(0,L.jsx)(`span`,{className:`truncate text-[9px] font-semibold`,children:a}),e.status===`active`&&(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[8px] font-bold text-success`,children:[(0,L.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-success`}),` `,i(`activity:codeMap.live`)]}),e.watcherConfirmed&&(0,L.jsx)(m,{className:`ml-auto h-3 w-3 text-success`,"aria-label":i(`activity:codeMap.filesystemConfirmed`)}),e.attribution===`correlated`&&!e.watcherConfirmed&&(0,L.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-warning`,title:i(`activity:codeMap.correlatedFromTheOnlyActiveTool`),children:i(`activity:codeMap.correlated`)}),e.attribution===`external`&&(0,L.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-destructive`,children:`external`})]}),(0,L.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px] font-semibold`,title:e.filePath,children:He(e.filePath)}),(e.symbol||e.line)&&(0,L.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 truncate font-mono text-[8px] text-success`,children:[(0,L.jsx)(f,{className:`h-2.5 w-2.5 shrink-0`}),e.symbol?.name??`line ${e.line}`,e.symbol?.kind&&(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,e.symbol.kind]})]}),e.change&&(0,L.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,L.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,L.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.durationMs!==void 0&&(0,L.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[e.durationMs,`ms`]})]}),e.summary&&e.summary!==e.toolName&&(0,L.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[8px] leading-3 text-muted-foreground`,children:e.summary})]}),!e.filePath.startsWith(`(`)&&(0,L.jsx)(w,{className:`mt-1 h-3 w-3 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100`})]})}function $e({presences:e,onLocate:n}){let{t:r}=t();return e.length===0?null:(0,L.jsxs)(`section`,{className:`pointer-events-auto absolute left-3 top-14 z-20 w-[304px] border bg-card/95 shadow-xl backdrop-blur`,children:[(0,L.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,L.jsx)(_,{className:`h-3.5 w-3.5 animate-pulse text-success`}),(0,L.jsx)(`h2`,{className:`text-[9px] font-black uppercase tracking-[0.18em]`,children:r(`activity:codeMap.liveAgentOperations`)}),(0,L.jsxs)(`span`,{className:`ml-auto bg-success px-1.5 py-0.5 font-mono text-[8px] font-bold text-success-foreground`,children:[e.length,` ONLINE`]})]}),(0,L.jsx)(`div`,{className:`max-h-[330px] overflow-y-auto`,children:e.map(e=>(0,L.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/35 px-3 py-1.5`,children:[(0,L.jsx)(`span`,{className:O(`flex h-6 w-6 items-center justify-center font-mono text-[8px] font-black`,V(e.key)),children:Be(e.agentName)}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`truncate text-[9px] font-bold`,children:e.agentName}),(0,L.jsxs)(`div`,{className:`truncate font-mono text-[7px] text-muted-foreground`,children:[`session `,e.sessionId.slice(0,12),` · agent `,e.agentId.slice(0,12)]})]}),(0,L.jsxs)(`span`,{className:`font-mono text-[8px] text-success`,children:[e.operations.length,` op`]})]}),e.operations.map(e=>(0,L.jsx)(W,{activity:e,onLocate:n},e.id??`${e.toolUseId}:${e.filePath}`))]},e.key))})]})}function et({paused:e,followLive:n,agentFilter:r,agents:i,onTogglePaused:o,onToggleFollow:s,onAgentFilter:c}){let{t:l}=t();return(0,L.jsxs)(`div`,{className:`pointer-events-auto absolute right-3 top-14 z-20 flex h-9 items-center border bg-card/95 shadow-lg backdrop-blur`,children:[(0,L.jsxs)(`button`,{type:`button`,className:O(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,n?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:s,title:l(`activity:codeMap.automaticallyEnterTheFileFunctionUsedByTheNewestVisibleAgent`),children:[(0,L.jsx)(f,{className:`h-3 w-3`}),` `,l(`activity:codeMap.follow`)]}),(0,L.jsxs)(`button`,{type:`button`,className:O(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,e?`bg-warning text-warning-foreground`:`text-success hover:bg-success/10`),onClick:o,title:e?`Resume the live telemetry stream`:`Freeze the current telemetry frame`,children:[e?(0,L.jsx)(a,{className:`h-3 w-3`}):(0,L.jsx)(S,{className:`h-3 w-3`}),e?`Resume`:`Live`]}),(0,L.jsxs)(`label`,{className:`flex h-full items-center gap-1.5 px-2 text-[8px] uppercase text-muted-foreground`,children:[l(`activity:codeMap.agent`),(0,L.jsxs)(`select`,{"aria-label":l(`activity:codeMap.filterCodemapByAgentAndSession`),className:`h-6 max-w-[170px] border bg-background px-1.5 font-mono text-[8px] text-foreground outline-none focus:border-primary`,value:r,onChange:e=>c(e.target.value),children:[(0,L.jsx)(`option`,{value:`all`,children:l(`activity:codeMap.allAgents`)}),i.map(e=>(0,L.jsxs)(`option`,{value:e.key,children:[e.agentName,` · `,e.sessionId.slice(0,10)]},e.key))]})]})]})}function tt({activeOperations:e,recentActivities:n,activityTotalCount:r,onLocate:i}){let{t:a}=t();return(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[e.length>0&&(0,L.jsxs)(`section`,{className:`border-b`,children:[(0,L.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b bg-success/5 px-3`,children:[(0,L.jsx)(_,{className:`h-3 w-3 animate-pulse text-success`}),(0,L.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:a(`activity:codeMap.activeNow`)}),(0,L.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:e.length})]}),e.map(e=>(0,L.jsx)(W,{activity:e,onLocate:i,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,L.jsx)(u,{className:`h-3 w-3 text-muted-foreground`}),(0,L.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:a(`activity:codeMap.eventStream`)}),(0,L.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] text-muted-foreground`,children:[r,` total`]})]}),n.length>0?n.map((e,t)=>(0,L.jsx)(W,{activity:e,onLocate:i,showAgent:!0},e.id??`${e.timestamp}:${t}`)):(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-7 py-16 text-center`,children:[(0,L.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center border bg-muted text-muted-foreground`,children:(0,L.jsx)(d,{className:`h-5 w-5`})}),(0,L.jsx)(`h3`,{className:`text-xs font-semibold`,children:a(`activity:codeMap.selectANodeOrWaitFor`)}),(0,L.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-muted-foreground`,children:a(`activity:codeMap.relationsAppearOnSelectionToolCalls`)})]})]})]})}function G({node:e,incomingCount:n,outgoingCount:r,onOpenNode:i,onOpenActivity:a}){let{t:o}=t(),s=R[e.kind].icon;return(0,L.jsxs)(`div`,{className:`border-b bg-muted/25 p-3`,children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:O(`flex h-8 w-8 items-center justify-center border`,R[e.kind].iconStyle),children:(0,L.jsx)(s,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`text-[8px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[e.external?`external `:``,e.kind]}),(0,L.jsx)(`div`,{className:`truncate font-mono text-xs font-semibold`,title:e.label,children:e.label})]})]}),(0,L.jsx)(`div`,{className:`break-all font-mono text-[9px] leading-relaxed text-muted-foreground`,children:e.file?F(e):e.package}),e.signature&&(0,L.jsx)(`pre`,{className:`mt-3 overflow-x-auto border bg-background p-2 font-mono text-[9px] leading-relaxed text-foreground`,children:e.signature}),(0,L.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 border`,children:[(0,L.jsx)(nt,{value:n,label:o(`activity:codeMap.incoming`),className:`border-r text-info`}),(0,L.jsx)(nt,{value:r,label:o(`activity:codeMap.outgoing`),className:`border-r text-primary`}),(0,L.jsx)(nt,{value:e.symbolCount??e.fileCount??e.line??`—`,label:e.kind===`package`?`files`:e.kind===`file`?`symbols`:`line`})]}),(0,L.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[e.kind!==`symbol`&&(0,L.jsxs)(`button`,{type:`button`,className:`flex h-7 flex-1 items-center justify-center gap-1.5 border bg-foreground text-[9px] font-semibold uppercase tracking-wider text-background hover:opacity-90`,onClick:()=>i(e),children:[(0,L.jsx)(w,{className:`h-3 w-3`}),` Open `,e.kind===`package`?`files`:`symbols`]}),e.file&&(0,L.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center justify-center gap-1.5 border px-2 text-[9px] uppercase text-muted-foreground hover:bg-muted`,onClick:()=>a(e.file),children:[(0,L.jsx)(u,{className:`h-3 w-3`}),` `,o(`activity:codeMap.activity`)]})]})]})}function nt({value:e,label:t,className:n}){return(0,L.jsxs)(`div`,{className:O(`p-2 text-center`,n),children:[(0,L.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:e}),(0,L.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:t})]})}function K(e){let{t:n}=t(),{title:r,subtitle:i,items:a,graph:o,selectedId:s,expanded:c,onToggle:l,onSelect:u}=e;return(0,L.jsxs)(`section`,{className:`border-b py-3`,children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-end justify-between px-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em]`,children:r}),(0,L.jsx)(`p`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:i})]}),(0,L.jsx)(`span`,{className:`border bg-muted px-1.5 py-0.5 font-mono text-[9px]`,children:a.length})]}),a.length===0?(0,L.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-muted-foreground`,children:n(`activity:codeMap.noRelationshipsInThisView`)}):a.map(e=>{let t=`${r}:${e.node.id}`,n=c.has(t),i=[...ye(o,e.node.id,`incoming`),...ye(o,e.node.id,`outgoing`)].filter((e,t,n)=>e.node.id!==s&&n.findIndex(t=>t.node.id===e.node.id)===t).slice(0,8);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`group flex min-h-9 items-center gap-1 px-2 hover:bg-muted/70`,children:[(0,L.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>i.length>0&&l(t),"aria-label":`${n?`Collapse`:`Expand`} relation ${e.node.label}`,children:i.length>0?n?(0,L.jsx)(T,{className:`h-3 w-3`}):(0,L.jsx)(D,{className:`h-3 w-3`}):(0,L.jsx)(`span`,{className:`h-px w-2 bg-border`})}),(0,L.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 py-1 text-left`,onClick:()=>u(e.node),children:[(0,L.jsx)(`span`,{className:`block truncate font-mono text-[10px] font-semibold`,title:e.node.label,children:e.node.label}),(0,L.jsx)(`span`,{className:`block truncate text-[9px] text-muted-foreground`,children:e.node.package??e.node.symbolKind??e.node.kind})]}),(0,L.jsx)(`span`,{className:`border px-1 py-0.5 font-mono text-[8px] text-muted-foreground`,children:e.edge.refType}),(0,L.jsxs)(`span`,{className:`w-5 text-right font-mono text-[9px] text-muted-foreground`,children:[`×`,e.edge.weight]})]}),n&&i.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`relative flex h-7 w-full items-center gap-2 border-l border-border pl-11 pr-3 text-left text-[9px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>u(e.node),children:[(0,L.jsx)(`span`,{className:`absolute left-7 top-1/2 h-px w-3 bg-border`}),(0,L.jsx)(d,{className:`h-3 w-3 shrink-0`}),(0,L.jsx)(`span`,{className:`truncate font-mono`,children:e.node.label}),(0,L.jsx)(`span`,{className:`ml-auto font-mono opacity-70`,children:e.edge.refType})]},`${t}:${e.node.id}`))]},t)})]})}function rt({selectedNode:e,incoming:n,outgoing:r,filteredGraph:i,expandedRelations:a,activeOperations:o,recentActivities:s,activityTotalCount:c,selectedActivities:l,onClearSelection:u,onOpenNode:d,onOpenActivity:f,onLocateActivity:p,onToggleRelation:m,onSelectNode:h}){let{t:g}=t();return(0,L.jsxs)(`aside`,{className:`flex w-[326px] shrink-0 flex-col border-l bg-card/80`,children:[(0,L.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b px-3`,children:[(0,L.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:g(`activity:codeMap.relationInspector`)}),e&&(0,L.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground`,onClick:u,"aria-label":g(`activity:codeMap.clearSelection`),children:(0,L.jsx)(y,{className:`h-3.5 w-3.5`})})]}),e?(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,L.jsx)(G,{node:e,incomingCount:n.length,outgoingCount:r.length,onOpenNode:d,onOpenActivity:f}),l.length>0&&(0,L.jsxs)(`section`,{className:`border-b bg-success/5 py-2`,children:[(0,L.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-3`,children:[(0,L.jsx)(_,{className:`h-3 w-3 animate-pulse text-success`}),(0,L.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:g(`activity:codeMap.agentsOnThisNode`)}),(0,L.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:l.length})]}),l.map(e=>(0,L.jsx)(W,{activity:e,onLocate:p,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,L.jsx)(K,{title:g(`activity:codeMap.incoming`),subtitle:g(`activity:codeMap.whoDependsOnThis`),items:n,graph:i,selectedId:e.id,expanded:a,onToggle:m,onSelect:h}),(0,L.jsx)(K,{title:g(`activity:codeMap.outgoing`),subtitle:g(`activity:codeMap.whatThisDependsOn`),items:r,graph:i,selectedId:e.id,expanded:a,onToggle:m,onSelect:h})]}):(0,L.jsx)(tt,{activeOperations:o,recentActivities:s,activityTotalCount:c,onLocate:p})]})}function it({node:e,onSelect:t,virtual:n}){let r=R[e.kind].icon;return(0,L.jsxs)(`button`,{type:`button`,"data-index":n?.index,ref:n?e=>n.measureElement(e):void 0,className:O(`min-h-8 items-center gap-2 px-3 py-1 text-left hover:bg-muted`,n?`absolute left-0 flex w-full`:`flex w-full`),style:n?{transform:`translateY(${n.start}px)`}:void 0,onClick:()=>t(e),children:[(0,L.jsx)(r,{className:O(`h-3.5 w-3.5 shrink-0`,e.kind===`package`?`text-primary`:e.kind===`file`?`text-info`:`text-success`)}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block truncate font-mono text-[10px]`,children:e.label}),(0,L.jsx)(`span`,{className:`block truncate text-[8px] text-muted-foreground`,children:e.file??e.package??e.symbolKind})]}),(0,L.jsx)(`span`,{className:`text-[8px] uppercase text-muted-foreground`,children:e.kind.slice(0,3)})]},e.id)}var q=80,J=40;function at(e,t){if(!e||t.size===0)return!1;let n=j(e);if(t.has(n))return!0;for(let e of t)if(e.endsWith(`/${n}`)||n.endsWith(`/${e}`))return!0;return!1}var ot=(0,k.memo)(function e(n){let{t:r}=t(),{directory:i,packageName:a,depth:o,expandedDirectories:l,expandedFiles:u,loadingBranches:d,graphForFile:f,onToggleDirectory:p,onToggleFile:m,onSelectFile:h,onOpenFile:g,onSelectSymbol:ee,selectedId:v,activeFileNorms:y,activeSymbolIds:b,revealAllKeys:te,onRevealAll:ne}=n,x=`files:${a}:${i.path||`.`}`,S=te.has(x)?i.files:i.files.slice(0,q),C=i.files.length-S.length;return(0,L.jsxs)(L.Fragment,{children:[i.directories.map(t=>{let r=`${a}:${t.path}`,i=l.has(r);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:8+o*12},onClick:()=>p(r),children:[i?(0,L.jsx)(T,{className:`h-3 w-3`}):(0,L.jsx)(D,{className:`h-3 w-3`}),i?(0,L.jsx)(c,{className:`h-3.5 w-3.5 text-warning`}):(0,L.jsx)(s,{className:`h-3.5 w-3.5 text-warning`}),(0,L.jsx)(`span`,{className:`truncate`,children:t.name})]}),i&&(0,L.jsx)(e,{...n,directory:t,depth:o+1})]},r)}),S.map(e=>{let t=u.has(e.file??e.id),n=M({level:`symbols`,file:e.file??e.label}),i=(e.file?f(e.file):void 0)?.nodes.filter(t=>t.kind===`symbol`&&t.file===e.file&&!t.external)??[],a=`symbols:${e.file??e.id}`,s=te.has(a)?i:i.slice(0,J),c=i.length-s.length,l=at(e.file,y);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:O(`group flex h-7 items-center pr-1 text-[11px] hover:bg-muted`,v===e.id&&`bg-primary/10 text-primary`),style:{paddingLeft:8+o*12},children:[(0,L.jsx)(`button`,{type:`button`,className:`flex h-6 w-4 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>m(e),"aria-label":`${t?`Collapse`:`Expand`} ${e.label}`,children:d.has(n)?(0,L.jsx)(oe,{className:`h-3 w-3 animate-spin`}):t?(0,L.jsx)(T,{className:`h-3 w-3`}):(0,L.jsx)(D,{className:`h-3 w-3`})}),(0,L.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>h(e),onDoubleClick:()=>g(e),children:[(0,L.jsx)(re,{className:`h-3.5 w-3.5 shrink-0 text-info`}),l&&(0,L.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 animate-pulse bg-success`,title:r(`activity:codeMap.liveOperation`)}),(0,L.jsx)(`span`,{className:`truncate font-mono`,title:e.file,children:e.label}),(0,L.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.symbolCount??0})]}),(0,L.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>g(e),title:r(`activity:codeMap.openSymbolMap`),"aria-label":`Open ${e.label} map`,children:(0,L.jsx)(w,{className:`h-3 w-3`})})]}),t&&s.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:O(`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[10px] hover:bg-muted`,v===e.id?`bg-primary/10 text-primary`:`text-muted-foreground`),style:{paddingLeft:38+o*12},onClick:()=>ee(e),children:[(0,L.jsx)(E,{className:`h-3 w-3 shrink-0 text-success`}),b.has(e.id)&&(0,L.jsx)(_,{className:`h-3 w-3 shrink-0 animate-pulse text-success`}),(0,L.jsx)(`span`,{className:`truncate font-mono`,children:e.label}),e.line&&(0,L.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] opacity-60`,children:[`:`,e.line]})]},e.id)),t&&c>0&&(0,L.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:38+o*12},onClick:()=>ne(a),children:[`Show `,c,` more symbols`]})]},e.id)}),C>0&&(0,L.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:8+o*12},onClick:()=>ne(x),children:[`Show `,C,` more files`]})]})});function st({rootGraph:e,search:n,searchInput:r,searchResults:i,virtualizeSearch:a,searchVirtualizer:o,treeScrollRef:s,selectedId:c,expandedPackages:l,expandedDirectories:u,expandedFiles:d,loadingBranches:f,activeFileNorms:p,activeSymbolIds:m,revealAllKeys:h,packageGraph:g,graphForFile:_,navigate:v,togglePackage:b,toggleDirectory:te,toggleFile:ne,revealAllTree:x,selectFileFromTree:S,selectSymbolFromTree:re,selectSearchResult:C,handleOpenNode:ie,onSearchInputChange:ae,onSearchChange:se}){let{t:E}=t();return(0,L.jsxs)(`aside`,{className:`flex w-[286px] shrink-0 flex-col border-r bg-card/70`,children:[(0,L.jsxs)(`div`,{className:`border-b p-3`,children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,L.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:E(`activity:codeMapTree.codeTree`)}),(0,L.jsxs)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:[e.nodes.length,` roots`]})]}),(0,L.jsxs)(`label`,{className:`flex h-8 items-center gap-2 border bg-background px-2 focus-within:border-primary`,children:[(0,L.jsx)(ee,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,L.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent font-mono text-[10px] outline-none placeholder:text-muted-foreground`,value:r,onChange:e=>ae(e.target.value),placeholder:E(`activity:codeMapTree.findPackageFileSymbol`)}),r&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>{ae(``),se(``)},"aria-label":E(`activity:codeMapTree.clearSearch`),children:(0,L.jsx)(y,{className:`h-3 w-3 text-muted-foreground`})})]})]}),(0,L.jsx)(`div`,{ref:s,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:n.trim()?(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`px-3 pb-2 text-[9px] text-muted-foreground`,children:[i.length,` loaded-map results`]}),i.length===0?(0,L.jsxs)(`p`,{className:`px-3 py-8 text-center text-[10px] text-muted-foreground`,children:[E(`activity:codeMapTree.noMatchInLoadedBranches`),(0,L.jsx)(`br`,{}),E(`activity:codeMapTree.expandAPackageToSearchIts`)]}):a?(0,L.jsx)(`div`,{style:{height:`${o.getTotalSize()}px`,width:`100%`,position:`relative`},children:o.getVirtualItems().map(e=>{let t=i[e.index];return t?(0,L.jsx)(it,{node:t,onSelect:C,virtual:{index:e.index,start:e.start,measureElement:o.measureElement}},t.id):null})}):i.map(e=>(0,L.jsx)(it,{node:e,onSelect:C},e.id))]}):e.nodes.map(e=>{let t=e.package??e.label,n=l.has(t),r=M({level:`files`,package:t}),i=g(t),a=i?ke(i.nodes):void 0;return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:O(`group flex h-8 items-center px-2 hover:bg-muted`,c===e.id&&`bg-primary/10 text-primary`),children:[(0,L.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 items-center justify-center text-muted-foreground`,onClick:()=>b(e),"aria-label":`${n?`Collapse`:`Expand`} ${t}`,children:f.has(r)?(0,L.jsx)(oe,{className:`h-3 w-3 animate-spin`}):n?(0,L.jsx)(T,{className:`h-3 w-3`}):(0,L.jsx)(D,{className:`h-3 w-3`})}),(0,L.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>v({level:`packages`},e.id),onDoubleClick:()=>v({level:`files`,package:t}),children:[(0,L.jsx)(fe,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,L.jsx)(`span`,{className:`truncate font-mono text-[10px] font-semibold`,children:e.label}),(0,L.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.fileCount??0})]}),(0,L.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>v({level:`files`,package:t}),title:E(`activity:codeMapTree.openFileMap`),"aria-label":`Open ${t} map`,children:(0,L.jsx)(w,{className:`h-3 w-3`})})]}),n&&a&&(0,L.jsx)(ot,{directory:a,packageName:t,depth:1,expandedDirectories:u,expandedFiles:d,loadingBranches:f,graphForFile:_,onToggleDirectory:te,onToggleFile:ne,onSelectFile:S,onOpenFile:ie,onSelectSymbol:re,selectedId:c,activeFileNorms:p,activeSymbolIds:m,revealAllKeys:h,onRevealAll:x})]},e.id)})}),(0,L.jsxs)(`div`,{className:`border-t px-3 py-2 text-[9px] leading-relaxed text-muted-foreground`,children:[E(`activity:codeMapTree.clickToFocusDoubleClickTo`),(0,L.jsx)(`br`,{}),E(`activity:codeMapTree.branchesStayOpenWhileTheMap`)]})]})}function ct(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a?a.type===t.type&&a.position.x===t.position.x&&a.position.y===t.position.y&&Ge(a.data,t.data)?(e[i]!==a&&(r=!0),a):(r=!0,{...a,...t,measured:a.measured}):(r=!0,t)});return r?i:e}function lt(e){return e.data?.renderKey}function ut(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a&<(a)===lt(t)?(e[i]!==a&&(r=!0),a):(r=!0,t)});return r?i:e}function dt(){let[e,t]=(0,k.useState)({level:`packages`}),n=M(e),[r,i]=(0,k.useState)(qe),[a,o]=(0,k.useState)(!0),[s,c]=(0,k.useState)(null),[u,d]=(0,k.useState)(null),[f,p]=(0,k.useState)(`layers`),[m,h]=(0,k.useState)(`smart`),[g,ee]=(0,k.useState)(`all`),[_,v]=(0,k.useState)(``),[y,b]=(0,k.useState)(``),[x,S]=(0,k.useState)(new Set),[re,C]=(0,k.useState)(new Set),[w,T]=(0,k.useState)(new Set),[oe,E]=(0,k.useState)(new Set),[ce,le]=(0,k.useState)(new Set),[D,ue]=(0,k.useState)(new Set),[de,fe]=(0,k.useState)(0),[O,_e]=(0,k.useState)(null),[A,xe]=(0,k.useState)(!1),[N,Se]=(0,k.useState)(`all`),[P,Te]=(0,k.useState)(null),[Ee,F]=(0,k.useState)(null),[De,Oe]=(0,k.useState)(0),I=(0,k.useRef)(new Map),R=(0,k.useRef)(null),z=(0,k.useRef)(null),B=(0,k.useRef)(``),V=(0,k.useRef)(``),H=(0,k.useRef)(null),He=(0,k.useRef)(new Set),{history:U,pulses:Ue,activeOperationsMap:We,activityTotalCount:Ge,resolveActivitySymbol:Ke,getActivityForFile:Je,sweepActivity:Qe}=pe(l(e=>({history:e.history,pulses:e.pulses,activeOperationsMap:e.activeOperations,activityTotalCount:e.totalCount,resolveActivitySymbol:e.resolveActivitySymbol,getActivityForFile:e.getActivityForFile,sweepActivity:e._sweep}))),W=(0,k.useMemo)(()=>[...We.values()].flat(),[We]),tt=(0,k.useMemo)(()=>[...Ue.keys()].map(e=>U.get(e)?.[0]).filter(e=>!!e),[U,Ue]),G=(0,k.useMemo)(()=>{let e=[];for(let t of U.values())e.push(...t.slice(0,16));return e.sort((e,t)=>t.timestamp-e.timestamp).slice(0,16)},[U]),nt=(0,k.useMemo)(()=>me([...W,...G]),[W,G]),K=(0,k.useMemo)(()=>{let e=P??W;return N===`all`?e:e.filter(e=>he(e)===N)},[W,N,P]),it=(0,k.useMemo)(()=>{let e=Ee??G;return N===`all`?e:e.filter(e=>he(e)===N)},[N,Ee,G]),q=(0,k.useDeferredValue)(K),J=(0,k.useDeferredValue)(it),at=(0,k.useDeferredValue)(tt),ot=(0,k.useMemo)(()=>me(K),[K]),[lt,dt,ft]=ie([]),[pt,mt,ht]=se([]),{fitView:gt}=ne(),Y=(0,k.useCallback)(async(e,t=!1)=>{let n=M(e),r=I.current.get(n);if(r&&!t)return je(I.current,n,r,48),r;let i=await fetch(ve(e),{credentials:`same-origin`});if(!i.ok){if(i.status===401||i.status===403)throw Error(`Authentication required — open this dashboard from its token URL.`);let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();return je(I.current,n,a,48),fe(e=>e+1),a},[]);(0,k.useEffect)(()=>{let e=window.setTimeout(()=>b(_),150);return()=>window.clearTimeout(e)},[_]);let _t=ge(e=>e.generation),vt=(0,k.useRef)(0),yt=(0,k.useRef)(null);(0,k.useEffect)(()=>{let t=!1,n=_t>vt.current;return n&&(vt.current=_t,I.current.clear(),fe(e=>e+1),S(new Set),C(new Set),T(new Set),le(new Set)),o(!0),c(null),Y(e,n).then(e=>{if(!t){if(i(e),!n){let t=R.current;R.current=null,d(t&&e.nodes.some(e=>e.id===t)?t:null)}o(!1)}}).catch(e=>{t||(c(e instanceof Error?e.message:String(e)),i(qe),o(!1))}),()=>{t=!0}},[n,Y,_t,e]);let X=(0,k.useCallback)((e,r)=>{if(R.current=r??null,M(e)===n){d(r??null),R.current=null;return}t(e)},[n]),bt=(0,k.useCallback)(async e=>{let t=M(e);if(!(I.current.has(t)||D.has(t))){ue(e=>new Set(e).add(t));try{await Y(e)}finally{ue(e=>{let n=new Set(e);return n.delete(t),n})}}},[Y,D]);(0,k.useEffect)(()=>{let e=!1,t=0;for(let n of W){if(t>=2)break;if(n.symbol||!n.toolUseId||n.filePath.startsWith(`(`))continue;let r=n.filePath;He.current.has(r)||(He.current.add(r),t+=1,Y({level:`symbols`,file:r}).then(t=>{if(e)return;let i=Le(n,t.nodes);i&&Ke(n.toolUseId,r,{id:i.id,name:i.label,...i.symbolKind?{kind:i.symbolKind}:{},...i.line?{line:i.line}:{}})}).catch(()=>void 0).finally(()=>{He.current.delete(r)}))}return()=>{e=!0}},[W,Y,Ke]);let Z=(0,k.useMemo)(()=>({nodes:r.nodes,edges:g===`all`?r.edges:r.edges.filter(e=>e.refType===g)}),[r,g]),Q=r.nodes.find(e=>e.id===u),$=(0,k.useMemo)(()=>we(Z,u,m),[m,Z,u]),xt=(0,k.useMemo)(()=>u?be(Z,u):new Set,[Z,u]),{incomingCounts:St,outgoingCounts:Ct}=(0,k.useMemo)(()=>{let e=new Map,t=new Map;for(let n of Z.edges)t.set(n.source,(t.get(n.source)??0)+1),e.set(n.target,(e.get(n.target)??0)+1);return{incomingCounts:e,outgoingCounts:t}},[Z]),wt=f===`orbit`?u??void 0:void 0,Tt=(0,k.useMemo)(()=>Ce($,f,wt),[$,f,wt]),Et=(0,k.useMemo)(()=>[n,f,f===`orbit`?u??``:``,Ae($)].join(``),[$,n,f,u]),Dt=(0,k.useCallback)(e=>{d(e.id),E(new Set)},[]),Ot=(0,k.useCallback)(e=>{e.kind===`package`&&X({level:`files`,package:e.package??e.label}),e.kind===`file`&&e.file&&X({level:`symbols`,file:e.file,package:e.package})},[X]),kt=(0,k.useMemo)(()=>[Ie(q),Ie(at),Ie(J)].join(``),[q,at,J]),At=(0,k.useMemo)(()=>{let e=new Set;for(let t of K)e.add(j(t.filePath));return e},[K]),jt=(0,k.useMemo)(()=>{let e=new Set;for(let t of K)t.symbol?.id&&e.add(t.symbol.id);return e},[K]);(0,k.useEffect)(()=>{let e=()=>{let e=Tt.map(({node:e})=>e),t=Fe(e,q),n=Fe(e,at),r=new Set(t.keys()),i=Tt.map(({node:e,position:r})=>{let i=t.get(e.id)??[],a=i[0]??n.get(e.id)?.[0];return{id:e.id,type:`codemap`,position:r,data:{graphNode:e,selected:e.id===u,dimmed:!!u&&!xt.has(e.id),incoming:St.get(e.id)??0,outgoing:Ct.get(e.id)??0,isActive:!!a,...a?{activityType:a.type}:{},activeOperations:i,onSelect:Dt,onOpen:Ot,onShowHistory:_e}}});dt(e=>ct(e,i));let a=6,o=$.edges.map((e,t)=>{let n=!!u&&(e.source===u||e.target===u),i=r.has(e.source)||r.has(e.target),o=i&&(n||a>0);o&&--a;let s=ze[e.refType]??`hsl(var(--muted-foreground))`,c=n||i?`smoothstep`:`default`;return{id:`edge:${e.source}:${e.target}:${t}`,source:e.source,target:e.target,type:c,animated:o,label:n?`${e.refType}${e.weight>1?` ×${e.weight}`:``}`:void 0,markerEnd:{type:te.ArrowClosed,color:s,width:14,height:14},style:{stroke:s,strokeWidth:i?Math.min(2.5+Math.log2(e.weight+1)*.65,5):n?Math.min(1.25+Math.log2(e.weight+1)*.65,4):1,opacity:i?1:u?n?.88:.08:.52},labelStyle:{fontSize:9,fontFamily:`var(--font-mono)`,fill:`hsl(var(--muted-foreground))`},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.92},labelBgPadding:[4,2],zIndex:i?4:n?2:0,data:{renderKey:`${e.refType}:${e.weight}:${u?n?`focused`:`dimmed`:`idle`}:${i?`live`:`still`}:${o?`anim`:`still`}:${c}`}}}),s=new Map,c=new Set(q.map(he));for(let e of[...J].sort((e,t)=>e.timestamp-t.timestamp)){let t=he(e),n=s.get(t);n?n.push(e):s.set(t,[e])}let l=[...s.entries()].map(([e,t])=>({agentKey:e,activities:t,live:c.has(e),latest:t[t.length-1]?.timestamp??0})).sort((e,t)=>Number(t.live)-Number(e.live)||t.latest-e.latest).slice(0,4),d=[];for(let{agentKey:e,activities:t,live:n}of l){let r=t.slice(-7).map(e=>({activity:e,node:$.nodes.find(t=>Pe(e,t))})).filter(e=>!!e.node).filter((e,t,n)=>t===0||e.node.id!==n[t-1]?.node.id),i=Ve(e);for(let t=1;t<r.length;t++){let o=r[t-1],s=r[t],c=n&&a>0;c&&--a,d.push({id:`trail:${e}:${o.activity.timestamp}:${s.activity.timestamp}`,source:o.node.id,target:s.node.id,type:`smoothstep`,animated:c,label:t===r.length-1?`${Be(s.activity.agentName??s.activity.agent??`agent`)} TRAIL`:void 0,markerEnd:{type:te.ArrowClosed,color:i,width:13,height:13},style:{stroke:i,strokeWidth:2.5,strokeDasharray:`7 5`,opacity:.9},labelStyle:{fontSize:8,fontWeight:700,fill:i},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.94},labelBgPadding:[4,2],zIndex:6,data:{renderKey:`${i}:${t===r.length-1?`label`:`plain`}:${n?`live`:`still`}:${c?`anim`:`still`}`}})}}Oe(d.length),mt(e=>ut(e,[...o,...d]))},t=Et,n=V.current!==t;V.current=t,H.current!==null&&(window.clearTimeout(H.current),H.current=null),n?e():H.current=window.setTimeout(()=>{H.current=null,e()},120);let r;return B.current!==Et&&(r=window.setTimeout(()=>{B.current=Et;let e=$.nodes.length>48?0:240;gt({padding:.2,duration:e,maxZoom:1.25})},20)),()=>{H.current!==null&&(window.clearTimeout(H.current),H.current=null),r!==void 0&&window.clearTimeout(r)}},[kt,$,u,q,J,at,Et,xt,gt,Ot,Dt,St,Ct,Tt,mt,dt]),(0,k.useEffect)(()=>{let e=window.setInterval(()=>{Qe()},2e3);return()=>window.clearInterval(e)},[Qe]);let Mt=I.current.get(`packages`)??(e.level===`packages`?r:qe),Nt=(0,k.useCallback)(e=>I.current.get(M({level:`files`,package:e})),[de]),Pt=(0,k.useCallback)(e=>I.current.get(M({level:`symbols`,file:e})),[de]),Ft=(0,k.useCallback)(e=>{let t=e.filePath,n=Ne(e.filePath),r=`file:${e.filePath}`;for(let i of I.current.values()){let a=i.nodes.find(t=>t.kind===`file`&&!t.external&&Me(t.file,e.filePath));if(a){t=a.file??t,n=a.package??n,r=a.id;break}}if(e.symbol){X({level:`symbols`,file:t,package:n},e.symbol.id);return}X({level:`files`,package:n},r)},[X]);(0,k.useEffect)(()=>{if(!A||P)return;let e=[...K].filter(e=>!e.filePath.startsWith(`(`)).sort((e,t)=>t.timestamp-e.timestamp)[0];if(!e)return;let t=`${e.id??e.toolUseId}:${e.filePath}:${e.symbol?.id??`file`}`;z.current!==t&&(z.current=t,Ft(e))},[K,A,Ft,P]);let It=(0,k.useCallback)(()=>{if(P){Te(null),F(null);return}Te([...W]),F([...G])},[W,P,G]),Lt=(0,k.useCallback)(e=>{let t=e.package??e.label,n=!x.has(t);S(e=>{let r=new Set(e);return n?r.add(t):r.delete(t),r}),n&&bt({level:`files`,package:t}).then(()=>{let e=I.current.get(M({level:`files`,package:t})),n=e?ke(e.nodes):void 0;n?.directories.length===1&&n.directories[0]&&C(e=>new Set(e).add(`${t}:${n.directories[0].path}`))}).catch(()=>void 0)},[bt,x]),Rt=(0,k.useCallback)(e=>{if(!e.file)return;let t=!w.has(e.file);T(n=>{let r=new Set(n);return t?r.add(e.file):r.delete(e.file),r}),t&&bt({level:`symbols`,file:e.file,package:e.package}).catch(()=>void 0)},[bt,w]),zt=(0,k.useCallback)(e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Bt=(0,k.useCallback)(e=>{le(t=>new Set(t).add(e))},[]),Vt=(0,k.useCallback)(e=>{X({level:`files`,package:e.package??`(root)`},e.id)},[X]),Ht=(0,k.useCallback)(e=>{e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),Ut=(0,k.useMemo)(()=>{let e=y.trim().toLocaleLowerCase();if(!e)return[];let t=new Map;for(let n of I.current.values())for(let r of n.nodes)`${r.label} ${r.file??``} ${r.signature??``} ${r.package??``}`.toLocaleLowerCase().includes(e)&&t.set(r.id,r);return[...t.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label)).slice(0,80)},[y,de]),Wt=Ut.length>40,Gt=ae({count:Ut.length,getScrollElement:()=>yt.current,estimateSize:()=>40,overscan:8,enabled:Wt}),Kt=(0,k.useCallback)(e=>{e.kind===`package`?X({level:`packages`},e.id):e.kind===`file`?X({level:`files`,package:e.package??`(root)`},e.id):e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),{incoming:qt,outgoing:Jt}=(0,k.useMemo)(()=>({incoming:Q?ye(Z,Q.id,`incoming`):[],outgoing:Q?ye(Z,Q.id,`outgoing`):[]}),[Z,Q]),{edgeWeight:Yt,connectedNodeCount:Xt}=(0,k.useMemo)(()=>{let e=0,t=new Set;for(let n of Z.edges)e+=n.weight,t.add(n.source),t.add(n.target);return{edgeWeight:e,connectedNodeCount:t.size}},[Z]),Zt=Q?K.filter(e=>Pe(e,Q)):[],Qt=O?Je(O):[];return(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,L.jsx)(Ze,{scope:e,graph:r,agentPresences:ot,edgeWeight:Yt,connectedNodeCount:Xt,navigate:X}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,L.jsx)(st,{rootGraph:Mt,search:y,searchInput:_,searchResults:Ut,virtualizeSearch:Wt,searchVirtualizer:Gt,treeScrollRef:yt,selectedId:u,expandedPackages:x,expandedDirectories:re,expandedFiles:w,loadingBranches:D,activeFileNorms:At,activeSymbolIds:jt,revealAllKeys:ce,packageGraph:Nt,graphForFile:Pt,navigate:X,togglePackage:Lt,toggleDirectory:zt,toggleFile:Rt,revealAllTree:Bt,selectFileFromTree:Vt,selectSymbolFromTree:Ht,selectSearchResult:Kt,handleOpenNode:Ot,onSearchInputChange:v,onSearchChange:b}),(0,L.jsxs)(`main`,{className:`relative min-w-0 flex-1 bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/0.055),transparent_38%)]`,children:[(0,L.jsx)(Xe,{layout:f,canvasMode:m,edgeFilter:g,canvasNodeCount:$.nodes.length,graphNodeCount:r.nodes.length,onLayoutChange:p,onCanvasModeChange:h,onEdgeFilterChange:ee}),(0,L.jsx)($e,{presences:ot,onLocate:Ft}),(0,L.jsx)(et,{paused:P!==null,followLive:A,agentFilter:N,agents:nt,onTogglePaused:It,onToggleFollow:()=>{z.current=null,xe(e=>!e)},onAgentFilter:e=>{z.current=null,Se(e)}}),(0,L.jsx)(Ye,{loading:a,error:s,graph:r,canvasNodeCount:$.nodes.length,flowNodes:lt,flowEdges:pt,onNodesChange:ft,onEdgesChange:ht,agentTrailCount:De})]}),(0,L.jsx)(rt,{selectedNode:Q,incoming:qt,outgoing:Jt,filteredGraph:Z,expandedRelations:oe,activeOperations:K,recentActivities:it,activityTotalCount:Ge,selectedActivities:Zt,onClearSelection:()=>d(null),onOpenNode:Ot,onOpenActivity:_e,onLocateActivity:Ft,onToggleRelation:e=>E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelectNode:Dt})]}),O&&(0,L.jsx)(Re,{historyFile:O,fileHistory:Qt,onClose:()=>_e(null)})]})}function ft(){return(0,L.jsx)(ue,{children:(0,L.jsx)(dt,{})})}export{ft as CodeMap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,lt as r,za as i}from"./vendor-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,lt as r,za as i}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./dialog-BMrjwjA6.js";import{t as d}from"./button-DAT5OnLL.js";import{t as f}from"./input-Ccsxvwz6.js";var p=e(n(),1),m=r(),h=i()((e,t)=>({request:null,open:n=>{t().request?.resolve(!1),e({request:n})},settle:n=>{t().request?.resolve(n),e({request:null})}}));function g(e){return new Promise(t=>{h.getState().open({...e,resolve:e=>t(e===!0)})})}function _(e){return new Promise(t=>{h.getState().open({...e,resolve:e=>t(e===null?`dismiss`:e?`confirm`:`cancel`)})})}function v(){let{t:e}=t(),n=h(e=>e.request),r=h(e=>e.settle);return(0,p.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Enter`&&(e.preventDefault(),h.getState().settle(n.defaultAction!==`cancel`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,m.jsx)(u,{open:n!==null,onOpenChange:e=>{e||r(null)},children:(0,m.jsxs)(s,{className:`max-w-md`,children:[(0,m.jsxs)(a,{children:[(0,m.jsx)(c,{children:n?.title}),n?.message&&(0,m.jsx)(l,{children:n.message})]}),(0,m.jsxs)(o,{className:`gap-2`,children:[(0,m.jsx)(d,{variant:`outline`,size:`sm`,autoFocus:n?.defaultAction===`cancel`,onClick:()=>r(!1),children:n?.cancelLabel??e(`common:action.cancel`)}),(0,m.jsx)(d,{variant:n?.danger?`destructive`:`default`,size:`sm`,autoFocus:n?.defaultAction!==`cancel`,onClick:()=>r(!0),children:n?.confirmLabel??e(`common:action.confirm`)})]})]})})}var y=i()((e,t)=>({request:null,open:n=>{t().request?.resolve(null),e({request:n})},settle:n=>{t().request?.resolve(n),e({request:null})}}));function b(e){return new Promise(t=>{y.getState().open({...e,resolve:t})})}function x(){let{t:e}=t(),n=y(e=>e.request),r=y(e=>e.settle),[i,h]=(0,p.useState)(``);(0,p.useEffect)(()=>{h(n?.defaultValue??``)},[n]);let g=()=>{let e=i.trim();r(e.length>0?e:null)};return(0,m.jsx)(u,{open:n!==null,onOpenChange:e=>{e||r(null)},children:(0,m.jsxs)(s,{className:`max-w-md`,children:[(0,m.jsxs)(a,{children:[(0,m.jsx)(c,{children:n?.title}),n?.message&&(0,m.jsx)(l,{children:n.message})]}),(0,m.jsx)(f,{autoFocus:!0,value:i,placeholder:n?.placeholder,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())}}),(0,m.jsxs)(o,{className:`gap-2`,children:[(0,m.jsx)(d,{variant:`outline`,size:`sm`,onClick:()=>r(null),children:n?.cancelLabel??e(`common:action.cancel`)}),(0,m.jsx)(d,{size:`sm`,disabled:i.trim().length===0,onClick:g,children:n?.confirmLabel??e(`common:action.ok`)})]})]})})}export{b as a,_ as i,x as n,h as o,g as r,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Gi as r,Ni as i,Wi as a,lt as o,pn as s}from"./vendor-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Gi as r,Ni as i,Wi as a,lt as o,pn as s}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{I as c}from"./stores-BUtRik4k.js";import{a as l,n as u,o as d,r as f,t as p}from"./dialog-BMrjwjA6.js";import{D as m,o as h}from"./index-cUeJ0FkT.js";var g=e(n(),1),_=o();function v(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}m`:`${(e/36e5).toFixed(1)}h`}function y(e){if(!e)return`—`;let t=new Date(e),n=Date.now(),r=t.getTime()-n,i=Math.abs(r);if(i<6e4)return r>=0?`<1m`:`<1m ago`;if(i<36e5){let e=Math.round(i/6e4);return r>=0?`${e}m`:`${e}m ago`}if(i<864e5){let e=Math.round(i/36e5);return r>=0?`${e}h`:`${e}h ago`}return t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function b({enabled:e,overdue:n}){let{t:o}=t();return e?n?(0,_.jsxs)(h,{variant:`destructive`,className:`gap-1`,children:[(0,_.jsx)(i,{className:`h-3 w-3`}),o(`activity:cronJobs.statusOverdue`)]}):(0,_.jsxs)(h,{variant:`outline`,className:`gap-1 border-success/30 bg-success/10 text-success`,children:[(0,_.jsx)(a,{className:`h-3 w-3`}),o(`activity:cronJobs.statusActive`)]}):(0,_.jsxs)(h,{variant:`secondary`,className:`gap-1`,children:[(0,_.jsx)(r,{className:`h-3 w-3`}),o(`activity:cronJobs.statusDisabled`)]})}function x({open:e,onClose:n}){let{t:r}=t(),a=c(e=>e.snapshot),o=c(e=>e.lastFiredAt);c(e=>e.revision);let h=a?.jobs??[],x=a?.count??0,S=a?.maxConcurrent??0,C=h.filter(e=>e.overdue).length,w=h.filter(e=>e.enabled).length,T=h.reduce((e,t)=>e+t.runCount,0),E=(0,g.useCallback)(e=>{e||n()},[n]);return(0,_.jsx)(p,{open:e,onOpenChange:E,children:(0,_.jsxs)(u,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,_.jsxs)(l,{children:[(0,_.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,_.jsx)(s,{className:`h-5 w-5`}),r(`activity:cronJobs.heading`)]}),(0,_.jsx)(f,{children:r(`activity:cronJobs.subtitle`)})]}),x>0&&(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-muted-foreground border-b border-border/70 pb-3`,children:[(0,_.jsx)(`span`,{className:`font-medium text-foreground`,children:r(`activity:cronJobs.jobCount`,{count:x})}),(0,_.jsx)(`span`,{className:`text-success`,children:r(`activity:cronJobs.enabledCount`,{count:w})}),C>0&&(0,_.jsx)(`span`,{className:`text-destructive`,children:r(`activity:cronJobs.overdueCount`,{count:C})}),(0,_.jsx)(`span`,{children:r(`activity:cronJobs.totalRuns`,{count:T})}),(0,_.jsx)(`span`,{className:`text-muted-foreground/60`,children:r(`activity:cronJobs.maxConcurrent`,{count:S})})]}),x===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-8 w-8 opacity-40`}),(0,_.jsx)(`p`,{className:`text-sm`,children:r(`activity:cronJobs.emptyTitle`)}),(0,_.jsxs)(`p`,{className:`text-xs`,children:[r(`activity:cronJobs.emptyUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`cron_schedule`}),` `,r(`activity:cronJobs.emptyToAdd`)]})]}),x>0&&(0,_.jsx)(m,{className:`flex-1 -mx-6 px-6`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-border/50 text-left text-xs text-muted-foreground`,children:[(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thStatus`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thName`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thInterval`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium text-right`,children:r(`activity:cronJobs.thRuns`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thNextRun`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:r(`activity:cronJobs.thLastRun`)}),(0,_.jsx)(`th`,{className:`pb-2 font-medium`,children:r(`activity:cronJobs.thAction`)})]})}),(0,_.jsx)(`tbody`,{children:h.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-border/30 last:border-0`,children:[(0,_.jsx)(`td`,{className:`py-2.5 pr-3`,children:(0,_.jsx)(b,{enabled:e.enabled,overdue:e.overdue})}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs font-medium max-w-[160px] truncate`,title:e.name,children:e.name}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.intervalMs)}),(0,_.jsxs)(`td`,{className:`py-2.5 pr-3 text-right font-mono text-xs tabular-nums`,children:[e.runCount,o[e.name]&&(0,_.jsx)(`span`,{className:`ml-1 text-success`,title:r(`activity:cronJobs.lastFiredAtTitle`,{time:o[e.name]}),children:`●`})]}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.nextRun)}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.lastRun)}),(0,_.jsx)(`td`,{className:`py-2.5 font-mono text-xs max-w-[200px] truncate text-muted-foreground`,title:e.action,children:e.action})]},e.name))})]})}),x>0&&(0,_.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-3 border-t border-border/70`,children:[r(`activity:cronJobs.footerUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px]`,children:`cron_schedule`}),` `,r(`activity:cronJobs.footerToAdd`),(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px] ml-1`,children:`cron_cancel`}),` `,r(`activity:cronJobs.footerToRemove`)]})]})})}export{x as CronJobsPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
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";var i=e(n(),1),a=r(),o={0:`P0 Dead Package`,1:`P1 Dead File`,2:`P2 Dead Symbol`},s={0:`hsl(var(--destructive))`,1:`hsl(var(--warning))`,2:`hsl(var(--info))`};async function c(e){let t=await e.text();try{return JSON.parse(t)}catch{let e=t.length>300?`${t.slice(0,300)}…`:t;throw console.warn(JSON.stringify({level:`warn`,event:`deadcode_parse_error`,preview:e,timestamp:new Date().toISOString()})),Error(`The server returned a non-JSON response (possibly an HTML error page). Check that the backend is running and the /api/deadcode/* routes are wired.`)}}function l(){let{t:e}=t(),[n,r]=(0,i.useState)(`idle`),[l,u]=(0,i.useState)(`idle`),[m,h]=(0,i.useState)(null),[g,_]=(0,i.useState)(null),[v,y]=(0,i.useState)(null),b=(0,i.useCallback)(async()=>{r(`scanning`),y(null),h(null),_(null),u(`idle`);try{let e=await fetch(`/api/deadcode/scan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});if(!e.ok){let t=await c(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await c(e);h(t),r(`done`)}catch(e){y(e instanceof Error?e.message:String(e)),r(`error`)}},[]),x=(0,i.useCallback)(async()=>{if(m){u(`generating`),y(null);try{let e=await fetch(`/api/deadcode/action-plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(m)});if(!e.ok){let t=await c(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await c(e);_(t),u(`ready`)}catch(e){y(e instanceof Error?e.message:String(e)),u(`idle`)}}},[m]),S=(0,i.useCallback)(()=>{if(!g)return;u(`executing`);let e=[`# Dead-Code Cleanup Plan`,``,g.summary,``,`## Files to address (in priority order)`,...g.files.map((e,t)=>`${t+1}. [${o[e.priority]}] ${e.file} — ${e.symbolCount} symbol(s) to remove`+(e.symbols.length>0?`\n Symbols: ${e.symbols.slice(0,5).join(`, `)}${e.symbols.length>5?` and ${e.symbols.length-5} more`:``}`:``))].join(`
|
|
2
2
|
`),t=window.__WS;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify({type:`user.message`,payload:{text:e,action:`send`}})):(navigator.clipboard.writeText(e),y(`Agent not connected. Plan copied to clipboard — paste it into the chat.`)),u(`idle`)},[g]);return(0,a.jsxs)(`div`,{style:{padding:`16px`,fontFamily:`var(--font-sans, system-ui, sans-serif)`,color:`hsl(var(--foreground))`,background:`hsl(var(--background))`},children:[(0,a.jsx)(`h2`,{style:{margin:`0 0 16px`,fontSize:`18px`,fontWeight:600,color:`hsl(var(--foreground))`},children:e(`activity:deadCode.deadCodeScan`)}),(0,a.jsx)(`button`,{type:`button`,onClick:b,disabled:n===`scanning`,style:{padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:n===`scanning`?`hsl(var(--muted))`:`hsl(var(--primary))`,color:n===`scanning`?`hsl(var(--muted-foreground))`:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:n===`scanning`?`not-allowed`:`pointer`},children:n===`scanning`?`Scanning…`:`Scan for Dead Code`}),v&&(0,a.jsxs)(`div`,{style:{marginTop:`12px`,padding:`8px 12px`,background:`hsl(var(--destructive) / 0.1)`,color:`hsl(var(--destructive))`,border:`1px solid hsl(var(--destructive) / 0.3)`,borderRadius:`0`,fontSize:`13px`},children:[v,(0,a.jsx)(`button`,{type:`button`,onClick:()=>y(null),style:{marginLeft:`12px`,background:`none`,border:`none`,cursor:`pointer`,fontWeight:600,color:`hsl(var(--destructive))`},children:`✕`})]}),m&&(0,a.jsxs)(`div`,{style:{marginTop:`16px`},children:[(0,a.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,marginBottom:`12px`},children:[(0,a.jsx)(d,{label:e(`activity:deadCode.totalSymbols`),value:m.stats.totalSymbols,token:`info`}),(0,a.jsx)(d,{label:e(`activity:deadCode.alive`),value:m.stats.alive,token:`success`}),(0,a.jsx)(d,{label:e(`activity:deadCode.dead`),value:m.stats.dead,token:`destructive`})]}),m.deadPackages.length>0&&(0,a.jsx)(f,{title:`Dead Packages (${m.deadPackages.length})`,token:`destructive`,children:m.deadPackages.map(e=>(0,a.jsx)(p,{columns:[e.package,e.path,`${e.fileCount} file(s)`]},e.package))}),m.deadFiles.length>0&&(0,a.jsx)(f,{title:`Dead Files (${m.deadFiles.length})`,token:`warning`,children:m.deadFiles.map(e=>(0,a.jsx)(p,{columns:[e.file,`${e.symbolCount} symbol(s)`,e.lang]},e.file))}),m.deadSymbols.length>0&&(0,a.jsxs)(f,{title:`Dead Symbols (${m.deadSymbols.length})`,token:`info`,children:[m.deadSymbols.slice(0,50).map(e=>(0,a.jsx)(p,{columns:[e.name,e.kind,e.file.split(`/`).pop()??e.file,`line ${e.line}`]},`${e.file}:${e.line}:${e.name}`)),m.deadSymbols.length>50&&(0,a.jsxs)(`div`,{style:{padding:`6px 8px`,color:`hsl(var(--muted-foreground))`,fontSize:`12px`},children:[`… and `,m.deadSymbols.length-50,` more`]})]}),n===`done`&&(0,a.jsx)(`button`,{type:`button`,onClick:x,disabled:l===`generating`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:l===`generating`?`hsl(var(--muted))`:`hsl(var(--accent))`,color:l===`generating`?`hsl(var(--muted-foreground))`:`hsl(var(--accent-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:l===`generating`?`not-allowed`:`pointer`},children:l===`generating`?`Generating…`:`Generate Action Plan`})]}),g&&(0,a.jsxs)(`div`,{style:{marginTop:`16px`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,padding:`12px`,background:`hsl(var(--card))`},children:[(0,a.jsx)(`h3`,{style:{margin:`0 0 8px`,fontSize:`15px`,fontWeight:600,color:`hsl(var(--card-foreground))`},children:e(`activity:deadCode.actionPlan`)}),(0,a.jsx)(`p`,{style:{fontSize:`13px`,color:`hsl(var(--muted-foreground))`,margin:`0 0 12px`},children:g.summary}),g.files.map((e,t)=>(0,a.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`8px`,padding:`6px 0`,borderBottom:t<g.files.length-1?`1px solid hsl(var(--border))`:`none`,fontSize:`13px`},children:[(0,a.jsx)(`span`,{style:{background:s[e.priority]??`hsl(var(--muted-foreground))`,color:`hsl(var(--primary-foreground))`,borderRadius:`0`,padding:`2px 6px`,fontSize:`11px`,fontWeight:600,whiteSpace:`nowrap`,flexShrink:0},children:o[e.priority]??`P${e.priority}`}),(0,a.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,a.jsx)(`div`,{style:{fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`hsl(var(--foreground))`},children:e.file}),(0,a.jsxs)(`div`,{style:{color:`hsl(var(--muted-foreground))`,fontSize:`12px`},children:[e.symbolCount,` symbol(s)`,e.symbols.length>0&&` · ${e.symbols.slice(0,2).join(`, `)}${e.symbols.length>2?`…`:``}`]})]})]},e.file)),(0,a.jsx)(`button`,{type:`button`,onClick:S,disabled:l===`executing`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:l===`executing`?`hsl(var(--muted))`:`hsl(var(--success))`,color:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:l===`executing`?`not-allowed`:`pointer`},children:l===`executing`?`Sending…`:`Execute Plan via Agent`})]})]})}var u={success:`hsl(var(--success))`,warning:`hsl(var(--warning))`,info:`hsl(var(--info))`,destructive:`hsl(var(--destructive))`,primary:`hsl(var(--primary))`};function d({label:e,value:t,token:n}){let r=u[n];return(0,a.jsxs)(`div`,{style:{flex:1,padding:`10px`,borderRadius:`0`,border:`1px solid hsl(var(--border))`,background:`hsl(var(--card))`,textAlign:`center`},children:[(0,a.jsx)(`div`,{style:{fontSize:`24px`,fontWeight:700,color:r},children:t}),(0,a.jsx)(`div`,{style:{fontSize:`12px`,color:`hsl(var(--muted-foreground))`,marginTop:`2px`},children:e})]})}function f({title:e,token:t,children:n}){let r=u[t];return(0,a.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,a.jsx)(`h3`,{style:{margin:`0 0 6px`,fontSize:`14px`,fontWeight:600,color:r,borderLeft:`3px solid ${r}`,paddingLeft:`8px`},children:e}),(0,a.jsx)(`div`,{style:{border:`1px solid hsl(var(--border))`,borderRadius:`0`,overflow:`hidden`,fontSize:`13px`},children:n})]})}function p({columns:e}){return(0,a.jsx)(`div`,{style:{display:`flex`,gap:`8px`,padding:`5px 8px`,borderBottom:`1px solid hsl(var(--border))`,fontSize:`13px`,fontFamily:`var(--font-mono, monospace)`,background:`hsl(var(--card))`,color:`hsl(var(--card-foreground))`},children:e.map((e,t)=>(0,a.jsx)(`span`,{style:{flex:t===0?2:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e},t))})}export{l as DeadCodeScanPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Ni as r,Pa as i,Rr as a,Ua as o,Xi as s,ai as c,fi as l,kt as u,lt as d,nn as f,oa as p,yn as m}from"./vendor-C_zEzV4N.js";import"./i18n-DbJfY4tY.js";import{c as h}from"./index-DQn-Lz9q.js";var g=e(n(),1),_=d();function v({title:e,value:n,subtitle:r,icon:i,color:a=`text-primary`,trend:o}){let{t:s}=t();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${a}`,children:n}),r&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:r})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${a}`,children:(0,_.jsx)(i,{className:`w-5 h-5`})})]}),o&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[o===`up`&&(0,_.jsx)(u,{className:`w-3 h-3 text-success`}),o===`down`&&(0,_.jsx)(u,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s(o===`up`?`activity:debug.trendUp`:o===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=t(),[n,d]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),n=null,r=e.headers.get(`content-type`)??``;if(e.ok&&r.includes(`application/json`)&&(n=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let i=await t.json();d({fileWatcher:n,system:i,lastUpdated:new Date,error:null})}catch(e){d(t=>({...t,error:e instanceof Error?e.message:o.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),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,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(p,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(m,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(m,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),n.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(r,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:n.lastUpdated.toLocaleTimeString()})]}),n.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(s,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:n.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:n.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:f,color:n.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:n.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:c,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:n.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:i,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:n.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:a,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:n.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:u,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:n.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:m,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(n.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:r,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(n.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:p,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(a,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.webuiServerProcess`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.processRamRss`),value:b(n.system?.memoryUsage?.rss??0),subtitle:n.system?`PID ${n.system.pid}`:void 0,icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(n.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:p,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(n.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:p,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(n.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:a,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(n.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:r,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(n.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(n.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(f,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.connection`),value:n.system?.codebaseIndexServer?.health?.status??n.system?.codebaseIndexServer?.status??`unknown`,subtitle:n.system?.codebaseIndexServer?.pid?`PID ${n.system.codebaseIndexServer.pid} · RTT ${n.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:i,color:n.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:n.system?.codebaseIndexServer?.status===`unresponsive`||n.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(n.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(n.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(n.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:p,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${n.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${n.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${n.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:a,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:n.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${n.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${n.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:l,color:n.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:n.fileWatcher,serverPid:n.system?.pid,serverMemory:n.system?.memoryUsage,serverHeapLimit:n.system?.heapLimit,serverUptime:n.system?.uptime,processes:n.system?.processes,codebaseIndexServer:n.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Ni as r,Pa as i,Rr as a,Ua as o,Xi as s,ai as c,fi as l,kt as u,lt as d,oa as f,rn as p,yn as m}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{c as h}from"./index-cUeJ0FkT.js";var g=e(n(),1),_=d();function v({title:e,value:n,subtitle:r,icon:i,color:a=`text-primary`,trend:o}){let{t:s}=t();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${a}`,children:n}),r&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:r})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${a}`,children:(0,_.jsx)(i,{className:`w-5 h-5`})})]}),o&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[o===`up`&&(0,_.jsx)(u,{className:`w-3 h-3 text-success`}),o===`down`&&(0,_.jsx)(u,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s(o===`up`?`activity:debug.trendUp`:o===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=t(),[n,d]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),n=null,r=e.headers.get(`content-type`)??``;if(e.ok&&r.includes(`application/json`)&&(n=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let i=await t.json();d({fileWatcher:n,system:i,lastUpdated:new Date,error:null})}catch(e){d(t=>({...t,error:e instanceof Error?e.message:o.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),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,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(f,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(m,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(m,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),n.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(r,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:n.lastUpdated.toLocaleTimeString()})]}),n.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(s,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:n.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:n.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:p,color:n.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:n.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:c,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:n.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:i,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:n.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:a,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:n.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:u,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:n.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:m,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(n.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:r,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(n.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:f,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(a,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.webuiServerProcess`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.processRamRss`),value:b(n.system?.memoryUsage?.rss??0),subtitle:n.system?`PID ${n.system.pid}`:void 0,icon:p,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(n.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(n.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:f,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(n.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:a,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(n.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:r,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(n.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(n.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(p,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.connection`),value:n.system?.codebaseIndexServer?.health?.status??n.system?.codebaseIndexServer?.status??`unknown`,subtitle:n.system?.codebaseIndexServer?.pid?`PID ${n.system.codebaseIndexServer.pid} · RTT ${n.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:i,color:n.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:n.system?.codebaseIndexServer?.status===`unresponsive`||n.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(n.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(n.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(n.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${n.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${n.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${n.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:a,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:n.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${n.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${n.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:l,color:n.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:n.fileWatcher,serverPid:n.system?.pid,serverMemory:n.system?.memoryUsage,serverHeapLimit:n.system?.heapLimit,serverUptime:n.system?.uptime,processes:n.system?.processes,codebaseIndexServer:n.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Rn as r,Ua as i,Zt as a,an as o,dt as s,lt as c,ra as l,yi as u}from"./vendor-C_zEzV4N.js";import"./i18n-DbJfY4tY.js";import{t as d}from"./useWebSocket-D9Dy4-9x.js";import{t as f}from"./utils-tsZEnrBH.js";import{o as p}from"./view-navigation-CZKugncK.js";import{c as m}from"./index-DQn-Lz9q.js";var h=e(n(),1);function g(e,t,n){return e<t?t:e>n?n:e}function _(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[g(r,0,1),Math.max(0,i),a]:null}function v(e){return g(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function y(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function b(e){let t=_(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${y(v(m))}${y(v(h))}${y(v(g))}`}function x(e){let t=e.trim(),n=b(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var S=c(),C=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],w=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function T(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function E({t:e,label:n}){let{t:r}=t(),i=e.bg??`#fff`,a=e.surface??i,o=e.fg??`#111`,s=e.muted??o,c=e.primary??`#3b82f6`,l=e.accent??c,u=e.border??s,d=e[`radius-md`]??e.radius??`0.5rem`,f=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,p=e[`font-display`]??e.fontDisplay??f,m=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,S.jsxs)(`div`,{style:{background:i,color:o,fontFamily:f},className:`flex min-w-0 flex-col gap-2 overflow-hidden p-3`,children:[(0,S.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:s},children:n}),(0,S.jsxs)(`div`,{style:{background:a,border:`1px solid ${u}`,borderRadius:d,boxShadow:m},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,S.jsx)(`div`,{style:{fontFamily:p},className:`text-base font-bold leading-tight`,children:r(`activity:designStudio.aaHeading`)}),(0,S.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:s},children:r(`activity:designStudio.theQuickBrownFoxJumpsOver`)}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,S.jsx)(`span`,{style:{background:c,color:i,borderRadius:d},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:r(`activity:designStudio.primary`)}),(0,S.jsx)(`span`,{style:{border:`1px solid ${u}`,color:o,borderRadius:d},className:`shrink-0 px-2 py-1 text-[10px]`,children:r(`activity:designStudio.ghost`)}),(0,S.jsx)(`span`,{style:{background:l,color:i,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:r(`activity:designStudio.badge`)})]}),(0,S.jsx)(`div`,{style:{border:`1px solid ${u}`,borderRadius:d,color:s},className:`text-[10px] px-2 py-1.5 mt-1`,children:r(`activity:designStudio.inputField`)})]})]})}function D({kit:e,overrides:n,onSet:r}){let[i,a]=(0,h.useState)(`light`),{t:o}=t(),s=T(i===`light`?e.light:e.dark,n,i);return(0,S.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:o(`activity:design.colors`)}),(0,S.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:f(`text-[10px] px-1.5 py-0.5`,i===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.filter(e=>s[e]).map(e=>{let t=x(s[e]??``)??`#000000`;return(0,S.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${s[e]}`,children:[(0,S.jsx)(`input`,{type:`color`,value:t,onChange:t=>r(`${i}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,S.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function O({onTune:e}){let{t:n}=t(),[r,i]=(0,h.useState)(``),a=({label:t,knob:n,values:r})=>(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(t=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>e({[n]:t}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-primary hover:text-primary-foreground`,children:t},t))})]});return(0,S.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1.5 rounded-lg border border-border/60 bg-muted/30 p-2`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:n(`activity:designStudio.tune`)}),(0,S.jsx)(a,{label:n(`activity:designStudio.radius`),knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,S.jsx)(a,{label:n(`activity:designStudio.density`),knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,S.jsx)(a,{label:n(`activity:designStudio.motion`),knob:`motion`,values:[`snappy`,`smooth`,`none`]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:n(`activity:designStudio.font`)}),(0,S.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:t=>{t.key===`Enter`&&r.trim()&&e({font:r.trim()})},placeholder:n(`activity:designStudio.spaceGrotesk`),className:`h-6 min-w-0 flex-1 rounded border border-border/60 bg-background/70 px-1.5 text-[10px]`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>r.trim()&&e({font:r.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:n(`activity:designStudio.set`)})]})]})}function k({className:e}){let{client:n}=d(),{t:c}=t(),[g,_]=(0,h.useState)([]),[v,y]=(0,h.useState)(null),[b,x]=(0,h.useState)({}),[w,k]=(0,h.useState)(`web`),[A,j]=(0,h.useState)(``),[M,N]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.payload;_(t?.kits??[]),y(t?.activeKit??null),x(t?.overrides??{})},t=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}))},r=e=>{let t=e.payload;t?.ok&&t.overrides&&x(t.overrides)},a=e=>{let t=e.payload;t?.ok&&t.overrides?(x(t.overrides),N(`Tuned`)):t?.error&&N(`Tune failed: ${t.error}`)},o=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}),N(`Swapped to ${t.kit}`))},s=e=>{let t=e.payload;N(t?.ok?i.t(`activity:design.wrote`,{path:t.path}):i.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},c=e=>{let t=e.payload;if(!t?.ok){N(i.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);N(t.violationCount?i.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):i.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return n.on(`design.list`,e),n.on(`design.use`,t),n.on(`design.set`,r),n.on(`design.tune`,a),n.on(`design.swap`,o),n.on(`design.materialize`,s),n.on(`design.verify`,c),n.send({type:`design.list`}),()=>{n.off(`design.list`,e),n.off(`design.use`,t),n.off(`design.set`,r),n.off(`design.tune`,a),n.off(`design.swap`,o),n.off(`design.materialize`,s),n.off(`design.verify`,c)}},[n]);let P=(0,h.useCallback)(e=>n?.send({type:`design.use`,payload:{kit:e,stack:w}}),[n,w]),F=(0,h.useCallback)((e,t)=>{x(n=>({...n,[e]:t})),n?.send({type:`design.set`,payload:{overrides:{[e]:t}}})},[n]),I=(0,h.useCallback)(e=>n?.send({type:`design.tune`,payload:{tune:e}}),[n]),L=(0,h.useCallback)(()=>{N(i.t(`activity:design.writing`)),n?.send({type:`design.materialize`,payload:{stack:w}})},[n,w]),R=(0,h.useCallback)(()=>{N(i.t(`activity:design.scanning`)),n?.send({type:`design.verify`})},[n]),z=(0,h.useMemo)(()=>{let e=A.trim().toLowerCase();return[...e?g.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):g].sort((e,t)=>e.name.localeCompare(t.name))},[g,A]);return(0,S.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)]`,e),children:[(0,S.jsx)(`div`,{className:`border-b border-border/60 p-3`,children:(0,S.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,S.jsx)(r,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:c(`activity:design.heading`)}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`activity:design.kitsCount`,{count:z.length})})]})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center lg:justify-end`,children:[(0,S.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:max-w-xs`,children:[(0,S.jsx)(o,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,S.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:c(`activity:design.searchPlaceholder`),className:`h-9 w-full rounded-md border border-border/70 bg-background/70 pl-8 pr-3 text-sm shadow-sm outline-none transition focus:border-primary/40 focus:ring-2 focus:ring-ring/30`})]}),(0,S.jsx)(`select`,{value:w,onChange:e=>k(e.target.value),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm shadow-sm`,title:c(`activity:design.stackTitle`),children:C.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))}),M&&(0,S.jsx)(`span`,{className:`min-w-0 truncate rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground sm:max-w-56`,children:M}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>p(`chat`),className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,title:c(`common:action.close`),children:(0,S.jsx)(s,{className:`h-4 w-4`})})]})]})})}),(0,S.jsx)(`div`,{ref:m(`design-gallery`),className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain p-3 sm:p-4`,children:z.length===0?(0,S.jsxs)(`div`,{className:`ws-surface mx-auto mt-8 flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center text-muted-foreground`,children:[(0,S.jsx)(r,{className:`h-8 w-8 text-primary/60`}),(0,S.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:c(`activity:design.kitsCount`,{count:0})}),(0,S.jsx)(`p`,{className:`text-xs`,children:c(`activity:design.searchPlaceholder`)})]}):(0,S.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(min(100%,20rem),1fr))]`,children:z.map(e=>{let t=v===e.id,n=t?b:{};return(0,S.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,t?`border-primary/60 ring-1 ring-primary/30`:`border-border/70`),children:[(0,S.jsxs)(`div`,{className:`grid min-h-[12rem] grid-cols-1 sm:grid-cols-2`,children:[(0,S.jsx)(E,{t:T(e.light,n,`light`),label:c(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,n,`dark`),label:c(`activity:designStudio.dark`)})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 border-t border-border/60 bg-card p-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,S.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),t&&(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,S.jsx)(l,{className:`w-3 h-3`}),` `,c(`activity:design.active`)]})]}),(0,S.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>P(e.id),className:f(`rounded-md px-2.5 py-1 text-[11px] font-medium transition`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:c(t?`activity:design.reapply`:`activity:design.use`)}),t&&(0,S.jsxs)(`button`,{type:`button`,onClick:L,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:c(`activity:design.materializeTitle`,{stack:w}),children:[(0,S.jsx)(u,{className:`w-3 h-3`}),` `,c(`activity:design.materialize`)]}),t&&(0,S.jsxs)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:c(`activity:design.verifyTitle`),children:[(0,S.jsx)(a,{className:`w-3 h-3`}),` `,c(`activity:design.verify`)]}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:e.bestFor})]}),t&&(0,S.jsx)(D,{kit:e,overrides:n,onSet:F}),t&&(0,S.jsx)(O,{onTune:I})]})]},e.id)})})})]})}export{k as DesignGalleryView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Rn as r,Ua as i,Zt as a,an as o,dt as s,lt as c,ra as l,yi as u}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as d}from"./useWebSocket-Ew1Bbjci.js";import{t as f}from"./utils-B5X3DKef.js";import{o as p}from"./view-navigation-Hd631M1W.js";import{c as m}from"./index-cUeJ0FkT.js";var h=e(n(),1);function g(e,t,n){return e<t?t:e>n?n:e}function _(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[g(r,0,1),Math.max(0,i),a]:null}function v(e){return g(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function y(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function b(e){let t=_(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${y(v(m))}${y(v(h))}${y(v(g))}`}function x(e){let t=e.trim(),n=b(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var S=c(),C=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],w=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function T(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function E({t:e,label:n}){let{t:r}=t(),i=e.bg??`#fff`,a=e.surface??i,o=e.fg??`#111`,s=e.muted??o,c=e.primary??`#3b82f6`,l=e.accent??c,u=e.border??s,d=e[`radius-md`]??e.radius??`0.5rem`,f=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,p=e[`font-display`]??e.fontDisplay??f,m=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,S.jsxs)(`div`,{style:{background:i,color:o,fontFamily:f},className:`flex min-w-0 flex-col gap-2 overflow-hidden p-3`,children:[(0,S.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:s},children:n}),(0,S.jsxs)(`div`,{style:{background:a,border:`1px solid ${u}`,borderRadius:d,boxShadow:m},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,S.jsx)(`div`,{style:{fontFamily:p},className:`text-base font-bold leading-tight`,children:r(`activity:designStudio.aaHeading`)}),(0,S.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:s},children:r(`activity:designStudio.theQuickBrownFoxJumpsOver`)}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,S.jsx)(`span`,{style:{background:c,color:i,borderRadius:d},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:r(`activity:designStudio.primary`)}),(0,S.jsx)(`span`,{style:{border:`1px solid ${u}`,color:o,borderRadius:d},className:`shrink-0 px-2 py-1 text-[10px]`,children:r(`activity:designStudio.ghost`)}),(0,S.jsx)(`span`,{style:{background:l,color:i,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:r(`activity:designStudio.badge`)})]}),(0,S.jsx)(`div`,{style:{border:`1px solid ${u}`,borderRadius:d,color:s},className:`text-[10px] px-2 py-1.5 mt-1`,children:r(`activity:designStudio.inputField`)})]})]})}function D({kit:e,overrides:n,onSet:r}){let[i,a]=(0,h.useState)(`light`),{t:o}=t(),s=T(i===`light`?e.light:e.dark,n,i);return(0,S.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:o(`activity:design.colors`)}),(0,S.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:f(`text-[10px] px-1.5 py-0.5`,i===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.filter(e=>s[e]).map(e=>{let t=x(s[e]??``)??`#000000`;return(0,S.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${s[e]}`,children:[(0,S.jsx)(`input`,{type:`color`,value:t,onChange:t=>r(`${i}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,S.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function O({onTune:e}){let{t:n}=t(),[r,i]=(0,h.useState)(``),a=({label:t,knob:n,values:r})=>(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(t=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>e({[n]:t}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-primary hover:text-primary-foreground`,children:t},t))})]});return(0,S.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1.5 rounded-lg border border-border/60 bg-muted/30 p-2`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:n(`activity:designStudio.tune`)}),(0,S.jsx)(a,{label:n(`activity:designStudio.radius`),knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,S.jsx)(a,{label:n(`activity:designStudio.density`),knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,S.jsx)(a,{label:n(`activity:designStudio.motion`),knob:`motion`,values:[`snappy`,`smooth`,`none`]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:n(`activity:designStudio.font`)}),(0,S.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:t=>{t.key===`Enter`&&r.trim()&&e({font:r.trim()})},placeholder:n(`activity:designStudio.spaceGrotesk`),className:`h-6 min-w-0 flex-1 rounded border border-border/60 bg-background/70 px-1.5 text-[10px]`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>r.trim()&&e({font:r.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:n(`activity:designStudio.set`)})]})]})}function k({className:e}){let{client:n}=d(),{t:c}=t(),[g,_]=(0,h.useState)([]),[v,y]=(0,h.useState)(null),[b,x]=(0,h.useState)({}),[w,k]=(0,h.useState)(`web`),[A,j]=(0,h.useState)(``),[M,N]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.payload;_(t?.kits??[]),y(t?.activeKit??null),x(t?.overrides??{})},t=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}))},r=e=>{let t=e.payload;t?.ok&&t.overrides&&x(t.overrides)},a=e=>{let t=e.payload;t?.ok&&t.overrides?(x(t.overrides),N(`Tuned`)):t?.error&&N(`Tune failed: ${t.error}`)},o=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}),N(`Swapped to ${t.kit}`))},s=e=>{let t=e.payload;N(t?.ok?i.t(`activity:design.wrote`,{path:t.path}):i.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},c=e=>{let t=e.payload;if(!t?.ok){N(i.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);N(t.violationCount?i.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):i.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return n.on(`design.list`,e),n.on(`design.use`,t),n.on(`design.set`,r),n.on(`design.tune`,a),n.on(`design.swap`,o),n.on(`design.materialize`,s),n.on(`design.verify`,c),n.send({type:`design.list`}),()=>{n.off(`design.list`,e),n.off(`design.use`,t),n.off(`design.set`,r),n.off(`design.tune`,a),n.off(`design.swap`,o),n.off(`design.materialize`,s),n.off(`design.verify`,c)}},[n]);let P=(0,h.useCallback)(e=>n?.send({type:`design.use`,payload:{kit:e,stack:w}}),[n,w]),F=(0,h.useCallback)((e,t)=>{x(n=>({...n,[e]:t})),n?.send({type:`design.set`,payload:{overrides:{[e]:t}}})},[n]),I=(0,h.useCallback)(e=>n?.send({type:`design.tune`,payload:{tune:e}}),[n]),L=(0,h.useCallback)(()=>{N(i.t(`activity:design.writing`)),n?.send({type:`design.materialize`,payload:{stack:w}})},[n,w]),R=(0,h.useCallback)(()=>{N(i.t(`activity:design.scanning`)),n?.send({type:`design.verify`})},[n]),z=(0,h.useMemo)(()=>{let e=A.trim().toLowerCase();return[...e?g.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):g].sort((e,t)=>e.name.localeCompare(t.name))},[g,A]);return(0,S.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)]`,e),children:[(0,S.jsx)(`div`,{className:`border-b border-border/60 p-3`,children:(0,S.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,S.jsx)(r,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:c(`activity:design.heading`)}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`activity:design.kitsCount`,{count:z.length})})]})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center lg:justify-end`,children:[(0,S.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:max-w-xs`,children:[(0,S.jsx)(o,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,S.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:c(`activity:design.searchPlaceholder`),className:`h-9 w-full rounded-md border border-border/70 bg-background/70 pl-8 pr-3 text-sm shadow-sm outline-none transition focus:border-primary/40 focus:ring-2 focus:ring-ring/30`})]}),(0,S.jsx)(`select`,{value:w,onChange:e=>k(e.target.value),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm shadow-sm`,title:c(`activity:design.stackTitle`),children:C.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))}),M&&(0,S.jsx)(`span`,{className:`min-w-0 truncate rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground sm:max-w-56`,children:M}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>p(`chat`),className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,title:c(`common:action.close`),children:(0,S.jsx)(s,{className:`h-4 w-4`})})]})]})})}),(0,S.jsx)(`div`,{ref:m(`design-gallery`),className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain p-3 sm:p-4`,children:z.length===0?(0,S.jsxs)(`div`,{className:`ws-surface mx-auto mt-8 flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center text-muted-foreground`,children:[(0,S.jsx)(r,{className:`h-8 w-8 text-primary/60`}),(0,S.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:c(`activity:design.kitsCount`,{count:0})}),(0,S.jsx)(`p`,{className:`text-xs`,children:c(`activity:design.searchPlaceholder`)})]}):(0,S.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(min(100%,20rem),1fr))]`,children:z.map(e=>{let t=v===e.id,n=t?b:{};return(0,S.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,t?`border-primary/60 ring-1 ring-primary/30`:`border-border/70`),children:[(0,S.jsxs)(`div`,{className:`grid min-h-[12rem] grid-cols-1 sm:grid-cols-2`,children:[(0,S.jsx)(E,{t:T(e.light,n,`light`),label:c(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,n,`dark`),label:c(`activity:designStudio.dark`)})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 border-t border-border/60 bg-card p-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,S.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),t&&(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,S.jsx)(l,{className:`w-3 h-3`}),` `,c(`activity:design.active`)]})]}),(0,S.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>P(e.id),className:f(`rounded-md px-2.5 py-1 text-[11px] font-medium transition`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:c(t?`activity:design.reapply`:`activity:design.use`)}),t&&(0,S.jsxs)(`button`,{type:`button`,onClick:L,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:c(`activity:design.materializeTitle`,{stack:w}),children:[(0,S.jsx)(u,{className:`w-3 h-3`}),` `,c(`activity:design.materialize`)]}),t&&(0,S.jsxs)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:c(`activity:design.verifyTitle`),children:[(0,S.jsx)(a,{className:`w-3 h-3`}),` `,c(`activity:design.verify`)]}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:e.bestFor})]}),t&&(0,S.jsx)(D,{kit:e,overrides:n,onSet:F}),t&&(0,S.jsx)(O,{onTune:I})]})]},e.id)})})})]})}export{k as DesignGalleryView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-c0pGYczr.js";import{Ba as n,Bt as r,Ct as i,En as a,Et as o,Ga as s,Ji as c,Ni as l,Oi as u,Ri as d,Tn as f,Ua as p,dn as m,dt as h,gn as g,jn as _,lt as v,mn as y,or as b,ut as x,vr as S,zi as C}from"./vendor-C_zEzV4N.js";import"./i18n-DbJfY4tY.js";import{t as w}from"./useWebSocket-D9Dy4-9x.js";import{t as T}from"./utils-tsZEnrBH.js";import{_ as E,t as D,v as O}from"./stores-C0xX0jn4.js";import{o as k}from"./view-navigation-CZKugncK.js";import{t as A}from"./button-DvpRpKkt.js";import{a as j}from"./ConfirmModal-KzK0LoJw.js";import{h as M,m as ee,p as te}from"./index-DQn-Lz9q.js";var N=e(s(),1),P=v(),F={pending:{icon:(0,P.jsx)(d,{className:`w-4 h-4`}),color:`text-muted-foreground`},in_progress:{icon:(0,P.jsx)(l,{className:`w-4 h-4 animate-spin`}),color:`text-primary`},blocked:{icon:(0,P.jsx)(_,{className:`w-4 h-4`}),color:`text-warning`},failed:{icon:(0,P.jsx)(C,{className:`w-4 h-4`}),color:`text-destructive`},review:{icon:(0,P.jsx)(y,{className:`w-4 h-4`}),color:`text-info`},completed:{icon:(0,P.jsx)(c,{className:`w-4 h-4`}),color:`text-success`}},I={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},L={feature:`bg-success/15 text-success`,bugfix:`bg-destructive/15 text-destructive`,refactor:`bg-primary/15 text-primary`,docs:`bg-info/15 text-info`,test:`bg-primary/15 text-primary`,chore:`bg-muted text-muted-foreground`};function R(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function z({task:e,onStatusChange:t,onRetry:r,agents:a,onAssign:o,compact:s,className:c}){let{t:u}=n(),d=F[e.status],[f,p]=(0,N.useState)(!1),m=e.status===`in_progress`;return(0,P.jsxs)(`div`,{className:T(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,m?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-success/35 bg-success/6`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,c),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:T(`mt-0.5`,d.color),role:`img`,"aria-label":m?u(`common:status.inProgress`):void 0,children:d.icon}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.priority]),children:e.priority}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,L[e.type]),children:e.type})]}),e.description&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,P.jsxs)(`div`,{className:T(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,P.jsx)(l,{className:`w-3 h-3 animate-spin`,"aria-label":u(`common:status.working`)}),(0,P.jsx)(`span`,{children:e.assignee})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,P.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,P.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,P.jsxs)(`span`,{children:[`• `,R(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,P.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!s&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:u(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:u(`activity:task.complete`)}),r&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,P.jsx)(y,{className:`w-3 h-3`}),` `,u(`activity:task.retry`)]}),o&&a&&a.length>0&&(f?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{o(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:u(`activity:task.unassigned`)}),a.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>p(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:u(`activity:task.assignTitle`),children:[(0,P.jsx)(i,{className:`w-3 h-3`}),` `,u(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,match:[`pending`,`blocked`]},{key:`in_progress`,match:[`in_progress`]},{key:`review`,match:[`review`]},{key:`failed`,match:[`failed`]},{key:`completed`,match:[`completed`]}],V={pending:`bg-muted text-muted-foreground`,ready:`bg-info/15 text-info`,running:`bg-primary/15 text-primary`,paused:`bg-warning/15 text-warning`,completed:`bg-success/15 text-success`,failed:`bg-destructive/15 text-destructive`,skipped:`bg-muted text-muted-foreground`};function ne(){let{client:e}=w(),{t}=n(),r=E(e=>e.phases),i=E(e=>e.multiBoard),[a,o]=(0,N.useState)(`phase`),[s,c]=(0,N.useState)(null),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(0),h=Math.min(f,Math.max(0,r.length-1)),g=i?r[h]:void 0,_=(0,N.useMemo)(()=>r.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[r]),v=(0,N.useMemo)(()=>[...new Set(_.map(e=>e.assignee).filter(e=>!!e))],[_]),y=(0,N.useCallback)(t=>e?.send?.(t),[e]),b=(0,N.useCallback)((e,t)=>y({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[y]),x=(0,N.useCallback)(e=>y({type:`goal.retryTask`,payload:{taskId:e}}),[y]),S=(0,N.useCallback)((e,t)=>y({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[y]),C=(0,N.useCallback)(e=>{j({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&y({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[y]),D=(0,N.useCallback)(e=>{s&&y({type:`goal.moveTask`,payload:{taskId:s,toPhaseId:e}}),c(null),d(null)},[s,y]),O=(0,N.useCallback)(e=>{s&&y({type:`goal.taskStatus`,payload:{taskId:s,status:e}}),c(null),d(null)},[s,y]),k={onStatusChange:b,onRetry:x,agents:v,onAssign:S};function A(e){return{draggable:!0,onDragStart:t=>{c(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{c(null),d(null)}}}function M(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,l!==e&&d(e)},onDragLeave:()=>d(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":l===e||void 0}}return r.length===0?(0,P.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:r.length,tasks:_.length})}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>o(`phase`),className:T(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,a===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(u,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>o(`status`),className:T(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,a===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(m,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),i&&g?(0,P.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-3 py-1.5`,children:r.map((e,t)=>(0,P.jsxs)(`button`,{type:`button`,onClick:()=>p(t),className:T(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===h?`border-primary/40 bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,P.jsx)(`span`,{className:`truncate`,children:e.name}),(0,P.jsxs)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount]})]},e.id))}),(0,P.jsx)(W,{phase:g,allTasks:_,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:M,dropToPhase:D,dropToStatus:O,onAddTask:C})]}):(0,P.jsx)(U,{phases:r,allTasks:_,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:M,dropToPhase:D,dropToStatus:O,onAddTask:C})]})}function H({phase:e,phaseTasks:t,callbacks:r,draggable:i,dropZone:a,dropToPhase:o,onAddTask:s,dragId:c,hoverKey:l}){let{t:u}=n();return(0,P.jsxs)(`div`,{...a(`phase:${e.id}`,()=>o(e.id)),className:T(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,P.jsx)(`span`,{className:T(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,V[e.status]),children:e.status})]}),(0,P.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),title:u(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(f,{className:`h-4 w-4`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:t.length===0?(0,P.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:u(`activity:board.dropHere`)}):t.map(e=>(0,P.jsx)(`div`,{...i(e.id),className:T(c===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...r})},e.id))})]})}function U({phases:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:u}){return(0,P.jsx)(P.Fragment,{children:n===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:e.map(e=>{let n=t.filter(t=>t.phaseId===e.id);return(0,P.jsx)(H,{phase:e,phaseTasks:n,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,dragId:r,hoverKey:i},e.id)})}):(0,P.jsx)(G,{phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:l})})}function W({phase:e,allTasks:t,layout:r,dragId:i,hoverKey:a,callbacks:o,draggable:s,dropZone:c,dropToPhase:l,dropToStatus:u,onAddTask:d}){let f=t.filter(t=>t.phaseId===e.id),{t:p}=n();return r===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:(0,P.jsx)(H,{phase:e,phaseTasks:f,callbacks:o,draggable:s,dropZone:c,dropToPhase:l,onAddTask:d,dragId:i,hoverKey:a})}):(0,P.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:p(`activity:board.status.${e.key}`)},e.key)),(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:T(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(t=>{let n=f.filter(e=>t.match.includes(e.status)),r=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...c(r,()=>u(t.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,a===r?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...s(e.id),className:T(i===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...o})},e.id))},t.key)})]},e.id)]})})}function G({phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:c}){let{t:l}=n();return(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:l(`activity:board.status.${e.key}`)},e.key)),e.map(e=>(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:T(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(n=>{let l=t.filter(t=>t.phaseId===e.id&&n.match.includes(t.status)),u=`cell:${e.id}:${n.key}`;return(0,P.jsx)(`div`,{...s(u,()=>c(n.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.map(e=>(0,P.jsx)(`div`,{...o(e.id),className:T(r===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...a})},e.id))},n.key)})]},e.id))]})}function K({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function q({onClose:e}){let{client:i}=w(),{t:s}=n(),c=E(e=>e.phases),l=E(e=>e.overallPercent),u=E(e=>e.autonomous),d=E(e=>e.title),m=E(e=>e.goal),v=E(e=>e.status),y=E(e=>e.lastError),C=E(e=>e.graphs);(0,N.useEffect)(()=>{i?.send?.({type:`goal.list`}),i?.send?.({type:`goal.state`})},[i]);let j=D(e=>e.worktrees),F=D(e=>e.baseBranch),[I,L]=(0,N.useState)(``),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(!1),[H,U]=(0,N.useState)(!0),[W,G]=(0,N.useState)(!1),[K,q]=(0,N.useState)(!1),[J,re]=(0,N.useState)(!1),Y=O(e=>e.result),X=O(e=>e.loading),Z=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(Z.current&&clearTimeout(Z.current),!I.trim()){O.getState().clear();return}return Z.current=setTimeout(()=>{O.getState().setLoading();let e=O.getState().nextSeq();i?.send?.({type:`goal.assess`,payload:{goal:I,seq:e}})},800),()=>{Z.current&&clearTimeout(Z.current)}},[I,i]),(0,N.useEffect)(()=>{!I.trim()&&!R&&O.getState().clear()},[I,R]);let Q=c.length>0,ie=R!=null&&!Q;(0,N.useEffect)(()=>{Q&&z(null)},[Q]);let ae=(0,N.useCallback)(()=>{let e=I.trim();if(!e||R!=null)return;let n=t.getState();n.addMessage({role:`user`,content:e}),n.addMessage({role:`assistant`,content:p.t(`activity:goalRun.planningAck`)}),z(e),L(``),i?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:H,multiBoard:W,verifyTasks:K,chimeraReview:J}}),k(`chat`)},[I,R,i,H]),oe=(0,N.useCallback)(()=>{i?.send?.({type:`goal.stop`,payload:{}}),z(null)},[i]),se=(0,N.useCallback)(()=>{i?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[i]),ce=(0,N.useCallback)(()=>{i?.send?.(v===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[i,v]),le=(0,N.useCallback)(()=>{i?.send?.({type:`goal.stop`,payload:{}})},[i]),ue=(0,N.useCallback)(()=>{i?.send?.({type:`goal.clear`,payload:{}}),E.getState().clear(),z(null),L(``)},[i]),[de,$]=(0,N.useState)(!1),fe=(0,N.useCallback)(()=>{i?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[i]),pe=v===`running`||v===`paused`,me=v===`stopped`||v===`completed`||v===`failed`,he=(0,N.useCallback)(e=>{e&&i?.send?.({type:`goal.load`,payload:{graphId:e}})},[i]);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,P.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2 border-b bg-card px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(S,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:Q&&d||`Goal`}),Q&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`activity:goalRun.summary`,{count:c.length,pct:l})})]}),Q&&(0,P.jsx)(`span`,{className:T(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,v===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:v===`paused`||v===`stopped`?`border-warning/40 bg-warning/10 text-warning`:v===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:y??void 0,children:v})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[C.length>0&&(0,P.jsxs)(`select`,{value:Q?C.find(e=>e.title===d)?.id??``:``,onChange:e=>he(e.target.value),title:s(`activity:goalRun.switchBoard`),className:`min-w-0 flex-1 rounded border border-border bg-card px-2 py-1 text-xs text-foreground sm:w-72 sm:flex-none`,children:[(0,P.jsx)(`option`,{value:``,disabled:!0,children:s(`activity:goalRun.boardsCount`,{count:C.length})}),C.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),Q&&(0,P.jsxs)(`button`,{type:`button`,onClick:se,title:s(`activity:goalRun.toggleAutonomousTitle`),className:T(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,u?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(x,{className:`h-3.5 w-3.5`}),` `,s(u?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ce,title:s(v===`paused`?`activity:goalRun.resumeTitle`:`activity:goalRun.pauseTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[v===`paused`?(0,P.jsx)(a,{className:`h-3.5 w-3.5`}):(0,P.jsx)(_,{className:`h-3.5 w-3.5`}),s(v===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:le,title:s(`activity:goalRun.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,P.jsx)(r,{className:`h-3.5 w-3.5 fill-current`}),` `,s(`activity:goalRun.stop`)]})]}),Q&&me&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ue,title:s(`activity:goalRun.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,P.jsx)(f,{className:`h-3.5 w-3.5`}),` `,s(`activity:goalRun.newLabel`)]}),de?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 text-xs`,children:[(0,P.jsx)(`span`,{className:`text-warning`,children:s(`activity:goalRun.revertConfirm`)}),(0,P.jsx)(`button`,{type:`button`,onClick:fe,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:s(`common:action.yes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:s(`common:action.no`)})]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:s(`activity:goalRun.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,P.jsx)(o,{className:`h-3.5 w-3.5`}),` `,s(`activity:goalRun.revert`)]})]}),(0,P.jsx)(A,{variant:`ghost`,size:`icon`,onClick:e,children:(0,P.jsx)(h,{className:`h-4 w-4`})})]})]}),Q&&m&&(0,P.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3`}),` `,s(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:m})]}),Q?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,P.jsx)(ne,{})}):ie?(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,P.jsx)(b,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:s(`activity:goalRun.planning`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`activity:goalRun.planningBody`)})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3`}),` `,s(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:R})]}),(0,P.jsxs)(A,{variant:`outline`,onClick:oe,className:`gap-2`,children:[(0,P.jsx)(r,{className:`h-4 w-4 fill-current`}),` `,s(`common:action.cancel`)]})]})}):(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(g,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:s(`activity:goalRun.startHeading`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`activity:goalRun.startBody`)})]}),(0,P.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:s(`activity:goalRun.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/70`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ae())}}),X&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(b,{className:`h-3 w-3 animate-spin`}),s(`activity:goalRun.assess.analyzing`)]}),!X&&Y&&!Y.parseFailed&&(0,P.jsxs)(`div`,{className:T(`rounded-lg border px-3 py-2 text-xs space-y-1.5`,Y.realistic?`border-success/40 bg-success/10`:`border-warning/40 bg-warning/10`),children:[(0,P.jsx)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:Y.realistic?(0,P.jsx)(`span`,{className:`text-success`,children:s(`activity:goalRun.assess.realistic`)}):(0,P.jsx)(`span`,{className:`text-warning`,children:s(`activity:goalRun.assess.durationConcern`)})}),Y.durationClaimed&&(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:s(`activity:goalRun.assess.durationClaimed`,{duration:Y.durationClaimed})}),(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:Y.explanation}),Y.recommendedDuration&&(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:s(`activity:goalRun.assess.recommendation`,{duration:Y.recommendedDuration})}),Y.concerns.length>0&&(0,P.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,P.jsx)(`p`,{className:`font-medium text-foreground/80`,children:s(`activity:goalRun.assess.concerns`)}),(0,P.jsx)(`ul`,{className:`list-disc pl-4 space-y-0.5 text-muted-foreground`,children:Y.concerns.map((e,t)=>(0,P.jsx)(`li`,{children:e},t))})]})]}),!X&&Y?.parseFailed&&(0,P.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:s(`activity:goalRun.assess.analysisFailed`)}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.isolateLabel`)]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 text-xs text-muted-foreground`,children:[(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:W,onChange:e=>G(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.multiBoardLabel`)]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>q(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.verifyTasksLabel`)]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:J,onChange:e=>re(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.chimeraReviewLabel`)]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[!X&&Y&&!Y.realistic&&!Y.parseFailed&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>O.getState().clear(),className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:s(`activity:goalRun.assess.overrideTitle`),children:s(`activity:goalRun.assess.override`)}),(0,P.jsxs)(A,{onClick:ae,disabled:!I.trim()||R!=null||X||!X&&Y!=null&&!Y.parseFailed&&!Y.realistic,className:`flex-1 gap-2`,title:I.trim()&&!X&&Y&&!Y.parseFailed&&!Y.realistic?s(`activity:goalRun.assess.disableTitle`):``,children:[(0,P.jsx)(a,{className:`h-4 w-4`}),s(`activity:goalRun.startButton`)]})]}),(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[s(`activity:goalRun.ctrlHint`),` ·`,` `,s(H?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),j.length>0&&(0,P.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!1),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:s(`activity:goalRun.lanes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:s(`activity:goalRun.graph`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,P.jsx)(te,{}),B?(0,P.jsx)(M,{worktrees:j,baseBranch:F}):(0,P.jsx)(ee,{worktrees:j,baseBranch:F})]})]})]})}export{q as GoalView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-CtIMb3sU.js";import{Ba as n,Bt as r,Ct as i,En as a,Et as o,Ga as s,Ji as c,Ni as l,Oi as u,Ri as d,Tn as f,Ua as p,dn as m,dt as h,gn as g,jn as _,lt as v,mn as y,or as b,ut as x,vr as S,zi as C}from"./vendor-DLS502Zs.js";import"./i18n-CYYBUSJB.js";import{t as w}from"./useWebSocket-Ew1Bbjci.js";import{t as T}from"./utils-B5X3DKef.js";import{t as E,v as D,y as O}from"./stores-BUtRik4k.js";import{o as k}from"./view-navigation-Hd631M1W.js";import{t as A}from"./button-DAT5OnLL.js";import{a as j}from"./ConfirmModal-BJOVE-JI.js";import{h as M,m as ee,p as te}from"./index-cUeJ0FkT.js";var N=e(s(),1),P=v(),F={pending:{icon:(0,P.jsx)(d,{className:`w-4 h-4`}),color:`text-muted-foreground`},in_progress:{icon:(0,P.jsx)(l,{className:`w-4 h-4 animate-spin`}),color:`text-primary`},blocked:{icon:(0,P.jsx)(_,{className:`w-4 h-4`}),color:`text-warning`},failed:{icon:(0,P.jsx)(C,{className:`w-4 h-4`}),color:`text-destructive`},review:{icon:(0,P.jsx)(y,{className:`w-4 h-4`}),color:`text-info`},completed:{icon:(0,P.jsx)(c,{className:`w-4 h-4`}),color:`text-success`}},I={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},L={feature:`bg-success/15 text-success`,bugfix:`bg-destructive/15 text-destructive`,refactor:`bg-primary/15 text-primary`,docs:`bg-info/15 text-info`,test:`bg-primary/15 text-primary`,chore:`bg-muted text-muted-foreground`};function R(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function z({task:e,onStatusChange:t,onRetry:r,agents:a,onAssign:o,compact:s,className:c}){let{t:u}=n(),d=F[e.status],[f,p]=(0,N.useState)(!1),m=e.status===`in_progress`;return(0,P.jsxs)(`div`,{className:T(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,m?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-success/35 bg-success/6`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,c),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:T(`mt-0.5`,d.color),role:`img`,"aria-label":m?u(`common:status.inProgress`):void 0,children:d.icon}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.priority]),children:e.priority}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,L[e.type]),children:e.type})]}),e.description&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,P.jsxs)(`div`,{className:T(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,P.jsx)(l,{className:`w-3 h-3 animate-spin`,"aria-label":u(`common:status.working`)}),(0,P.jsx)(`span`,{children:e.assignee})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,P.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,P.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,P.jsxs)(`span`,{children:[`• `,R(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,P.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!s&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:u(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:u(`activity:task.complete`)}),r&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,P.jsx)(y,{className:`w-3 h-3`}),` `,u(`activity:task.retry`)]}),o&&a&&a.length>0&&(f?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{o(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:u(`activity:task.unassigned`)}),a.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>p(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:u(`activity:task.assignTitle`),children:[(0,P.jsx)(i,{className:`w-3 h-3`}),` `,u(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,match:[`pending`,`blocked`]},{key:`in_progress`,match:[`in_progress`]},{key:`review`,match:[`review`]},{key:`failed`,match:[`failed`]},{key:`completed`,match:[`completed`]}],V={pending:`bg-muted text-muted-foreground`,ready:`bg-info/15 text-info`,running:`bg-primary/15 text-primary`,paused:`bg-warning/15 text-warning`,completed:`bg-success/15 text-success`,failed:`bg-destructive/15 text-destructive`,skipped:`bg-muted text-muted-foreground`};function ne(){let{client:e}=w(),{t}=n(),r=D(e=>e.phases),i=D(e=>e.multiBoard),[a,o]=(0,N.useState)(`phase`),[s,c]=(0,N.useState)(null),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(0),h=Math.min(f,Math.max(0,r.length-1)),g=i?r[h]:void 0,_=(0,N.useMemo)(()=>r.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[r]),v=(0,N.useMemo)(()=>[...new Set(_.map(e=>e.assignee).filter(e=>!!e))],[_]),y=(0,N.useCallback)(t=>e?.send?.(t),[e]),b=(0,N.useCallback)((e,t)=>y({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[y]),x=(0,N.useCallback)(e=>y({type:`goal.retryTask`,payload:{taskId:e}}),[y]),S=(0,N.useCallback)((e,t)=>y({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[y]),C=(0,N.useCallback)(e=>{j({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&y({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[y]),E=(0,N.useCallback)(e=>{s&&y({type:`goal.moveTask`,payload:{taskId:s,toPhaseId:e}}),c(null),d(null)},[s,y]),O=(0,N.useCallback)(e=>{s&&y({type:`goal.taskStatus`,payload:{taskId:s,status:e}}),c(null),d(null)},[s,y]),k={onStatusChange:b,onRetry:x,agents:v,onAssign:S};function A(e){return{draggable:!0,onDragStart:t=>{c(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{c(null),d(null)}}}function M(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,l!==e&&d(e)},onDragLeave:()=>d(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":l===e||void 0}}return r.length===0?(0,P.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:r.length,tasks:_.length})}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>o(`phase`),className:T(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,a===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(u,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>o(`status`),className:T(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,a===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(m,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),i&&g?(0,P.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-3 py-1.5`,children:r.map((e,t)=>(0,P.jsxs)(`button`,{type:`button`,onClick:()=>p(t),className:T(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===h?`border-primary/40 bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,P.jsx)(`span`,{className:`truncate`,children:e.name}),(0,P.jsxs)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount]})]},e.id))}),(0,P.jsx)(W,{phase:g,allTasks:_,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:M,dropToPhase:E,dropToStatus:O,onAddTask:C})]}):(0,P.jsx)(U,{phases:r,allTasks:_,layout:a,dragId:s,hoverKey:l,callbacks:k,draggable:A,dropZone:M,dropToPhase:E,dropToStatus:O,onAddTask:C})]})}function H({phase:e,phaseTasks:t,callbacks:r,draggable:i,dropZone:a,dropToPhase:o,onAddTask:s,dragId:c,hoverKey:l}){let{t:u}=n();return(0,P.jsxs)(`div`,{...a(`phase:${e.id}`,()=>o(e.id)),className:T(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,P.jsx)(`span`,{className:T(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,V[e.status]),children:e.status})]}),(0,P.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),title:u(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(f,{className:`h-4 w-4`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:t.length===0?(0,P.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:u(`activity:board.dropHere`)}):t.map(e=>(0,P.jsx)(`div`,{...i(e.id),className:T(c===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...r})},e.id))})]})}function U({phases:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:u}){return(0,P.jsx)(P.Fragment,{children:n===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:e.map(e=>{let n=t.filter(t=>t.phaseId===e.id);return(0,P.jsx)(H,{phase:e,phaseTasks:n,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,dragId:r,hoverKey:i},e.id)})}):(0,P.jsx)(G,{phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:l})})}function W({phase:e,allTasks:t,layout:r,dragId:i,hoverKey:a,callbacks:o,draggable:s,dropZone:c,dropToPhase:l,dropToStatus:u,onAddTask:d}){let f=t.filter(t=>t.phaseId===e.id),{t:p}=n();return r===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:(0,P.jsx)(H,{phase:e,phaseTasks:f,callbacks:o,draggable:s,dropZone:c,dropToPhase:l,onAddTask:d,dragId:i,hoverKey:a})}):(0,P.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:p(`activity:board.status.${e.key}`)},e.key)),(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:T(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(t=>{let n=f.filter(e=>t.match.includes(e.status)),r=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...c(r,()=>u(t.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,a===r?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...s(e.id),className:T(i===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...o})},e.id))},t.key)})]},e.id)]})})}function G({phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:c}){let{t:l}=n();return(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:l(`activity:board.status.${e.key}`)},e.key)),e.map(e=>(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:T(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(n=>{let l=t.filter(t=>t.phaseId===e.id&&n.match.includes(t.status)),u=`cell:${e.id}:${n.key}`;return(0,P.jsx)(`div`,{...s(u,()=>c(n.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.map(e=>(0,P.jsx)(`div`,{...o(e.id),className:T(r===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...a})},e.id))},n.key)})]},e.id))]})}function K({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function q({onClose:e}){let{client:i}=w(),{t:s}=n(),c=D(e=>e.phases),l=D(e=>e.overallPercent),u=D(e=>e.autonomous),d=D(e=>e.title),m=D(e=>e.goal),v=D(e=>e.status),y=D(e=>e.lastError),C=D(e=>e.graphs);(0,N.useEffect)(()=>{i?.send?.({type:`goal.list`}),i?.send?.({type:`goal.state`})},[i]);let j=E(e=>e.worktrees),F=E(e=>e.baseBranch),[I,L]=(0,N.useState)(``),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(!1),[H,U]=(0,N.useState)(!0),[W,G]=(0,N.useState)(!1),[K,q]=(0,N.useState)(!1),[J,re]=(0,N.useState)(!1),Y=O(e=>e.result),X=O(e=>e.loading),Z=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(Z.current&&clearTimeout(Z.current),!I.trim()){O.getState().clear();return}return Z.current=setTimeout(()=>{O.getState().setLoading();let e=O.getState().nextSeq();i?.send?.({type:`goal.assess`,payload:{goal:I,seq:e}})},800),()=>{Z.current&&clearTimeout(Z.current)}},[I,i]),(0,N.useEffect)(()=>{!I.trim()&&!R&&O.getState().clear()},[I,R]);let Q=c.length>0,ie=R!=null&&!Q;(0,N.useEffect)(()=>{Q&&z(null)},[Q]);let ae=(0,N.useCallback)(()=>{let e=I.trim();if(!e||R!=null)return;let n=t.getState();n.addMessage({role:`user`,content:e}),n.addMessage({role:`assistant`,content:p.t(`activity:goalRun.planningAck`)}),z(e),L(``),i?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:H,multiBoard:W,verifyTasks:K,chimeraReview:J}}),k(`chat`)},[I,R,i,H]),oe=(0,N.useCallback)(()=>{i?.send?.({type:`goal.stop`,payload:{}}),z(null)},[i]),se=(0,N.useCallback)(()=>{i?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[i]),ce=(0,N.useCallback)(()=>{i?.send?.(v===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[i,v]),le=(0,N.useCallback)(()=>{i?.send?.({type:`goal.stop`,payload:{}})},[i]),ue=(0,N.useCallback)(()=>{i?.send?.({type:`goal.clear`,payload:{}}),D.getState().clear(),z(null),L(``)},[i]),[de,$]=(0,N.useState)(!1),fe=(0,N.useCallback)(()=>{i?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[i]),pe=v===`running`||v===`paused`,me=v===`stopped`||v===`completed`||v===`failed`,he=(0,N.useCallback)(e=>{e&&i?.send?.({type:`goal.load`,payload:{graphId:e}})},[i]);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,P.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2 border-b bg-card px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(S,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:Q&&d||`Goal`}),Q&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`activity:goalRun.summary`,{count:c.length,pct:l})})]}),Q&&(0,P.jsx)(`span`,{className:T(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,v===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:v===`paused`||v===`stopped`?`border-warning/40 bg-warning/10 text-warning`:v===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:y??void 0,children:v})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[C.length>0&&(0,P.jsxs)(`select`,{value:Q?C.find(e=>e.title===d)?.id??``:``,onChange:e=>he(e.target.value),title:s(`activity:goalRun.switchBoard`),className:`min-w-0 flex-1 rounded border border-border bg-card px-2 py-1 text-xs text-foreground sm:w-72 sm:flex-none`,children:[(0,P.jsx)(`option`,{value:``,disabled:!0,children:s(`activity:goalRun.boardsCount`,{count:C.length})}),C.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),Q&&(0,P.jsxs)(`button`,{type:`button`,onClick:se,title:s(`activity:goalRun.toggleAutonomousTitle`),className:T(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,u?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(x,{className:`h-3.5 w-3.5`}),` `,s(u?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ce,title:s(v===`paused`?`activity:goalRun.resumeTitle`:`activity:goalRun.pauseTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[v===`paused`?(0,P.jsx)(a,{className:`h-3.5 w-3.5`}):(0,P.jsx)(_,{className:`h-3.5 w-3.5`}),s(v===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:le,title:s(`activity:goalRun.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,P.jsx)(r,{className:`h-3.5 w-3.5 fill-current`}),` `,s(`activity:goalRun.stop`)]})]}),Q&&me&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ue,title:s(`activity:goalRun.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,P.jsx)(f,{className:`h-3.5 w-3.5`}),` `,s(`activity:goalRun.newLabel`)]}),de?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 text-xs`,children:[(0,P.jsx)(`span`,{className:`text-warning`,children:s(`activity:goalRun.revertConfirm`)}),(0,P.jsx)(`button`,{type:`button`,onClick:fe,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:s(`common:action.yes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:s(`common:action.no`)})]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:s(`activity:goalRun.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,P.jsx)(o,{className:`h-3.5 w-3.5`}),` `,s(`activity:goalRun.revert`)]})]}),(0,P.jsx)(A,{variant:`ghost`,size:`icon`,onClick:e,children:(0,P.jsx)(h,{className:`h-4 w-4`})})]})]}),Q&&m&&(0,P.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3`}),` `,s(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:m})]}),Q?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,P.jsx)(ne,{})}):ie?(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,P.jsx)(b,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:s(`activity:goalRun.planning`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`activity:goalRun.planningBody`)})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3`}),` `,s(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:R})]}),(0,P.jsxs)(A,{variant:`outline`,onClick:oe,className:`gap-2`,children:[(0,P.jsx)(r,{className:`h-4 w-4 fill-current`}),` `,s(`common:action.cancel`)]})]})}):(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(g,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:s(`activity:goalRun.startHeading`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`activity:goalRun.startBody`)})]}),(0,P.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:s(`activity:goalRun.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/70`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ae())}}),X&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(b,{className:`h-3 w-3 animate-spin`}),s(`activity:goalRun.assess.analyzing`)]}),!X&&Y&&!Y.parseFailed&&(0,P.jsxs)(`div`,{className:T(`rounded-lg border px-3 py-2 text-xs space-y-1.5`,Y.realistic?`border-success/40 bg-success/10`:`border-warning/40 bg-warning/10`),children:[(0,P.jsx)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:Y.realistic?(0,P.jsx)(`span`,{className:`text-success`,children:s(`activity:goalRun.assess.realistic`)}):(0,P.jsx)(`span`,{className:`text-warning`,children:s(`activity:goalRun.assess.durationConcern`)})}),Y.durationClaimed&&(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:s(`activity:goalRun.assess.durationClaimed`,{duration:Y.durationClaimed})}),(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:Y.explanation}),Y.recommendedDuration&&(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:s(`activity:goalRun.assess.recommendation`,{duration:Y.recommendedDuration})}),Y.concerns.length>0&&(0,P.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,P.jsx)(`p`,{className:`font-medium text-foreground/80`,children:s(`activity:goalRun.assess.concerns`)}),(0,P.jsx)(`ul`,{className:`list-disc pl-4 space-y-0.5 text-muted-foreground`,children:Y.concerns.map((e,t)=>(0,P.jsx)(`li`,{children:e},t))})]})]}),!X&&Y?.parseFailed&&(0,P.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:s(`activity:goalRun.assess.analysisFailed`)}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.isolateLabel`)]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 text-xs text-muted-foreground`,children:[(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:W,onChange:e=>G(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.multiBoardLabel`)]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>q(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.verifyTasksLabel`)]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:J,onChange:e=>re(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),s(`activity:goalRun.chimeraReviewLabel`)]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[!X&&Y&&!Y.realistic&&!Y.parseFailed&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>O.getState().clear(),className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:s(`activity:goalRun.assess.overrideTitle`),children:s(`activity:goalRun.assess.override`)}),(0,P.jsxs)(A,{onClick:ae,disabled:!I.trim()||R!=null||X||!X&&Y!=null&&!Y.parseFailed&&!Y.realistic,className:`flex-1 gap-2`,title:I.trim()&&!X&&Y&&!Y.parseFailed&&!Y.realistic?s(`activity:goalRun.assess.disableTitle`):``,children:[(0,P.jsx)(a,{className:`h-4 w-4`}),s(`activity:goalRun.startButton`)]})]}),(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[s(`activity:goalRun.ctrlHint`),` ·`,` `,s(H?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),j.length>0&&(0,P.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!1),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:s(`activity:goalRun.lanes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:s(`activity:goalRun.graph`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,P.jsx)(te,{}),B?(0,P.jsx)(M,{worktrees:j,baseBranch:F}):(0,P.jsx)(ee,{worktrees:j,baseBranch:F})]})]})]})}export{q as GoalView};
|