@markus-global/cli 0.9.6 → 0.9.7-rc.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/README.md +1 -1
- package/dist/commands/skill.d.ts +3 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +148 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +17 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/markus.mjs +5522 -2746
- package/dist/web-ui/assets/{CommentInput-CBNbViJY.js → CommentInput-CIxUL6dU.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-DE3pZgeX.js → ContentRenderer-Bb_drUpO.js} +2 -2
- package/dist/web-ui/assets/DeliverableShareModal-BEeIlXig.js +1 -0
- package/dist/web-ui/assets/Deliverables-CJFzxbLw.js +3 -0
- package/dist/web-ui/assets/{Notifications-DnOdXHNc.js → Notifications-Cz2LKhGE.js} +1 -1
- package/dist/web-ui/assets/{Search-BxFLlgcf.js → Search-dq45wHQN.js} +1 -1
- package/dist/web-ui/assets/Settings-WAXEtxMR.js +8 -0
- package/dist/web-ui/assets/{Store-BELkjEqO.js → Store-DOGCOxTK.js} +1 -1
- package/dist/web-ui/assets/Team-NM2SsmjN.js +81 -0
- package/dist/web-ui/assets/Work-ornw-1Zh.js +11 -0
- package/dist/web-ui/assets/{arc-CyhYnNcy.js → arc-D4xcu8MX.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-BYIYNrCP.js → architectureDiagram-3BPJPVTR-DP3EZPSb.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-Tj8Yz066.js → blockDiagram-GPEHLZMM-BnSHtwXa.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-Ifa4IAJa.js → c4Diagram-AAUBKEIU-DpPSihlY.js} +1 -1
- package/dist/web-ui/assets/channel-DSB2MBEK.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-CNSbz4EK.js → chunk-2J33WTMH-DD5lZIGF.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-DhNtaIHh.js → chunk-4BX2VUAB-D9wu9GG0.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-WUpOSLP9.js → chunk-55IACEB6-p_n2ARjh.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-BJV_Jz1H.js → chunk-727SXJPM-BiTqi43c.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-BHu_5o0Y.js → chunk-AQP2D5EJ-DVPMedje.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-CfxugWTK.js → chunk-FMBD7UC4-B53AqN8D.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-hIFBUDLZ.js → chunk-ND2GUHAM-sACe_lkd.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-DF0OYrsG.js → chunk-QZHKN3VN-B0qDAQUW.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-D5cDjaiz.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-D5cDjaiz.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-C3LM31P0.js → cose-bilkent-S5V4N54A-BzZayQQf.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-C_m79Kes.js → dagre-BM42HDAG-DjcfWzm_.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-D8liSSSE.js → diagram-2AECGRRQ-CEK9T3rW.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-DqtsU-bB.js → diagram-5GNKFQAL-BJsJPwEI.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-C6zkMDRo.js → diagram-KO2AKTUF-BZlki2qo.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-Dx2JnYqj.js → diagram-LMA3HP47-Bkmh3WcY.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-ZI_lN3Ui.js → diagram-OG6HWLK6-4THSXHiA.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-DQ5VepuZ.js → erDiagram-TEJ5UH35-CPj2HGe-.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-6GiDnWFL.js → flowDiagram-I6XJVG4X-Bu8HgFqR.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-D6HROKP8.js → ganttDiagram-6RSMTGT7-C5gs9b9P.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-CXm0stFt.js → gitGraphDiagram-PVQCEYII-DxnBgR_T.js} +1 -1
- package/dist/web-ui/assets/index-BbQpGkiM.css +1 -0
- package/dist/web-ui/assets/index-CiAGgfZx.js +672 -0
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-C1RxESvu.js → infoDiagram-5YYISTIA-D4M-cR8I.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-K65PlAf9.js → ishikawaDiagram-YF4QCWOH-Oiq6jknk.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-_Rs_Vudv.js → journeyDiagram-JHISSGLW-D2gmyCKv.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-Jf6WnoNW.js → kanban-definition-UN3LZRKU-DqjzkO8l.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-C6jfI8lj.js → mermaid.core-N5tL3hIv.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-CuVR_m6C.js → mindmap-definition-RKZ34NQL-ATHsVy0v.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-BiPJBXLU.js → pieDiagram-4H26LBE5-CprLr2Gv.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-C4hoAfNv.js → quadrantDiagram-W4KKPZXB-0uN86dlU.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-BmjjjPuK.js → requirementDiagram-4Y6WPE33-CQmWbZXW.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-ts7xFx2o.js → sankeyDiagram-5OEKKPKP-D6kdJsQI.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-C3je_x5z.js → sequenceDiagram-3UESZ5HK-1Y79snKt.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-CREzVZ-3.js → stateDiagram-AJRCARHV-BqmCPSIN.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DRaoGsBn.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-CriALCTC.js → timeline-definition-PNZ67QCA-OG71KAzb.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-Bc9NNe3M.js → vennDiagram-CIIHVFJN-V9c-71bn.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-psF9We_q.js → wardley-L42UT6IY-C3A6_LpL.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-DNZ9Jdgm.js → wardleyDiagram-YWT4CUSO-B54ZiT7U.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-COezi66E.js → xychartDiagram-2RQKCTM6-DpWlpUfV.js} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/package.json +2 -2
- package/templates/roles/{SHARED.md → HANDBOOK.md} +17 -7
- package/templates/roles/org-manager/ROLE.md +1 -5
- package/templates/roles/skill-architect/ROLE.md +1 -1
- package/templates/skills/agent-building/SKILL.md +109 -11
- package/templates/skills/skill-building/SKILL.md +61 -0
- package/templates/skills/team-building/SKILL.md +110 -4
- package/dist/web-ui/assets/Deliverables-Cx97uG2f.js +0 -6
- package/dist/web-ui/assets/Settings-D0i8Lnsk.js +0 -8
- package/dist/web-ui/assets/Team-D_C3tvWh.js +0 -80
- package/dist/web-ui/assets/Work-DpRdSwD5.js +0 -11
- package/dist/web-ui/assets/channel-B33xJsNY.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-BePK-BYt.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-BePK-BYt.js +0 -1
- package/dist/web-ui/assets/index-BMzsi3-i.js +0 -670
- package/dist/web-ui/assets/index-C9gwAZYM.css +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-CZU51KZ-.js +0 -1
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{u as rt,j as e,r as s,k as is,A as pt,w as ht,s as cs,m as Ht,l as L,o as ds,p as us,q as Vt,t as xs,v as fs,x as ms,y as st,z as ps,R as hs,B as gs,C as bs,D as ys,a as vs,b as js,E as ws,d as ks,c as Ns,F as Ss,P as Ne,M as Cs,n as Ye,i as Is,G as Ls}from"./index-BMzsi3-i.js";import{resolveFormat as Ts,ContentRenderer as Ms}from"./ContentRenderer-DE3pZgeX.js";function Se(c){return Array.isArray(c)?c.map(m=>String(m).trim()).filter(Boolean):typeof c=="string"&&c?c.split(",").map(m=>m.trim()).filter(Boolean):[]}function Es(c){return c.files&&typeof c.files=="object"&&!Array.isArray(c.files)?c.files:null}function He({label:c,value:m}){return m?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:c}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:m})]}):null}function Qe({label:c,value:m,color:p}){if(!m)return null;const n={purple:"bg-brand-500/15 text-brand-500",cyan:"bg-blue-500/15 text-blue-600",indigo:"bg-brand-500/15 text-brand-500",gray:"bg-gray-500/15 text-fg-secondary",emerald:"bg-green-500/15 text-green-600"};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:c}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${n[p]??n.gray} capitalize inline-block`,children:m})]})}function Ct({files:c}){const{t:m}=rt(["builder","common"]),[p,n]=s.useState(Object.keys(c)[0]??""),v=Object.keys(c);return v.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:m("builder:artifact.files",{count:v.length})}),e.jsxs("div",{className:"mt-1 bg-surface-elevated/50 rounded-lg border border-border-default/30 overflow-hidden",children:[e.jsx("div",{className:"flex gap-0.5 px-1.5 py-1 border-b border-border-default/30 overflow-x-auto",children:v.map(A=>e.jsx("button",{onClick:()=>n(A),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${p===A?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:A},A))}),p&&c[p]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:c[p]})]})]})}function Rs({artifact:c,mode:m}){const{t:p}=rt(["builder","common"]),n=Es(c),v=c.agent,A=c.team,q=c.dependencies,z=c.displayName??c.name;if(m==="agent"){const U=v?.roleName,_=v?.agentRole,M=v?.llmProvider,K=v?.llmModel,R=Se(q?.env),W=Se(q?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(He,{label:p("builder:artifact.name"),value:z}),e.jsx(He,{label:p("builder:artifact.description"),value:c.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[U&&e.jsx(Qe,{label:p("builder:artifact.baseTemplate"),value:U,color:"indigo"}),e.jsx(Qe,{label:p("builder:artifact.agentRole"),value:_,color:_==="manager"?"purple":"cyan"})]}),Se(c.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:Se(c.tags).map(k=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:k},k))}),(M||K)&&e.jsxs("div",{className:"flex gap-2",children:[M&&e.jsx(Qe,{label:p("builder:artifact.llmProvider"),value:M,color:"gray"}),K&&e.jsx(Qe,{label:p("builder:artifact.llmModel"),value:K,color:"gray"})]}),R.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:p("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:R.map(k=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:k},k))})]}),W.length>0&&e.jsx(He,{label:p("builder:artifact.skills"),value:W.join(", ")}),n&&e.jsx(Ct,{files:n})]})}if(m==="team"){const _=A?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(He,{label:p("builder:artifact.name"),value:z}),e.jsx(He,{label:p("builder:artifact.description"),value:c.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(Qe,{label:p("builder:artifact.category"),value:c.category,color:"indigo"})}),Se(c.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:Se(c.tags).map(M=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:M},M))}),n&&e.jsx(Ct,{files:n}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:p("builder:artifact.members",{count:_.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:_.map((M,K)=>e.jsxs("div",{className:"bg-surface-elevated/30 rounded-lg px-2 py-1.5 border border-border-default/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center text-[10px] font-bold ${M.role==="manager"?"bg-brand-500/20 text-brand-500":"bg-blue-500/20 text-blue-600"}`,children:M.role==="manager"?"★":K+1}),e.jsx("span",{className:"text-xs text-fg-secondary flex-1 truncate",children:M.name}),typeof M.roleName=="string"&&M.roleName&&e.jsx("span",{className:"text-[10px] text-brand-500/70 font-mono",children:M.roleName}),e.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["x",String(M.count??1)]})]}),Se(M.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:Se(M.skills).map(R=>e.jsx("span",{className:"px-1 py-0.5 text-[9px] bg-green-500/10 text-green-600 rounded font-mono",children:R},R))})]},K))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(He,{label:p("builder:artifact.name"),value:z}),e.jsx(He,{label:p("builder:artifact.description"),value:c.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(Qe,{label:p("builder:artifact.category"),value:c.category,color:"indigo"})}),n&&e.jsx(Ct,{files:n}),Se(c.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:Se(c.tags).map(U=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:U},U))})]})}const Kt={agent:"🤖",project:"📁",requirement:"📋",task:"✅",deliverable:"📦",workflow:"⚙️"},As=["project","requirement","task","deliverable","workflow","agent"];function Gt(c){return c.dataUrl.startsWith("data:image/")}function Ds(c,m){if(Gt({dataUrl:m}))return null;const p=c.split(".").pop()?.toLowerCase()??"";return{pdf:"📄",docx:"📝",doc:"📝",xlsx:"📊",xls:"📊",pptx:"📎",csv:"📊",json:"🔧",xml:"🔧",html:"🌐",epub:"📚"}[p]??"📁"}function $s({value:c,onChange:m,onSend:p,disabled:n=!1,placeholder:v="",sending:A=!1,onStop:q,contextChips:z,mentionItems:U,pendingFiles:_,onAttach:M,onPaste:K,onDrop:R,onDragOver:W,onRemoveFile:k,replyTo:Z,onClearReply:re,fileInputRef:be,visionWarning:Fe,maxFiles:_e=5,className:Ce="",compact:le=!1,onMentionChipsChange:me}){const{t:ye}=rt(["team","common"]),G=s.useRef(null),ie=s.useRef(null);s.useRef(null);const[ce,de]=s.useState(!1),[ve,pe]=s.useState(""),[Y,J]=s.useState(0),[ee,je]=s.useState(null),[F,Ie]=s.useState([]),r=(U??[]).filter(o=>o.name.toLowerCase().includes(ve)),ue=(()=>{if(r.length===0)return[];const o=new Map;for(const O of r){const D=O.type??"agent";o.has(D)||o.set(D,[]),o.get(D).push(O)}const P=[];for(const O of As){const D=o.get(O);D?.length&&P.push({type:O,items:D})}return P})();s.useEffect(()=>{if(!ce||!G.current){je(null);return}const o=G.current.getBoundingClientRect();je({left:o.left+16,bottom:window.innerHeight-o.top+4})},[ce]);const Ee=s.useCallback(()=>{const o=ie.current;o&&(o.style.height="auto",o.style.height=`${Math.min(o.scrollHeight,le?80:120)}px`)},[le]);s.useEffect(()=>{Ee()},[c,Ee]);const Ve=s.useCallback(o=>{if(m(o),!U?.length){de(!1);return}const P=ie.current?.selectionStart??o.length,O=o.slice(0,P),D=O.lastIndexOf("@");if(D>=0){const V=D===0?"":O[D-1];if(D===0||/[\s\n,,。!?!?;;::、()()\[\]【】]/.test(V)){const ne=O.slice(D+1);if(!ne.includes(" ")&&!ne.includes(`
|
|
2
|
-
`)){de(!0),pe(ne.toLowerCase()),J(0);return}}}de(!1)},[m,U]),Re=s.useCallback(o=>{const P=ie.current?.selectionStart??c.length,D=c.slice(0,P).lastIndexOf("@"),V=c.slice(P),Q=c.slice(0,D)+V.replace(/^\s/,"");m(Q);const ne={id:`mention_${Date.now()}_${o.id}`,entityId:o.id,name:o.name,entityType:o.type},De=[...F,ne];Ie(De),me?.(De),de(!1),J(0),requestAnimationFrame(()=>{const xe=D;ie.current?.setSelectionRange(xe,xe),ie.current?.focus()})},[c,m,F,me]),Le=s.useCallback(()=>{p(),Ie([]),me?.([])},[p,me]),X=s.useCallback(o=>{if(ce&&r.length>0){const P=o.key==="ArrowUp"||o.ctrlKey&&o.key==="p",O=o.key==="ArrowDown"||o.ctrlKey&&o.key==="n",D=o.key==="Enter"||o.key==="Tab",V=o.key==="Escape";if(P){o.preventDefault(),J(Q=>(Q-1+r.length)%r.length);return}if(O){o.preventDefault(),J(Q=>(Q+1)%r.length);return}if(D){o.preventDefault();const Q=r[Y];Q&&Re(Q);return}if(V){o.preventDefault(),de(!1);return}}o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),Le())},[ce,r,Y,Re,Le]),we=_??[],Ae=ce&&r.length>0&&ee&&is.createPortal(e.jsx("div",{className:"fixed bg-surface-elevated border border-border-default rounded-lg shadow-xl overflow-hidden max-h-64 overflow-y-auto min-w-[220px]",style:{left:ee.left,bottom:ee.bottom,zIndex:9999},children:(()=>{let o=0;return ue.map(P=>{const O=Kt[P.type],D=ye(`page.mentionType.${P.type}`);return e.jsxs("div",{children:[e.jsxs("div",{className:"px-3 py-1 text-[10px] text-fg-tertiary font-medium uppercase tracking-wider border-b border-border-default bg-surface-secondary/50 flex items-center gap-1.5 sticky top-0",children:[e.jsx("span",{children:O}),e.jsx("span",{children:D})]}),P.items.map(V=>{const Q=o++;return e.jsxs("button",{ref:ne=>{Q===Y&&ne&&ne.scrollIntoView({block:"nearest"})},onMouseDown:ne=>{ne.preventDefault(),Re(V)},onMouseEnter:()=>J(Q),className:`w-full text-left px-4 py-2 text-sm flex items-center gap-2 transition-colors ${Q===Y?"bg-brand-500/15 text-brand-500":"text-fg-secondary hover:bg-surface-overlay"}`,children:[V.type==="agent"?e.jsx(pt,{name:V.name,avatarUrl:V.avatarUrl,size:20,bgClass:"bg-brand-500/20 text-brand-500"}):e.jsx("span",{className:"text-xs w-5 h-5 flex items-center justify-center shrink-0",children:O}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:V.name}),V.role&&e.jsx("span",{className:"text-[10px] text-fg-tertiary ml-auto shrink-0",children:V.role})]},V.id)})]},P.type)})})()}),document.body);return e.jsxs("div",{ref:G,className:`relative bg-surface-primary border border-border-default shadow-lg shadow-black/10 rounded-2xl p-3 ${Ce}`,onDrop:R,onDragOver:W,children:[Ae,(z&&z.length>0||F.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2",children:[F.map(o=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-brand-500/10 border border-brand-500/30 text-xs text-brand-400 max-w-[200px]",children:[e.jsx("span",{className:"shrink-0 text-[10px]",children:Kt[o.entityType]}),e.jsx("span",{className:"truncate font-medium",children:o.name}),e.jsx("button",{onClick:()=>{const P=F.filter(O=>O.id!==o.id);Ie(P),me?.(P)},className:"shrink-0 text-brand-400/60 hover:text-red-400 transition-colors",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},o.id)),z?.map(o=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-surface-elevated border border-border-default text-xs text-fg-secondary max-w-[200px]",children:[e.jsx("span",{className:"truncate",children:o.label}),o.onRemove&&e.jsx("button",{onClick:o.onRemove,className:"shrink-0 text-fg-tertiary hover:text-red-500 transition-colors",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},o.id))]}),we.length>0&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 overflow-x-auto pb-1",children:[we.map(o=>e.jsxs("div",{className:"relative group/img shrink-0",children:[Gt(o)?e.jsx("img",{src:o.dataUrl,alt:o.name,className:"w-16 h-16 rounded-lg object-cover border border-border-default"}):e.jsxs("div",{className:"w-16 h-16 rounded-lg border border-border-default bg-surface-elevated flex flex-col items-center justify-center gap-0.5",title:o.name,children:[e.jsx("span",{className:"text-xl leading-none",children:Ds(o.name,o.dataUrl)}),e.jsx("span",{className:"text-[9px] text-fg-tertiary truncate max-w-[56px] px-0.5",children:o.name.split(".").pop()?.toUpperCase()})]}),k&&e.jsx("button",{onClick:()=>k(o.id),className:"absolute -top-1.5 -right-1.5 w-5 h-5 bg-surface-secondary border border-gray-600 rounded-full flex items-center justify-center text-fg-secondary hover:text-red-500 hover:border-red-500 text-xs opacity-0 group-hover/img:opacity-100 transition-opacity",children:"×"})]},o.id)),we.length<_e&&M&&e.jsx("button",{onClick:M,className:"w-16 h-16 rounded-lg border border-dashed border-gray-600 flex items-center justify-center text-fg-tertiary hover:text-fg-secondary hover:border-gray-400 transition-colors shrink-0",title:ye("page.addMoreFiles"),children:e.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})})]}),Fe&&e.jsxs("div",{className:"text-[10px] text-amber-500/80 mb-1.5 flex items-center gap-1",children:[e.jsx("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 9v4m0 4h.01M12 2L2 22h20L12 2z",strokeLinecap:"round",strokeLinejoin:"round"})}),ye("page.visionWarning")]}),Z&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-3 py-1.5 bg-surface-elevated rounded-lg border border-border-default/50",children:[e.jsxs("div",{className:"flex-1 min-w-0 pl-2 border-l-2 border-brand-500/50",children:[e.jsx("span",{className:"text-[11px] font-medium text-brand-500",children:Z.sender}),e.jsx("p",{className:"text-[11px] text-fg-tertiary truncate",children:Z.text})]}),re&&e.jsx("button",{onClick:re,className:"text-fg-tertiary hover:text-fg-secondary shrink-0 p-0.5",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{className:"flex gap-2 items-end",children:[M&&e.jsx("button",{onClick:M,disabled:n,className:"px-2.5 py-2.5 text-fg-tertiary hover:text-fg-secondary disabled:opacity-40 transition-colors rounded-xl hover:bg-surface-elevated",title:ye("page.attachFilesTitle"),children:e.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("textarea",{ref:ie,value:c,onChange:o=>Ve(o.target.value),onKeyDown:X,onPaste:K,placeholder:v,disabled:n,rows:le?1:2,className:"flex-1 px-4 py-3 bg-transparent rounded-xl text-sm outline-none disabled:opacity-40 transition-colors resize-none overflow-hidden leading-relaxed placeholder:text-fg-secondary",style:{minHeight:le?"36px":"52px",maxHeight:le?"80px":"120px"}}),A&&q&&e.jsx("button",{onClick:q,className:"px-3 py-2.5 bg-red-600 hover:bg-red-500 text-white text-sm rounded-xl transition-colors flex items-center gap-1.5",title:ye("page.stopAgent"),children:e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}),e.jsx("button",{onClick:Le,disabled:n||!c.trim()&&we.length===0&&F.length===0,className:"px-5 py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-40 text-white text-sm rounded-xl transition-colors",children:ye("common:send")})]})]})}function Bs({agentId:c,sessionId:m,agents:p,authUser:n,onClose:v,contextChips:A,extraMentionItems:q,width:z,className:U=""}){const{t:_}=rt(["team","common"]),M=p.find(d=>d.id===c),K=M?.name??_("page.fallbackAgent"),R=n?.name??_("page.fallbackYou"),[W,k]=s.useState([]),[Z,re]=s.useState(m??null),[be,Fe]=s.useState(!0),[_e,Ce]=s.useState(!1),[le,me]=s.useState(""),[ye,G]=s.useState([]),[ie,ce]=s.useState([]),de=s.useRef(null),ve=s.useRef(null),pe=s.useRef(null),Y=s.useRef(!0),J=s.useRef(Z);J.current=Z;const ee=s.useMemo(()=>({today:_("page.dateToday"),yesterday:_("page.dateYesterday")}),[_]),je=s.useMemo(()=>{const d=_("page.chatGreetings",{returnObjects:!0});return Array.isArray(d)&&d.length>0?d[Math.floor(Math.random()*d.length)]:""},[_]),F=s.useCallback((d="auto")=>{ve.current?.scrollIntoView({behavior:d})},[]);s.useEffect(()=>{let d=!1;return Fe(!0),k([]),(async()=>{try{let I=m??null;if(!I){const{sessions:H}=await L.sessions.listByAgent(c,10);I=H.find($=>$.isMain)?.id??H[0]?.id??null}if(d)return;if(re(I),I){const H=await L.sessions.getMessages(I,50);if(d)return;const E=H.messages.map(gs).filter($=>$.sender!=="agent"||$.text||$.segments&&$.segments.length>0);k(E)}}catch{}d||Fe(!1)})(),()=>{d=!0}},[c,m]);const Ie=s.useRef(!0);s.useEffect(()=>{Ie.current&&!be&&W.length>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>F())}),Ie.current=be},[be,W.length,F]),s.useEffect(()=>{!be&&Y.current&&requestAnimationFrame(()=>F())},[W,F,be]),s.useEffect(()=>ht.on("chat:proactive_message",S=>{const I=S.payload,H=I.agentId??"";if(H!==c)return;const E=I.targetUserId;if(E&&E!==n?.id)return;const $=I.message??"",he=I.sessionId??"",te=I.messageId??"";if(!$||$==="[cancelled]"||$==="[Stream cancelled]"||he&&J.current&&he!==J.current)return;const C=I.metadata??{},ge=C.role==="user",{cleaned:se,priority:Te}=cs($),l=!ge&&(!!C.notifyUser||se!==$),g=typeof C.userText=="string"?C.userText:"",i=typeof C.userMessageId=="string"?C.userMessageId:"",x=typeof C.createdAt=="string"&&C.createdAt||(typeof S.timestamp=="string"?S.timestamp:void 0)||new Date().toISOString(),h=(()=>{try{return new Date(x).toLocaleTimeString()}catch{return new Date().toLocaleTimeString()}})(),y={id:te||`proactive_${Date.now()}`,sender:ge?"user":"agent",text:se,time:h,rawCreatedAt:x,...ge?{}:{agentName:I.agentName??K,agentId:H,...l?{isNotification:!0,notifyPriority:C.priority??Te}:{}}};k(w=>{if(w.some(b=>b.id===y.id))return w;let N=w;return!ge&&g&&(N.some(j=>i&&j.id===i||j.sender==="user"&&j.text===g)||(N=Ht(N,{id:i||`feishu_user_${y.id}`,sender:"user",text:g,time:h,rawCreatedAt:x}))),Ht(N,y)})}),[c,K,n?.id]);const[r,ue]=s.useState(!1),Ee=s.useCallback(()=>{const d=de.current;if(!d)return;const S=d.scrollHeight-d.scrollTop-d.clientHeight<60;Y.current=S,ue(!S)},[]),Ve=s.useCallback(()=>{pe.current?.abort(),pe.current=null,Ce(!1),G([]),L.agents.cancelProcessing(c).catch(()=>{})},[c]),[Re,Le]=s.useState(null),[X,we]=s.useState(null),[Ae,o]=s.useState(!1),P=s.useCallback(async(d,S)=>{let I=d?.trim()??"";if(!I){const l=[];if(ie.length>0&&l.push(ie.map(g=>`@[${g.name}](${g.entityType}:${g.entityId})`).join(" ")),A?.length)for(const g of A)l.push(`[${g.type}: ${g.label}]
|
|
3
|
-
${g.content}`);le.trim()&&l.push(le.trim()),I=l.join(`
|
|
4
|
-
|
|
5
|
-
`)}if(!I)return;d||(me(""),ce([])),Y.current=!0,Ce(!0),G([]);const H=S!==void 0?S:Z,E=`a_${Date.now()}`,$=new Date().toISOString(),he={id:`u_${Date.now()}`,sender:"user",text:I,time:new Date().toLocaleTimeString(),rawCreatedAt:$};k(l=>[...l,he,{id:E,sender:"agent",text:"",time:new Date().toLocaleTimeString(),rawCreatedAt:$,segments:[]}]);let te=!1;const C=l=>{k(g=>{const i=[...g],x=i.findIndex(oe=>oe.id===E);if(x<0)return g;const h=i[x].segments??[],y=h[h.length-1],w=y?.type==="text"?y.thinking??"":"";let N="",b="",j=l;for(;j.length>0;)if(te){const oe=j.indexOf("</think>");oe>=0?(N+=j.slice(0,oe),j=j.slice(oe+8),te=!1):(N+=j,j="")}else{const oe=j.indexOf("<think>");oe>=0?(b+=j.slice(0,oe),j=j.slice(oe+7),te=!0):(b+=j,j="")}const ae=w+N||void 0,$e=y?.type==="text"?[...h.slice(0,-1),{type:"text",content:y.content+b,thinking:ae,createdAt:y.createdAt}]:[...h,{type:"text",content:b,thinking:ae,createdAt:new Date().toISOString()}];return i[x]={...i[x],text:i[x].text+b,segments:$e},i})},ge=l=>{if(l.type==="session_start"&&l.sessionId){re(l.sessionId);return}k(g=>{const i=[...g],x=i.findIndex(y=>y.id===E);if(x<0)return g;const h=[...i[x].committedSegments??[]];return l.type==="thinking_commit"?h.push({type:"text",content:"",thinking:l.content,createdAt:l.createdAt}):h.push({type:"text",content:l.content,createdAt:l.createdAt}),i[x]={...i[x],committedSegments:h},i})},se=l=>{l.phase!=="heartbeat"&&(l.phase==="start"?(G(g=>[...g,{...l,phase:"start",ts:Date.now()}]),k(g=>{const i=[...g],x=i.findIndex(j=>j.id===E);if(x<0)return g;const h=[...i[x].segments??[]],y=`${l.tool}_${Date.now()}`,w=new Date().toISOString();let N=!1;if(l.arguments)for(let j=h.length-1;j>=0;j--){const ae=h[j];if(ae.type==="tool"&&ae.tool===l.tool&&ae.status==="running"){h[j]={...ae,args:l.arguments},N=!0;break}}N||h.push({type:"tool",key:y,tool:l.tool,status:"running",args:l.arguments,createdAt:w});const b=[...i[x].committedSegments??[]];return l.arguments!==void 0&&b.push({type:"tool",key:y,tool:l.tool,status:"running",args:l.arguments,createdAt:w}),i[x]={...i[x],segments:h,committedSegments:b},i})):l.phase==="output"?k(g=>{const i=[...g],x=i.findIndex(y=>y.id===E);if(x<0)return g;const h=[...i[x].segments??[]];for(let y=h.length-1;y>=0;y--){const w=h[y];if(w.type==="tool"&&w.tool===l.tool&&w.status==="running"){h[y]={...w,liveOutput:bs(w.liveOutput,l.output??"")};break}}return i[x]={...i[x],segments:h},i}):l.phase==="subagent_progress"&&l.subagentEvent?k(g=>{const i=[...g],x=i.findIndex(y=>y.id===E);if(x<0)return g;const h=y=>{const w=[...y];for(let N=w.length-1;N>=0;N--){const b=w[N];if(b.type==="tool"&&(b.tool==="spawn_subagent"||b.tool==="spawn_subagents")&&b.status==="running"){w[N]={...b,subagentLogs:ys(b.subagentLogs,l.subagentEvent)};break}}return w};return i[x]={...i[x],segments:h(i[x].segments??[]),committedSegments:h(i[x].committedSegments??[])},i}):l.phase==="end"&&(G(g=>[...g,{...l,phase:"end",ts:Date.now()}]),k(g=>{const i=[...g],x=i.findIndex(b=>b.id===E);if(x<0)return g;const h=new Date().toISOString(),y=[...i[x].segments??[]];let w;for(let b=y.length-1;b>=0;b--){const j=y[b];if(j.type==="tool"&&j.tool===l.tool&&j.status==="running"){w=j.subagentLogs,y[b]={...j,status:l.success===!1?"error":"done",args:l.arguments,result:l.result,error:l.error,durationMs:l.durationMs,liveOutput:void 0,createdAt:h};break}}const N=[...i[x].committedSegments??[]];for(let b=N.length-1;b>=0;b--){const j=N[b];if(j.type==="tool"&&j.tool===l.tool&&j.status==="running"){N[b]={...j,status:l.success===!1?"error":"done",args:l.arguments,result:l.result,error:l.error,durationMs:l.durationMs,liveOutput:void 0,createdAt:h,subagentLogs:w??j.subagentLogs};break}}return i[x]={...i[x],segments:y,committedSegments:N},i})))},Te=new AbortController;pe.current=Te;try{const l=await L.agents.messageStream(c,I,C,se,Te.signal,void 0,H,void 0,void 0,ge);l.merged&&k(g=>g.filter(i=>i.id!==E)),!l.merged&&l.segments?.length&&k(g=>{const i=[...g],x=i.findIndex(w=>w.id===E);if(x<0)return g;const h=ds(l.segments,i[x].segments);let y=l.content||i[x].text;return y||(y=h.filter(w=>w.type==="text").map(w=>w.content).join("")),i[x]={...i[x],text:y,segments:h,committedSegments:h},i}),!l.merged&&!l.segments?.length&&k(g=>{const i=[...g],x=i.findIndex(b=>b.id===E);if(x<0)return g;const h=i[x],y=h.committedSegments??[],N=y.filter(b=>b.type==="text"&&!!b.content).map(b=>b.content).join("")||l.content||h.text;return(y.length>0||N)&&(i[x]={...h,text:N,segments:y.length>0?y:h.segments}),i}),l.sessionId&&re(l.sessionId)}catch(l){const g=l?.sessionId;g&&re(g);const i=us(l,_);k(i?x=>{const h=[...x],y=h.findIndex(w=>w.id===E);if(y>=0){const w=h[y].segments??[];h[y]={...h[y],text:i,isError:!0,segments:[...w,{type:"text",content:i}]}}return h}:x=>{const h=[...x],y=h.findIndex(w=>w.id===E);if(y>=0){const w=h[y];if(!(w.text||w.segments&&w.segments.length>0&&w.segments.some(b=>b.type==="text"&&(b.content||b.thinking)||b.type==="tool")))return x.filter(b=>b.id!==E);h[y]={...w,isStopped:!0}}return h})}k(l=>{const g=[...l],i=g.findIndex(x=>x.id===E);if(i>=0){const x=(g[i].segments??[]).map(h=>h.type==="tool"&&h.status==="running"?{...h,status:"stopped"}:h);g[i]={...g[i],segments:x}}return g}),Ce(!1),G([]),pe.current=null},[le,c,Z,_,ie,A]),O=s.useCallback(d=>{navigator.clipboard.writeText(d.text||"").then(()=>{Le(d.id),setTimeout(()=>Le(S=>S===d.id?null:S),1500)})},[]),D=async d=>{if(!(!X||!Z)){o(!0);try{const S=await L.agents.evolveFromMessage(c,{parentSessionId:Z,sourceMessageId:X.id.startsWith("a_")||X.id.startsWith("u_")?void 0:X.id,sourceText:(X.text||"").slice(0,500)||void 0,userNote:d.trim()||void 0});we(null),re(S.sessionId),k([]),await P(S.seedPrompt,S.sessionId)}catch(S){console.error("evolve-from-message failed",S)}finally{o(!1)}}},V=W[W.length-1],Q=_e&&V?.sender==="agent",ne=s.useMemo(()=>{for(let d=W.length-1;d>=0;d--)if(W[d].sender==="agent")return W[d].id;return null},[W]),[De,xe]=s.useState([]);s.useEffect(()=>{let d=!1;return(async()=>{const I=[];try{const[H,E,$,he,te]=await Promise.all([L.projects.list().catch(()=>({projects:[]})),L.requirements.list().catch(()=>({requirements:[]})),L.tasks.list({pageSize:100}).catch(()=>({tasks:[]})),L.deliverables.search({limit:100}).catch(()=>({results:[]})),L.teams.list().catch(()=>({teams:[],ungrouped:[]}))]);for(const C of H.projects)I.push({id:C.id,name:C.name,type:"project",role:C.status});for(const C of E.requirements)I.push({id:C.id,name:C.title,type:"requirement",role:C.priority});for(const C of $.tasks)I.push({id:C.id,name:C.title,type:"task",role:C.status});for(const C of he.results)I.push({id:C.id,name:C.title,type:"deliverable",role:C.type});for(const C of te.teams)try{const ge=await L.workflows.list(C.id);for(const se of ge.workflows)I.push({id:se.name,name:se.displayName||se.name,type:"workflow",role:`v${se.version}`})}catch{}}catch{}d||xe(I)})(),()=>{d=!0}},[]);const Ke=s.useMemo(()=>{const d=p.map(S=>({id:S.id,name:S.name,role:S.role,avatarUrl:S.avatarUrl,type:"agent"}));return[...De,...d,...q??[]]},[p,De,q]);return e.jsxs("div",{className:`flex flex-col bg-surface-primary border-l border-border-default ${U}`,style:z?{width:z}:{width:400},children:[e.jsxs("div",{className:"h-12 px-4 flex items-center gap-2 shrink-0 border-b border-border-default",children:[e.jsx(pt,{name:K,avatarUrl:M?.avatarUrl,size:24,bgClass:"bg-brand-500/15 text-brand-600",className:"rounded-md"}),e.jsx("span",{className:"text-sm font-medium text-fg-primary truncate flex-1",children:K}),v&&e.jsx("button",{onClick:v,className:"text-fg-tertiary hover:text-fg-secondary transition-colors p-1",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{ref:de,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3",onScroll:Ee,children:[be?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("svg",{className:"animate-spin h-5 w-5 text-fg-tertiary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}):W.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx(pt,{name:K,avatarUrl:M?.avatarUrl,size:40,bgClass:"bg-brand-500/20 text-brand-500"}),e.jsx("p",{className:"text-fg-secondary text-sm font-medium",children:je})]}):W.map((d,S)=>{const I=S>0?W[S-1]:null,H=Vt(d.rawCreatedAt),E=I?Vt(I.rawCreatedAt):"",$=!!(H&&E&&H!==E),he=S===W.length-1,te=Q&&he,C=te;return e.jsxs("div",{children:[$&&e.jsxs("div",{className:"flex items-center gap-3 py-1 my-1",children:[e.jsx("div",{className:"flex-1 h-px bg-border-default"}),e.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium uppercase tracking-wider shrink-0",children:xs(d.rawCreatedAt,ee)}),e.jsx("div",{className:"flex-1 h-px bg-border-default"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"shrink-0 mt-0.5",children:e.jsx(pt,{name:d.sender==="user"?R:K,avatarUrl:d.sender==="user"?n?.avatarUrl:M?.avatarUrl,size:24,bgClass:d.sender==="user"?"bg-brand-600":"bg-brand-500/15 text-brand-600",className:"rounded-md"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-fg-primary",children:d.sender==="user"?R:K}),e.jsx("span",{className:"text-[10px] text-fg-tertiary",children:fs(d.time,d.rawCreatedAt,ee)})]}),e.jsx("div",{className:`mt-0.5 ${d.sender==="agent"?"py-0.5":"bg-surface-secondary rounded-xl px-3 py-2 w-fit max-w-full"} ${C&&d.sender==="agent"?"streaming-bubble":""}`,children:d.sender==="user"?e.jsx("div",{className:"text-sm text-fg-secondary whitespace-pre-wrap",children:d.text}):d.segments&&d.segments.length>0?e.jsx(ms,{msg:d,isStreaming:te,liveActivities:te?ye:[]}):d.isError||d.text.startsWith("⚠")?e.jsx("div",{className:"text-[13px] text-fg-tertiary leading-relaxed whitespace-pre-wrap",children:d.text.replace(/^⚠\s*/,"")}):e.jsx(st,{content:d.text,className:"text-sm text-fg-secondary"})}),!te&&e.jsx(ps,{msg:d,onCopy:O,onRemember:we,showRemember:!0,isCopied:Re===d.id,isLastAgentMsg:d.id===ne})]})]})]},d.id)}),e.jsx("div",{ref:ve})]}),X&&e.jsx(hs,{busy:Ae,onConfirm:d=>{D(d)},onCancel:()=>{Ae||we(null)}}),r&&e.jsx("div",{className:"flex justify-center -mt-10 relative z-10 pointer-events-none",children:e.jsx("button",{onClick:()=>F("smooth"),className:"pointer-events-auto w-8 h-8 rounded-full bg-surface-elevated border border-border-default shadow-md flex items-center justify-center text-fg-tertiary hover:text-fg-secondary transition-colors",title:_("page.scrollToBottom"),children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})}),e.jsx("div",{className:"px-3 py-2 shrink-0 border-t border-border-default",children:e.jsx($s,{value:le,onChange:me,onSend:()=>{P()},disabled:!c,placeholder:_("page.placeholder.direct"),sending:_e,onStop:Ve,contextChips:A,mentionItems:Ke,onMentionChipsChange:ce,compact:!0,className:"shadow-none border-0"})})]})}const Xe={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},Ps=["file","directory"];function mt(c){return/^https?:\/\//i.test(c)}function Ws(c,m){const p=Date.now(),n=new Date(c).getTime(),v=p-n,A=Math.floor(v/6e4);if(A<1)return m("time.justNow");if(A<60)return m("time.minutesAgo",{count:A});const q=Math.floor(A/60);if(q<24)return m("time.hoursAgo",{count:q});const z=Math.floor(q/24);if(z===1)return m("time.yesterday");if(z<30)return m("time.daysAgo",{count:z});const U=Math.floor(z/30);return U<12?m("time.monthsAgo",{count:U}):m("time.yearsAgo",{count:Math.floor(U/12)})}const We={agent:{icon:"✦",color:"bg-brand-500/10 text-brand-500"},team:{icon:"◈",color:"bg-blue-500/10 text-blue-600"},skill:{icon:"⬡",color:"bg-amber-500/10 text-amber-600"}};function Os({authUser:c,previewMode:m,previewData:p}={}){const{t:n}=rt(["deliverables","common"]),v=vs(),A=js(Ne.DELIVERABLES),q=ws({side:"left",defaultWidth:384,minWidth:280,maxWidth:600,storageKey:"markus_deliverables_list"}),[z,U]=s.useState(!1),_=s.useRef(z);_.current=z,s.useEffect(()=>{if(!v)return;const t=()=>{_.current&&U(!1)};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[v]);const M=100,K=5e3,[R,W]=s.useState(p?.items??[]),[k,Z]=s.useState(p?.items?.length??0),[re,be]=s.useState(!1),[Fe,_e]=s.useState(p?.projects??[]),[Ce,le]=s.useState(p?.agents??[]),[me,ye]=s.useState([]),[G,ie]=s.useState(!p),[ce,de]=s.useState(""),[ve,pe]=s.useState(""),[Y,J]=s.useState(""),[ee,je]=s.useState(""),[F,Ie]=s.useState("date"),[r,ue]=s.useState(()=>p?.initialSelectedId&&p.items?p.items.find(t=>t.id===p.initialSelectedId)??p.items[0]??null:p?.items?.[0]??null),[Ee,Ve]=s.useState(null),[Re,Le]=s.useState(""),[X,we]=s.useState(!0),[Ae,o]=s.useState(()=>{const t=new Date,a=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;return new Set([a])}),[P,O]=s.useState(!1),[D,V]=s.useState(!1),Q=s.useMemo(()=>[{id:"date"},{id:"project"},{id:"team"},{id:"agent"}],[]),ne=s.useCallback(t=>{Ie(t)},[]),De=ks(Q,F,ne),xe=s.useRef(null),[Ke,d]=s.useState(null),[S,I]=s.useState("markdown"),[H,E]=s.useState(null),[$,he]=s.useState(null),[te,C]=s.useState(!1),[ge,se]=s.useState(!1),[Te,l]=s.useState(!1),[g,i]=s.useState(null),[x,h]=s.useState(""),[y,w]=s.useState(new Set),[N,b]=s.useState(!1),j=Ns(),ae=j?.keyboardPane??"content",[$e,oe]=s.useState(!1),[Yt,nt]=s.useState([]),[Ze,qe]=s.useState(null),[Ge,Oe]=s.useState(!1),[Je,gt]=s.useState(""),[Be,ze]=s.useState(!1),[bt,Lt]=s.useState(!1),[yt,Ue]=s.useState(null),vt=s.useRef(null),Tt=s.useCallback(t=>{t&&(t.style.height="auto",t.style.height=t.scrollHeight+"px")},[]),Mt=s.useRef(void 0);s.useEffect(()=>{Tt(vt.current)},[Je,Ge,Tt]);const ke=(t,a)=>{Ve({type:t,text:a}),setTimeout(()=>Ve(null),3e3)},Et=async t=>{await Ls(t)?(l(!0),setTimeout(()=>l(!1),1500)):ke("error",n("detail.copyFailed"))},at=s.useMemo(()=>new Map(Ce.map(t=>[t.id,t])),[Ce]),jt=s.useMemo(()=>new Map(Fe.map(t=>[t.id,t])),[Fe]),Rt=s.useMemo(()=>new Map(me.map(t=>[t.id,t])),[me]),ot=s.useCallback(t=>{if(!t||t==="default")return null;const a=jt.get(t)?.name;return!a||a==="default"?null:a},[jt]);s.useEffect(()=>{m||(L.projects.list().then(t=>_e(t.projects)).catch(()=>{}),L.agents.list().then(t=>le(t.agents??[])).catch(()=>{}),L.teams.list().then(t=>ye(t.teams??[])).catch(()=>{}),L.system.storage().then(t=>h(t.dataDir+"/shared")).catch(()=>{}),L.deliverables.checkHealth().then(t=>w(new Set(t.missingFiles))).catch(()=>{}))},[m]),s.useEffect(()=>(Mt.current=setTimeout(()=>pe(ce),300),()=>clearTimeout(Mt.current)),[ce]);const lt=s.useMemo(()=>({q:ve||void 0,type:Y||void 0,artifactType:ee||void 0}),[ve,Y,ee]),it=F==="date"?M:K,Me=s.useCallback(async()=>{ie(!0),xe.current?.scrollTo({top:0,behavior:"instant"});try{const{results:t,total:a}=await L.deliverables.search({...lt,offset:0,limit:it});W(t),Z(a),ue(u=>u&&t.some(f=>f.id===u.id)?u:null)}catch{W([]),Z(0),ue(null)}ie(!1)},[lt,it]),ct=s.useCallback(async()=>{if(!(re||R.length>=k)){be(!0);try{const{results:t,total:a}=await L.deliverables.search({...lt,offset:R.length,limit:it});W(u=>[...u,...t]),Z(a)}catch{}be(!1)}},[lt,it,R.length,k,re]);s.useEffect(()=>{m||Me()},[Me,m]),s.useEffect(()=>{!m||!p||(W(p.items??[]),Z(p.items?.length??0),_e(p.projects??[]),le(p.agents??[]),p.initialSelectedId&&ue(p.items?.find(t=>t.id===p.initialSelectedId)??p.items?.[0]??null))},[m,p]);const At=s.useRef(r);At.current=r,s.useEffect(()=>{if(m||!A)return;const t=ht.on("deliverable:created",()=>Me()),a=ht.on("deliverable:updated",f=>{Me();const T=f.payload?.deliverableId;T&&At.current?.id===T&&L.deliverables.get(T).then(B=>{B.deliverable&&(ue(B.deliverable),$t(B.deliverable))}).catch(()=>{})}),u=ht.on("deliverable:removed",()=>Me());return()=>{t(),a(),u()}},[Me,A,m]);const dt=s.useRef(null),wt=s.useRef(R);wt.current=R;const et=s.useCallback(t=>{const a=f=>{ue(f),v&&(U(!0),history.pushState({mobileDetail:Ne.DELIVERABLES},"",window.location.hash))},u=wt.current.find(f=>f.id===t);if(u){a(u);return}L.deliverables.get(t).then(f=>{f.deliverable&&a(f.deliverable)}).catch(()=>{})},[v]);s.useEffect(()=>{if(m)return;const t=window.location.hash.slice(1).split("/"),a=Ss(t[0])===Ne.DELIVERABLES?t[1]:void 0,u=localStorage.getItem("markus_nav_openDeliverable")||a;u&&(localStorage.removeItem("markus_nav_openDeliverable"),wt.current.length>0?et(u):dt.current=u);const f=T=>{const B=T.detail;B?.params?.openDeliverable&&(localStorage.removeItem("markus_nav_openDeliverable"),et(B.params.openDeliverable))};return window.addEventListener("markus:navigate",f),()=>window.removeEventListener("markus:navigate",f)},[et,m]),s.useEffect(()=>{const t=dt.current;!t||R.length===0||(dt.current=null,et(t))},[R,et]);const Dt=s.useCallback(()=>{const t=xe.current;!t||G||re||R.length>=k||t.scrollHeight<=t.clientHeight+100&&ct()},[G,re,R.length,k,ct]);s.useEffect(()=>{const t=xe.current;if(!t)return;const a=()=>{t.scrollTop+t.clientHeight>=t.scrollHeight-100&&ct()};return t.addEventListener("scroll",a,{passive:!0}),()=>t.removeEventListener("scroll",a)},[ct]),s.useEffect(()=>{Dt()},[Dt,X,Ae]);const Pe=s.useMemo(()=>{const t=new Map;for(const u of R){let f,T;if(F==="project"){const B=ot(u.projectId);f=B?u.projectId??"_none":"_none",T=B??n("noProject")}else if(F==="team"){const fe=(u.agentId?at.get(u.agentId):void 0)?.teamId??"_none";f=fe,T=fe!=="_none"?Rt.get(fe)?.name??fe:n("noTeam")}else if(F==="agent")f=u.agentId??"_none",T=u.agentId?at.get(u.agentId)?.name??u.agentId:n("common:unknown");else{const B=new Date(u.updatedAt);f=`${B.getFullYear()}-${String(B.getMonth()+1).padStart(2,"0")}-${String(B.getDate()).padStart(2,"0")}`,T=f}t.has(f)||t.set(f,{label:T,items:[]}),t.get(f).items.push(u)}const a=[...t.entries()];return F==="date"?a.sort((u,f)=>f[0].localeCompare(u[0])):a.sort((u,f)=>u[1].label.localeCompare(f[1].label)),a},[R,F,jt,at,Rt,n]);s.useEffect(()=>{if(F==="date"&&X){const t=new Date,a=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;o(new Set([a]))}else o(new Set)},[F]);const Qt=async t=>{Le("remove");try{await L.deliverables.remove(t.id),ke("success",n("removed")),ue(null),Me()}catch(a){ke("error",n("common:error",{message:String(a)}))}Le("")},Xt=()=>{Ye.navigate(Ne.BUILDER)},$t=async t=>{if(t.reference&&!mt(t.reference)){if(t.type==="directory"){se(!0);return}C(!0);try{const a=await L.files.preview(t.reference);if(a.type==="image"&&a.mimeType)E({src:`data:${a.mimeType};base64,${a.content}`,name:a.name});else if(a.type==="audio"||a.type==="video"){const u=a.streamUrl||(a.path?L.files.streamUrl(a.path):L.files.streamUrl(t.reference));he({kind:a.type,src:u,name:a.name})}else a.type==="binary"?se(!0):typeof a.content=="string"?(d(a.content),I(Ts({format:t.format,reference:t.reference,content:a.content}))):se(!0)}catch{d(null),t.type==="file"&&se(!0)}C(!1)}};s.useEffect(()=>{m||(d(null),I("markdown"),E(null),he(null),se(!1),r&&$t(r))},[r?.id,m]);const Bt=s.useCallback(t=>X!==Ae.has(t),[X,Ae]),Pt=Pe.length>0&&Pe.every(([t])=>Bt(t)),Zt=s.useCallback(t=>{o(a=>{const u=new Set(a);return u.has(t)?u.delete(t):u.add(t),u})},[]),Wt=s.useCallback(t=>{o(a=>{if(a.has(t)===X)return a;const u=new Set(a);return X?u.add(t):u.delete(t),u})},[X]),Jt=s.useCallback(()=>{we(t=>!t),o(new Set)},[]),ut=!!(Y||ee||ve),Ft=s.useCallback(()=>{J(""),je(""),de(""),pe("")},[]),tt=s.useMemo(()=>Pe.flatMap(([,t])=>t.items),[Pe]);s.useEffect(()=>{m||v||G||r||dt.current||tt.length!==0&&ue(tt[0])},[m,v,G,r,tt]);const kt=s.useRef(null);s.useEffect(()=>{if(!r){kt.current=null;return}if(kt.current===r.id)return;const t=Pe.find(([,a])=>a.items.some(u=>u.id===r.id));t&&(kt.current=r.id,Wt(t[0]))},[r?.id,Pe,Wt]);const _t=s.useRef(null),Ot=s.useRef(ae);s.useEffect(()=>{if(m||v||!A)return;const t=Ot.current;Ot.current=ae,!(ae!=="l1"||t==="l1")&&N&&b(!1)},[ae,m,v,A,N]),s.useEffect(()=>{if(m||v||!A)return;const t=a=>{if(j?.keyboardPane==="l0")return;if(a.target instanceof HTMLInputElement||a.target instanceof HTMLTextAreaElement){a.key==="Escape"&&(a.target.blur(),a.preventDefault());return}if(Is(a.target))return;if((a.metaKey||a.ctrlKey)&&a.key==="f"){a.preventDefault(),_t.current?.focus();return}if(a.metaKey||a.ctrlKey||a.altKey)return;const u=a.key.length===1?a.key.toLowerCase():a.key;if(u==="h"||u==="ArrowLeft"){a.preventDefault(),N&&b(!1),j?.setL0FocusPageId(Ne.DELIVERABLES),j?.setLeftCollapsed(!1),j?.setKeyboardPane("l0");return}if(u==="l"||u==="ArrowRight"){a.preventDefault(),N&&b(!1),j?.keyboardPane!=="l1"&&j?.setKeyboardPane("l1");return}const f=u==="j"||u==="ArrowDown"?1:u==="k"||u==="ArrowUp"?-1:0;if(!f)return;a.preventDefault(),j?.setKeyboardPane("l1"),N&&b(!1);const T=tt;if(T.length===0)return;const B=r?T.findIndex(ls=>ls.id===r.id):-1,fe=B<0?f>0?-1:0:B,ft=Math.max(0,Math.min(T.length-1,fe+f));zt(T[ft]),requestAnimationFrame(()=>{document.querySelector(`[data-deliverable-id="${T[ft].id}"]`)?.scrollIntoView({block:"nearest"})})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[tt,r,m,v,A,j,N]);const xt=s.useRef(null),es=s.useCallback(t=>{if(!v)return;const a=xe.current;!a||a.scrollTop>0||(xt.current={y:t.touches[0].clientY,scrollTop:a.scrollTop})},[v]),ts=s.useCallback(t=>{if(!v||!xt.current||D)return;const a=t.changedTouches[0].clientY-xt.current.y;xt.current=null,a>80&&xe.current&&xe.current.scrollTop<=0&&(V(!0),Me().finally(()=>V(!1)))},[v,D,Me]),zt=t=>{const a=()=>{ue(t),nt([]),Oe(!1),ze(!1),v&&(oe(!1),U(!0),history.pushState({mobileDetail:Ne.DELIVERABLES},"",window.location.hash))};Be?Ue({action:a}):a()},ss=()=>{if(!Be){const t=Ke??r?.summary??"";gt(t)}Oe(!0)},rs=()=>{Be?Ue({action:()=>{Oe(!1),ze(!1)}}):Oe(!1)},Ut=async()=>{if(!(!r?.reference||bt)){Lt(!0);try{await L.files.write(r.reference,Je),d(Je),ze(!1),Oe(!1),ke("success",n("detail.saved"))}catch(t){ke("error",n("detail.saveFailed")+": "+String(t))}Lt(!1)}},ns=()=>{Oe(!1),ze(!1),Ue(null)};s.useEffect(()=>{if(!Be)return;const t=a=>{a.preventDefault()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[Be]),s.useEffect(()=>{if(!Be)return;const t=a=>{a.preventDefault(),a.stopImmediatePropagation(),Ue({action:()=>{Oe(!1),ze(!1);const{page:u,params:f}=a.detail||{};u&&Ye.navigate(u,f)}})};return window.addEventListener("markus:navigate",t),()=>window.removeEventListener("markus:navigate",t)},[Be]);const Nt=s.useRef(!1);s.useEffect(()=>{if(!$e){Nt.current=!1;return}if(v||Nt.current)return;const t=400,a=N?0:q.width??384;window.innerWidth-160-a-t<480&&!N&&b(!0)},[$e,v,N,q.width]);const St=s.useRef(null),as=s.useCallback((t,a)=>{const u=t.length>30?`${t.slice(0,15)}…${t.slice(-12)}`:t,f=`sel_${Date.now()}`;let T;if(a){const B=r?.reference??"";T=["[html-selection]",`Text: "${t}"`,`CSS Selector: ${a.cssSelector}`,`XPath: ${a.xpath}`,B?`File: ${B}`:""].filter(Boolean).join(`
|
|
6
|
-
`)}else T=t;nt(B=>[...B,{id:f,label:a?`🌐 ${u}`:u,type:"selection",content:T,onRemove:()=>nt(fe=>fe.filter(ft=>ft.id!==f))}]),$e||oe(!0),qe(null),window.getSelection()?.removeAllRanges()},[$e,r?.reference]),os=s.useCallback(t=>{if(!t.text.trim())return;const u=St.current?.querySelector("iframe")?.getBoundingClientRect(),f=(u?.left??0)+t.rect.x+t.rect.width/2,T=(u?.top??0)+t.rect.y;qe({x:f,y:T,text:t.text,htmlMeta:{xpath:t.xpath,cssSelector:t.cssSelector}})},[]);return s.useEffect(()=>{const t=St.current;if(!t)return;const a=()=>{requestAnimationFrame(()=>{const f=window.getSelection(),T=f?.toString().trim();if(!T||!f?.rangeCount){qe(null);return}const B=f.getRangeAt(0);if(!t.contains(B.commonAncestorContainer)){qe(null);return}const fe=B.getBoundingClientRect();qe({x:fe.left+fe.width/2,y:fe.top,text:T})})},u=f=>{const T=document.getElementById("selection-toolbar");T&&T.contains(f.target)||qe(null)};return t.addEventListener("mouseup",a),document.addEventListener("mousedown",u),()=>{t.removeEventListener("mouseup",a),document.removeEventListener("mousedown",u)}},[]),e.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[e.jsxs("div",{"data-keyboard-pane":"l1",className:`${v?"flex-1 min-w-0":"shrink-0"} flex flex-col bg-surface-secondary rounded-xl m-1 mr-0 ${!v&&ae==="l1"?"ring-1 ring-inset ring-brand-500/30":""}`,style:v?z?{display:"none"}:void 0:N?{display:"none"}:{width:q.width},children:[e.jsxs("div",{"data-electron-drag":!0,className:"p-4 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v&&e.jsx(Cs,{}),!v&&e.jsx("button",{onClick:()=>b(!0),className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0 bg-brand-500/15 text-brand-500 hover:bg-brand-500/25",title:n("sidebar.collapse"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]})}),e.jsxs("h2",{className:"text-sm font-semibold text-fg-secondary truncate",children:[n("title"),k>0&&e.jsxs("span",{className:"ml-1.5 text-fg-tertiary font-normal",children:["(",k,")"]})]})]})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-muted pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:_t,value:ce,onChange:t=>de(t.target.value),placeholder:n("searchPlaceholder"),className:"w-full bg-surface-elevated border border-border-default rounded-lg pl-8 pr-8 py-2 text-sm text-fg-primary focus:border-brand-500 focus:outline-none transition-colors"}),ce&&e.jsx("button",{onClick:()=>{de(""),pe("")},className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 flex items-center justify-center rounded-full bg-surface-overlay text-fg-tertiary hover:text-fg-secondary transition-colors",children:e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),x&&!v&&e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 bg-surface-elevated rounded-lg text-[10px] text-fg-tertiary",children:[e.jsx("span",{className:"truncate font-mono",children:x}),e.jsx("button",{onClick:()=>{L.system.openPath(x)},className:"shrink-0 underline hover:text-fg-secondary transition-colors",children:n("common:open")})]}),v&&e.jsxs("button",{onClick:()=>O(t=>!t),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors ${P||ut?"bg-brand-500/15 text-brand-500":"bg-surface-elevated text-fg-secondary"}`,children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),e.jsx("line",{x1:"12",y1:"18",x2:"20",y2:"18"})]}),n("filters.filtersLabel"),ut&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-brand-500"}),e.jsx("svg",{className:`w-3 h-3 ml-auto transition-transform ${P?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),e.jsxs("div",{className:v&&!P?"hidden":"space-y-3",children:[e.jsxs("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide filter-pills-fade",children:[e.jsx(It,{label:n("filters.allTypes"),value:"",current:Y||ee||"",onClick:()=>{J(""),je("")}}),Ps.map(t=>e.jsx(It,{label:`${Xe[t]?.icon??""} ${t}`,value:t,current:Y,onClick:a=>{J(a),je("")}},t)),["agent","team","skill"].map(t=>e.jsx(It,{label:`${We[t].icon} ${n(`artifactTypes.${t}`)}`,value:t,current:ee,onClick:a=>{je(a),J("")}},t))]}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary",children:n("filters.group")}),["date","project","team","agent"].map(t=>e.jsx("button",{onClick:()=>{Ie(t)},className:`px-2 py-1 rounded text-xs transition-colors ${F===t?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:n(`groupBy.${t}`)},t)),Pe.length>1&&e.jsx("button",{onClick:Jt,className:"ml-auto px-1.5 py-1 rounded text-[10px] text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated transition-colors",title:n(Pt?"expandAllTooltip":"collapseAllTooltip"),children:n(Pt?"expandAll":"collapseAll")})]})]}),ut&&e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[ve&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:["“",ve,"”",e.jsx("button",{onClick:()=>{de(""),pe("")},className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),Y&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[Xe[Y]?.icon," ",Y,e.jsx("button",{onClick:()=>J(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),ee&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[We[ee]?.icon," ",n(`artifactTypes.${ee}`),e.jsx("button",{onClick:()=>je(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("button",{onClick:Ft,className:"text-[10px] text-fg-tertiary hover:text-brand-500 ml-auto transition-colors",children:n("filters.clearAll")})]})]}),Ee&&e.jsx("div",{className:`mx-4 mt-2 px-3 py-1.5 text-xs rounded-lg ${Ee.type==="success"?"bg-green-500/15 text-green-600":"bg-red-500/15 text-red-500"}`,children:Ee.text}),e.jsxs("div",{ref:xe,className:"flex-1 overflow-y-auto p-2 space-y-1 transition-opacity duration-150",style:{opacity:G?.5:1},onTouchStart:v?t=>{De.onTouchStart(t),es(t)}:void 0,onTouchEnd:v?t=>{De.onTouchEnd(t),ts(t)}:void 0,children:[D&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-brand-500",children:[e.jsx(qt,{})," ",e.jsx("span",{className:"text-[10px]",children:n("filters.refreshing")})]}),G?e.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(t=>e.jsxs("div",{className:"animate-pulse space-y-2",children:[e.jsx("div",{className:"h-4 bg-surface-elevated rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-surface-elevated rounded w-1/2"})]},t))}):R.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6 text-center",children:[e.jsx("svg",{className:"w-12 h-12 text-fg-muted mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),ut?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:n("empty.noResults")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:n("empty.noResultsHint")}),e.jsx("button",{onClick:Ft,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:n("filters.clearAll")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:n("empty.title")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:n("empty.subtitle")}),e.jsx("button",{onClick:()=>Ye.navigate(Ne.WORK),className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:n("empty.goToWork")})]})]}):Pe.map(([t,a])=>{const u=Bt(t);return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>Zt(t),className:"w-full flex items-center gap-1.5 px-2 py-2 rounded-md hover:bg-surface-elevated/50 transition-colors group/header border-b border-border-subtle/50",children:[e.jsx("svg",{className:`w-3 h-3 text-fg-tertiary transition-transform duration-200 shrink-0 ${u?"":"rotate-90"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.jsx("span",{className:"text-[11px] font-semibold text-fg-tertiary uppercase tracking-wider truncate",children:a.label}),e.jsxs("span",{className:"text-[10px] text-fg-muted bg-surface-elevated px-1.5 py-0.5 rounded-full shrink-0",children:[a.items.length,R.length<k?"+":""]})]}),e.jsx("div",{className:`overflow-hidden transition-all duration-200 ${u?"max-h-0 opacity-0":"max-h-[5000px] opacity-100"}`,children:a.items.map(f=>e.jsx("button",{"data-deliverable-id":f.id,onClick:()=>zt(f),className:`w-full text-left px-3 py-2 rounded-lg transition-all duration-150 ${r?.id===f.id?ae==="l1"?"bg-brand-500/25 ring-1 ring-inset ring-brand-500/40 border-l-2 border-l-brand-500 border-y border-r border-y-brand-500/20 border-r-brand-500/20":"bg-brand-600/15 border-l-2 border-l-brand-500 border-y border-r border-y-brand-500/20 border-r-brand-500/20":"hover:bg-surface-elevated/60 border-l-2 border-l-transparent border-y border-r border-transparent"}`,children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.artifactType&&We[f.artifactType]?e.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded font-medium shrink-0 ${We[f.artifactType].color}`,children:We[f.artifactType].icon}):e.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded font-medium uppercase shrink-0 ${Xe[f.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:Xe[f.type]?.icon??f.type.charAt(0)}),e.jsx("span",{className:"text-sm font-medium text-fg-primary truncate flex-1",children:f.title}),y.has(f.id)&&e.jsx("span",{className:"shrink-0 text-amber-500",title:n("detail.fileMissing"),children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),e.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:Ws(f.updatedAt,n)})]})},f.id))})]},t)}),re&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-fg-tertiary",children:[e.jsx(qt,{})," ",e.jsx("span",{className:"text-[10px]",children:n("common:loadingMore")})]}),!G&&R.length>0&&e.jsx("div",{className:"text-center text-[10px] text-fg-tertiary py-2",children:R.length<k?n("count.partial",{loaded:R.length,total:k}):n("count.total",{total:k})})]})]}),!v&&e.jsx("div",{className:"w-2 shrink-0 cursor-col-resize group relative flex items-center justify-center hover:bg-brand-500/5 transition-colors",onMouseDown:q.onResizeStart,children:e.jsxs("div",{className:"flex flex-col gap-1 items-center opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"}),e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"}),e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"})]})}),(!v||z)&&e.jsxs("div",{"data-no-drag":!0,className:"flex-1 overflow-hidden min-w-0 flex relative self-stretch",children:[e.jsxs("div",{ref:St,className:"flex-1 overflow-y-auto min-w-0 h-full",children:[N&&!v&&e.jsxs("div",{className:"sticky top-0 z-10 bg-surface-primary/80 backdrop-blur-sm px-4 py-2 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{Nt.current=!0,b(!1)},className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0 text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated",title:n("sidebar.expand"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]})}),e.jsx("span",{className:"text-sm font-medium text-fg-secondary truncate",children:r?.title??n("detail.details")})]}),v&&e.jsxs("div",{className:"sticky top-0 z-10 bg-surface-secondary px-4 py-2.5 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>history.back(),className:"text-fg-secondary hover:text-fg-primary transition-colors p-1 -ml-1",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),e.jsx("span",{className:"text-sm font-medium truncate",children:r?.title??n("detail.details")})]}),r?e.jsxs("div",{className:"p-6 space-y-4",children:[!m&&y.has(r.id)&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/20 rounded-lg text-amber-600 text-xs",children:[e.jsxs("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsx("span",{children:n("detail.fileMissing")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h2",{className:"text-xl font-semibold text-fg-primary",children:r.title}),!m&&e.jsx("button",{onClick:()=>i(r),disabled:!!Re,className:"p-1.5 rounded-lg text-fg-tertiary hover:text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 shrink-0",title:n("common:remove"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:`px-2 py-0.5 rounded text-xs font-medium uppercase ${Xe[r.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:[Xe[r.type]?.icon??""," ",r.type]}),r.artifactType&&We[r.artifactType]&&e.jsxs("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${We[r.artifactType].color}`,children:[We[r.artifactType].icon," ",n("detail.builderWithType",{type:n(`artifactTypes.${r.artifactType}`)})]}),r.tags.length>0&&r.tags.map(t=>e.jsx("span",{className:"px-2 py-0.5 text-xs bg-surface-elevated text-fg-secondary rounded",children:t},t))]}),(r.taskId||r.agentId||ot(r.projectId))&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.taskId&&e.jsx("button",{onClick:()=>Ye.navigate(Ne.WORK,{openTask:r.taskId}),className:"text-xs text-brand-500 hover:underline bg-brand-500/10 px-2 py-0.5 rounded",children:n("links.task",{id:`${r.taskId.slice(0,12)}...`})}),r.agentId&&e.jsx("button",{onClick:()=>Ye.navigate(Ne.TEAM,{selectAgent:r.agentId}),className:"text-xs text-blue-600 hover:underline bg-blue-500/10 px-2 py-0.5 rounded",children:n("links.agent",{name:at.get(r.agentId)?.name??r.agentId.slice(0,12)})}),ot(r.projectId)&&e.jsx("button",{onClick:()=>Ye.navigate(Ne.WORK,{projectId:r.projectId}),className:"text-xs text-blue-600 hover:underline bg-blue-500/10 px-2 py-0.5 rounded",children:n("links.project",{name:ot(r.projectId)})})]}),(r.diffStats||r.testResults)&&e.jsxs("div",{className:"flex gap-3 flex-wrap",children:[r.diffStats&&e.jsxs("div",{className:"bg-surface-elevated rounded-lg px-3 py-2 text-xs flex items-center gap-2",children:[e.jsxs("span",{className:"text-fg-tertiary font-medium",children:[n("diffStats.title"),":"]}),e.jsx("span",{className:"text-fg-secondary",children:n("diffStats.files",{count:r.diffStats.filesChanged})}),e.jsxs("span",{className:"text-green-600",children:["+",r.diffStats.additions]}),e.jsxs("span",{className:"text-red-500",children:["-",r.diffStats.deletions]})]}),r.testResults&&e.jsxs("div",{className:"bg-surface-elevated rounded-lg px-3 py-2 text-xs flex items-center gap-2",children:[e.jsxs("span",{className:"text-fg-tertiary font-medium",children:[n("testResults.title"),":"]}),e.jsx("span",{className:"text-green-600",children:n("testResults.passed",{count:r.testResults.passed})}),e.jsx("span",{className:"text-red-500",children:n("testResults.failed",{count:r.testResults.failed})}),e.jsx("span",{className:"text-fg-secondary",children:n("testResults.skipped",{count:r.testResults.skipped})})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-fg-tertiary flex-wrap",children:[e.jsxs("span",{children:[n("metadata.created")," ",new Date(r.createdAt).toLocaleString()]}),e.jsxs("span",{children:[n("metadata.updated")," ",new Date(r.updatedAt).toLocaleString()]}),e.jsx("span",{className:"text-fg-muted select-all",children:r.id.slice(0,12)})]}),r.reference&&!mt(r.reference)&&r.type==="file"&&e.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[e.jsx("button",{onClick:()=>{L.files.reveal(r.reference).catch(()=>ke("error",n("detail.failedToOpenBrowser")))},className:"text-xs font-mono text-brand-500 hover:text-brand-500 hover:underline truncate flex-1 text-left cursor-pointer",title:n("detail.openInFileBrowser"),children:r.reference}),e.jsx("button",{onClick:()=>{L.files.reveal(r.reference).catch(()=>ke("error",n("detail.failedToOpenBrowser")))},className:"px-2 py-1 text-[10px] rounded bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",title:n("detail.revealInFinder"),children:n("common:open")}),e.jsx("button",{onClick:()=>Et(r.reference),className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${Te?"bg-green-500/20 text-green-600":"bg-surface-overlay/50 text-fg-secondary hover:bg-surface-overlay"}`,title:n("detail.copyPath"),children:n(Te?"common:copied":"common:copy")})]}),r.reference&&!mt(r.reference)&&r.type!=="file"&&r.type!=="directory"&&e.jsx("span",{className:"text-xs text-fg-tertiary font-mono break-all",children:r.reference})]}),r.artifactType&&r.artifactData?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Rs,{artifact:r.artifactData,mode:r.artifactType})}),r.reference&&e.jsxs("div",{className:"px-3 py-2 bg-surface-elevated rounded-lg",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider block mb-1",children:n("detail.artifactDirectory")}),e.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all",children:r.reference})]}),e.jsx("div",{className:"flex gap-2",children:e.jsx("button",{onClick:Xt,className:"flex-1 px-4 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:n("detail.openInBuilder")})}),r.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(st,{content:r.summary,className:"text-fg-secondary text-sm"})})]}):r.reference&&mt(r.reference)?e.jsxs("div",{className:"space-y-4",children:[r.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(st,{content:r.summary,className:"text-fg-secondary text-sm"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-10",children:[e.jsxs("svg",{className:"w-10 h-10 text-fg-muted mb-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),e.jsx("p",{className:"text-xs text-fg-tertiary font-mono mb-4 px-4 text-center break-all select-all",children:r.reference}),e.jsx("button",{onClick:()=>window.open(r.reference,"_blank","noopener,noreferrer"),className:"px-6 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:n("detail.openUrl")})]})]}):r.type==="directory"&&r.reference?e.jsxs("div",{className:"space-y-4",children:[r.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(st,{content:r.summary,className:"text-fg-secondary text-sm"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-10",children:[e.jsx("svg",{className:"w-10 h-10 text-fg-muted mb-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),e.jsx("p",{className:"text-xs text-fg-tertiary font-mono mb-4 px-4 text-center break-all select-all",children:r.reference}),e.jsx("button",{onClick:()=>{L.files.reveal(r.reference).catch(()=>ke("error",n("detail.failedToOpenBrowser")))},className:"px-6 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:n("detail.openInFileBrowser")})]})]}):e.jsxs("div",{className:"bg-surface-elevated rounded-xl overflow-hidden",children:[(Ke||r.summary)&&!te&&!H&&!ge&&r.reference&&r.type==="file"&&(S==="markdown"||S==="text"||S==="html")&&e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border-subtle bg-surface-secondary/50",children:[e.jsx("button",{onClick:rs,className:`px-3 py-1 rounded text-xs font-medium transition-colors ${Ge?"text-fg-tertiary hover:text-fg-secondary":"bg-brand-600/20 text-brand-500"}`,children:n("detail.preview")}),e.jsx("button",{onClick:ss,className:`px-3 py-1 rounded text-xs font-medium transition-colors ${Ge?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:n("detail.edit")}),e.jsx("div",{className:"flex-1"}),Ge&&e.jsx("button",{onClick:Ut,disabled:!Be||bt,className:"px-3 py-1 rounded text-xs font-medium bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:n(bt?"detail.saving":"detail.save")})]}),e.jsx("div",{className:"p-5",children:te?e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-5/6"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-4/6"}),e.jsx("div",{className:"h-32 bg-surface-overlay/40 rounded-lg w-full mt-2"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-2/3"})]}):H?e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("img",{src:H.src,alt:H.name,className:"max-w-full max-h-[60vh] rounded-lg object-contain"}),e.jsx("span",{className:"text-xs text-fg-tertiary",children:H.name})]}):$?e.jsxs("div",{className:"flex flex-col gap-3 py-4",children:[$.kind==="audio"?e.jsx("audio",{controls:!0,preload:"metadata",src:$.src,className:"w-full"}):e.jsx("video",{controls:!0,preload:"metadata",src:$.src,className:"w-full max-h-[60vh] rounded-lg bg-black"}),e.jsx("span",{className:"text-xs text-fg-tertiary",children:$.name})]}):Ke?Ge?e.jsx("div",{className:"animate-fadeIn",children:e.jsx("textarea",{ref:vt,value:Je,onChange:t=>{gt(t.target.value),ze(!0)},className:"w-full min-h-[120px] p-3 text-sm font-mono bg-surface-primary border border-border-subtle rounded-lg text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50 overflow-hidden",style:{resize:"none"},spellCheck:!1})},"edit"):e.jsx("div",{className:"animate-fadeIn",children:e.jsx(Ms,{content:Ke,format:S,className:"text-fg-secondary text-sm",onHtmlSelection:os,basePath:r?.reference?r.reference.replace(/[/\\][^/\\]+$/,""):void 0})},"preview"):ge?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:n("detail.cannotPreview",{type:r.type})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{L.files.reveal(r.reference).catch(()=>ke("error",n("detail.failedToOpen")))},className:"text-xs bg-surface-elevated px-3 py-2 rounded text-brand-500 hover:text-brand-500 hover:underline flex-1 truncate text-left cursor-pointer font-mono",title:n("detail.openInFileBrowser"),children:r.reference}),e.jsx("button",{onClick:()=>{L.files.reveal(r.reference).catch(()=>ke("error",n("detail.failedToOpen")))},className:"px-3 py-2 text-xs rounded-lg bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",children:n("common:open")}),e.jsx("button",{onClick:()=>Et(r.reference),className:`px-3 py-2 text-xs rounded-lg transition-colors shrink-0 ${Te?"bg-green-500/20 text-green-600":"bg-surface-overlay/50 text-fg-secondary hover:bg-surface-overlay"}`,children:n(Te?"common:copied":"common:copy")})]})]}):r.summary?Ge?e.jsx("textarea",{ref:vt,value:Je,onChange:t=>{gt(t.target.value),ze(!0)},className:"w-full min-h-[120px] p-3 text-sm font-mono bg-surface-primary border border-border-subtle rounded-lg text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50 overflow-hidden",style:{resize:"none"},spellCheck:!1}):e.jsx(st,{content:r.summary,className:"text-fg-secondary text-sm"}):e.jsx("p",{className:"text-sm text-fg-tertiary italic",children:n("detail.noContent")})})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center text-fg-tertiary space-y-3 max-w-xs",children:[e.jsx("div",{className:"w-16 h-16 mx-auto rounded-2xl bg-surface-elevated/60 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-fg-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),e.jsx("p",{className:"text-sm text-fg-secondary",children:n("detail.selectToView")}),!v&&e.jsx("p",{className:"text-[10px] text-fg-muted",children:n("detail.keyboardHint")})]})})]}),r?.agentId&&!$e&&!v&&e.jsx("button",{type:"button",onClick:()=>oe(!0),className:"absolute bottom-6 right-6 z-20 w-12 h-12 rounded-full bg-brand-600 hover:bg-brand-500 text-white shadow-lg shadow-black/20 flex items-center justify-center transition-transform hover:scale-105 animate-fab-in",title:n("chat.openChat"),children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),$e&&r?.agentId&&!v&&e.jsx(Bs,{agentId:r.agentId,agents:Ce,authUser:c,onClose:()=>{oe(!1),nt([])},contextChips:[{id:`deliverable_ctx_${r.id}`,label:`📦 ${r.title}`,type:"deliverable",content:`${n("chat.currentDeliverable")}: ${r.title} (id: ${r.id})`},...Yt],width:400})]}),Ze&&e.jsx("div",{id:"selection-toolbar",className:"fixed z-50 -translate-x-1/2 -translate-y-full bg-surface-elevated border border-border-default rounded-lg shadow-xl overflow-hidden",style:{left:Ze.x,top:Ze.y-8},children:e.jsxs("button",{onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),as(Ze.text,Ze.htmlMeta)},className:"px-3 py-1.5 text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-1.5 whitespace-nowrap",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),n("contextMenu.addToConversation")]})}),g&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>i(null),children:e.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 max-w-sm mx-4 shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-red-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{className:"w-5 h-5 text-red-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary",children:n("detail.confirmRemoveTitle")}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:n("detail.confirmRemoveMessage",{name:g.title})})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>i(null),className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:n("common:cancel")}),e.jsx("button",{onClick:()=>{const t=g;i(null),Qt(t)},disabled:!!Re,className:"px-4 py-1.5 text-xs bg-red-600 hover:bg-red-500 text-white rounded-lg transition-colors disabled:opacity-50",children:n("common:remove")})]})]})}),yt&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>Ue(null),children:e.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 max-w-sm mx-4 shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-amber-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary",children:n("detail.unsavedTitle")}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:n("detail.unsavedMessage")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>Ue(null),className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:n("common:cancel")}),e.jsx("button",{onClick:()=>{ns(),yt.action()},className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:n("detail.discard")}),e.jsx("button",{onClick:async()=>{await Ut(),yt.action(),Ue(null)},className:"px-4 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors",children:n("detail.saveAndLeave")})]})]})})]})}function It({label:c,value:m,current:p,onClick:n}){return e.jsx("button",{onClick:()=>n(p===m?"":m),className:`px-2 py-1 rounded text-xs whitespace-nowrap shrink-0 transition-colors ${p===m?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:c})}function qt(){return e.jsxs("svg",{className:"animate-spin h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}export{Os as DeliverablesPage};
|