@grackle-ai/web 0.33.0 → 0.34.0

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.
@@ -88,4 +88,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
88
88
  `),te=Xd(pe.entries());!(U=te()).done;){var ye=U.value,q=ye[0],z=ye[1];W.push({type:"text",value:q===pe.length-1?z:z+`
89
89
  `,position:{start:{line:v+q,column:1},end:{line:v+q,column:1}}})}return v+=ge,W}if(Object.prototype.hasOwnProperty.call(F,"children")){var Y=v;return F.children=H(F.children),W.push(F),F.position={start:{line:Y,column:1},end:{line:v,column:1}},W}return W.push(F),W},[])})(g.children),g.position=g.children.length>0?{start:{line:g.children[0].position.start.line,column:0},end:{line:g.children[g.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var A,j=(function(H){var J=/{([\d,-]+)}/,W=H.split(",").map(function(ge){return ge.trim()}).join();if(J.test(W)){var F=J.exec(W)[1],ne=J_(F);return function(ge){return ne.includes(ge+1)}}return function(){return!1}})(p),N=(function(H){var J=wf(/showLineNumbers=(\d+)/i,{lines:1});if(J.test(H)){var W=J.exec(H);return Number(W.groups.lines)}return 1})(p),C=(function(H){for(var J=new Array(H),W=0;W<H;W++)J[W]={type:"element",tagName:"span",properties:{className:[]},children:[]};return J})(g.position.end.line),B=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],R=function(){var H,J,W=A.value,F=W[0],ne=W[1];ne.properties.className=["code-line"];var ge=W_(g,function(U){return U.position.start.line<=F+1&&U.position.end.line>=F+1});ne.children=ge.children,(p.toLowerCase().includes("showLineNumbers".toLowerCase())||a.showLineNumbers===!0||typeof a.showLineNumbers=="object"&&a.showLineNumbers.includes(b))&&!B.some(function(U){return p.toLowerCase().includes(U)})&&(ne.properties.line=[(F+N).toString()],ne.properties.className.push("line-number")),j(F)&&ne.properties.className.push("highlight-line"),(b==="diff"||(H=b)!=null&&H.includes("diff-"))&&Br(ne).substring(0,1)==="-"?ne.properties.className.push("deleted"):(b==="diff"||(J=b)!=null&&J.includes("diff-"))&&Br(ne).substring(0,1)==="+"&&ne.properties.className.push("inserted")},X=Xd(C.entries());!(A=X()).done;)R();C.length>0&&Br(C[C.length-1]).trim()===""&&C.pop(),o.children=C}}}})(Q_);const JN="_systemEvent_qvd33_1",WN="_systemTimestamp_qvd33_9",ew="_textEvent_qvd33_13",tw="_toolUseEvent_qvd33_100",nw="_toolUseHeader_qvd33_121",aw="_toolUsePrefix_qvd33_128",sw="_toolUseName_qvd33_133",iw="_toolUseArgs_qvd33_138",lw="_toolResultEvent_qvd33_149",ow="_toolResultHeader_qvd33_155",rw="_toolResultIndicatorOk_qvd33_179",cw="_toolResultIndicatorError_qvd33_186",uw="_toolResultLabel_qvd33_193",dw="_toolResultToggle_qvd33_197",fw="_toolResultCommand_qvd33_203",hw="_toolResultEllipsis_qvd33_213",mw="_toolResultPre_qvd33_217",pw="_errorEvent_qvd33_238",gw="_statusEvent_qvd33_247",vw="_userInputEvent_qvd33_257",yw="_userInputContent_qvd33_264",bw="_defaultEvent_qvd33_281",St={systemEvent:JN,systemTimestamp:WN,textEvent:ew,toolUseEvent:tw,toolUseHeader:nw,toolUsePrefix:aw,toolUseName:sw,toolUseArgs:iw,toolResultEvent:lw,toolResultHeader:ow,toolResultIndicatorOk:rw,toolResultIndicatorError:cw,toolResultLabel:uw,toolResultToggle:dw,toolResultCommand:fw,toolResultEllipsis:hw,toolResultPre:mw,errorEvent:pw,statusEvent:gw,userInputEvent:vw,userInputContent:yw,defaultEvent:bw};function Sw({time:n,content:a}){return h.jsxs("div",{className:St.systemEvent,children:[h.jsxs("span",{className:St.systemTimestamp,children:["[",n,"]"]})," ",a]})}function _w({content:n}){return h.jsx("div",{className:St.textEvent,children:h.jsx(kf,{remarkPlugins:[Rf],rehypePlugins:[QN],children:n})})}function xw({content:n}){let a="",l=n;try{const o=JSON.parse(n);a=o.tool||"",l=JSON.stringify(o.args,null,2)}catch{}return h.jsxs("div",{className:St.toolUseEvent,children:[h.jsxs("div",{className:St.toolUseHeader,children:[h.jsx("span",{className:St.toolUsePrefix,children:">"}),a?h.jsx("span",{className:St.toolUseName,children:a}):null]}),h.jsx("pre",{className:St.toolUseArgs,children:l})]})}const n0=5;function Tw(n,a){if(a==null)return"";if(typeof a!="object")return String(a);const l=a;if(typeof l.command=="string")return l.command;if(typeof l.file_path=="string")return l.file_path;if(typeof l.pattern=="string"){const o=typeof l.path=="string"?` in ${l.path}`:"";return`${l.pattern}${o}`}if(typeof l.path=="string")return l.path;if(typeof l.query=="string")return l.query;try{const o=JSON.stringify(a);return o.length>150?`${o.slice(0,150)}…`:o}catch{return""}}function Ew({content:n,raw:a,toolUseCtx:l}){const[o,r]=S.useState(!1);let u=!1;if(a)try{u=JSON.parse(a).is_error===!0}catch{}const d=n.split(`
90
90
  `),m=d.length>n0,p=o?n:d.slice(0,n0).join(`
91
- `),v=((l==null?void 0:l.tool)??"")||(u?"Tool error":"Tool output"),b=l?Tw(l.tool,l.args):"",x=h.jsxs(h.Fragment,{children:[h.jsx("span",{className:u?St.toolResultIndicatorError:St.toolResultIndicatorOk,"aria-label":u?"error":"success",children:u?"✗":"✓"}),h.jsx("span",{className:St.toolResultLabel,children:v}),m&&h.jsx("span",{className:St.toolResultToggle,"aria-hidden":"true",children:o?"▾":"▸"})]});return h.jsxs("div",{className:St.toolResultEvent,children:[m?h.jsx("button",{className:St.toolResultHeader,onClick:()=>{r(T=>!T)},"aria-expanded":o,children:x}):h.jsx("div",{className:St.toolResultHeader,children:x}),b&&h.jsx("div",{className:St.toolResultCommand,children:b}),h.jsxs("pre",{className:St.toolResultPre,children:[p,!o&&m&&h.jsx("span",{className:St.toolResultEllipsis,children:"…"})]})]})}function Cw({content:n}){return h.jsxs("div",{className:St.errorEvent,children:["Error: ",n]})}function Aw({content:n}){return h.jsxs("div",{className:St.statusEvent,children:["--- ",n," ---"]})}function jw({content:n}){return h.jsx("div",{className:St.userInputEvent,children:h.jsx("span",{className:St.userInputContent,children:n})})}function Nw({content:n}){return h.jsx("div",{className:St.defaultEvent,children:n})}function w1({event:n,toolUseCtx:a}){const l=new Date(n.timestamp).toLocaleTimeString();switch(n.eventType){case"system":return h.jsx(Sw,{time:l,content:n.content});case"text":case"output":return h.jsx(_w,{content:n.content});case"tool_use":return h.jsx(xw,{content:n.content});case"tool_result":return h.jsx(Ew,{content:n.content,raw:n.raw,toolUseCtx:a});case"error":return h.jsx(Cw,{content:n.content});case"status":return h.jsx(Aw,{content:n.content});case"user_input":return h.jsx(jw,{content:n.content});default:return h.jsx(Nw,{content:n.content})}}const ww="_overlay_cmicx_1",Dw="_dialog_cmicx_11",kw="_title_cmicx_30",Rw="_description_cmicx_38",Mw="_actions_cmicx_45",Ow="_cancelButton_cmicx_52",Bw="_confirmButton_cmicx_79",Is={overlay:ww,dialog:Dw,title:kw,description:Rw,actions:Mw,cancelButton:Ow,confirmButton:Bw};function Sc({isOpen:n,title:a,description:l,confirmLabel:o="Delete",onConfirm:r,onCancel:u}){const d=S.useId(),m=S.useId();return h.jsx(ys,{children:n&&h.jsx($n.div,{className:Is.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:p=>{p.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":l?m:void 0,children:h.jsxs($n.div,{className:Is.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:p=>p.stopPropagation(),children:[h.jsx("h3",{id:d,className:Is.title,children:a}),l&&h.jsx("p",{id:m,className:Is.description,children:l}),h.jsxs("div",{className:Is.actions,children:[h.jsx("button",{type:"button",className:Is.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),h.jsx("button",{type:"button",className:Is.confirmButton,onClick:r,children:o})]})]})})})}const Lw="_spinner_13c8l_1",zw="_spin_13c8l_1",Uw="_sm_13c8l_14",Vw="_md_13c8l_20",Iw="_lg_13c8l_26",a0={spinner:Lw,spin:zw,sm:Uw,md:Vw,lg:Iw};function s0({size:n="md",className:a,label:l="Loading",liveRegion:o=!1}){return h.jsx("span",{className:`${a0.spinner} ${a0[n]} ${a??""}`,role:o?"status":void 0,"aria-label":l,"aria-hidden":o?void 0:!0})}const Df={not_started:{color:"var(--text-tertiary)",icon:"○",label:"Not Started"},working:{color:"var(--accent-green)",icon:"●",label:"Working"},paused:{color:"var(--accent-yellow)",icon:"◉",label:"Paused"},complete:{color:"var(--accent-green)",icon:"✓",label:"Complete"},failed:{color:"var(--accent-red)",icon:"✗",label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:"⦸",label:"Blocked"}};function vs(n){return n==="blocked"?Df.blocked:Df[Th(n)]}const Hw={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function qw(n){return Hw[Th(n)]??"statusPending"}const Gw=["working","paused","failed","not_started","blocked","complete"],i0=["not_started","working","paused","complete","failed"],Pw={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function Th(n){return n in Df&&n!=="blocked"?n:Pw[n]??"not_started"}const Fw={not_started:"--text-tertiary",working:"--accent-green",paused:"--accent-yellow",complete:"--accent-green",failed:"--accent-red",pending:"--text-tertiary",assigned:"--text-tertiary",in_progress:"--accent-green",review:"--accent-yellow",done:"--accent-green",waiting_input:"--accent-yellow"},$w="_container_15oob_1",Yw="_header_15oob_5",Kw="_searchInput_15oob_17",Zw="_searchHighlight_15oob_50",Xw="_addButton_15oob_56",Qw="_createForm_15oob_83",Jw="_createInput_15oob_89",Ww="_createButton_15oob_120",eD="_creatingHint_15oob_161",tD="_projectRow_15oob_170",nD="_selected_15oob_188",aD="_expandArrow_15oob_193",sD="_expanded_15oob_200",iD="_projectName_15oob_204",lD="_taskCount_15oob_208",oD="_newTaskButton_15oob_214",rD="_taskRow_15oob_241",cD="_taskStatusIcon_15oob_271",uD="_taskTitle_15oob_275",dD="_dependencyBadge_15oob_282",fD="_blockedBadge_15oob_294",hD="_leafSpacer_15oob_299",mD="_childCountBadge_15oob_304",pD="_addChildButton_15oob_317",gD="_emptyCta_15oob_366",vD="_ctaDescription_15oob_379",yD="_ctaButton_15oob_385",bD="_emptyTaskCta_15oob_420",SD="_headerActions_15oob_425",_D="_groupToggle_15oob_431",xD="_groupToggleActive_15oob_458",TD="_statusGroupHeader_15oob_462",ED="_statusGroupIcon_15oob_481",CD="_statusGroupLabel_15oob_485",AD="_statusGroupCount_15oob_490",jD="_createTaskLink_15oob_503",Ne={container:$w,header:Yw,searchInput:Kw,searchHighlight:Zw,addButton:Xw,createForm:Qw,createInput:Jw,createButton:Ww,creatingHint:eD,projectRow:tD,selected:nD,expandArrow:aD,expanded:sD,projectName:iD,taskCount:lD,newTaskButton:oD,taskRow:rD,taskStatusIcon:cD,taskTitle:uD,dependencyBadge:dD,blockedBadge:fD,leafSpacer:hD,childCountBadge:mD,addChildButton:pD,emptyCta:gD,ctaDescription:vD,ctaButton:yD,emptyTaskCta:bD,headerActions:SD,groupToggle:_D,groupToggleActive:xD,statusGroupHeader:TD,statusGroupIcon:ED,statusGroupLabel:CD,statusGroupCount:AD,createTaskLink:jD};function ND(n){if(n.length===0)return[];const a=[...n].sort((o,r)=>o[0]-r[0]),l=[[a[0][0],a[0][1]]];for(let o=1;o<a.length;o++){const r=l[l.length-1],[u,d]=a[o];u<=r[1]+1?r[1]=Math.max(r[1],d):l.push([u,d])}return l}function D1({text:n,indices:a}){if(!a||a.length===0)return h.jsx(h.Fragment,{children:n});const l=ND(a),o=[];let r=0;for(const[u,d]of l)u>r&&o.push(h.jsx("span",{children:n.slice(r,u)},`p${r}`)),o.push(h.jsx("mark",{className:Ne.searchHighlight,children:n.slice(u,d+1)},`m${u}`)),r=d+1;return r<n.length&&o.push(h.jsx("span",{children:n.slice(r)},`p${r}`)),h.jsx(h.Fragment,{children:o})}const wD=[{name:"name",weight:2},{name:"description",weight:1}],DD=[{name:"title",weight:2},{name:"description",weight:1}],k1=34,kD=16,R1="grackle-group-by-status";function l0(){try{return localStorage.getItem(R1)==="true"}catch{return!1}}function RD(n){try{localStorage.setItem(R1,String(n))}catch{}}function MD(n,a){const l=new Map;for(const u of n){const m=u.dependsOn.length>0&&u.dependsOn.some(g=>a.get(g)!=="complete")?"blocked":u.status,p=l.get(m);p?p.push(u):l.set(m,[u])}const o=[],r=new Set;for(const u of Gw){r.add(u);const d=l.get(u);if(d&&d.length>0){d.sort((p,g)=>p.sortOrder-g.sortOrder);const m=vs(u);o.push({status:u,label:m.label,style:m,tasks:d})}}for(const[u,d]of l)if(!r.has(u)&&d.length>0){d.sort((p,g)=>p.sortOrder-g.sortOrder);const m=vs(u);o.push({status:u,label:m.label,style:m,tasks:d})}return o}function OD({group:n,isExpanded:a,onToggle:l,selectedTaskId:o,navigate:r,titleHighlights:u}){return h.jsxs("div",{"data-testid":`status-group-${n.status}`,children:[h.jsxs("div",{className:Ne.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":a,onClick:l,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l())},children:[h.jsx("span",{className:`${Ne.expandArrow} ${a?Ne.expanded:""}`,children:"▸"}),h.jsx("span",{className:Ne.statusGroupIcon,style:{color:n.style.color},children:n.style.icon}),h.jsx("span",{className:Ne.statusGroupLabel,children:n.label}),h.jsx("span",{className:Ne.statusGroupCount,children:n.tasks.length})]}),h.jsx(ys,{children:a&&h.jsx($n.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:n.tasks.map(d=>{const m=vs(d.status),p=o===d.id;return h.jsxs("div",{onClick:()=>r(ms(d.id)),className:`${Ne.taskRow} ${p?Ne.selected:""}`,style:{"--task-indent":`${k1}px`},"data-task-id":d.id,children:[h.jsx("span",{className:Ne.leafSpacer}),h.jsx("span",{className:Ne.taskStatusIcon,style:{color:m.color},children:m.icon}),h.jsx("span",{className:Ne.taskTitle,title:d.title,children:h.jsx(D1,{text:d.title,indices:u.get(d.id)})})]},d.id)})})})]})}function BD(n){const a=new Map(n.map(o=>[o.id,{...o,children:[]}])),l=[];for(const o of a.values())o.parentTaskId&&a.has(o.parentTaskId)?a.get(o.parentTaskId).children.push(o):l.push(o);for(const o of a.values())o.children.sort((r,u)=>r.sortOrder-u.sortOrder);return l.sort((o,r)=>o.sortOrder-r.sortOrder)}function M1({node:n,depth:a,expandedTasks:l,toggleTask:o,selectedTaskId:r,navigate:u,projectId:d,taskStatusById:m,titleHighlights:p}){const g=vs(n.status),v=n.dependsOn.length>0&&n.dependsOn.some(j=>m.get(j)!=="complete"),b=l.has(n.id),x=n.children.length>0,T=r===n.id,A=k1+a*kD;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{onClick:()=>u(ms(n.id)),className:`${Ne.taskRow} ${T?Ne.selected:""}`,style:{"--task-indent":`${A}px`},"data-task-id":n.id,children:[x&&h.jsx("span",{className:`${Ne.expandArrow} ${b?Ne.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:j=>{j.stopPropagation(),o(n.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),o(n.id))},children:"▸"}),!x&&h.jsx("span",{className:Ne.leafSpacer}),h.jsx("span",{className:Ne.taskStatusIcon,style:{color:g.color},children:g.icon}),h.jsx("span",{className:Ne.taskTitle,title:n.title,children:h.jsx(D1,{text:n.title,indices:p.get(n.id)})}),x&&h.jsxs("span",{className:Ne.childCountBadge,children:[n.children.filter(j=>j.status==="complete").length,"/",n.children.length]}),n.dependsOn.length>0&&h.jsx("span",{className:`${Ne.dependencyBadge} ${v?Ne.blockedBadge:""}`,title:`Depends on: ${n.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),a<sN&&h.jsx("button",{onClick:j=>{j.stopPropagation(),u($s(d,n.id))},title:"Add child task","aria-label":"Add child task",className:Ne.addChildButton,children:"+"})]}),h.jsx(ys,{children:x&&b&&h.jsx($n.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:n.children.map(j=>h.jsx(M1,{node:j,depth:a+1,expandedTasks:l,toggleTask:o,selectedTaskId:r,navigate:u,projectId:d,taskStatusById:m,titleHighlights:p},j.id))})})]})}function LD(){const{projects:n,tasks:a,loadTasks:l,createProject:o,projectCreating:r}=nn(),u=na(),[d,m]=S.useState(new Set),[p,g]=S.useState(new Set),[v,b]=S.useState(new Set),[x,T]=S.useState(!1),[A,j]=S.useState(""),[N,C]=S.useState(l0),[B,R]=S.useState(l0),[X,H]=S.useState(new Map),J=()=>{const P=!N;RD(P),C(P),P&&(R(!0),H(new Map))},W=(P,I)=>{const De=`${P}:${I}`;H($e=>{const vt=new Map($e),xt=vt.has(De)?vt.get(De):B;return vt.set(De,!xt),vt})},F=(P,I)=>{const De=`${P}:${I}`;return X.has(De)?X.get(De):B},ne=dn("/tasks/:taskId/*"),ge=dn("/projects/:projectId"),U=(ne==null?void 0:ne.params.taskId)!=="new"?ne==null?void 0:ne.params.taskId:void 0,pe=ge==null?void 0:ge.params.projectId,te=S.useRef(d);te.current=d;const ye=S.useMemo(()=>new Map(a.map(P=>[P.id,P.status])),[a]),q=P=>{m(I=>{const De=new Set(I);return De.has(P)?De.delete(P):(De.add(P),l(P)),De})},z=P=>{g(I=>{const De=new Set(I);return De.has(P)?(De.delete(P),b($e=>new Set($e).add(P))):(De.add(P),b($e=>{const vt=new Set($e);return vt.delete(P),vt})),De})};S.useEffect(()=>{const P=new Set(a.filter(I=>I.parentTaskId).map(I=>I.parentTaskId));P.size>0&&g(I=>{const De=new Set(I);for(const $e of P)v.has($e)||De.add($e);return De})},[a,v]),S.useEffect(()=>{pe&&!te.current.has(pe)&&(m(P=>new Set(P).add(pe)),l(pe))},[pe,l]);const Y=()=>{!A.trim()||r||(o(A.trim()),j(""),T(!1))},[ee,ke]=S.useState(""),{directMatchTaskIds:je,treeMatchTaskIds:Pe,visibleProjectIds:we,matchedProjectIds:_e,titleHighlights:Ce}=S.useMemo(()=>{if(!ee.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,visibleProjectIds:null,matchedProjectIds:null,titleHighlights:new Map};const P=e0(n,ee,wD),I=e0(a,ee,DD),De=new Set(P.map(Ze=>Ze.item.id)),$e=new Set(I.map(Ze=>Ze.item.id)),vt=new Map;for(const Ze of I){const ze=Ze.matches.find(Sn=>Sn.key==="title");ze&&vt.set(Ze.item.id,ze.indices)}const xt=new Set(De);for(const Ze of I)xt.add(Ze.item.projectId);const Gt=new Set($e),We=new Map(a.map(Ze=>[Ze.id,Ze]));for(const Ze of[...$e]){let ze=We.get(Ze);for(;ze!=null&&ze.parentTaskId;)Gt.add(ze.parentTaskId),ze=We.get(ze.parentTaskId)}return{directMatchTaskIds:$e,treeMatchTaskIds:Gt,visibleProjectIds:xt,matchedProjectIds:De,titleHighlights:vt}},[ee,n,a]),Q=S.useRef(new Set);return S.useEffect(()=>{if(ee.trim())for(const P of n)!d.has(P.id)&&!Q.current.has(P.id)&&(Q.current.add(P.id),l(P.id))},[ee,n,d,l]),h.jsxs("div",{className:Ne.container,children:[h.jsxs("div",{className:Ne.header,children:[h.jsx("span",{children:"Projects"}),h.jsxs("div",{className:Ne.headerActions,children:[h.jsx("button",{className:`${Ne.groupToggle} ${N?Ne.groupToggleActive:""}`,onClick:J,"aria-label":N?"Switch to tree view":"Group tasks by status","aria-pressed":N,title:N?"Switch to tree view":"Group tasks by status","data-testid":"group-by-status-toggle",children:"≡"}),h.jsx("button",{className:Ne.addButton,onClick:()=>T(!x),"aria-label":"Create project",title:"Create project",children:"+"})]})]}),n.length>0&&h.jsx("input",{type:"text",value:ee,onChange:P=>ke(P.target.value),placeholder:"Filter...","aria-label":"Filter projects and tasks",className:Ne.searchInput,"data-testid":"sidebar-search"}),x&&h.jsxs("div",{className:Ne.createForm,children:[h.jsx("input",{type:"text",value:A,onChange:P=>j(P.target.value),onKeyDown:P=>P.key==="Enter"&&Y(),placeholder:"Project name...",autoFocus:!0,disabled:r,className:Ne.createInput}),h.jsx("button",{onClick:Y,className:Ne.createButton,disabled:r,children:r?h.jsx(s0,{size:"sm",label:"Creating project"}):"OK"})]}),r&&h.jsxs("div",{className:Ne.creatingHint,children:[h.jsx(s0,{size:"sm",label:"Creating project"}),"Creating project…"]}),n.length===0&&!x&&h.jsxs("div",{className:Ne.emptyCta,children:[h.jsx("button",{className:Ne.ctaButton,onClick:()=>T(!0),children:"Create Project"}),h.jsx("div",{className:Ne.ctaDescription,children:"Organize your work into projects"})]}),n.map(P=>{if(we&&!we.has(P.id))return null;const I=je!==null,De=d.has(P.id)||I,$e=a.filter(ze=>ze.projectId===P.id),vt=(_e==null?void 0:_e.has(P.id))??!1,xt=I&&!vt?N?je:Pe:null,Gt=xt?$e.filter(ze=>xt.has(ze.id)):$e,We=pe===P.id,Ze=De&&!N?BD(Gt):[];return h.jsxs("div",{children:[h.jsxs("div",{onClick:()=>{We?q(P.id):(De||q(P.id),u(oo(P.id)))},className:`${Ne.projectRow} ${We?Ne.selected:""}`,children:[h.jsx("span",{className:`${Ne.expandArrow} ${De?Ne.expanded:""}`,children:"▸"}),h.jsx("span",{className:Ne.projectName,title:P.name,children:P.name}),h.jsx("span",{className:Ne.taskCount,children:$e.length>0&&`${$e.filter(ze=>ze.status==="complete").length}/${$e.length}`}),h.jsx("button",{onClick:ze=>{ze.stopPropagation(),u($s(P.id))},title:"New task",className:Ne.newTaskButton,children:"+"})]}),h.jsx(ys,{children:De&&h.jsxs($n.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},style:{overflow:"hidden"},children:[N?MD(Gt,ye).map(ze=>h.jsx(OD,{group:ze,isExpanded:F(P.id,ze.status),onToggle:()=>W(P.id,ze.status),selectedTaskId:U,navigate:u,titleHighlights:Ce},ze.status)):Ze.map(ze=>h.jsx(M1,{node:ze,depth:0,expandedTasks:p,toggleTask:z,selectedTaskId:U,navigate:u,projectId:P.id,taskStatusById:ye,titleHighlights:Ce},ze.id)),Gt.length===0&&h.jsx("div",{className:Ne.emptyTaskCta,children:h.jsx("button",{className:Ne.createTaskLink,onClick:()=>u($s(P.id)),children:"+ Create Task"})})]})})]},P.id)})]})}const zD="_container_lovia_1",UD="_content_lovia_40",o0={container:zD,content:UD},VD=320,O1=220,B1=600,L1="grackle-sidebar-width";function ID(){try{const n=localStorage.getItem(L1);if(n!==null){const a=Number(n);if(Number.isFinite(a)&&a>=O1&&a<=B1)return a}}catch{}return VD}function HD(n){try{localStorage.setItem(L1,String(n))}catch{}}function qD(){const[n]=S.useState(ID),a=S.useRef(null);return S.useEffect(()=>{const l=a.current;if(!l)return;const o=new ResizeObserver(r=>{for(const u of r){const d=u.borderBoxSize[0];if(d){const m=Math.round(d.inlineSize);m>=O1&&m<=B1&&HD(m)}}});return o.observe(l),()=>{o.disconnect()}},[]),h.jsx("div",{className:o0.container,ref:a,"data-testid":"sidebar",style:{width:n},children:h.jsx("div",{className:o0.content,children:h.jsx(LD,{})})})}const GD="_bar_8ghh5_1",PD="_barColumn_8ghh5_32",FD="_barRow_8ghh5_63",$D="_input_8ghh5_74",YD="_inputSmall_8ghh5_109",KD="_select_8ghh5_178",ZD="_btnPrimary_8ghh5_214",XD="_btnDanger_8ghh5_245",QD="_btnGhost_8ghh5_284",JD="_badge_8ghh5_312",WD="_statusText_8ghh5_322",ek="_statusCompleted_8ghh5_327",tk="_statusFailed_8ghh5_331",nk="_statusBlocked_8ghh5_335",ak="_hintText_8ghh5_340",sk="_creatingHint_8ghh5_345",ik="_errorHint_8ghh5_353",lk="_disconnectHint_8ghh5_359",fe={bar:GD,barColumn:PD,barRow:FD,input:$D,inputSmall:YD,select:KD,btnPrimary:ZD,btnDanger:XD,btnGhost:QD,badge:JD,statusText:WD,statusCompleted:ek,statusFailed:tk,statusBlocked:nk,hintText:ak,creatingHint:sk,errorHint:ik,disconnectHint:lk};function r0({value:n,onChange:a,testId:l}){return h.jsxs("select",{"data-testid":l,value:n,onChange:o=>a(o.target.value),className:fe.select,children:[h.jsx("option",{value:"claude-code",children:"claude-code"}),h.jsx("option",{value:"codex",children:"codex"}),h.jsx("option",{value:"copilot",children:"copilot"}),h.jsx("option",{value:"stub",children:"stub"})]})}function c0(n,a){if(!n)return!1;const l=a.find(o=>o.id===n);return l!==void 0&&(l.status==="disconnected"||l.status==="error")}function u0({environmentId:n,onReconnect:a}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:fe.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),h.jsx("button",{type:"button",onClick:()=>a(n),className:fe.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function ok(){const{spawn:n,sendInput:a,kill:l,sessions:o,tasks:r,environments:u,personas:d,addEnvironment:m,provisionEnvironment:p,codespaces:g,codespaceError:v,codespaceListError:b,codespaceCreating:x,listCodespaces:T,createCodespace:A}=nn(),{showToast:j}=go(),N=na(),[C]=If(),B=dn("/sessions/:sessionId"),R=dn("/tasks/:taskId"),X=dn("/tasks/:taskId/stream"),H=dn("/tasks/:taskId/findings"),J=dn("/tasks/:taskId/edit"),W=dn("/sessions/new"),F=dn("/environments/new"),ne=dn("/projects/:projectId"),ge=dn("/tasks/new"),U=dn("/"),pe=dn("/settings/*"),te=B==null?void 0:B.params.sessionId,ye=(R==null?void 0:R.params.taskId)??(X==null?void 0:X.params.taskId)??(H==null?void 0:H.params.taskId),q=!!W,z=!!F,Y=!!ne,ee=!!ge,ke=!!J,je=!!U&&!q&&!z&&!Y&&!ee,Pe=!!pe,we=q?C.get("env")??"":"",_e=q?C.get("runtime")??"claude-code":"claude-code",[Ce,Q]=S.useState(""),[P,I]=S.useState(q?_e:"claude-code"),[De,$e]=S.useState(""),vt=be=>{if($e(be),be){const re=d.find(ie=>ie.id===be);re!=null&&re.runtime&&I(re.runtime)}},[xt,Gt]=S.useState(""),[We,Ze]=S.useState("local"),[ze,Sn]=S.useState("claude-code"),[_n,Zn]=S.useState(""),[an,Xn]=S.useState(""),[Z,le]=S.useState(""),[ce,de]=S.useState(""),[Te,Ee]=S.useState(""),[et,Le]=S.useState(""),[ot,Dt]=S.useState(""),[Tt,Lt]=S.useState(""),[rt,Et]=S.useState(""),[cn,yt]=S.useState("pick");S.useEffect(()=>{q&&I(_e)},[q,_e]);const $t=te?o.find(be=>be.id===te):void 0,Yt=ye?r.find(be=>be.id===ye):void 0,_s=(Yt==null?void 0:Yt.latestSessionId)||void 0,ae=_s?o.find(be=>be.id===_s):void 0,Me=Yt?Yt.dependsOn.some(be=>{const re=r.find(ie=>ie.id===be);return re&&re.status!=="complete"}):!1;if(je||Pe)return h.jsx("div",{className:fe.bar,children:h.jsx("span",{className:fe.hintText,children:"Select a session or click + to start"})});if(ke||ee)return h.jsx(h.Fragment,{});if(z){const be=se=>{if(!se.trim())return!0;const Ct=Number(se);return Number.isInteger(Ct)&&Ct>=1&&Ct<=65535},re=()=>!(!xt.trim()||We==="ssh"&&!_n.trim()||We==="codespace"&&!et.trim()||(We==="local"||We==="ssh")&&!be(an)),ie=()=>{if(!re())return;const se={};if(We==="local"){if(_n.trim()&&(se.host=_n.trim()),an.trim()){const Ct=Number(an);Number.isInteger(Ct)&&(se.port=Ct)}}else if(We==="ssh"){if(se.host=_n.trim(),Z.trim()&&(se.user=Z.trim()),an.trim()){const Ct=Number(an);Number.isInteger(Ct)&&(se.sshPort=Ct)}ot.trim()&&(se.identityFile=ot.trim())}else We==="docker"?(ce.trim()&&(se.image=ce.trim()),Te.trim()&&(se.repo=Te.trim())):We==="codespace"&&(se.codespaceName=et.trim());m(xt.trim(),We,se,ze),j("Environment added successfully","success"),Gt(""),Ze("local"),Sn("claude-code"),Zn(""),Xn(""),le(""),de(""),Ee(""),Le(""),Dt(""),Lt(""),Et(""),yt("pick"),N(qi,{replace:!0})};return h.jsxs("div",{className:fe.barColumn,children:[h.jsxs("div",{className:fe.barRow,children:[h.jsx("span",{className:fe.badge,children:"new env"}),h.jsx("input",{type:"text",value:xt,onChange:se=>Gt(se.target.value),placeholder:"Environment name...",autoFocus:!0,className:fe.input}),h.jsxs("select",{value:We,onChange:se=>{Ze(se.target.value),se.target.value==="codespace"&&(T(),yt("pick"),Le(""))},className:fe.select,children:[h.jsx("option",{value:"local",children:"local"}),h.jsx("option",{value:"ssh",children:"ssh"}),h.jsx("option",{value:"docker",children:"docker"}),h.jsx("option",{value:"codespace",children:"codespace"})]}),h.jsx(r0,{value:ze,onChange:Sn,testId:"new-environment-runtime-select"}),h.jsx("button",{onClick:ie,disabled:!re(),className:fe.btnPrimary,children:"Add"})]}),h.jsxs("div",{className:fe.barRow,children:[We==="local"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:_n,onChange:se=>Zn(se.target.value),placeholder:"Host (optional)...",className:fe.inputSmall}),h.jsx("input",{type:"number",min:1,max:65535,value:an,onChange:se=>Xn(se.target.value),placeholder:"Port (optional)...",className:fe.inputSmall})]}),We==="ssh"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:_n,onChange:se=>Zn(se.target.value),placeholder:"Host (required)...",className:fe.inputSmall}),h.jsx("input",{type:"text",value:Z,onChange:se=>le(se.target.value),placeholder:"User (optional)...",className:fe.inputSmall}),h.jsx("input",{type:"number",min:1,max:65535,value:an,onChange:se=>Xn(se.target.value),placeholder:"SSH port (optional)...",className:fe.inputSmall}),h.jsx("input",{type:"text",value:ot,onChange:se=>Dt(se.target.value),placeholder:"Identity file (optional)...",className:fe.inputSmall})]}),We==="docker"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:ce,onChange:se=>de(se.target.value),placeholder:"Image (optional)...",className:fe.inputSmall}),h.jsx("input",{type:"text",value:Te,onChange:se=>Ee(se.target.value),placeholder:"Repo (optional)...",className:fe.inputSmall})]}),We==="codespace"&&cn==="pick"&&h.jsxs(h.Fragment,{children:[!b&&h.jsxs("select",{value:et,onChange:se=>{se.target.value==="__create__"?(yt("create"),Le("")):(Le(se.target.value),se.target.value&&!xt.trim()&&Gt(se.target.value))},disabled:x,className:fe.select,children:[h.jsx("option",{value:"",children:"Select a codespace..."}),g.map(se=>h.jsxs("option",{value:se.name,children:[se.name," (",se.repository,") — ",se.state]},se.name)),h.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),x&&h.jsx("span",{className:fe.creatingHint,children:"Creating codespace..."}),b&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:fe.errorHint,children:b}),h.jsx("input",{type:"text",value:et,onChange:se=>Le(se.target.value),placeholder:"Or enter codespace name manually...",className:fe.inputSmall})]}),v&&!b&&h.jsx("span",{className:fe.errorHint,children:v})]}),We==="codespace"&&cn==="create"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:Tt,onChange:se=>Lt(se.target.value),placeholder:"owner/repo",className:fe.inputSmall}),h.jsx("input",{type:"text",value:rt,onChange:se=>Et(se.target.value),placeholder:"Machine type (optional)...",className:fe.inputSmall}),h.jsx("button",{onClick:()=>{Tt.trim()&&(A(Tt.trim(),rt.trim()||void 0),yt("pick"),Lt(""),Et(""))},disabled:!Tt.trim(),className:fe.btnPrimary,children:"Create"}),h.jsx("button",{onClick:()=>{yt("pick"),Lt(""),Et("")},className:fe.btnGhost,children:"Cancel"})]})]})]})}if(Y)return h.jsx("div",{className:fe.bar,children:h.jsx("span",{className:fe.hintText,children:"Select a task or click + to create one"})});if(ye&&Yt){if(Yt.status==="not_started"){const be=Me?Yt.dependsOn.map(re=>r.find(ie=>ie.id===re)).filter(re=>re&&re.status!=="complete").map(re=>re.title):[];return h.jsx("div",{className:fe.bar,children:Me?h.jsxs("span",{className:fe.statusBlocked,children:["Blocked by: ",be.join(", ")]}):h.jsx("span",{className:fe.hintText,children:"Use the buttons above to start or manage this task"})})}if(Yt.status==="working"||Yt.status==="paused"){if((ae==null?void 0:ae.status)==="idle"){const re=ae.environmentId,ie=c0(re,u),se=Ct=>{Ct.preventDefault();const Mn=Yt.latestSessionId||_s;!Ce.trim()||!Mn||ie||(a(Mn,Ce),Q(""))};return h.jsxs("form",{onSubmit:se,className:fe.bar,children:[ie&&re&&h.jsx(u0,{environmentId:re,onReconnect:p}),h.jsx("input",{type:"text",value:Ce,onChange:Ct=>Q(Ct.target.value),placeholder:"Type a message...",autoFocus:!ie,disabled:ie,className:fe.input}),h.jsx("span",{title:ie?"Environment is unavailable — reconnect first":void 0,children:h.jsx("button",{type:"submit",disabled:!Ce.trim()||ie,className:fe.btnPrimary,children:"Send"})})]})}return h.jsx("div",{className:fe.bar,children:h.jsx("input",{type:"text",disabled:!0,placeholder:"Agent is working...",className:fe.input})})}if(Yt.status==="complete")return h.jsxs("div",{className:fe.bar,children:[h.jsx("span",{className:`${fe.statusText} ${fe.statusCompleted}`,children:"Task completed"}),h.jsx("button",{onClick:()=>N($s(Yt.projectId)),className:fe.btnPrimary,children:"+ New Task"})]});if(Yt.status==="failed")return h.jsx("div",{className:fe.bar,children:h.jsx("span",{className:`${fe.statusText} ${fe.statusFailed}`,children:"Task failed"})})}if(q){const be=re=>{re.preventDefault(),!(!Ce.trim()||!we)&&(n(we,Ce,void 0,P,De),j("Session started","success"),Q(""),$e(""))};return h.jsxs("form",{onSubmit:be,className:fe.bar,children:[h.jsx("span",{className:fe.badge,children:"new chat"}),h.jsx("input",{type:"text",value:Ce,onChange:re=>Q(re.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:fe.input}),h.jsx(r0,{value:P,onChange:I,testId:"new-chat-runtime-select"}),h.jsxs("select",{value:De,onChange:re=>vt(re.target.value),className:fe.select,children:[h.jsx("option",{value:"",children:"No persona"}),d.map(re=>h.jsx("option",{value:re.id,children:re.name},re.id))]}),h.jsx("button",{type:"submit",disabled:!Ce.trim()||!we,className:fe.btnPrimary,children:"Go"})]})}if(te){const be=($t==null?void 0:$t.status)==="running",re=($t==null?void 0:$t.status)==="idle",ie=$t!==void 0&&["completed","failed","interrupted"].includes($t.status);if(be)return h.jsxs("div",{className:fe.bar,children:[h.jsx("input",{type:"text",disabled:!0,placeholder:"Agent is working...",className:fe.input}),h.jsx("button",{onClick:()=>l(te),className:fe.btnDanger,title:"Stop session",children:"Stop"})]});if(re){const se=c0($t.environmentId,u),Ct=Mn=>{Mn.preventDefault(),!(!Ce.trim()||se)&&(a(te,Ce),Q(""))};return h.jsxs("form",{onSubmit:Ct,className:fe.bar,children:[se&&$t.environmentId&&h.jsx(u0,{environmentId:$t.environmentId,onReconnect:p}),h.jsx("input",{type:"text",value:Ce,onChange:Mn=>Q(Mn.target.value),placeholder:"Type a message...",autoFocus:!se,disabled:se,className:fe.input}),h.jsx("span",{title:se?"Environment is unavailable — reconnect first":void 0,children:h.jsx("button",{type:"submit",disabled:!Ce.trim()||se,className:fe.btnPrimary,children:"Send"})}),h.jsx("button",{type:"button",onClick:()=>l(te),className:fe.btnDanger,title:"Stop session",children:"Stop"})]})}if(ie)return h.jsxs("div",{className:fe.bar,children:[h.jsxs("span",{className:`${fe.statusText} ${fe.hintText}`,children:["Session ",$t.status]}),h.jsx("button",{onClick:()=>N(z0($t.environmentId,$t.runtime)),className:fe.btnPrimary,children:"+ New Chat"})]})}return h.jsx("div",{className:fe.bar,children:h.jsx("span",{className:fe.hintText,children:"Loading..."})})}const rk="_toast_da8ll_1",ck="_success_da8ll_18",uk="_icon_da8ll_22",dk="_error_da8ll_25",fk="_warning_da8ll_32",hk="_info_da8ll_38",mk="_message_da8ll_53",pk="_close_da8ll_60",Yl={toast:rk,success:ck,icon:uk,error:dk,warning:fk,info:hk,message:mk,close:pk},gk={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function vk({toast:n,onDismiss:a}){return S.useEffect(()=>{const l=setTimeout(()=>a(n.id),n.duration);return()=>clearTimeout(l)},[n.id,n.duration,a]),h.jsxs($n.div,{className:`${Yl.toast} ${Yl[n.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[h.jsx("span",{className:Yl.icon,"aria-hidden":"true",children:gk[n.variant]}),h.jsx("span",{className:Yl.message,children:n.message}),h.jsx("button",{type:"button",className:Yl.close,onClick:()=>a(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const yk="_container_qqse2_1",bk={container:yk};function Sk(){const{toasts:n,dismissToast:a}=go();return h.jsx("div",{className:bk.container,"data-testid":"toast-container",children:h.jsx(ys,{children:n.map(l=>h.jsx(vk,{toast:l,onDismiss:a},l.id))})})}function _k(n,a){const l=S.useRef(null);S.useEffect(()=>{const o=l.current;if(l.current=n,o===null)return;const r=new Map;for(const d of o)r.set(d.id,d);const u=new Set;for(const d of n){u.add(d.id);const m=r.get(d.id);m&&m.status!==d.status&&(d.status==="connecting"||d.status==="sleeping"||(d.status==="connected"?a("Environment connected","success"):d.status==="error"?a("Environment provision failed","error"):d.status==="disconnected"&&(m.status==="connected"?a("Environment disconnected","warning"):a("Environment stopped","info"))))}for(const d of o)u.has(d.id)||a("Environment removed","info")},[n,a])}const xk="_panelContainer_2zqh5_1",Tk="_emptyState_2zqh5_8",Ek="_fadeIn_2zqh5_1",Ck="_projectSummary_2zqh5_17",Ak="_projectSummaryTitle_2zqh5_28",jk="_projectSummarySubtitle_2zqh5_32",Nk="_header_2zqh5_36",wk="_headerInfo_2zqh5_69",Dk="_killButton_2zqh5_75",kk="_headerTitle_2zqh5_104",Rk="_headerActions_2zqh5_119",Mk="_taskStatusBadge_2zqh5_126",Ok="_taskBranch_2zqh5_135",Bk="_taskBlockedBadge_2zqh5_141",Lk="_btnPrimary_2zqh5_149",zk="_btnDanger_2zqh5_180",Uk="_btnGhost_2zqh5_219",Vk="_rejectInput_2zqh5_245",Ik="_tabBar_2zqh5_275",Hk="_tab_2zqh5_275",qk="_active_2zqh5_301",Gk="_eventScroll_2zqh5_306",Pk="_tabContent_2zqh5_312",Fk="_noContext_2zqh5_317",$k="_overviewContent_2zqh5_323",Yk="_overviewDashboard_2zqh5_332",Kk="_overviewHero_2zqh5_338",Zk="_statusBadge_2zqh5_345",Xk="_statusPending_2zqh5_357",Qk="_statusAssigned_2zqh5_362",Jk="_statusInProgress_2zqh5_367",Wk="_statusReview_2zqh5_372",eR="_statusDone_2zqh5_377",tR="_statusFailed_2zqh5_382",nR="_statusWaitingInput_2zqh5_387",aR="_overviewBranchPill_2zqh5_392",sR="_branchLink_2zqh5_407",iR="_overviewSection_2zqh5_418",lR="_overviewLabel_2zqh5_424",oR="_overviewValue_2zqh5_431",rR="_overviewMuted_2zqh5_436",cR="_overviewMarkdown_2zqh5_442",uR="_envRow_2zqh5_511",dR="_envDot_2zqh5_517",fR="_envDotGreen_2zqh5_524",hR="_envDotYellow_2zqh5_528",mR="_envDotRed_2zqh5_532",pR="_envDotGray_2zqh5_536",gR="_depList_2zqh5_540",vR="_depItem_2zqh5_546",yR="_depBlocked_2zqh5_553",bR="_depDone_2zqh5_557",SR="_timeline_2zqh5_561",_R="_timelineRow_2zqh5_567",xR="_timelineKey_2zqh5_574",TR="_timelineValue_2zqh5_580",ER="_timelineDelta_2zqh5_584",CR="_reviewNotes_2zqh5_595",AR="_overviewDescription_2zqh5_606",jR="_waitingMessage_2zqh5_612",NR="_errorMessage_2zqh5_616",wR="_eventOverflowWarning_2zqh5_620",DR="_attemptSelector_2zqh5_634",kR="_attemptLabel_2zqh5_650",RR="_attemptButton_2zqh5_654",MR="_attemptActive_2zqh5_671",OR="_attemptStatus_2zqh5_677",BR="_emptyCta_2zqh5_683",LR="_ctaTitle_2zqh5_695",zR="_ctaDescription_2zqh5_701",UR="_ctaButton_2zqh5_708",VR="_ctaLink_2zqh5_743",IR="_projectHeader_2zqh5_757",HR="_projectName_2zqh5_782",qR="_projectMeta_2zqh5_795",GR="_metaRow_2zqh5_803",PR="_metaLabel_2zqh5_816",FR="_metaValue_2zqh5_831",$R="_metaPlaceholder_2zqh5_841",YR="_editButton_2zqh5_846",KR="_editInput_2zqh5_862",ZR="_editTextarea_2zqh5_894",XR="_editSelect_2zqh5_930",QR="_archiveButton_2zqh5_963",JR="_repoLink_2zqh5_993",WR="_metaValueClickable_2zqh5_1003",eM="_editHint_2zqh5_1022",tM="_editError_2zqh5_1031",nM="_editInputInvalid_2zqh5_1038",aM="_unsavedDot_2zqh5_1043",sM="_metaToggle_2zqh5_1051",iM="_metaToggleArrow_2zqh5_1072",lM="_metaToggleArrowOpen_2zqh5_1077",oM="_progressBarContainer_2zqh5_1081",rM="_progressBar_2zqh5_1081",cM="_progressFill_2zqh5_1097",uM="_progressLabel_2zqh5_1104",dM="_metaTimestamps_2zqh5_1111",fM="_metaTimestamp_2zqh5_1111",hM="_editFieldWrapper_2zqh5_1133",D={panelContainer:xk,emptyState:Tk,fadeIn:Ek,projectSummary:Ck,projectSummaryTitle:Ak,projectSummarySubtitle:jk,header:Nk,headerInfo:wk,killButton:Dk,headerTitle:kk,headerActions:Rk,taskStatusBadge:Mk,taskBranch:Ok,taskBlockedBadge:Bk,btnPrimary:Lk,btnDanger:zk,btnGhost:Uk,rejectInput:Vk,tabBar:Ik,tab:Hk,active:qk,eventScroll:Gk,tabContent:Pk,noContext:Fk,overviewContent:$k,overviewDashboard:Yk,overviewHero:Kk,statusBadge:Zk,statusPending:Xk,statusAssigned:Qk,statusInProgress:Jk,statusReview:Wk,statusDone:eR,statusFailed:tR,statusWaitingInput:nR,overviewBranchPill:aR,branchLink:sR,overviewSection:iR,overviewLabel:lR,overviewValue:oR,overviewMuted:rR,overviewMarkdown:cR,envRow:uR,envDot:dR,envDotGreen:fR,envDotYellow:hR,envDotRed:mR,envDotGray:pR,depList:gR,depItem:vR,depBlocked:yR,depDone:bR,timeline:SR,timelineRow:_R,timelineKey:xR,timelineValue:TR,timelineDelta:ER,reviewNotes:CR,overviewDescription:AR,waitingMessage:jR,errorMessage:NR,eventOverflowWarning:wR,attemptSelector:DR,attemptLabel:kR,attemptButton:RR,attemptActive:MR,attemptStatus:OR,emptyCta:BR,ctaTitle:LR,ctaDescription:zR,ctaButton:UR,ctaLink:VR,projectHeader:IR,projectName:HR,projectMeta:qR,metaRow:GR,metaLabel:PR,metaValue:FR,metaPlaceholder:$R,editButton:YR,editInput:KR,editTextarea:ZR,editSelect:XR,archiveButton:QR,repoLink:JR,metaValueClickable:WR,editHint:eM,editError:tM,editInputInvalid:nM,unsavedDot:aM,metaToggle:sM,metaToggleArrow:iM,metaToggleArrowOpen:lM,progressBarContainer:oM,progressBar:rM,progressFill:cM,progressLabel:uM,metaTimestamps:dM,metaTimestamp:fM,editFieldWrapper:hM};function mM(){const{projects:n,createProject:a}=nn();return n.length===0?h.jsxs("div",{className:D.emptyCta,children:[h.jsx("div",{className:D.ctaTitle,children:"Welcome to Grackle"}),h.jsx("div",{className:D.ctaDescription,children:"Organize your work into projects and let agents tackle the tasks."}),h.jsx("button",{className:D.ctaButton,onClick:()=>{const l=window.prompt("Project name:");l!=null&&l.trim()&&a(l.trim())},children:"Create Your First Project"})]}):h.jsx("div",{className:D.emptyState,children:"Select a project or task to get started"})}function pM(n,a){const l=[];let o=n;const r=new Set;for(;o&&a.has(o)&&!r.has(o);){r.add(o);const u=a.get(o);l.unshift(u),o=u.parentTaskId||void 0}return l}const Ys={label:"Home",url:"/"};function gM(n){return n?[Ys,{label:"Settings",url:"/settings"},{label:n,url:void 0}]:[Ys,{label:"Settings",url:void 0}]}function vM(){return[Ys,{label:"New Environment",url:void 0}]}function yM(){return[Ys,{label:"New Chat",url:void 0}]}function bM(n){return[Ys,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function SM(n,a){const l=a.find(o=>o.id===n);return[Ys,{label:(l==null?void 0:l.name)??"Project",url:void 0}]}function _M(n,a,l){const o=pM(n,l),r=l.get(n),u=r==null?void 0:r.projectId,d=u?a.find(g=>g.id===u):void 0,m=[Ys];d&&m.push({label:d.name,url:oo(d.id)});for(let g=0;g<o.length-1;g++)m.push({label:o[g].title,url:ms(o[g].id)});const p=o[o.length-1];return m.push({label:(p==null?void 0:p.title)??n,url:void 0}),m}function xM(){const n=yM();return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:n}),h.jsx("div",{className:D.emptyState,children:"Enter a prompt below to start a new session"})]})}function z1(n){const a=[];for(const l of n){const o=a[a.length-1];l.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?a[a.length-1]={...o,content:o.content+l.content}:a.push(l)}return a}function U1(n){const a=new Map;for(const u of n)if(u.raw)try{a.set(u,JSON.parse(u.raw))}catch{}const l=new Map;for(const u of n){if(u.eventType!=="tool_use")continue;const d=a.get(u);if(!(!d||typeof d.id!="string"))try{const m=JSON.parse(u.content);l.set(d.id,{tool:m.tool,args:m.args})}catch{}}const o=new Set;return n.map(u=>{if(u.eventType!=="tool_result")return u;const d=a.get(u);if(!d||typeof d.tool_use_id!="string")return u;const m=l.get(d.tool_use_id);return m?(o.add(d.tool_use_id),{...u,toolUseCtx:m}):u}).filter(u=>{if(u.eventType!=="tool_use")return!0;const d=a.get(u);return d&&typeof d.id=="string"?!o.has(d.id):!0})}function TM({sessionId:n,session:a,isActive:l,onKill:o}){return h.jsxs("div",{className:D.header,children:[h.jsxs("span",{children:["Session: ",n.slice(0,8),a&&` | ${a.runtime} | ${a.status}`]}),h.jsxs("span",{className:D.headerInfo,children:[a&&h.jsx("span",{children:a.prompt.length>60?a.prompt.slice(0,60)+"...":a.prompt}),l&&h.jsx("button",{onClick:()=>o(n),title:"Stop session",className:D.killButton,children:"×"})]})]})}function EM({eventsDropped:n}){return n<=0?h.jsx(h.Fragment,{}):h.jsxs("div",{className:D.eventOverflowWarning,role:"alert",children:["⚠ ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function CM({sessionEvents:n,session:a,eventsDropped:l,scrollRef:o}){const r=a&&["completed","failed","interrupted"].includes(a.status),u=r?`Session ${a.status} with no events recorded.`:"Waiting for events...";return h.jsxs("div",{ref:o,className:D.eventScroll,children:[n.length===0&&h.jsx("div",{className:r?D.errorMessage:D.waitingMessage,children:u}),h.jsx(EM,{eventsDropped:l}),n.map((d,m)=>h.jsx(w1,{event:d,toolUseCtx:d.toolUseCtx},`${d.sessionId}-${d.timestamp}-${m}`))]})}function AM(){const{sessionId:n}=dc(),{events:a,eventsDropped:l,sessions:o,kill:r,loadSessionEvents:u}=nn(),d=S.useRef(null),m=S.useRef(void 0),p=bM(n),g=o.find(x=>x.id===n)??void 0,v=S.useMemo(()=>{const x=n?a.filter(T=>T.sessionId===n):[];return U1(z1(x))},[a,n]);if(S.useEffect(()=>{n&&n!==m.current&&(m.current=n,u(n))},[n,u]),S.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[v.length]),!n)return h.jsx("div",{className:D.emptyState,children:"No session selected"});const b=(g==null?void 0:g.status)==="running"||(g==null?void 0:g.status)==="idle";return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:p}),h.jsx(TM,{sessionId:n,session:g,isActive:b,onKill:r}),h.jsx(CM,{sessionEvents:v,session:g,eventsDropped:l,scrollRef:d})]})}const d0=220,f0=70,jM=40,NM=60,wM="hierarchy",DM="dependency";function kM(n){return S.useMemo(()=>{if(n.length===0)return{nodes:[],edges:[]};const a=new hv.graphlib.Graph({multigraph:!0});a.setDefaultEdgeLabel(()=>({})),a.setGraph({rankdir:"TB",nodesep:jM,ranksep:NM});const l=new Map(n.map(d=>[d.id,d])),o=new Map;for(const d of n)if(d.parentTaskId&&l.has(d.parentTaskId)){const m=o.get(d.parentTaskId)||[];m.push(d),o.set(d.parentTaskId,m)}for(const d of n)a.setNode(d.id,{width:d0,height:f0});const r=[];for(const d of n){if(d.parentTaskId&&l.has(d.parentTaskId)){const m=`hierarchy-${d.parentTaskId}-${d.id}`;a.setEdge(d.parentTaskId,d.id,{},m),r.push({id:m,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:wM},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const m of d.dependsOn)if(l.has(m)){const p=`dependency-${m}-${d.id}`;a.setEdge(m,d.id,{},p),r.push({id:p,source:m,target:d.id,type:"smoothstep",data:{edgeType:DM},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return hv.layout(a),{nodes:n.map(d=>{const m=a.node(d.id),p=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:m.x-d0/2,y:m.y-f0/2},data:{task:d,childCount:p.length,doneChildCount:p.filter(g=>g.status==="complete").length,hasDependencies:d.dependsOn.length>0}}}),edges:r}},[n])}const RM="_dagContainer_js4w6_1",MM="_taskNode_js4w6_26",OM="_taskNodeBorder_js4w6_54",BM="_taskNodeContent_js4w6_60",LM="_taskNodeHeader_js4w6_70",zM="_taskNodeIcon_js4w6_77",UM="_taskNodeTitle_js4w6_82",VM="_taskNodeBadges_js4w6_90",IM="_childBadge_js4w6_95",HM="_depBadge_js4w6_107",qM="_handle_js4w6_119",GM="_emptyCta_js4w6_126",PM="_ctaDescription_js4w6_137",FM="_ctaButton_js4w6_144",fn={dagContainer:RM,taskNode:MM,taskNodeBorder:OM,taskNodeContent:BM,taskNodeHeader:LM,taskNodeIcon:zM,taskNodeTitle:UM,taskNodeBadges:VM,childBadge:IM,depBadge:HM,handle:qM,emptyCta:GM,ctaDescription:PM,ctaButton:FM};function $M({data:n}){const{task:a,childCount:l,doneChildCount:o,hasDependencies:r}=n,u=vs(a.status);return h.jsxs("div",{className:fn.taskNode,"data-task-id":a.id,"data-task-title":a.title,children:[h.jsx(mv,{type:"target",position:pv.Top,className:fn.handle}),h.jsx("div",{className:fn.taskNodeBorder,style:{backgroundColor:u.color}}),h.jsxs("div",{className:fn.taskNodeContent,children:[h.jsxs("div",{className:fn.taskNodeHeader,children:[h.jsx("span",{className:fn.taskNodeIcon,style:{color:u.color},children:u.icon}),h.jsx("span",{className:fn.taskNodeTitle,children:a.title})]}),h.jsxs("div",{className:fn.taskNodeBadges,children:[l>0&&h.jsxs("span",{className:fn.childBadge,children:[o,"/",l]}),r&&h.jsx("span",{className:fn.depBadge,children:"dep"})]})]}),h.jsx(mv,{type:"source",position:pv.Bottom,className:fn.handle})]})}const YM=Fw,KM={task:$M};function ZM({projectId:n}){const{tasks:a}=nn(),l=na(),{resolvedThemeId:o}=P0(),r=S.useMemo(()=>a.filter(v=>v.projectId===n),[a,n]),{nodes:u,edges:d}=kM(r),m=S.useMemo(()=>{const v=getComputedStyle(document.documentElement),b={};for(const[x,T]of Object.entries(YM))b[x]=v.getPropertyValue(T).trim()||"#6b7a8d";return b},[o]),p=S.useCallback((v,b)=>{l(ms(b.id))},[l]),g=S.useCallback(v=>{const b=v.data;return m[b.task.status]||m.pending},[m]);return r.length===0?h.jsxs("div",{className:fn.emptyCta,children:[h.jsx("button",{className:fn.ctaButton,onClick:()=>l($s(n)),children:"Create Task"}),h.jsx("div",{className:fn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):h.jsx("div",{className:fn.dagContainer,children:h.jsxs(tx,{nodes:u,edges:d,nodeTypes:KM,onNodeClick:p,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[h.jsx(nx,{variant:ax.Dots,gap:24,size:1,color:"var(--text-disabled)"}),h.jsx(sx,{showInteractive:!1}),h.jsx(ix,{nodeColor:g,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function XM({tasks:n,taskStatusById:a,sessionStatusByTaskId:l}){const o=new Map;for(const u of n)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const r=new Map(i0.map(u=>[u,[]]));for(const u of n){const d=Th(u.status),m=u.dependsOn.length>0&&u.dependsOn.some(A=>a.get(A)!=="complete"),p=o.get(u.id)??[],g=p.length,v=p.filter(A=>A.status==="complete").length;let b;if(d==="paused"&&l){const A=l.get(u.id);A==="idle"?b="Needs input":A==="completed"&&(b="Ready to complete")}const x={task:u,isBlocked:m,childCount:g,doneChildCount:v,pausedSubBadge:b},T=r.get(d);T?T.push(x):r.get("not_started").push(x)}for(const u of r.values())u.sort((d,m)=>d.task.sortOrder-m.task.sortOrder);return i0.map(u=>{const d=vs(u);return{status:u,label:d.label,style:d,tasks:r.get(u)??[]}})}const QM="_boardContainer_1c4y1_1",JM="_column_1c4y1_17",WM="_columnHeader_1c4y1_34",e3="_columnIcon_1c4y1_47",t3="_columnLabel_1c4y1_52",n3="_columnCount_1c4y1_57",a3="_cardList_1c4y1_67",s3="_emptyPlaceholder_1c4y1_76",i3="_card_1c4y1_67",l3="_cardHeader_1c4y1_107",o3="_cardStatusIcon_1c4y1_113",r3="_cardTitle_1c4y1_119",c3="_cardBadges_1c4y1_127",u3="_badge_1c4y1_134",d3="_blockedBadge_1c4y1_146",f3="_childBadge_1c4y1_151",h3="_depBadge_1c4y1_155",m3="_parentBadge_1c4y1_159",p3="_pausedSubBadge_1c4y1_166",g3="_personaBadge_1c4y1_170",v3="_envBadge_1c4y1_174",y3="_emptyCta_1c4y1_178",b3="_ctaButton_1c4y1_188",S3="_ctaDescription_1c4y1_204",Je={boardContainer:QM,column:JM,columnHeader:WM,columnIcon:e3,columnLabel:t3,columnCount:n3,cardList:a3,emptyPlaceholder:s3,card:i3,cardHeader:l3,cardStatusIcon:o3,cardTitle:r3,cardBadges:c3,badge:u3,blockedBadge:d3,childBadge:f3,depBadge:h3,parentBadge:m3,pausedSubBadge:p3,personaBadge:g3,envBadge:v3,emptyCta:y3,ctaButton:b3,ctaDescription:S3};function _3({projectId:n}){const{tasks:a,sessions:l,personas:o,environments:r}=nn(),u=na(),d=S.useMemo(()=>a.filter(b=>b.projectId===n),[a,n]),m=S.useMemo(()=>new Map(a.map(b=>[b.id,b.status])),[a]),p=S.useMemo(()=>new Map(d.map(b=>[b.id,b])),[d]),g=S.useMemo(()=>{const b=new Map(l.map(C=>[C.id,C])),x=new Map(o.map(C=>[C.id,C])),T=new Map(r.map(C=>[C.id,C])),A=new Map,j=new Map,N=new Map;for(const C of d)if(C.latestSessionId){const B=b.get(C.latestSessionId);if(B){if(A.set(C.id,B.status),B.personaId){const R=x.get(B.personaId);R&&j.set(C.id,R.name)}if(B.environmentId){const R=T.get(B.environmentId);R&&N.set(C.id,R.displayName)}}}return{sessionStatusByTaskId:A,personaNameByTaskId:j,environmentNameByTaskId:N}},[d,l,o,r]),v=S.useMemo(()=>XM({tasks:d,taskStatusById:m,sessionStatusByTaskId:g.sessionStatusByTaskId}),[d,m,g]);return d.length===0?h.jsxs("div",{className:Je.emptyCta,"data-testid":"board-empty-cta",children:[h.jsx("button",{className:Je.ctaButton,onClick:()=>u($s(n)),children:"Create Task"}),h.jsx("div",{className:Je.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):h.jsx("div",{className:Je.boardContainer,"data-testid":"board-container",children:v.map(b=>h.jsxs("section",{className:Je.column,"data-testid":`board-column-${b.status}`,"aria-label":`${b.label}, ${b.tasks.length} ${b.tasks.length===1?"task":"tasks"}`,children:[h.jsxs("div",{className:Je.columnHeader,children:[h.jsx("span",{className:Je.columnIcon,style:{color:b.style.color},children:b.style.icon}),h.jsx("span",{className:Je.columnLabel,children:b.label}),h.jsx("span",{className:Je.columnCount,"data-testid":`board-count-${b.status}`,children:b.tasks.length})]}),h.jsx("div",{className:Je.cardList,children:b.tasks.length===0?h.jsx("div",{className:Je.emptyPlaceholder,children:"No tasks"}):h.jsx(ys,{mode:"popLayout",children:b.tasks.map(x=>h.jsx($n.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:h.jsx(x3,{boardTask:x,tasksById:p,personaName:g.personaNameByTaskId.get(x.task.id),envName:g.environmentNameByTaskId.get(x.task.id),onClick:()=>u(ms(x.task.id))})},x.task.id))})})]},b.status))})}function x3({boardTask:n,tasksById:a,personaName:l,envName:o,onClick:r}){const{task:u,isBlocked:d,childCount:m,doneChildCount:p,pausedSubBadge:g}=n,v=vs(u.status),b=u.parentTaskId?a.get(u.parentTaskId):void 0;return h.jsxs("div",{className:Je.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:r,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),r())},children:[h.jsxs("div",{className:Je.cardHeader,children:[h.jsx("span",{className:Je.cardStatusIcon,style:{color:v.color},children:v.icon}),h.jsx("span",{className:Je.cardTitle,children:u.title})]}),h.jsxs("div",{className:Je.cardBadges,children:[b&&h.jsx("span",{className:`${Je.badge} ${Je.parentBadge}`,title:b.title,children:b.title}),m>0&&h.jsxs("span",{className:`${Je.badge} ${Je.childBadge}`,children:[p,"/",m]}),d&&h.jsx("span",{className:`${Je.badge} ${Je.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&h.jsx("span",{className:`${Je.badge} ${Je.depBadge}`,children:"dep"}),g&&h.jsx("span",{className:`${Je.badge} ${Je.pausedSubBadge}`,children:g}),l&&h.jsx("span",{className:`${Je.badge} ${Je.personaBadge}`,children:l}),o&&h.jsx("span",{className:`${Je.badge} ${Je.envBadge}`,children:o})]})]})}function T3(n){const a=n.toLowerCase();return a==="ready"||a==="running"||a==="available"||a==="connected"?D.envDotGreen:a==="provisioning"||a==="starting"||a==="pending"||a==="connecting"?D.envDotYellow:a==="error"||a==="failed"||a==="disconnected"?D.envDotRed:D.envDotGray}function h0(n){if(!n)return"";const a=new Date(n);if(isNaN(a.getTime()))return"";const o=Date.now()-a.getTime();if(o<0)return"just now";const r=Math.floor(o/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const u=Math.floor(r/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<30?`${d}d ago`:a.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function E3(){const{projectId:n}=dc(),a=na(),{tasks:l,environments:o,projects:r,archiveProject:u,updateProject:d}=nn(),[m,p]=S.useState("tasks"),[g,v]=S.useState(!1),[b,x]=S.useState(null),[T,A]=S.useState(""),[j,N]=S.useState(""),[C,B]=S.useState(!1),R=S.useRef(void 0),X=S.useRef(null),H=S.useRef(null),J=S.useRef(null),W=S.useRef(null),F=S.useRef(null),ne=S.useRef(null),ge=SM(n,r);S.useEffect(()=>{const Q=R.current;R.current=n,!(Q===void 0||Q===n)&&(b!==null||T!=="")&&(x(null),A(""))},[n,b,T]),S.useEffect(()=>{if(b===null)return;const Q=b==="name"?H.current:b==="description"?J.current:b==="repoUrl"?W.current:b==="worktreeBasePath"?ne.current:F.current;if(!Q)return;const P=window.setTimeout(()=>{Q.focus()},0);return()=>{window.clearTimeout(P)}},[b]);const U=r.find(Q=>Q.id===n),pe=l.filter(Q=>Q.projectId===n),te=pe.filter(Q=>Q.status==="complete").length,ye=pe.length,q=ye>0?Math.round(te/ye*100):0,z=100,Y=(Q,P)=>{X.current=Q,x(Q),A(P),N("")},ee=()=>{X.current=null,x(null),A(""),N("")},ke=(Q,P)=>{if(Q==="name"){const I=P.trim();if(!I)return"Name is required";if(I.length>z)return`Max ${z} characters`}if(Q==="repoUrl"){const I=P.trim();if(I&&!/^https?:\/\/.+/.test(I))return"Must be a valid http(s) URL"}return""},je=Q=>{if(!U)return;const P=T.trim(),I=ke(Q,T);if(I){N(I);return}if(Q==="name"){if(P===U.name){ee();return}d(U.id,{name:P})}else if(Q==="description"){const De=T;if(De===U.description){ee();return}d(U.id,{description:De})}else if(Q==="repoUrl"){if(P===U.repoUrl){ee();return}d(U.id,{repoUrl:P})}else if(Q==="defaultEnvironmentId"){if(T===U.defaultEnvironmentId){ee();return}d(U.id,{defaultEnvironmentId:T})}else{if(P===U.worktreeBasePath){ee();return}d(U.id,{worktreeBasePath:P})}ee()},Pe=(Q,P)=>{Q.key==="Escape"?ee():Q.key==="Enter"&&P!=="description"&&je(P)},we=Q=>U?Q==="name"?T.trim()!==U.name:Q==="description"?T!==U.description:Q==="repoUrl"?T.trim()!==U.repoUrl:Q==="defaultEnvironmentId"?T!==U.defaultEnvironmentId:T.trim()!==U.worktreeBasePath:!1,_e=o.find(Q=>Q.id===(U==null?void 0:U.defaultEnvironmentId)),Ce=b==="description"?"Tab to save · Esc to cancel":"Enter to save · Esc to cancel";return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:ge}),h.jsxs("div",{className:D.projectHeader,children:[h.jsx("span",{className:D.projectName,"data-testid":"project-name",children:b==="name"?h.jsxs("div",{className:D.editFieldWrapper,children:[h.jsx("input",{ref:H,className:`${D.editInput} ${j?D.editInputInvalid:""}`,value:T,onChange:Q=>{A(Q.target.value),N("")},onBlur:Q=>{if(X.current==="name"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="name"||je("name")},onKeyDown:Q=>Pe(Q,"name"),maxLength:z,"aria-label":"Project name","data-testid":"edit-name-input"}),we("name")&&h.jsx("span",{className:D.unsavedDot,title:"Unsaved changes"}),j&&h.jsx("span",{className:D.editError,"data-testid":"edit-error",children:j}),h.jsx("span",{className:D.editHint,children:Ce})]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:()=>Y("name",(U==null?void 0:U.name)||""),title:"Click to edit name","aria-label":`Edit project name: ${(U==null?void 0:U.name)||n}`,"data-testid":"edit-name-button",children:[(U==null?void 0:U.name)||n,h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})}),h.jsx("button",{className:D.archiveButton,onClick:()=>v(!0),title:"Archive project","data-testid":"archive-project-button",children:"Archive"})]}),h.jsxs("button",{className:D.metaToggle,onClick:()=>B(!C),"aria-expanded":!C,"aria-controls":"project-meta-panel","data-testid":"meta-toggle",children:[h.jsx("span",{className:`${D.metaToggleArrow} ${C?"":D.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!C&&h.jsxs("div",{className:D.projectMeta,"data-testid":"project-meta",id:"project-meta-panel",children:[h.jsxs("div",{className:D.metaRow,children:[h.jsx("span",{className:D.metaLabel,children:"Description"}),h.jsx("div",{className:D.metaValue,children:b==="description"?h.jsxs("div",{className:D.editFieldWrapper,children:[h.jsx("textarea",{ref:J,className:D.editTextarea,value:T,onChange:Q=>{A(Q.target.value),N("")},onBlur:Q=>{if(X.current==="description"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="description"||je("description")},onKeyDown:Q=>Pe(Q,"description"),title:"Project description","aria-label":"Project description","data-testid":"edit-description-input"}),we("description")&&h.jsx("span",{className:D.unsavedDot,title:"Unsaved changes"}),h.jsx("span",{className:D.editHint,children:Ce})]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:()=>Y("description",(U==null?void 0:U.description)||""),title:"Click to edit description","aria-label":"Edit project description","data-testid":"edit-description-button",children:[U!=null&&U.description?h.jsx("span",{className:D.overviewMarkdown,children:h.jsx(kf,{remarkPlugins:[Rf],children:U.description})}):h.jsx("span",{className:D.metaPlaceholder,children:"No description"}),h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:D.metaRow,children:[h.jsx("span",{className:D.metaLabel,children:"Repository"}),h.jsx("div",{className:D.metaValue,children:b==="repoUrl"?h.jsxs("div",{className:D.editFieldWrapper,children:[h.jsx("input",{ref:W,className:`${D.editInput} ${j?D.editInputInvalid:""}`,value:T,onChange:Q=>{A(Q.target.value),N("")},onBlur:Q=>{if(X.current==="repoUrl"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="repoUrl"||je("repoUrl")},onKeyDown:Q=>Pe(Q,"repoUrl"),placeholder:"https://github.com/...","aria-label":"Project repository URL","data-testid":"edit-repo-input"}),we("repoUrl")&&h.jsx("span",{className:D.unsavedDot,title:"Unsaved changes"}),j&&h.jsx("span",{className:D.editError,"data-testid":"edit-error",children:j}),h.jsx("span",{className:D.editHint,children:Ce})]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:Q=>{Q.preventDefault(),Y("repoUrl",(U==null?void 0:U.repoUrl)||"")},title:"Click to edit repository URL","aria-label":"Edit project repository URL","data-testid":"edit-repo-button",children:[U!=null&&U.repoUrl&&/^https?:\/\//i.test(U.repoUrl)?h.jsx("a",{className:D.repoLink,href:U.repoUrl,target:"_blank",rel:"noopener noreferrer",onClick:Q=>Q.stopPropagation(),children:U.repoUrl}):U!=null&&U.repoUrl?h.jsx("span",{children:U.repoUrl}):h.jsx("span",{className:D.metaPlaceholder,children:"No repository"}),h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:D.metaRow,children:[h.jsx("span",{className:D.metaLabel,children:"Environment"}),h.jsx("div",{className:D.metaValue,children:b==="defaultEnvironmentId"?h.jsxs("select",{ref:F,className:D.editSelect,value:T,onChange:Q=>{X.current=null,A(Q.target.value);const P=Q.target.value;U&&P!==U.defaultEnvironmentId&&d(U.id,{defaultEnvironmentId:P}),ee()},onBlur:Q=>{if(X.current==="defaultEnvironmentId"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="defaultEnvironmentId"||ee()},title:"Default environment","aria-label":"Project default environment","data-testid":"edit-env-select",children:[h.jsx("option",{value:"",children:"None"}),o.map(Q=>h.jsx("option",{value:Q.id,children:Q.displayName},Q.id))]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:()=>Y("defaultEnvironmentId",(U==null?void 0:U.defaultEnvironmentId)||""),title:"Click to change default environment","aria-label":"Edit project default environment","data-testid":"edit-env-button",children:[_e?h.jsxs("span",{className:D.envRow,children:[h.jsx("span",{className:`${D.envDot} ${T3(_e.status)}`}),_e.displayName]}):h.jsx("span",{className:D.metaPlaceholder,children:(U==null?void 0:U.defaultEnvironmentId)||"No default environment"}),h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:D.metaRow,children:[h.jsx("span",{className:D.metaLabel,children:"Worktree Base"}),h.jsx("div",{className:D.metaValue,children:b==="worktreeBasePath"?h.jsxs("div",{className:D.editFieldWrapper,children:[h.jsx("input",{ref:ne,className:`${D.editInput} ${j?D.editInputInvalid:""}`,value:T,onChange:Q=>{A(Q.target.value),N("")},onBlur:Q=>{if(X.current==="worktreeBasePath"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="worktreeBasePath"||je("worktreeBasePath")},onKeyDown:Q=>Pe(Q,"worktreeBasePath"),placeholder:"/workspaces/my-repo","aria-label":"Worktree base path","data-testid":"edit-worktree-base-path-input"}),we("worktreeBasePath")&&h.jsx("span",{className:D.unsavedDot,title:"Unsaved changes"}),j&&h.jsx("span",{className:D.editError,"data-testid":"edit-error",children:j}),h.jsx("span",{className:D.editHint,children:Ce})]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:()=>Y("worktreeBasePath",(U==null?void 0:U.worktreeBasePath)||""),title:"Click to edit worktree base path","aria-label":"Edit worktree base path","data-testid":"edit-worktree-base-path-button",children:[U!=null&&U.worktreeBasePath?h.jsx("span",{children:U.worktreeBasePath}):h.jsx("span",{className:D.metaPlaceholder,children:"Default (server default)"}),h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),U&&h.jsxs("div",{className:D.metaTimestamps,children:[h.jsxs("span",{className:D.metaTimestamp,children:["Created ",h0(U.createdAt)]}),U.updatedAt&&U.updatedAt!==U.createdAt&&h.jsxs("span",{className:D.metaTimestamp,children:["· Updated ",h0(U.updatedAt)]})]})]}),ye>0&&h.jsxs("div",{className:D.progressBarContainer,"data-testid":"progress-bar",children:[h.jsx("div",{className:D.progressBar,children:h.jsx("div",{className:D.progressFill,style:{width:`${q}%`}})}),h.jsxs("span",{className:D.progressLabel,children:[te,"/",ye]})]}),h.jsxs("div",{className:D.tabBar,role:"tablist","aria-label":"Project view",children:[h.jsx("button",{role:"tab","aria-selected":m==="graph",className:`${D.tab} ${m==="graph"?D.active:""}`,onClick:()=>p("graph"),children:"Graph"}),h.jsx("button",{role:"tab","aria-selected":m==="board",className:`${D.tab} ${m==="board"?D.active:""}`,onClick:()=>p("board"),"data-testid":"board-tab",children:"Board"}),h.jsx("button",{role:"tab","aria-selected":m==="tasks",className:`${D.tab} ${m==="tasks"?D.active:""}`,onClick:()=>p("tasks"),children:"Tasks"})]}),m==="tasks"&&ye>0&&h.jsxs("div",{className:D.projectSummary,children:[h.jsx("span",{className:D.projectSummaryTitle,children:`${te}/${ye} tasks complete`}),h.jsx("span",{className:D.projectSummarySubtitle,children:"Select a task or click + to create one"})]}),m==="tasks"&&ye===0&&h.jsxs("div",{className:D.emptyCta,children:[h.jsx("button",{className:D.ctaButton,onClick:()=>a($s(n)),children:"Create Task"}),h.jsx("div",{className:D.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),m==="board"&&h.jsx(_3,{projectId:n}),m==="graph"&&h.jsx(ZM,{projectId:n}),h.jsx(Sc,{isOpen:g,title:"Archive Project?",description:"This will hide the project from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{U&&(u(U.id),a("/",{replace:!0})),v(!1)},onCancel:()=>v(!1)})]})}const C3="_container_cddyd_1",A3="_header_cddyd_8",j3="_headerTitle_cddyd_35",N3="_badge_cddyd_44",w3="_headerActions_cddyd_54",D3="_body_cddyd_61",k3="_formContent_cddyd_73",R3="_section_cddyd_85",M3="_label_cddyd_91",O3="_titleInput_cddyd_98",B3="_descriptionTextarea_cddyd_131",L3="_parentContext_cddyd_167",z3="_parentLabel_cddyd_175",U3="_parentName_cddyd_182",V3="_depList_cddyd_220",I3="_depItem_cddyd_226",H3="_depItemSelected_cddyd_248",q3="_noDeps_cddyd_252",G3="_btnPrimary_cddyd_258",P3="_btnGhost_cddyd_289",gt={container:C3,header:A3,headerTitle:j3,badge:N3,headerActions:w3,body:D3,formContent:k3,section:R3,label:M3,titleInput:O3,descriptionTextarea:B3,parentContext:L3,parentLabel:z3,parentName:U3,depList:V3,depItem:I3,depItemSelected:H3,noDeps:q3,btnPrimary:G3,btnGhost:P3};function V1({mode:n,taskId:a,projectId:l,parentTaskId:o}){const{tasks:r,createTask:u,updateTask:d}=nn(),{showToast:m}=go(),p=na(),g=n==="edit",v=g&&a?r.find(U=>U.id===a):void 0,b=g?(v==null?void 0:v.projectId)??"":l??"",x=g?(v==null?void 0:v.parentTaskId)??"":o??"",T=x?r.find(U=>U.id===x):void 0,[A,j]=S.useState((v==null?void 0:v.title)??""),[N,C]=S.useState((v==null?void 0:v.description)??""),[B,R]=S.useState((v==null?void 0:v.dependsOn)??[]),X=S.useRef(!1);S.useEffect(()=>{g&&v&&!X.current&&(X.current=!0,j(v.title),C(v.description),R(v.dependsOn))},[g,v]);const H=r.filter(U=>U.projectId===b&&(!g||U.id!==a)&&U.id!==x),J=A.trim().length>0&&(!g||v!==void 0)&&(g||b.length>0),W=U=>{R(pe=>pe.includes(U)?pe.filter(te=>te!==U):[...pe,U])},F=()=>{J&&(g&&v===void 0||(g&&a?(d(a,A.trim(),N,B),m("Task updated","success"),p(ms(a),{replace:!0})):(u(b,A.trim(),N,B.length>0?B:void 0,x||void 0),m("Task created","success"),p(oo(b),{replace:!0}))))},ne=()=>{p(g&&a?ms(a):oo(b))},ge=g?"edit task":x?"child task":"new task";return h.jsxs("div",{className:gt.container,children:[h.jsxs("div",{className:gt.header,children:[h.jsxs("div",{className:gt.headerTitle,children:[h.jsx("span",{className:gt.badge,children:ge}),T&&h.jsxs("span",{className:gt.parentContext,children:[h.jsx("span",{className:gt.parentLabel,children:"Child of"}),h.jsx("span",{className:gt.parentName,children:T.title})]})]}),h.jsxs("div",{className:gt.headerActions,children:[h.jsx("button",{onClick:F,disabled:!J,className:gt.btnPrimary,"data-testid":"task-edit-save",children:g?"Save Changes":"Create"}),h.jsx("button",{onClick:ne,className:gt.btnGhost,children:"Cancel"})]})]}),h.jsx("div",{className:gt.body,children:h.jsxs("div",{className:gt.formContent,children:[h.jsxs("div",{className:gt.section,children:[h.jsx("label",{className:gt.label,htmlFor:"task-edit-title",children:"Title"}),h.jsx("input",{id:"task-edit-title",type:"text",value:A,onChange:U=>j(U.target.value),placeholder:"Task title...",autoFocus:!0,className:gt.titleInput,"data-testid":"task-edit-title",onKeyDown:U=>{U.key==="Enter"&&J&&F()}})]}),h.jsxs("div",{className:gt.section,children:[h.jsx("label",{className:gt.label,htmlFor:"task-edit-description",children:"Description"}),h.jsx("textarea",{id:"task-edit-description",value:N,onChange:U=>C(U.target.value),placeholder:"Describe the task... (markdown supported)",className:gt.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),h.jsxs("div",{className:gt.section,children:[h.jsx("div",{className:gt.label,children:"Dependencies"}),H.length===0?h.jsx("div",{className:gt.noDeps,children:"No other tasks in this project"}):h.jsx("div",{className:gt.depList,children:H.map(U=>{const pe=B.includes(U.id);return h.jsxs("label",{className:`${gt.depItem} ${pe?gt.depItemSelected:""}`,"data-testid":`dep-option-${U.id}`,children:[h.jsx("input",{type:"checkbox",checked:pe,onChange:()=>W(U.id)}),U.title,h.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",U.status,")"]})]},U.id)})})]})]})})]})}function F3(){const[n]=If(),a=n.get("project")??"",l=n.get("parent")??void 0;return a?h.jsx(V1,{mode:"new",projectId:a,parentTaskId:l}):h.jsx(Pr,{to:"/",replace:!0})}function $3(){const{taskId:n}=dc();return h.jsx(V1,{mode:"edit",taskId:n})}const Y3="_container_1pqxm_1",K3="_emptyState_1pqxm_8",Z3="_card_1pqxm_14",X3="_cardHeader_1pqxm_34",Q3="_categoryBadge_1pqxm_46",J3="_findingTitle_1pqxm_54",W3="_findingDate_1pqxm_60",e5="_findingContent_1pqxm_72",t5="_tags_1pqxm_78",n5="_tag_1pqxm_78",ra={container:Y3,emptyState:K3,card:Z3,cardHeader:X3,categoryBadge:Q3,findingTitle:J3,findingDate:W3,findingContent:e5,tags:t5,tag:n5};function a5(n){const a=new Date(n),l=new Date,o=l.getTime()-a.getTime(),r=Math.floor(o/1e3),u=Math.floor(r/60),d=Math.floor(u/60),m=Math.floor(d/24);if(r<60)return"just now";if(u<60)return`${u}m ago`;if(d<24)return`${d}h ago`;if(m===1)return"yesterday";if(m<7)return`${m} days ago`;const p=a.getFullYear()===l.getFullYear(),g=a.toLocaleString("en-US",{month:"short"}),v=a.getDate();return p?`${g} ${v}`:`${g} ${v} ${a.getFullYear()}`}const m0={architecture:{text:"var(--accent-blue)",bg:"var(--accent-blue-dim)"},api:{text:"var(--accent-green)",bg:"var(--accent-green-dim)"},bug:{text:"var(--accent-red)",bg:"var(--accent-red-dim)"},decision:{text:"var(--accent-yellow)",bg:"var(--accent-yellow-dim)"},dependency:{text:"var(--accent-purple)",bg:"var(--accent-purple-dim)"},pattern:{text:"var(--accent-cyan)",bg:"var(--accent-cyan-dim)"},general:{text:"var(--text-secondary)",bg:"var(--bg-elevated)"}};function s5({projectId:n}){const{findings:a}=nn(),l=a.filter(o=>o.projectId===n);return l.length===0?h.jsx("div",{className:ra.emptyState,children:"No findings yet. Agents will post discoveries here."}):h.jsx("div",{className:ra.container,children:l.map((o,r)=>{const u=m0[o.category]||m0.general;return h.jsxs($n.div,{className:ra.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},children:[h.jsxs("div",{className:ra.cardHeader,children:[h.jsx("span",{className:ra.categoryBadge,style:{background:u.bg,color:u.text},children:o.category}),h.jsx("span",{className:ra.findingTitle,children:o.title}),h.jsx("span",{className:ra.findingDate,title:o.createdAt,children:a5(o.createdAt)})]}),h.jsx("div",{className:ra.findingContent,children:o.content.length>300?o.content.slice(0,300)+"...":o.content}),o.tags.length>0&&h.jsx("div",{className:ra.tags,children:o.tags.map(d=>h.jsx("span",{className:ra.tag,style:{color:u.text,textShadow:`0 0 8px ${u.text}`},children:d},d))})]},o.id)})})}function qr(n){if(!n)return"—";const a=new Date(n);return isNaN(a.getTime())?"—":a.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Qd(n,a){if(!n||!a)return;const l=new Date(a).getTime()-new Date(n).getTime();if(isNaN(l)||l<0)return;const o=Math.floor(l/6e4),r=Math.floor(l%6e4/1e3);if(o===0)return`${r}s`;const u=Math.floor(o/60),d=o%60;return u===0?`${o}m ${r}s`:`${u}h ${d}m`}function i5(n){const a=n.toLowerCase();return a==="ready"||a==="running"||a==="available"||a==="connected"?D.envDotGreen:a==="provisioning"||a==="starting"||a==="pending"||a==="connecting"?D.envDotYellow:a==="error"||a==="failed"||a==="disconnected"?D.envDotRed:D.envDotGray}function l5({status:n}){const a=vs(n),l=qw(n);return h.jsx("span",{className:`${D.statusBadge} ${D[l]??D.statusPending}`,children:a.label})}function o5({task:n,tasksById:a,environments:l,projects:o,taskSessions:r}){const u=r.length>0?r[r.length-1]:void 0,d=(u==null?void 0:u.environmentId)??"",m=d?l.find(v=>v.id===d):void 0,p=o.find(v=>v.id===n.projectId),g=n.branch&&(p!=null&&p.repoUrl)?`${p.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(n.branch)}`:void 0;return h.jsxs("div",{className:D.overviewDashboard,children:[h.jsxs("div",{className:D.overviewHero,children:[h.jsx(l5,{status:n.status}),n.branch&&h.jsx("span",{className:D.overviewBranchPill,children:g?h.jsxs("a",{href:g,target:"_blank",rel:"noreferrer noopener",className:D.branchLink,children:["🔗"," ",n.branch]}):h.jsxs("span",{children:["🔗"," ",n.branch]})})]}),typeof n.description=="string"&&n.description&&h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Description"}),h.jsx("div",{className:D.overviewMarkdown,children:h.jsx(kf,{remarkPlugins:[Rf],children:n.description})})]}),d&&h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Environment"}),h.jsxs("div",{className:D.envRow,children:[m&&h.jsx("span",{className:`${D.envDot} ${i5(m.status)}`,title:m.status,"aria-label":`Status: ${m.status}`,role:"img"}),h.jsx("span",{className:D.overviewValue,children:(m==null?void 0:m.displayName)??d})]})]}),h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Dependencies"}),n.dependsOn.length===0?h.jsx("div",{className:D.overviewMuted,children:"None"}):h.jsx("div",{className:D.depList,children:n.dependsOn.map(v=>{const b=a.get(v),x=(b==null?void 0:b.status)==="complete";return h.jsxs("div",{className:`${D.depItem} ${x?D.depDone:D.depBlocked}`,children:[h.jsx("span",{children:x?"✓":"○"}),h.jsx("span",{children:(b==null?void 0:b.title)??v})]},v)})})]}),h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Timeline"}),h.jsxs("div",{className:D.timeline,children:[n.createdAt&&h.jsxs("div",{className:D.timelineRow,children:[h.jsx("span",{className:D.timelineKey,children:"Created"}),h.jsx("span",{className:D.timelineValue,children:qr(n.createdAt)})]}),n.assignedAt&&(()=>{const v=Qd(n.createdAt,n.assignedAt);return h.jsxs("div",{className:D.timelineRow,children:[h.jsx("span",{className:D.timelineKey,children:"Assigned"}),h.jsx("span",{className:D.timelineValue,children:qr(n.assignedAt)}),v!==void 0&&h.jsx("span",{className:D.timelineDelta,children:v})]})})(),n.startedAt&&(()=>{const v=Qd(n.assignedAt??n.createdAt,n.startedAt);return h.jsxs("div",{className:D.timelineRow,children:[h.jsx("span",{className:D.timelineKey,children:"Started"}),h.jsx("span",{className:D.timelineValue,children:qr(n.startedAt)}),v!==void 0&&h.jsx("span",{className:D.timelineDelta,children:v})]})})(),n.completedAt&&(()=>{const v=Qd(n.startedAt,n.completedAt);return h.jsxs("div",{className:D.timelineRow,children:[h.jsx("span",{className:D.timelineKey,children:"Completed"}),h.jsx("span",{className:D.timelineValue,children:qr(n.completedAt)}),v!==void 0&&h.jsx("span",{className:D.timelineDelta,children:v})]})})(),!n.createdAt&&!n.assignedAt&&!n.startedAt&&!n.completedAt&&h.jsx("div",{className:D.overviewMuted,children:"No timing data"})]})]}),n.reviewNotes&&h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Review Notes"}),h.jsx("div",{className:D.reviewNotes,children:n.reviewNotes})]})]})}function r5({eventsDropped:n}){return n<=0?h.jsx(h.Fragment,{}):h.jsxs("div",{className:D.eventOverflowWarning,role:"alert",children:["⚠ ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown."]})}function c5({task:n,sessionId:a,isBlocked:l,onStart:o,onResume:r,onStop:u,onComplete:d,onDelete:m,onEdit:p}){if(n.status==="not_started")return l?h.jsxs("div",{className:D.headerActions,children:[h.jsx("button",{onClick:p,className:D.btnGhost,children:"Edit"}),h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})]}):h.jsxs("div",{className:D.headerActions,children:[h.jsx("button",{onClick:o,className:D.btnPrimary,children:"Start"}),h.jsx("button",{onClick:p,className:D.btnGhost,children:"Edit"}),h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})]});if(n.status==="working")return h.jsx("div",{className:D.headerActions,children:h.jsx("button",{onClick:u,disabled:!a,className:D.btnDanger,children:"Stop"})});if(n.status==="paused")return h.jsxs("div",{className:D.headerActions,children:[h.jsx("button",{onClick:d,className:D.btnPrimary,children:"Complete"}),h.jsx("button",{onClick:r,className:D.btnGhost,children:"Resume"}),h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})]});if(n.status==="complete")return h.jsx("div",{className:D.headerActions,children:h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})});if(n.status==="failed")return h.jsxs("div",{className:D.headerActions,children:[h.jsx("button",{onClick:o,className:D.btnPrimary,children:"Retry"}),h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})]})}function u5({taskSessions:n,selectedSessionId:a,onSelect:l}){if(!(n.length<2))return h.jsxs("div",{className:D.attemptSelector,"data-testid":"attempt-selector",children:[h.jsx("span",{className:D.attemptLabel,children:"Attempts:"}),n.map((o,r)=>{const u=o.id===a,d=o.status==="completed"?"✓":o.status==="failed"?"✗":o.status==="running"||o.status==="idle"?"●":"";return h.jsxs("button",{className:`${D.attemptButton} ${u?D.attemptActive:""}`,onClick:()=>l(o.id),title:`Attempt #${r+1} — ${o.status}`,"aria-label":`Attempt #${r+1}, ${o.status}`,"aria-pressed":u,"data-testid":`attempt-${r+1}`,children:["#",r+1,d&&h.jsx("span",{className:D.attemptStatus,children:d})]},o.id)})]})}function Jd(){const{taskId:n}=dc(),a=hn(),l=na(),{events:o,eventsDropped:r,tasks:u,environments:d,loadSessionEvents:m,loadFindings:p,kill:g,startTask:v,resumeTask:b,completeTask:x,deleteTask:T,projects:A,taskSessions:j,loadTaskSessions:N}=nn(),C=S.useRef(null),B=S.useRef(void 0),R=S.useRef(void 0),X=S.useRef(void 0),H=S.useRef(void 0),J=S.useRef(void 0),W=a.pathname.endsWith("/stream")?"stream":a.pathname.endsWith("/findings")?"findings":"overview",[F,ne]=S.useState(W),[ge,U]=S.useState(!1),[pe,te]=S.useState(void 0),ye=S.useRef(W);W!==ye.current&&(ye.current=W,W!==F&&ne(W));const q=u.find(P=>P.id===n),z=(q==null?void 0:q.projectId)||void 0,Y=q?j[q.id]??[]:[];let ee;pe&&Y.some(P=>P.id===pe)?ee=pe:ee=(q==null?void 0:q.latestSessionId)||void 0;const ke=()=>{U(!0)},je=()=>{q&&(T(q.id),U(!1),l(oo(q.projectId),{replace:!0}))};if((q==null?void 0:q.id)!==R.current&&(R.current=q==null?void 0:q.id,pe!==void 0&&te(void 0)),S.useEffect(()=>{if(!(q!=null&&q.id))return;const P=q.id!==H.current,I=q.latestSessionId!==J.current;(P||I)&&(H.current=q.id,J.current=q.latestSessionId,N(q.id))},[q==null?void 0:q.id,q==null?void 0:q.latestSessionId,N]),(q==null?void 0:q.status)!==X.current){X.current=q==null?void 0:q.status;const P=(q==null?void 0:q.status)==="not_started"?"overview":(q==null?void 0:q.status)==="working"||(q==null?void 0:q.status)==="paused"?"stream":(q==null?void 0:q.status)==="complete"?"findings":void 0;P&&P!==F&&ne(P)}const Pe=S.useMemo(()=>new Map(u.map(P=>[P.id,P])),[u]),we=S.useMemo(()=>{const P=ee?o.filter(I=>I.sessionId===ee):[];return U1(z1(P))},[o,ee]),_e=q?q.dependsOn.some(P=>{const I=Pe.get(P);return I!==void 0&&I.status!=="complete"}):!1,Ce=S.useMemo(()=>_M(n,A,Pe),[n,A,Pe]);S.useEffect(()=>{ee&&ee!==B.current&&(B.current=ee,m(ee))},[ee,m]),S.useEffect(()=>{F==="findings"&&z&&p(z)},[F,z,p]),S.useEffect(()=>{C.current&&F==="stream"&&(C.current.scrollTop=C.current.scrollHeight)},[we.length,F]);const Q=P=>{ne(P),l(ms(n,P==="overview"?void 0:P))};return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:Ce}),h.jsxs("div",{className:D.header,children:[h.jsxs("span",{className:D.headerTitle,children:[h.jsx("span",{"data-testid":"task-title",children:(q==null?void 0:q.title)||n}),q&&h.jsx("span",{className:D.taskStatusBadge,"data-testid":"task-status",children:q.status}),(q==null?void 0:q.branch)&&h.jsx("span",{className:D.taskBranch,children:q.branch}),_e&&h.jsx("span",{className:D.taskBlockedBadge,children:"blocked"})]}),q&&h.jsx(c5,{task:q,sessionId:ee,isBlocked:_e,onStart:()=>v(q.id),onResume:()=>b(q.id),onStop:()=>ee&&g(ee),onComplete:()=>x(q.id),onDelete:ke,onEdit:()=>l(GT(q.id))})]}),h.jsxs("div",{className:D.tabBar,role:"tablist","aria-label":"Task view",children:[h.jsx("button",{role:"tab","aria-selected":F==="overview",className:`${D.tab} ${F==="overview"?D.active:""}`,onClick:()=>Q("overview"),children:"Overview"}),h.jsx("button",{role:"tab","aria-selected":F==="stream",className:`${D.tab} ${F==="stream"?D.active:""}`,onClick:()=>Q("stream"),children:"Stream"}),h.jsx("button",{role:"tab","aria-selected":F==="findings",className:`${D.tab} ${F==="findings"?D.active:""}`,onClick:()=>Q("findings"),children:"Findings"})]}),h.jsxs(ys,{mode:"wait",children:[F==="overview"&&h.jsx($n.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:D.overviewContent,children:q?h.jsx(o5,{task:q,tasksById:Pe,environments:d,projects:A,taskSessions:Y}):h.jsx("div",{className:D.waitingMessage,children:"No additional details"})},"overview"),F==="stream"&&h.jsxs($n.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[h.jsx(u5,{taskSessions:Y,selectedSessionId:ee,onSelect:P=>te(P)}),h.jsxs("div",{ref:C,className:D.eventScroll,children:[!ee&&q&&h.jsxs("div",{className:D.emptyCta,children:[h.jsx("button",{className:D.ctaButton,onClick:()=>v(q.id),children:"Start Task"}),h.jsx("div",{className:D.ctaDescription,children:"Click to begin agent execution"})]}),ee&&we.length===0&&h.jsx("div",{className:D.waitingMessage,children:"Waiting for events..."}),h.jsx(r5,{eventsDropped:r}),we.map((P,I)=>h.jsx(w1,{event:P,toolUseCtx:P.toolUseCtx},`${P.sessionId}-${P.timestamp}-${I}`))]})]},"stream"),F==="findings"&&h.jsx($n.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:D.tabContent,children:z?h.jsx(s5,{projectId:z}):h.jsx("div",{className:D.noContext,children:"Navigate to a task within a project to view findings"})},"findings")]}),q&&h.jsx(Sc,{isOpen:ge,title:"Delete Task?",description:`"${q.title}" will be permanently removed.`,onConfirm:je,onCancel:()=>U(!1)})]})}function d5(){const n=vM();return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:n}),h.jsx("div",{className:D.emptyState,children:"Configure the new environment below"})]})}const f5="_layout_1sbe4_1",h5="_content_1sbe4_8",p0={layout:f5,content:h5},m5={environments:"Environments",credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About"};function p5(){const a=hn().pathname.replace(/^\/settings\/?/,"").split("/")[0],l=m5[a],o=gM(l);return h.jsxs("div",{className:p0.layout,children:[h.jsx(Qi,{segments:o}),h.jsx("div",{className:p0.content,children:h.jsx(k0,{})})]})}const g5="_nav_13n0b_1",v5="_tab_13n0b_44",y5="_tabIcon_13n0b_82",b5="_tabActive_13n0b_88",Gr={nav:g5,tab:v5,tabIcon:y5,tabActive:b5},Oa=[{path:"environments",label:"Environments",icon:"🖥️"},{path:"credentials",label:"Credentials",icon:"🔑"},{path:"personas",label:"Personas",icon:"👤"},{path:"appearance",label:"Appearance",icon:"🎨"},{path:"about",label:"About",icon:"ℹ️"}];function S5(){var d;const n=hn(),a=na(),l=S.useRef(null),o=((d=Oa.find(m=>n.pathname===`${qi}/${m.path}`))==null?void 0:d.path)??Oa[0].path,r=S.useCallback(m=>{a(`${qi}/${m}`)},[a]),u=S.useCallback(m=>{var T,A;const p=(T=l.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!p)return;const g=Array.from(p).findIndex(j=>j===document.activeElement),v=g>=0?g:Oa.findIndex(j=>j.path===o);let b=v;if(m.key==="ArrowDown")m.preventDefault(),b=(v+1)%Oa.length;else if(m.key==="ArrowUp")m.preventDefault(),b=(v-1+Oa.length)%Oa.length;else if(m.key==="Home")m.preventDefault(),b=0;else if(m.key==="End")m.preventDefault(),b=Oa.length-1;else return;const x=Oa[b].path;a(`${qi}/${x}`),(A=p[b])==null||A.focus()},[o,a]);return h.jsx("nav",{className:Gr.nav,ref:l,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:Oa.map(m=>{const p=m.path===o;return h.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Gr.tab} ${p?Gr.tabActive:""}`,onClick:()=>r(m.path),children:[h.jsx("span",{className:Gr.tabIcon,"aria-hidden":"true",children:m.icon}),m.label]},m.path)})})}const _5="_container_1nk8c_1",x5="_header_1nk8c_5",T5="_headerLabel_1nk8c_12",E5="_addButton_1nk8c_20",C5="_envRow_1nk8c_55",A5="_targeted_1nk8c_69",j5="_expanded_1nk8c_72",N5="_statusDot_1nk8c_76",w5="_pulse_1nk8c_79",D5="_envName_1nk8c_83",k5="_envActions_1nk8c_87",R5="_idleLabel_1nk8c_94",M5="_newChatButton_1nk8c_99",O5="_envActionsRow_1nk8c_126",B5="_connectButton_1nk8c_134",L5="_stopButton_1nk8c_160",z5="_deleteButton_1nk8c_186",U5="_provisionMessage_1nk8c_213",V5="_errorMessage_1nk8c_220",I5="_sessionRow_1nk8c_227",H5="_selected_1nk8c_243",q5="_sessionDot_1nk8c_248",G5="_sessionSummaryRow_1nk8c_252",P5="_sessionExpandArrow_1nk8c_272",F5="_sessionSummaryText_1nk8c_283",$5="_sessionCountBadge_1nk8c_290",Y5="_emptyCta_1nk8c_313",K5="_ctaDescription_1nk8c_326",Z5="_ctaButton_1nk8c_332",Qe={container:_5,header:x5,headerLabel:T5,addButton:E5,envRow:C5,targeted:A5,expanded:j5,statusDot:N5,pulse:w5,envName:D5,envActions:k5,idleLabel:R5,newChatButton:M5,envActionsRow:O5,connectButton:B5,stopButton:L5,deleteButton:z5,provisionMessage:U5,errorMessage:V5,sessionRow:I5,selected:H5,sessionDot:q5,sessionSummaryRow:G5,sessionExpandArrow:P5,sessionSummaryText:F5,sessionCountBadge:$5,emptyCta:Y5,ctaDescription:K5,ctaButton:Z5},X5={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"},Q5={running:"running",idle:"awaiting input",failed:"failed",interrupted:"interrupted",completed:"completed"},g0=["running","idle","failed","interrupted","completed"],J5=.2;function W5(n){const a={};for(const u of n)a[u.status]=(a[u.status]||0)+1;const l=g0.filter(u=>a[u]>0).map(u=>`${a[u]} ${Q5[u]||u}`),o=new Set(g0),r=Object.keys(a).filter(u=>!o.has(u)).sort().map(u=>`${a[u]} ${u}`);return[...l,...r].join(", ")}function eO({status:n}){const a=n==="running"?"var(--accent-green)":n==="idle"?"var(--accent-yellow)":n==="completed"?"var(--text-secondary)":n==="failed"||n==="interrupted"?"var(--accent-red)":"var(--text-tertiary)";return h.jsx("span",{className:Qe.sessionDot,style:{color:a},children:"●"})}function tO({env:n,envSessions:a,selectedSessionId:l,isNewChatTarget:o,expanded:r,onToggleExpand:u,sessionsExpanded:d,onToggleSessionsExpand:m,provisionProgress:p,onProvision:g,onStop:v,onRemove:b,navigate:x}){const[T,A]=S.useState(!1),j=X5[n.status]||"var(--text-tertiary)",N=n.status==="connected",C=n.status==="connecting",B=n.status==="disconnected"||n.status==="error";return h.jsxs("div",{children:[h.jsx(Sc,{isOpen:T,title:"Delete Environment?",description:`"${n.displayName||n.id}" will be permanently removed. This destroys the workspace and removes all data.`,onConfirm:()=>{b(n.id),A(!1)},onCancel:()=>A(!1)}),h.jsxs("div",{className:`${Qe.envRow} ${o?Qe.targeted:""} ${r?Qe.expanded:""}`,"data-testid":"env-row",onClick:u,children:[h.jsx("span",{className:`${Qe.statusDot} ${N?Qe.pulse:""}`,style:{color:j},children:"●"}),h.jsx("span",{className:Qe.envName,title:n.displayName||n.id,children:n.displayName||n.id}),h.jsxs("span",{className:Qe.envActions,children:[a.length===0&&!o&&!r&&h.jsx("span",{className:Qe.idleLabel,children:"(idle)"}),N&&h.jsx("button",{onClick:R=>{R.stopPropagation(),x(z0(n.id,n.defaultRuntime||"claude-code"))},title:"New chat",className:Qe.newChatButton,children:"+"})]})]}),r&&h.jsxs("div",{className:Qe.envActionsRow,children:[C&&p&&h.jsx("span",{className:Qe.provisionMessage,children:p.message}),n.status==="error"&&(p==null?void 0:p.stage)==="error"&&h.jsx("span",{className:Qe.errorMessage,children:p.message}),B&&h.jsx("button",{onClick:R=>{R.stopPropagation(),g(n.id)},className:Qe.connectButton,children:n.status==="error"?"Retry":"Connect"}),N&&h.jsx("button",{onClick:R=>{R.stopPropagation(),v(n.id)},className:Qe.stopButton,children:"Stop"}),!C&&h.jsx("button",{onClick:R=>{R.stopPropagation(),A(!0)},className:Qe.deleteButton,children:"Delete"})]}),a.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:Qe.sessionSummaryRow,"data-testid":"session-summary-row",role:"button",tabIndex:0,"aria-expanded":d,"aria-label":d?"Collapse sessions":"Expand sessions",onClick:m,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),m())},children:[h.jsx("span",{className:`${Qe.sessionExpandArrow} ${d?Qe.expanded:""}`,children:"▸"}),h.jsx("span",{className:Qe.sessionSummaryText,children:W5(a)}),h.jsx("span",{className:Qe.sessionCountBadge,children:a.length})]}),h.jsx(ys,{children:d&&h.jsx($n.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:J5,ease:"easeInOut"},style:{overflow:"hidden"},children:a.map(R=>h.jsxs("div",{onClick:X=>{X.stopPropagation(),x(L0(R.id))},className:`${Qe.sessionRow} ${l===R.id?Qe.selected:""}`,title:R.prompt,"data-testid":"session-row",children:[h.jsx(eO,{status:R.status})," ",R.prompt.length>24?R.prompt.slice(0,24)+"...":R.prompt]},R.id))})})]})]})}function nO(){const{environments:n,sessions:a,provisionStatus:l,provisionEnvironment:o,stopEnvironment:r,removeEnvironment:u}=nn(),d=na(),[m,p]=S.useState(null),[g,v]=S.useState(new Set),b=dn("/sessions/:sessionId"),x=dn("/sessions/new"),T=(b==null?void 0:b.params.sessionId)!=="new"?b==null?void 0:b.params.sessionId:void 0,[A]=If(),j=x?A.get("env")??void 0:void 0;return h.jsxs("div",{className:Qe.container,children:[h.jsxs("div",{className:Qe.header,children:[h.jsx("span",{className:Qe.headerLabel,children:"Environments"}),h.jsx("button",{className:Qe.addButton,onClick:()=>d(jv),title:"Add environment",children:"+ Add Environment"})]}),n.length===0&&h.jsxs("div",{className:Qe.emptyCta,children:[h.jsx("button",{className:Qe.ctaButton,onClick:()=>d(jv),children:"Add Environment"}),h.jsx("div",{className:Qe.ctaDescription,children:"Connect an environment to run agents"})]}),n.map(N=>{const C=a.filter(B=>B.environmentId===N.id);return h.jsx(tO,{env:N,envSessions:C,selectedSessionId:T,isNewChatTarget:j===N.id,expanded:m===N.id,onToggleExpand:()=>p(m===N.id?null:N.id),sessionsExpanded:g.has(N.id),onToggleSessionsExpand:()=>{v(B=>{const R=new Set(B);return R.has(N.id)?R.delete(N.id):R.add(N.id),R})},provisionProgress:l[N.id],onProvision:o,onStop:r,onRemove:u,navigate:d},N.id)})]})}function aO(){return h.jsx(nO,{})}const sO="_section_1ingb_14",iO="_sectionTitle_1ingb_26",lO="_sectionDescription_1ingb_35",oO="_tokenList_1ingb_48",rO="_tokenRow_1ingb_55",cO="_tokenBadge_1ingb_68",uO="_tokenName_1ingb_83",dO="_tokenTarget_1ingb_90",fO="_deleteButton_1ingb_99",hO="_addForm_1ingb_113",mO="_formRow_1ingb_119",pO="_input_1ingb_125",gO="_select_1ingb_155",vO="_addButton_1ingb_187",yO="_emptyStateInfo_1ingb_221",bO="_themeOptions_1ingb_229",SO="_themeOption_1ingb_229",_O="_themeOptionSelected_1ingb_254",xO="_themeOptionHeader_1ingb_259",TO="_themeOptionLabel_1ingb_266",EO="_themeOptionDesc_1ingb_273",CO="_variantToggle_1ingb_279",AO="_variantButton_1ingb_286",jO="_variantActive_1ingb_305",NO="_themeSwatches_1ingb_311",wO="_themeSwatch_1ingb_311",DO="_systemToggle_1ingb_325",kO="_systemToggleHint_1ingb_341",RO="_themeActive_1ingb_348",MO="_aboutGrid_1ingb_354",OO="_aboutItem_1ingb_360",BO="_aboutLabel_1ingb_373",LO="_aboutValue_1ingb_379",zO="_aboutDot_1ingb_387",UO="_aboutDotConnected_1ingb_394",VO="_aboutDotDisconnected_1ingb_398",he={section:sO,sectionTitle:iO,sectionDescription:lO,tokenList:oO,tokenRow:rO,tokenBadge:cO,tokenName:uO,tokenTarget:dO,deleteButton:fO,addForm:hO,formRow:mO,input:pO,select:gO,addButton:vO,emptyStateInfo:yO,themeOptions:bO,themeOption:SO,themeOptionSelected:_O,themeOptionHeader:xO,themeOptionLabel:TO,themeOptionDesc:EO,variantToggle:CO,variantButton:AO,variantActive:jO,themeSwatches:NO,themeSwatch:wO,systemToggle:DO,systemToggleHint:kO,themeActive:RO,aboutGrid:MO,aboutItem:OO,aboutLabel:BO,aboutValue:LO,aboutDot:zO,aboutDotConnected:UO,aboutDotDisconnected:VO},IO=[{key:"claude",label:"Claude",description:"Forward Claude credentials for AI agent access.",options:[{value:"off",label:"Off"},{value:"subscription",label:"Subscription"},{value:"api_key",label:"API Key"}]},{key:"github",label:"GitHub",description:"Forward GITHUB_TOKEN and GH_TOKEN for git operations.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"copilot",label:"Copilot",description:"Forward Copilot tokens (COPILOT_GITHUB_TOKEN, CLI config).",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"codex",label:"Codex",description:"Forward OPENAI_API_KEY for Codex/OpenAI access.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]}];function HO(){const{credentialProviders:n,updateCredentialProviders:a}=nn(),l=(o,r)=>{const u={...n};o==="claude"?u.claude=r:u[o]=r,a(u)};return h.jsxs("section",{className:he.section,children:[h.jsx("h3",{className:he.sectionTitle,children:"Credential Providers"}),h.jsx("p",{className:he.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),h.jsx("div",{className:he.tokenList,children:IO.map(o=>h.jsxs("div",{className:he.tokenRow,children:[h.jsx("span",{className:he.tokenName,children:o.label}),h.jsx("span",{className:he.tokenTarget,children:o.description}),h.jsx("select",{className:he.select,value:n[o.key],onChange:r=>l(o.key,r.target.value),children:o.options.map(r=>h.jsx("option",{value:r.value,children:r.label},r.value))})]},o.key))})]})}const qO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function GO(){const{tokens:n,setToken:a,deleteToken:l}=nn(),{showToast:o}=go(),[r,u]=S.useState(""),[d,m]=S.useState(""),[p,g]=S.useState("env_var"),[v,b]=S.useState(""),[x,T]=S.useState(null),A=C=>{if(C.preventDefault(),!r||!d)return;const B=p==="env_var"?v||r.toUpperCase()+"_TOKEN":"";a(r,d,p,B,p==="file"?v:""),o("Token saved successfully","success"),u(""),m(""),b("")},j=C=>{T(C)},N=()=>{x&&(l(x),o("Token deleted","info")),T(null)};return h.jsxs(h.Fragment,{children:[h.jsx(Sc,{isOpen:x!==null,title:"Delete Token?",description:x?`"${x}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>T(null)}),h.jsxs("section",{className:he.section,children:[h.jsx("h3",{className:he.sectionTitle,children:"Tokens"}),h.jsx("p",{className:he.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),n.length===0?h.jsx("div",{className:he.emptyStateInfo,children:"Add your first API token to enable service integrations."}):h.jsx("div",{className:he.tokenList,children:n.map(C=>h.jsxs("div",{className:he.tokenRow,children:[h.jsx("span",{className:he.tokenBadge,children:C.tokenType}),h.jsx("span",{className:he.tokenName,children:C.name}),h.jsx("span",{className:he.tokenTarget,children:C.tokenType==="env_var"?C.envVar:C.filePath}),h.jsx("button",{className:he.deleteButton,onClick:()=>j(C.name),title:`Delete ${C.name}`,children:"×"})]},C.name))}),h.jsxs("form",{className:he.addForm,onSubmit:A,children:[h.jsxs("div",{className:he.formRow,children:[h.jsx("input",{className:he.input,type:"text",placeholder:"Token name",value:r,onChange:C=>u(C.target.value)}),h.jsx("input",{className:he.input,type:"password",placeholder:"Value",value:d,onChange:C=>m(C.target.value)})]}),h.jsxs("div",{className:he.formRow,children:[h.jsx("select",{className:he.select,value:p,onChange:C=>g(C.target.value),children:qO.map(C=>h.jsx("option",{value:C.value,children:C.label},C.value))}),h.jsx("input",{className:he.input,type:"text",placeholder:p==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:C=>b(C.target.value)}),h.jsx("button",{className:he.addButton,type:"submit",children:"Add Token"})]})]})]})]})}function PO(){return h.jsxs(h.Fragment,{children:[h.jsx(HO,{}),h.jsx(GO,{})]})}const FO="_container_1xcp7_1",$O="_header_1xcp7_7",YO="_form_1xcp7_19",KO="_formActions_1xcp7_87",ZO="_list_1xcp7_93",XO="_card_1xcp7_99",QO="_active_1xcp7_109",JO="_cardHeader_1xcp7_113",WO="_cardActions_1xcp7_123",eB="_description_1xcp7_128",tB="_meta_1xcp7_134",nB="_promptDetails_1xcp7_151",aB="_promptText_1xcp7_163",sB="_empty_1xcp7_180",iB="_btnPrimary_1xcp7_186",lB="_btnSecondary_1xcp7_220",oB="_btnSmall_1xcp7_247",rB="_btnDanger_1xcp7_273",Mt={container:FO,header:$O,form:YO,formActions:KO,list:ZO,card:XO,active:QO,cardHeader:JO,cardActions:WO,description:eB,meta:tB,promptDetails:nB,promptText:aB,empty:sB,btnPrimary:iB,btnSecondary:lB,btnSmall:oB,btnDanger:rB};function cB(){const{personas:n,createPersona:a,updatePersona:l,deletePersona:o}=nn(),[r,u]=S.useState(null),[d,m]=S.useState(!1),[p,g]=S.useState(null),[v,b]=S.useState(""),[x,T]=S.useState(""),[A,j]=S.useState(""),[N,C]=S.useState(""),[B,R]=S.useState(""),[X,H]=S.useState(0),J=()=>{b(""),T(""),j(""),C(""),R(""),H(0)},W=()=>{J(),u(null),m(!0)},F=te=>{b(te.name),T(te.description),j(te.systemPrompt),C(te.runtime),R(te.model),H(te.maxTurns),u(te),m(!1)},ne=te=>{te.preventDefault(),!(!v.trim()||!A.trim())&&(r?(l(r.id,v,x,A,N,B,X),u(null)):(a(v,x,A,N,B,X),m(!1)),J())},ge=te=>{o(te),g(null),(r==null?void 0:r.id)===te&&(u(null),J())},U=()=>{u(null),m(!1),J()},pe=()=>h.jsxs("form",{onSubmit:ne,className:Mt.form,children:[h.jsx("h3",{children:r?"Edit Persona":"Create Persona"}),h.jsxs("label",{children:["Name",h.jsx("input",{type:"text",value:v,onChange:te=>b(te.target.value),placeholder:"e.g. Frontend Engineer",required:!0})]}),h.jsxs("label",{children:["Description",h.jsx("input",{type:"text",value:x,onChange:te=>T(te.target.value),placeholder:"Brief description..."})]}),h.jsxs("label",{children:["Runtime",h.jsxs("select",{value:N,onChange:te=>C(te.target.value),children:[h.jsx("option",{value:"",children:"Default"}),h.jsx("option",{value:"claude-code",children:"claude-code"}),h.jsx("option",{value:"codex",children:"codex"}),h.jsx("option",{value:"copilot",children:"copilot"})]})]}),h.jsxs("label",{children:["Model",h.jsx("input",{type:"text",value:B,onChange:te=>R(te.target.value),placeholder:"e.g. sonnet"})]}),h.jsxs("label",{children:["Max Turns",h.jsx("input",{type:"number",value:X,onChange:te=>H(parseInt(te.target.value,10)||0),min:0})]}),h.jsxs("label",{children:["System Prompt",h.jsx("textarea",{value:A,onChange:te=>j(te.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0})]}),h.jsxs("div",{className:Mt.formActions,children:[h.jsx("button",{type:"submit",className:Mt.btnPrimary,children:r?"Save":"Create"}),h.jsx("button",{type:"button",onClick:U,className:Mt.btnSecondary,children:"Cancel"})]})]});return h.jsxs("div",{className:Mt.container,children:[h.jsxs("div",{className:Mt.header,children:[h.jsx("h2",{children:"Personas"}),h.jsx("button",{onClick:W,className:Mt.btnPrimary,children:"+ New Persona"})]}),(d||r)&&pe(),n.length===0&&!d?h.jsx("p",{className:Mt.empty,children:"No personas yet. Create one to get started."}):h.jsx("div",{className:Mt.list,children:n.map(te=>h.jsxs("div",{className:`${Mt.card} ${(r==null?void 0:r.id)===te.id?Mt.active:""}`,children:[h.jsxs("div",{className:Mt.cardHeader,children:[h.jsx("strong",{children:te.name}),h.jsxs("div",{className:Mt.cardActions,children:[h.jsx("button",{onClick:()=>F(te),className:Mt.btnSmall,children:"Edit"}),p===te.id?h.jsxs(h.Fragment,{children:[h.jsx("button",{onClick:()=>ge(te.id),className:Mt.btnDanger,children:"Confirm"}),h.jsx("button",{onClick:()=>g(null),className:Mt.btnSmall,children:"Cancel"})]}):h.jsx("button",{onClick:()=>g(te.id),className:Mt.btnSmall,children:"Delete"})]})]}),te.description&&h.jsx("p",{className:Mt.description,children:te.description}),h.jsxs("div",{className:Mt.meta,children:[te.runtime&&h.jsxs("span",{children:["Runtime: ",te.runtime]}),te.model&&h.jsxs("span",{children:["Model: ",te.model]}),te.maxTurns>0&&h.jsxs("span",{children:["Max turns: ",te.maxTurns]})]}),h.jsxs("details",{className:Mt.promptDetails,children:[h.jsx("summary",{children:"System Prompt"}),h.jsx("pre",{className:Mt.promptText,children:te.systemPrompt})]})]},te.id))})]})}function uB(){return h.jsx(cB,{})}function dB(){const{themeId:n,resolvedThemeId:a,setTheme:l,preferSystem:o,setPreferSystem:r}=P0();return h.jsxs("section",{className:he.section,children:[h.jsx("h3",{className:he.sectionTitle,children:"Appearance"}),h.jsx("p",{className:he.sectionDescription,children:"Choose how Grackle looks across the app."}),h.jsx("div",{className:he.themeOptions,children:hc.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),m=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,p=d&&a===u.variantLightId;return h.jsxs("button",{type:"button",className:`${he.themeOption} ${m?he.themeOptionSelected:""}`,"aria-pressed":m,onClick:()=>l(u.id),children:[h.jsxs("span",{className:he.themeOptionHeader,children:[h.jsxs("span",{children:[h.jsx("span",{className:he.themeOptionLabel,children:u.label}),h.jsx("span",{className:he.themeOptionDesc,children:u.description})]}),d&&h.jsxs("span",{className:he.variantToggle,children:[h.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&p?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),r(!1),l(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r(!1),l(u.variantLightId))},"aria-label":"Light variant","aria-pressed":m&&p,children:"☼"}),h.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&!p?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),r(!1),l(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r(!1),l(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":m&&!p,children:"☾"})]})]}),u.swatches&&h.jsx("span",{className:he.themeSwatches,children:u.swatches.map((g,v)=>h.jsx("span",{className:he.themeSwatch,style:{background:g}},v))})]},u.id)})}),h.jsxs("label",{className:he.systemToggle,children:[h.jsx("input",{type:"checkbox",checked:o,onChange:u=>r(u.target.checked)}),h.jsx("span",{children:"Match system light/dark preference"})]}),h.jsx("p",{className:he.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),h.jsxs("p",{className:he.themeActive,children:["Active theme: ",h.jsx("strong",{children:a})]})]})}function fB(){return h.jsx(dB,{})}function hB(){const{connected:n,environments:a,sessions:l}=nn(),o=a.filter(d=>d.status==="connected").length,r=a.length,u=l.filter(d=>["running","idle"].includes(d.status)).length;return h.jsxs("section",{className:he.section,"data-testid":"about-panel",children:[h.jsx("h3",{className:he.sectionTitle,children:"About"}),h.jsx("p",{className:he.sectionDescription,children:"Connection status and application information."}),h.jsxs("div",{className:he.aboutGrid,children:[h.jsxs("div",{className:he.aboutItem,children:[h.jsx("span",{className:he.aboutLabel,children:"Connection"}),h.jsxs("span",{className:he.aboutValue,children:[h.jsx("span",{className:`${he.aboutDot} ${n?he.aboutDotConnected:he.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),h.jsxs("div",{className:he.aboutItem,children:[h.jsx("span",{className:he.aboutLabel,children:"Environments"}),h.jsxs("span",{className:he.aboutValue,children:[o,"/",r," connected"]})]}),h.jsxs("div",{className:he.aboutItem,children:[h.jsx("span",{className:he.aboutLabel,children:"Active Sessions"}),h.jsx("span",{className:he.aboutValue,children:u})]}),h.jsxs("div",{className:he.aboutItem,children:[h.jsx("span",{className:he.aboutLabel,children:"Version"}),h.jsx("span",{className:he.aboutValue,children:"0.32.0"})]})]})]})}function mB(){return h.jsx(hB,{})}const pB="_root_h353j_1",gB="_body_h353j_7",vB="_main_h353j_19",yB="_sidebarWrapper_h353j_26",bB="_overlay_h353j_56",Kl={root:pB,body:gB,main:vB,sidebarWrapper:yB,overlay:bB},SB=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function _B(){const{lastSpawnedId:n,environments:a}=nn(),{showToast:l}=go();_k(a,l);const o=na(),r=hn(),u=r.pathname.startsWith(qi),[d,m]=S.useState(!1),p=S.useCallback(()=>m(g=>!g),[]);return S.useEffect(()=>{m(!1)},[r.pathname]),S.useEffect(()=>{if(!d)return;const g=v=>{v.key==="Escape"&&m(!1)};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[d]),S.useEffect(()=>{n&&!r.pathname.startsWith("/tasks/")&&o(L0(n),{replace:!0})},[n,o,r.pathname]),h.jsxs("div",{className:Kl.root,children:[h.jsx(kE,{onToggleSidebar:u?void 0:p,sidebarOpen:d}),h.jsxs("div",{className:Kl.body,children:[h.jsx("div",{className:Kl.sidebarWrapper,"data-sidebar-open":d,"data-settings":u,children:u?h.jsx(S5,{}):h.jsx(qD,{})}),d&&!u&&h.jsx("div",{className:Kl.overlay,"data-testid":"drawer-overlay",onClick:()=>m(!1)}),h.jsxs("div",{className:Kl.main,children:[h.jsx(k0,{}),h.jsx(ok,{})]})]}),h.jsx(Sk,{})]})}function xB(){return h.jsx(rT,{children:h.jsxs(Ot,{element:h.jsx(_B,{}),children:[h.jsx(Ot,{index:!0,element:h.jsx(mM,{})}),h.jsx(Ot,{path:"sessions/new",element:h.jsx(xM,{})}),h.jsx(Ot,{path:"sessions/:sessionId",element:h.jsx(AM,{})}),h.jsx(Ot,{path:"projects/:projectId",element:h.jsx(E3,{})}),h.jsx(Ot,{path:"tasks/new",element:h.jsx(F3,{})}),h.jsx(Ot,{path:"tasks/:taskId",element:h.jsx(Jd,{})}),h.jsx(Ot,{path:"tasks/:taskId/stream",element:h.jsx(Jd,{})}),h.jsx(Ot,{path:"tasks/:taskId/findings",element:h.jsx(Jd,{})}),h.jsx(Ot,{path:"tasks/:taskId/edit",element:h.jsx($3,{})}),h.jsx(Ot,{path:"environments/new",element:h.jsx(d5,{})}),h.jsxs(Ot,{path:"settings",element:h.jsx(p5,{}),children:[h.jsx(Ot,{index:!0,element:h.jsx(Pr,{to:"environments",replace:!0})}),h.jsx(Ot,{path:"environments",element:h.jsx(aO,{})}),h.jsx(Ot,{path:"credentials",element:h.jsx(PO,{})}),h.jsx(Ot,{path:"tokens",element:h.jsx(Pr,{to:"../credentials",replace:!0})}),h.jsx(Ot,{path:"personas",element:h.jsx(uB,{})}),h.jsx(Ot,{path:"appearance",element:h.jsx(fB,{})}),h.jsx(Ot,{path:"about",element:h.jsx(mB,{})})]}),h.jsx(Ot,{path:"*",element:h.jsx(Pr,{to:"/",replace:!0})})]})})}function TB(){const n=SB?pE:lE;return h.jsx(_E,{children:h.jsx(vE,{children:h.jsx(n,{children:h.jsx(MT,{children:h.jsx(xB,{})})})})})}ux.createRoot(document.getElementById("root")).render(h.jsx(S.StrictMode,{children:h.jsx(TB,{})}));
91
+ `),v=((l==null?void 0:l.tool)??"")||(u?"Tool error":"Tool output"),b=l?Tw(l.tool,l.args):"",x=h.jsxs(h.Fragment,{children:[h.jsx("span",{className:u?St.toolResultIndicatorError:St.toolResultIndicatorOk,"aria-label":u?"error":"success",children:u?"✗":"✓"}),h.jsx("span",{className:St.toolResultLabel,children:v}),m&&h.jsx("span",{className:St.toolResultToggle,"aria-hidden":"true",children:o?"▾":"▸"})]});return h.jsxs("div",{className:St.toolResultEvent,children:[m?h.jsx("button",{className:St.toolResultHeader,onClick:()=>{r(T=>!T)},"aria-expanded":o,children:x}):h.jsx("div",{className:St.toolResultHeader,children:x}),b&&h.jsx("div",{className:St.toolResultCommand,children:b}),h.jsxs("pre",{className:St.toolResultPre,children:[p,!o&&m&&h.jsx("span",{className:St.toolResultEllipsis,children:"…"})]})]})}function Cw({content:n}){return h.jsxs("div",{className:St.errorEvent,children:["Error: ",n]})}function Aw({content:n}){return h.jsxs("div",{className:St.statusEvent,children:["--- ",n," ---"]})}function jw({content:n}){return h.jsx("div",{className:St.userInputEvent,children:h.jsx("span",{className:St.userInputContent,children:n})})}function Nw({content:n}){return h.jsx("div",{className:St.defaultEvent,children:n})}function w1({event:n,toolUseCtx:a}){const l=new Date(n.timestamp).toLocaleTimeString();switch(n.eventType){case"system":return h.jsx(Sw,{time:l,content:n.content});case"text":case"output":return h.jsx(_w,{content:n.content});case"tool_use":return h.jsx(xw,{content:n.content});case"tool_result":return h.jsx(Ew,{content:n.content,raw:n.raw,toolUseCtx:a});case"error":return h.jsx(Cw,{content:n.content});case"status":return h.jsx(Aw,{content:n.content});case"user_input":return h.jsx(jw,{content:n.content});default:return h.jsx(Nw,{content:n.content})}}const ww="_overlay_cmicx_1",Dw="_dialog_cmicx_11",kw="_title_cmicx_30",Rw="_description_cmicx_38",Mw="_actions_cmicx_45",Ow="_cancelButton_cmicx_52",Bw="_confirmButton_cmicx_79",Is={overlay:ww,dialog:Dw,title:kw,description:Rw,actions:Mw,cancelButton:Ow,confirmButton:Bw};function Sc({isOpen:n,title:a,description:l,confirmLabel:o="Delete",onConfirm:r,onCancel:u}){const d=S.useId(),m=S.useId();return h.jsx(ys,{children:n&&h.jsx($n.div,{className:Is.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:p=>{p.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":l?m:void 0,children:h.jsxs($n.div,{className:Is.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:p=>p.stopPropagation(),children:[h.jsx("h3",{id:d,className:Is.title,children:a}),l&&h.jsx("p",{id:m,className:Is.description,children:l}),h.jsxs("div",{className:Is.actions,children:[h.jsx("button",{type:"button",className:Is.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),h.jsx("button",{type:"button",className:Is.confirmButton,onClick:r,children:o})]})]})})})}const Lw="_spinner_13c8l_1",zw="_spin_13c8l_1",Uw="_sm_13c8l_14",Vw="_md_13c8l_20",Iw="_lg_13c8l_26",a0={spinner:Lw,spin:zw,sm:Uw,md:Vw,lg:Iw};function s0({size:n="md",className:a,label:l="Loading",liveRegion:o=!1}){return h.jsx("span",{className:`${a0.spinner} ${a0[n]} ${a??""}`,role:o?"status":void 0,"aria-label":l,"aria-hidden":o?void 0:!0})}const Df={not_started:{color:"var(--text-tertiary)",icon:"○",label:"Not Started"},working:{color:"var(--accent-green)",icon:"●",label:"Working"},paused:{color:"var(--accent-yellow)",icon:"◉",label:"Paused"},complete:{color:"var(--accent-green)",icon:"✓",label:"Complete"},failed:{color:"var(--accent-red)",icon:"✗",label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:"⦸",label:"Blocked"}};function vs(n){return n==="blocked"?Df.blocked:Df[Th(n)]}const Hw={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function qw(n){return Hw[Th(n)]??"statusPending"}const Gw=["working","paused","failed","not_started","blocked","complete"],i0=["not_started","working","paused","complete","failed"],Pw={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function Th(n){return n in Df&&n!=="blocked"?n:Pw[n]??"not_started"}const Fw={not_started:"--text-tertiary",working:"--accent-green",paused:"--accent-yellow",complete:"--accent-green",failed:"--accent-red",pending:"--text-tertiary",assigned:"--text-tertiary",in_progress:"--accent-green",review:"--accent-yellow",done:"--accent-green",waiting_input:"--accent-yellow"},$w="_container_15oob_1",Yw="_header_15oob_5",Kw="_searchInput_15oob_17",Zw="_searchHighlight_15oob_50",Xw="_addButton_15oob_56",Qw="_createForm_15oob_83",Jw="_createInput_15oob_89",Ww="_createButton_15oob_120",eD="_creatingHint_15oob_161",tD="_projectRow_15oob_170",nD="_selected_15oob_188",aD="_expandArrow_15oob_193",sD="_expanded_15oob_200",iD="_projectName_15oob_204",lD="_taskCount_15oob_208",oD="_newTaskButton_15oob_214",rD="_taskRow_15oob_241",cD="_taskStatusIcon_15oob_271",uD="_taskTitle_15oob_275",dD="_dependencyBadge_15oob_282",fD="_blockedBadge_15oob_294",hD="_leafSpacer_15oob_299",mD="_childCountBadge_15oob_304",pD="_addChildButton_15oob_317",gD="_emptyCta_15oob_366",vD="_ctaDescription_15oob_379",yD="_ctaButton_15oob_385",bD="_emptyTaskCta_15oob_420",SD="_headerActions_15oob_425",_D="_groupToggle_15oob_431",xD="_groupToggleActive_15oob_458",TD="_statusGroupHeader_15oob_462",ED="_statusGroupIcon_15oob_481",CD="_statusGroupLabel_15oob_485",AD="_statusGroupCount_15oob_490",jD="_createTaskLink_15oob_503",Ne={container:$w,header:Yw,searchInput:Kw,searchHighlight:Zw,addButton:Xw,createForm:Qw,createInput:Jw,createButton:Ww,creatingHint:eD,projectRow:tD,selected:nD,expandArrow:aD,expanded:sD,projectName:iD,taskCount:lD,newTaskButton:oD,taskRow:rD,taskStatusIcon:cD,taskTitle:uD,dependencyBadge:dD,blockedBadge:fD,leafSpacer:hD,childCountBadge:mD,addChildButton:pD,emptyCta:gD,ctaDescription:vD,ctaButton:yD,emptyTaskCta:bD,headerActions:SD,groupToggle:_D,groupToggleActive:xD,statusGroupHeader:TD,statusGroupIcon:ED,statusGroupLabel:CD,statusGroupCount:AD,createTaskLink:jD};function ND(n){if(n.length===0)return[];const a=[...n].sort((o,r)=>o[0]-r[0]),l=[[a[0][0],a[0][1]]];for(let o=1;o<a.length;o++){const r=l[l.length-1],[u,d]=a[o];u<=r[1]+1?r[1]=Math.max(r[1],d):l.push([u,d])}return l}function D1({text:n,indices:a}){if(!a||a.length===0)return h.jsx(h.Fragment,{children:n});const l=ND(a),o=[];let r=0;for(const[u,d]of l)u>r&&o.push(h.jsx("span",{children:n.slice(r,u)},`p${r}`)),o.push(h.jsx("mark",{className:Ne.searchHighlight,children:n.slice(u,d+1)},`m${u}`)),r=d+1;return r<n.length&&o.push(h.jsx("span",{children:n.slice(r)},`p${r}`)),h.jsx(h.Fragment,{children:o})}const wD=[{name:"name",weight:2},{name:"description",weight:1}],DD=[{name:"title",weight:2},{name:"description",weight:1}],k1=34,kD=16,R1="grackle-group-by-status";function l0(){try{return localStorage.getItem(R1)==="true"}catch{return!1}}function RD(n){try{localStorage.setItem(R1,String(n))}catch{}}function MD(n,a){const l=new Map;for(const u of n){const m=u.dependsOn.length>0&&u.dependsOn.some(g=>a.get(g)!=="complete")?"blocked":u.status,p=l.get(m);p?p.push(u):l.set(m,[u])}const o=[],r=new Set;for(const u of Gw){r.add(u);const d=l.get(u);if(d&&d.length>0){d.sort((p,g)=>p.sortOrder-g.sortOrder);const m=vs(u);o.push({status:u,label:m.label,style:m,tasks:d})}}for(const[u,d]of l)if(!r.has(u)&&d.length>0){d.sort((p,g)=>p.sortOrder-g.sortOrder);const m=vs(u);o.push({status:u,label:m.label,style:m,tasks:d})}return o}function OD({group:n,isExpanded:a,onToggle:l,selectedTaskId:o,navigate:r,titleHighlights:u}){return h.jsxs("div",{"data-testid":`status-group-${n.status}`,children:[h.jsxs("div",{className:Ne.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":a,onClick:l,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l())},children:[h.jsx("span",{className:`${Ne.expandArrow} ${a?Ne.expanded:""}`,children:"▸"}),h.jsx("span",{className:Ne.statusGroupIcon,style:{color:n.style.color},children:n.style.icon}),h.jsx("span",{className:Ne.statusGroupLabel,children:n.label}),h.jsx("span",{className:Ne.statusGroupCount,children:n.tasks.length})]}),h.jsx(ys,{children:a&&h.jsx($n.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:n.tasks.map(d=>{const m=vs(d.status),p=o===d.id;return h.jsxs("div",{onClick:()=>r(ms(d.id)),className:`${Ne.taskRow} ${p?Ne.selected:""}`,style:{"--task-indent":`${k1}px`},"data-task-id":d.id,children:[h.jsx("span",{className:Ne.leafSpacer}),h.jsx("span",{className:Ne.taskStatusIcon,style:{color:m.color},children:m.icon}),h.jsx("span",{className:Ne.taskTitle,title:d.title,children:h.jsx(D1,{text:d.title,indices:u.get(d.id)})})]},d.id)})})})]})}function BD(n){const a=new Map(n.map(o=>[o.id,{...o,children:[]}])),l=[];for(const o of a.values())o.parentTaskId&&a.has(o.parentTaskId)?a.get(o.parentTaskId).children.push(o):l.push(o);for(const o of a.values())o.children.sort((r,u)=>r.sortOrder-u.sortOrder);return l.sort((o,r)=>o.sortOrder-r.sortOrder)}function M1({node:n,depth:a,expandedTasks:l,toggleTask:o,selectedTaskId:r,navigate:u,projectId:d,taskStatusById:m,titleHighlights:p}){const g=vs(n.status),v=n.dependsOn.length>0&&n.dependsOn.some(j=>m.get(j)!=="complete"),b=l.has(n.id),x=n.children.length>0,T=r===n.id,A=k1+a*kD;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{onClick:()=>u(ms(n.id)),className:`${Ne.taskRow} ${T?Ne.selected:""}`,style:{"--task-indent":`${A}px`},"data-task-id":n.id,children:[x&&h.jsx("span",{className:`${Ne.expandArrow} ${b?Ne.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:j=>{j.stopPropagation(),o(n.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),o(n.id))},children:"▸"}),!x&&h.jsx("span",{className:Ne.leafSpacer}),h.jsx("span",{className:Ne.taskStatusIcon,style:{color:g.color},children:g.icon}),h.jsx("span",{className:Ne.taskTitle,title:n.title,children:h.jsx(D1,{text:n.title,indices:p.get(n.id)})}),x&&h.jsxs("span",{className:Ne.childCountBadge,children:[n.children.filter(j=>j.status==="complete").length,"/",n.children.length]}),n.dependsOn.length>0&&h.jsx("span",{className:`${Ne.dependencyBadge} ${v?Ne.blockedBadge:""}`,title:`Depends on: ${n.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),a<sN&&h.jsx("button",{onClick:j=>{j.stopPropagation(),u($s(d,n.id))},title:"Add child task","aria-label":"Add child task",className:Ne.addChildButton,children:"+"})]}),h.jsx(ys,{children:x&&b&&h.jsx($n.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:n.children.map(j=>h.jsx(M1,{node:j,depth:a+1,expandedTasks:l,toggleTask:o,selectedTaskId:r,navigate:u,projectId:d,taskStatusById:m,titleHighlights:p},j.id))})})]})}function LD(){const{projects:n,tasks:a,loadTasks:l,createProject:o,projectCreating:r}=nn(),u=na(),[d,m]=S.useState(new Set),[p,g]=S.useState(new Set),[v,b]=S.useState(new Set),[x,T]=S.useState(!1),[A,j]=S.useState(""),[N,C]=S.useState(l0),[B,R]=S.useState(l0),[X,H]=S.useState(new Map),J=()=>{const P=!N;RD(P),C(P),P&&(R(!0),H(new Map))},W=(P,I)=>{const De=`${P}:${I}`;H($e=>{const vt=new Map($e),xt=vt.has(De)?vt.get(De):B;return vt.set(De,!xt),vt})},F=(P,I)=>{const De=`${P}:${I}`;return X.has(De)?X.get(De):B},ne=dn("/tasks/:taskId/*"),ge=dn("/projects/:projectId"),U=(ne==null?void 0:ne.params.taskId)!=="new"?ne==null?void 0:ne.params.taskId:void 0,pe=ge==null?void 0:ge.params.projectId,te=S.useRef(d);te.current=d;const ye=S.useMemo(()=>new Map(a.map(P=>[P.id,P.status])),[a]),q=P=>{m(I=>{const De=new Set(I);return De.has(P)?De.delete(P):(De.add(P),l(P)),De})},z=P=>{g(I=>{const De=new Set(I);return De.has(P)?(De.delete(P),b($e=>new Set($e).add(P))):(De.add(P),b($e=>{const vt=new Set($e);return vt.delete(P),vt})),De})};S.useEffect(()=>{const P=new Set(a.filter(I=>I.parentTaskId).map(I=>I.parentTaskId));P.size>0&&g(I=>{const De=new Set(I);for(const $e of P)v.has($e)||De.add($e);return De})},[a,v]),S.useEffect(()=>{pe&&!te.current.has(pe)&&(m(P=>new Set(P).add(pe)),l(pe))},[pe,l]);const Y=()=>{!A.trim()||r||(o(A.trim()),j(""),T(!1))},[ee,ke]=S.useState(""),{directMatchTaskIds:je,treeMatchTaskIds:Pe,visibleProjectIds:we,matchedProjectIds:_e,titleHighlights:Ce}=S.useMemo(()=>{if(!ee.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,visibleProjectIds:null,matchedProjectIds:null,titleHighlights:new Map};const P=e0(n,ee,wD),I=e0(a,ee,DD),De=new Set(P.map(Ze=>Ze.item.id)),$e=new Set(I.map(Ze=>Ze.item.id)),vt=new Map;for(const Ze of I){const ze=Ze.matches.find(Sn=>Sn.key==="title");ze&&vt.set(Ze.item.id,ze.indices)}const xt=new Set(De);for(const Ze of I)xt.add(Ze.item.projectId);const Gt=new Set($e),We=new Map(a.map(Ze=>[Ze.id,Ze]));for(const Ze of[...$e]){let ze=We.get(Ze);for(;ze!=null&&ze.parentTaskId;)Gt.add(ze.parentTaskId),ze=We.get(ze.parentTaskId)}return{directMatchTaskIds:$e,treeMatchTaskIds:Gt,visibleProjectIds:xt,matchedProjectIds:De,titleHighlights:vt}},[ee,n,a]),Q=S.useRef(new Set);return S.useEffect(()=>{if(ee.trim())for(const P of n)!d.has(P.id)&&!Q.current.has(P.id)&&(Q.current.add(P.id),l(P.id))},[ee,n,d,l]),h.jsxs("div",{className:Ne.container,children:[h.jsxs("div",{className:Ne.header,children:[h.jsx("span",{children:"Projects"}),h.jsxs("div",{className:Ne.headerActions,children:[h.jsx("button",{className:`${Ne.groupToggle} ${N?Ne.groupToggleActive:""}`,onClick:J,"aria-label":N?"Switch to tree view":"Group tasks by status","aria-pressed":N,title:N?"Switch to tree view":"Group tasks by status","data-testid":"group-by-status-toggle",children:"≡"}),h.jsx("button",{className:Ne.addButton,onClick:()=>T(!x),"aria-label":"Create project",title:"Create project",children:"+"})]})]}),n.length>0&&h.jsx("input",{type:"text",value:ee,onChange:P=>ke(P.target.value),placeholder:"Filter...","aria-label":"Filter projects and tasks",className:Ne.searchInput,"data-testid":"sidebar-search"}),x&&h.jsxs("div",{className:Ne.createForm,children:[h.jsx("input",{type:"text",value:A,onChange:P=>j(P.target.value),onKeyDown:P=>P.key==="Enter"&&Y(),placeholder:"Project name...",autoFocus:!0,disabled:r,className:Ne.createInput}),h.jsx("button",{onClick:Y,className:Ne.createButton,disabled:r,children:r?h.jsx(s0,{size:"sm",label:"Creating project"}):"OK"})]}),r&&h.jsxs("div",{className:Ne.creatingHint,children:[h.jsx(s0,{size:"sm",label:"Creating project"}),"Creating project…"]}),n.length===0&&!x&&h.jsxs("div",{className:Ne.emptyCta,children:[h.jsx("button",{className:Ne.ctaButton,onClick:()=>T(!0),children:"Create Project"}),h.jsx("div",{className:Ne.ctaDescription,children:"Organize your work into projects"})]}),n.map(P=>{if(we&&!we.has(P.id))return null;const I=je!==null,De=d.has(P.id)||I,$e=a.filter(ze=>ze.projectId===P.id),vt=(_e==null?void 0:_e.has(P.id))??!1,xt=I&&!vt?N?je:Pe:null,Gt=xt?$e.filter(ze=>xt.has(ze.id)):$e,We=pe===P.id,Ze=De&&!N?BD(Gt):[];return h.jsxs("div",{children:[h.jsxs("div",{onClick:()=>{We?q(P.id):(De||q(P.id),u(oo(P.id)))},className:`${Ne.projectRow} ${We?Ne.selected:""}`,children:[h.jsx("span",{className:`${Ne.expandArrow} ${De?Ne.expanded:""}`,children:"▸"}),h.jsx("span",{className:Ne.projectName,title:P.name,children:P.name}),h.jsx("span",{className:Ne.taskCount,children:$e.length>0&&`${$e.filter(ze=>ze.status==="complete").length}/${$e.length}`}),h.jsx("button",{onClick:ze=>{ze.stopPropagation(),u($s(P.id))},title:"New task",className:Ne.newTaskButton,children:"+"})]}),h.jsx(ys,{children:De&&h.jsxs($n.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},style:{overflow:"hidden"},children:[N?MD(Gt,ye).map(ze=>h.jsx(OD,{group:ze,isExpanded:F(P.id,ze.status),onToggle:()=>W(P.id,ze.status),selectedTaskId:U,navigate:u,titleHighlights:Ce},ze.status)):Ze.map(ze=>h.jsx(M1,{node:ze,depth:0,expandedTasks:p,toggleTask:z,selectedTaskId:U,navigate:u,projectId:P.id,taskStatusById:ye,titleHighlights:Ce},ze.id)),Gt.length===0&&h.jsx("div",{className:Ne.emptyTaskCta,children:h.jsx("button",{className:Ne.createTaskLink,onClick:()=>u($s(P.id)),children:"+ Create Task"})})]})})]},P.id)})]})}const zD="_container_lovia_1",UD="_content_lovia_40",o0={container:zD,content:UD},VD=320,O1=220,B1=600,L1="grackle-sidebar-width";function ID(){try{const n=localStorage.getItem(L1);if(n!==null){const a=Number(n);if(Number.isFinite(a)&&a>=O1&&a<=B1)return a}}catch{}return VD}function HD(n){try{localStorage.setItem(L1,String(n))}catch{}}function qD(){const[n]=S.useState(ID),a=S.useRef(null);return S.useEffect(()=>{const l=a.current;if(!l)return;const o=new ResizeObserver(r=>{for(const u of r){const d=u.borderBoxSize[0];if(d){const m=Math.round(d.inlineSize);m>=O1&&m<=B1&&HD(m)}}});return o.observe(l),()=>{o.disconnect()}},[]),h.jsx("div",{className:o0.container,ref:a,"data-testid":"sidebar",style:{width:n},children:h.jsx("div",{className:o0.content,children:h.jsx(LD,{})})})}const GD="_bar_8ghh5_1",PD="_barColumn_8ghh5_32",FD="_barRow_8ghh5_63",$D="_input_8ghh5_74",YD="_inputSmall_8ghh5_109",KD="_select_8ghh5_178",ZD="_btnPrimary_8ghh5_214",XD="_btnDanger_8ghh5_245",QD="_btnGhost_8ghh5_284",JD="_badge_8ghh5_312",WD="_statusText_8ghh5_322",ek="_statusCompleted_8ghh5_327",tk="_statusFailed_8ghh5_331",nk="_statusBlocked_8ghh5_335",ak="_hintText_8ghh5_340",sk="_creatingHint_8ghh5_345",ik="_errorHint_8ghh5_353",lk="_disconnectHint_8ghh5_359",fe={bar:GD,barColumn:PD,barRow:FD,input:$D,inputSmall:YD,select:KD,btnPrimary:ZD,btnDanger:XD,btnGhost:QD,badge:JD,statusText:WD,statusCompleted:ek,statusFailed:tk,statusBlocked:nk,hintText:ak,creatingHint:sk,errorHint:ik,disconnectHint:lk};function r0({value:n,onChange:a,testId:l}){return h.jsxs("select",{"data-testid":l,value:n,onChange:o=>a(o.target.value),className:fe.select,children:[h.jsx("option",{value:"claude-code",children:"claude-code"}),h.jsx("option",{value:"codex",children:"codex"}),h.jsx("option",{value:"copilot",children:"copilot"}),h.jsx("option",{value:"stub",children:"stub"})]})}function c0(n,a){if(!n)return!1;const l=a.find(o=>o.id===n);return l!==void 0&&(l.status==="disconnected"||l.status==="error")}function u0({environmentId:n,onReconnect:a}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:fe.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),h.jsx("button",{type:"button",onClick:()=>a(n),className:fe.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function ok(){const{spawn:n,sendInput:a,kill:l,sessions:o,tasks:r,environments:u,personas:d,addEnvironment:m,provisionEnvironment:p,codespaces:g,codespaceError:v,codespaceListError:b,codespaceCreating:x,listCodespaces:T,createCodespace:A}=nn(),{showToast:j}=go(),N=na(),[C]=If(),B=dn("/sessions/:sessionId"),R=dn("/tasks/:taskId"),X=dn("/tasks/:taskId/stream"),H=dn("/tasks/:taskId/findings"),J=dn("/tasks/:taskId/edit"),W=dn("/sessions/new"),F=dn("/environments/new"),ne=dn("/projects/:projectId"),ge=dn("/tasks/new"),U=dn("/"),pe=dn("/settings/*"),te=B==null?void 0:B.params.sessionId,ye=(R==null?void 0:R.params.taskId)??(X==null?void 0:X.params.taskId)??(H==null?void 0:H.params.taskId),q=!!W,z=!!F,Y=!!ne,ee=!!ge,ke=!!J,je=!!U&&!q&&!z&&!Y&&!ee,Pe=!!pe,we=q?C.get("env")??"":"",_e=q?C.get("runtime")??"claude-code":"claude-code",[Ce,Q]=S.useState(""),[P,I]=S.useState(q?_e:"claude-code"),[De,$e]=S.useState(""),vt=be=>{if($e(be),be){const re=d.find(ie=>ie.id===be);re!=null&&re.runtime&&I(re.runtime)}},[xt,Gt]=S.useState(""),[We,Ze]=S.useState("local"),[ze,Sn]=S.useState("claude-code"),[_n,Zn]=S.useState(""),[an,Xn]=S.useState(""),[Z,le]=S.useState(""),[ce,de]=S.useState(""),[Te,Ee]=S.useState(""),[et,Le]=S.useState(""),[ot,Dt]=S.useState(""),[Tt,Lt]=S.useState(""),[rt,Et]=S.useState(""),[cn,yt]=S.useState("pick");S.useEffect(()=>{q&&I(_e)},[q,_e]);const $t=te?o.find(be=>be.id===te):void 0,Yt=ye?r.find(be=>be.id===ye):void 0,_s=(Yt==null?void 0:Yt.latestSessionId)||void 0,ae=_s?o.find(be=>be.id===_s):void 0,Me=Yt?Yt.dependsOn.some(be=>{const re=r.find(ie=>ie.id===be);return re&&re.status!=="complete"}):!1;if(je||Pe)return h.jsx("div",{className:fe.bar,children:h.jsx("span",{className:fe.hintText,children:"Select a session or click + to start"})});if(ke||ee)return h.jsx(h.Fragment,{});if(z){const be=se=>{if(!se.trim())return!0;const Ct=Number(se);return Number.isInteger(Ct)&&Ct>=1&&Ct<=65535},re=()=>!(!xt.trim()||We==="ssh"&&!_n.trim()||We==="codespace"&&!et.trim()||(We==="local"||We==="ssh")&&!be(an)),ie=()=>{if(!re())return;const se={};if(We==="local"){if(_n.trim()&&(se.host=_n.trim()),an.trim()){const Ct=Number(an);Number.isInteger(Ct)&&(se.port=Ct)}}else if(We==="ssh"){if(se.host=_n.trim(),Z.trim()&&(se.user=Z.trim()),an.trim()){const Ct=Number(an);Number.isInteger(Ct)&&(se.sshPort=Ct)}ot.trim()&&(se.identityFile=ot.trim())}else We==="docker"?(ce.trim()&&(se.image=ce.trim()),Te.trim()&&(se.repo=Te.trim())):We==="codespace"&&(se.codespaceName=et.trim());m(xt.trim(),We,se,ze),j("Environment added successfully","success"),Gt(""),Ze("local"),Sn("claude-code"),Zn(""),Xn(""),le(""),de(""),Ee(""),Le(""),Dt(""),Lt(""),Et(""),yt("pick"),N(qi,{replace:!0})};return h.jsxs("div",{className:fe.barColumn,children:[h.jsxs("div",{className:fe.barRow,children:[h.jsx("span",{className:fe.badge,children:"new env"}),h.jsx("input",{type:"text",value:xt,onChange:se=>Gt(se.target.value),placeholder:"Environment name...",autoFocus:!0,className:fe.input}),h.jsxs("select",{value:We,onChange:se=>{Ze(se.target.value),se.target.value==="codespace"&&(T(),yt("pick"),Le(""))},className:fe.select,children:[h.jsx("option",{value:"local",children:"local"}),h.jsx("option",{value:"ssh",children:"ssh"}),h.jsx("option",{value:"docker",children:"docker"}),h.jsx("option",{value:"codespace",children:"codespace"})]}),h.jsx(r0,{value:ze,onChange:Sn,testId:"new-environment-runtime-select"}),h.jsx("button",{onClick:ie,disabled:!re(),className:fe.btnPrimary,children:"Add"})]}),h.jsxs("div",{className:fe.barRow,children:[We==="local"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:_n,onChange:se=>Zn(se.target.value),placeholder:"Host (optional)...",className:fe.inputSmall}),h.jsx("input",{type:"number",min:1,max:65535,value:an,onChange:se=>Xn(se.target.value),placeholder:"Port (optional)...",className:fe.inputSmall})]}),We==="ssh"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:_n,onChange:se=>Zn(se.target.value),placeholder:"Host (required)...",className:fe.inputSmall}),h.jsx("input",{type:"text",value:Z,onChange:se=>le(se.target.value),placeholder:"User (optional)...",className:fe.inputSmall}),h.jsx("input",{type:"number",min:1,max:65535,value:an,onChange:se=>Xn(se.target.value),placeholder:"SSH port (optional)...",className:fe.inputSmall}),h.jsx("input",{type:"text",value:ot,onChange:se=>Dt(se.target.value),placeholder:"Identity file (optional)...",className:fe.inputSmall})]}),We==="docker"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:ce,onChange:se=>de(se.target.value),placeholder:"Image (optional)...",className:fe.inputSmall}),h.jsx("input",{type:"text",value:Te,onChange:se=>Ee(se.target.value),placeholder:"Repo (optional)...",className:fe.inputSmall})]}),We==="codespace"&&cn==="pick"&&h.jsxs(h.Fragment,{children:[!b&&h.jsxs("select",{value:et,onChange:se=>{se.target.value==="__create__"?(yt("create"),Le("")):(Le(se.target.value),se.target.value&&!xt.trim()&&Gt(se.target.value))},disabled:x,className:fe.select,children:[h.jsx("option",{value:"",children:"Select a codespace..."}),g.map(se=>h.jsxs("option",{value:se.name,children:[se.name," (",se.repository,") — ",se.state]},se.name)),h.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),x&&h.jsx("span",{className:fe.creatingHint,children:"Creating codespace..."}),b&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:fe.errorHint,children:b}),h.jsx("input",{type:"text",value:et,onChange:se=>Le(se.target.value),placeholder:"Or enter codespace name manually...",className:fe.inputSmall})]}),v&&!b&&h.jsx("span",{className:fe.errorHint,children:v})]}),We==="codespace"&&cn==="create"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:Tt,onChange:se=>Lt(se.target.value),placeholder:"owner/repo",className:fe.inputSmall}),h.jsx("input",{type:"text",value:rt,onChange:se=>Et(se.target.value),placeholder:"Machine type (optional)...",className:fe.inputSmall}),h.jsx("button",{onClick:()=>{Tt.trim()&&(A(Tt.trim(),rt.trim()||void 0),yt("pick"),Lt(""),Et(""))},disabled:!Tt.trim(),className:fe.btnPrimary,children:"Create"}),h.jsx("button",{onClick:()=>{yt("pick"),Lt(""),Et("")},className:fe.btnGhost,children:"Cancel"})]})]})]})}if(Y)return h.jsx("div",{className:fe.bar,children:h.jsx("span",{className:fe.hintText,children:"Select a task or click + to create one"})});if(ye&&Yt){if(Yt.status==="not_started"){const be=Me?Yt.dependsOn.map(re=>r.find(ie=>ie.id===re)).filter(re=>re&&re.status!=="complete").map(re=>re.title):[];return h.jsx("div",{className:fe.bar,children:Me?h.jsxs("span",{className:fe.statusBlocked,children:["Blocked by: ",be.join(", ")]}):h.jsx("span",{className:fe.hintText,children:"Use the buttons above to start or manage this task"})})}if(Yt.status==="working"||Yt.status==="paused"){if((ae==null?void 0:ae.status)==="idle"){const re=ae.environmentId,ie=c0(re,u),se=Ct=>{Ct.preventDefault();const Mn=Yt.latestSessionId||_s;!Ce.trim()||!Mn||ie||(a(Mn,Ce),Q(""))};return h.jsxs("form",{onSubmit:se,className:fe.bar,children:[ie&&re&&h.jsx(u0,{environmentId:re,onReconnect:p}),h.jsx("input",{type:"text",value:Ce,onChange:Ct=>Q(Ct.target.value),placeholder:"Type a message...",autoFocus:!ie,disabled:ie,className:fe.input}),h.jsx("span",{title:ie?"Environment is unavailable — reconnect first":void 0,children:h.jsx("button",{type:"submit",disabled:!Ce.trim()||ie,className:fe.btnPrimary,children:"Send"})})]})}return h.jsx("div",{className:fe.bar,children:h.jsx("input",{type:"text",disabled:!0,placeholder:"Agent is working...",className:fe.input})})}if(Yt.status==="complete")return h.jsxs("div",{className:fe.bar,children:[h.jsx("span",{className:`${fe.statusText} ${fe.statusCompleted}`,children:"Task completed"}),h.jsx("button",{onClick:()=>N($s(Yt.projectId)),className:fe.btnPrimary,children:"+ New Task"})]});if(Yt.status==="failed")return h.jsx("div",{className:fe.bar,children:h.jsx("span",{className:`${fe.statusText} ${fe.statusFailed}`,children:"Task failed"})})}if(q){const be=re=>{re.preventDefault(),!(!Ce.trim()||!we)&&(n(we,Ce,void 0,P,De),j("Session started","success"),Q(""),$e(""))};return h.jsxs("form",{onSubmit:be,className:fe.bar,children:[h.jsx("span",{className:fe.badge,children:"new chat"}),h.jsx("input",{type:"text",value:Ce,onChange:re=>Q(re.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:fe.input}),h.jsx(r0,{value:P,onChange:I,testId:"new-chat-runtime-select"}),h.jsxs("select",{value:De,onChange:re=>vt(re.target.value),className:fe.select,children:[h.jsx("option",{value:"",children:"No persona"}),d.map(re=>h.jsx("option",{value:re.id,children:re.name},re.id))]}),h.jsx("button",{type:"submit",disabled:!Ce.trim()||!we,className:fe.btnPrimary,children:"Go"})]})}if(te){const be=($t==null?void 0:$t.status)==="running",re=($t==null?void 0:$t.status)==="idle",ie=$t!==void 0&&["completed","failed","interrupted"].includes($t.status);if(be)return h.jsxs("div",{className:fe.bar,children:[h.jsx("input",{type:"text",disabled:!0,placeholder:"Agent is working...",className:fe.input}),h.jsx("button",{onClick:()=>l(te),className:fe.btnDanger,title:"Stop session",children:"Stop"})]});if(re){const se=c0($t.environmentId,u),Ct=Mn=>{Mn.preventDefault(),!(!Ce.trim()||se)&&(a(te,Ce),Q(""))};return h.jsxs("form",{onSubmit:Ct,className:fe.bar,children:[se&&$t.environmentId&&h.jsx(u0,{environmentId:$t.environmentId,onReconnect:p}),h.jsx("input",{type:"text",value:Ce,onChange:Mn=>Q(Mn.target.value),placeholder:"Type a message...",autoFocus:!se,disabled:se,className:fe.input}),h.jsx("span",{title:se?"Environment is unavailable — reconnect first":void 0,children:h.jsx("button",{type:"submit",disabled:!Ce.trim()||se,className:fe.btnPrimary,children:"Send"})}),h.jsx("button",{type:"button",onClick:()=>l(te),className:fe.btnDanger,title:"Stop session",children:"Stop"})]})}if(ie)return h.jsxs("div",{className:fe.bar,children:[h.jsxs("span",{className:`${fe.statusText} ${fe.hintText}`,children:["Session ",$t.status]}),h.jsx("button",{onClick:()=>N(z0($t.environmentId,$t.runtime)),className:fe.btnPrimary,children:"+ New Chat"})]})}return h.jsx("div",{className:fe.bar,children:h.jsx("span",{className:fe.hintText,children:"Loading..."})})}const rk="_toast_da8ll_1",ck="_success_da8ll_18",uk="_icon_da8ll_22",dk="_error_da8ll_25",fk="_warning_da8ll_32",hk="_info_da8ll_38",mk="_message_da8ll_53",pk="_close_da8ll_60",Yl={toast:rk,success:ck,icon:uk,error:dk,warning:fk,info:hk,message:mk,close:pk},gk={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function vk({toast:n,onDismiss:a}){return S.useEffect(()=>{const l=setTimeout(()=>a(n.id),n.duration);return()=>clearTimeout(l)},[n.id,n.duration,a]),h.jsxs($n.div,{className:`${Yl.toast} ${Yl[n.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[h.jsx("span",{className:Yl.icon,"aria-hidden":"true",children:gk[n.variant]}),h.jsx("span",{className:Yl.message,children:n.message}),h.jsx("button",{type:"button",className:Yl.close,onClick:()=>a(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const yk="_container_qqse2_1",bk={container:yk};function Sk(){const{toasts:n,dismissToast:a}=go();return h.jsx("div",{className:bk.container,"data-testid":"toast-container",children:h.jsx(ys,{children:n.map(l=>h.jsx(vk,{toast:l,onDismiss:a},l.id))})})}function _k(n,a){const l=S.useRef(null);S.useEffect(()=>{const o=l.current;if(l.current=n,o===null)return;const r=new Map;for(const d of o)r.set(d.id,d);const u=new Set;for(const d of n){u.add(d.id);const m=r.get(d.id);m&&m.status!==d.status&&(d.status==="connecting"||d.status==="sleeping"||(d.status==="connected"?a("Environment connected","success"):d.status==="error"?a("Environment provision failed","error"):d.status==="disconnected"&&(m.status==="connected"?a("Environment disconnected","warning"):a("Environment stopped","info"))))}for(const d of o)u.has(d.id)||a("Environment removed","info")},[n,a])}const xk="_panelContainer_2zqh5_1",Tk="_emptyState_2zqh5_8",Ek="_fadeIn_2zqh5_1",Ck="_projectSummary_2zqh5_17",Ak="_projectSummaryTitle_2zqh5_28",jk="_projectSummarySubtitle_2zqh5_32",Nk="_header_2zqh5_36",wk="_headerInfo_2zqh5_69",Dk="_killButton_2zqh5_75",kk="_headerTitle_2zqh5_104",Rk="_headerActions_2zqh5_119",Mk="_taskStatusBadge_2zqh5_126",Ok="_taskBranch_2zqh5_135",Bk="_taskBlockedBadge_2zqh5_141",Lk="_btnPrimary_2zqh5_149",zk="_btnDanger_2zqh5_180",Uk="_btnGhost_2zqh5_219",Vk="_rejectInput_2zqh5_245",Ik="_tabBar_2zqh5_275",Hk="_tab_2zqh5_275",qk="_active_2zqh5_301",Gk="_eventScroll_2zqh5_306",Pk="_tabContent_2zqh5_312",Fk="_noContext_2zqh5_317",$k="_overviewContent_2zqh5_323",Yk="_overviewDashboard_2zqh5_332",Kk="_overviewHero_2zqh5_338",Zk="_statusBadge_2zqh5_345",Xk="_statusPending_2zqh5_357",Qk="_statusAssigned_2zqh5_362",Jk="_statusInProgress_2zqh5_367",Wk="_statusReview_2zqh5_372",eR="_statusDone_2zqh5_377",tR="_statusFailed_2zqh5_382",nR="_statusWaitingInput_2zqh5_387",aR="_overviewBranchPill_2zqh5_392",sR="_branchLink_2zqh5_407",iR="_overviewSection_2zqh5_418",lR="_overviewLabel_2zqh5_424",oR="_overviewValue_2zqh5_431",rR="_overviewMuted_2zqh5_436",cR="_overviewMarkdown_2zqh5_442",uR="_envRow_2zqh5_511",dR="_envDot_2zqh5_517",fR="_envDotGreen_2zqh5_524",hR="_envDotYellow_2zqh5_528",mR="_envDotRed_2zqh5_532",pR="_envDotGray_2zqh5_536",gR="_depList_2zqh5_540",vR="_depItem_2zqh5_546",yR="_depBlocked_2zqh5_553",bR="_depDone_2zqh5_557",SR="_timeline_2zqh5_561",_R="_timelineRow_2zqh5_567",xR="_timelineKey_2zqh5_574",TR="_timelineValue_2zqh5_580",ER="_timelineDelta_2zqh5_584",CR="_reviewNotes_2zqh5_595",AR="_overviewDescription_2zqh5_606",jR="_waitingMessage_2zqh5_612",NR="_errorMessage_2zqh5_616",wR="_eventOverflowWarning_2zqh5_620",DR="_attemptSelector_2zqh5_634",kR="_attemptLabel_2zqh5_650",RR="_attemptButton_2zqh5_654",MR="_attemptActive_2zqh5_671",OR="_attemptStatus_2zqh5_677",BR="_emptyCta_2zqh5_683",LR="_ctaTitle_2zqh5_695",zR="_ctaDescription_2zqh5_701",UR="_ctaButton_2zqh5_708",VR="_ctaLink_2zqh5_743",IR="_projectHeader_2zqh5_757",HR="_projectName_2zqh5_782",qR="_projectMeta_2zqh5_795",GR="_metaRow_2zqh5_803",PR="_metaLabel_2zqh5_816",FR="_metaValue_2zqh5_831",$R="_metaPlaceholder_2zqh5_841",YR="_editButton_2zqh5_846",KR="_editInput_2zqh5_862",ZR="_editTextarea_2zqh5_894",XR="_editSelect_2zqh5_930",QR="_archiveButton_2zqh5_963",JR="_repoLink_2zqh5_993",WR="_metaValueClickable_2zqh5_1003",eM="_editHint_2zqh5_1022",tM="_editError_2zqh5_1031",nM="_editInputInvalid_2zqh5_1038",aM="_unsavedDot_2zqh5_1043",sM="_metaToggle_2zqh5_1051",iM="_metaToggleArrow_2zqh5_1072",lM="_metaToggleArrowOpen_2zqh5_1077",oM="_progressBarContainer_2zqh5_1081",rM="_progressBar_2zqh5_1081",cM="_progressFill_2zqh5_1097",uM="_progressLabel_2zqh5_1104",dM="_metaTimestamps_2zqh5_1111",fM="_metaTimestamp_2zqh5_1111",hM="_editFieldWrapper_2zqh5_1133",D={panelContainer:xk,emptyState:Tk,fadeIn:Ek,projectSummary:Ck,projectSummaryTitle:Ak,projectSummarySubtitle:jk,header:Nk,headerInfo:wk,killButton:Dk,headerTitle:kk,headerActions:Rk,taskStatusBadge:Mk,taskBranch:Ok,taskBlockedBadge:Bk,btnPrimary:Lk,btnDanger:zk,btnGhost:Uk,rejectInput:Vk,tabBar:Ik,tab:Hk,active:qk,eventScroll:Gk,tabContent:Pk,noContext:Fk,overviewContent:$k,overviewDashboard:Yk,overviewHero:Kk,statusBadge:Zk,statusPending:Xk,statusAssigned:Qk,statusInProgress:Jk,statusReview:Wk,statusDone:eR,statusFailed:tR,statusWaitingInput:nR,overviewBranchPill:aR,branchLink:sR,overviewSection:iR,overviewLabel:lR,overviewValue:oR,overviewMuted:rR,overviewMarkdown:cR,envRow:uR,envDot:dR,envDotGreen:fR,envDotYellow:hR,envDotRed:mR,envDotGray:pR,depList:gR,depItem:vR,depBlocked:yR,depDone:bR,timeline:SR,timelineRow:_R,timelineKey:xR,timelineValue:TR,timelineDelta:ER,reviewNotes:CR,overviewDescription:AR,waitingMessage:jR,errorMessage:NR,eventOverflowWarning:wR,attemptSelector:DR,attemptLabel:kR,attemptButton:RR,attemptActive:MR,attemptStatus:OR,emptyCta:BR,ctaTitle:LR,ctaDescription:zR,ctaButton:UR,ctaLink:VR,projectHeader:IR,projectName:HR,projectMeta:qR,metaRow:GR,metaLabel:PR,metaValue:FR,metaPlaceholder:$R,editButton:YR,editInput:KR,editTextarea:ZR,editSelect:XR,archiveButton:QR,repoLink:JR,metaValueClickable:WR,editHint:eM,editError:tM,editInputInvalid:nM,unsavedDot:aM,metaToggle:sM,metaToggleArrow:iM,metaToggleArrowOpen:lM,progressBarContainer:oM,progressBar:rM,progressFill:cM,progressLabel:uM,metaTimestamps:dM,metaTimestamp:fM,editFieldWrapper:hM};function mM(){const{projects:n,createProject:a}=nn();return n.length===0?h.jsxs("div",{className:D.emptyCta,children:[h.jsx("div",{className:D.ctaTitle,children:"Welcome to Grackle"}),h.jsx("div",{className:D.ctaDescription,children:"Organize your work into projects and let agents tackle the tasks."}),h.jsx("button",{className:D.ctaButton,onClick:()=>{const l=window.prompt("Project name:");l!=null&&l.trim()&&a(l.trim())},children:"Create Your First Project"})]}):h.jsx("div",{className:D.emptyState,children:"Select a project or task to get started"})}function pM(n,a){const l=[];let o=n;const r=new Set;for(;o&&a.has(o)&&!r.has(o);){r.add(o);const u=a.get(o);l.unshift(u),o=u.parentTaskId||void 0}return l}const Ys={label:"Home",url:"/"};function gM(n){return n?[Ys,{label:"Settings",url:"/settings"},{label:n,url:void 0}]:[Ys,{label:"Settings",url:void 0}]}function vM(){return[Ys,{label:"New Environment",url:void 0}]}function yM(){return[Ys,{label:"New Chat",url:void 0}]}function bM(n){return[Ys,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function SM(n,a){const l=a.find(o=>o.id===n);return[Ys,{label:(l==null?void 0:l.name)??"Project",url:void 0}]}function _M(n,a,l){const o=pM(n,l),r=l.get(n),u=r==null?void 0:r.projectId,d=u?a.find(g=>g.id===u):void 0,m=[Ys];d&&m.push({label:d.name,url:oo(d.id)});for(let g=0;g<o.length-1;g++)m.push({label:o[g].title,url:ms(o[g].id)});const p=o[o.length-1];return m.push({label:(p==null?void 0:p.title)??n,url:void 0}),m}function xM(){const n=yM();return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:n}),h.jsx("div",{className:D.emptyState,children:"Enter a prompt below to start a new session"})]})}function z1(n){const a=[];for(const l of n){const o=a[a.length-1];l.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?a[a.length-1]={...o,content:o.content+l.content}:a.push(l)}return a}function U1(n){const a=new Map;for(const u of n)if(u.raw)try{a.set(u,JSON.parse(u.raw))}catch{}const l=new Map;for(const u of n){if(u.eventType!=="tool_use")continue;const d=a.get(u);if(!(!d||typeof d.id!="string"))try{const m=JSON.parse(u.content);l.set(d.id,{tool:m.tool,args:m.args})}catch{}}const o=new Set;return n.map(u=>{if(u.eventType!=="tool_result")return u;const d=a.get(u);if(!d||typeof d.tool_use_id!="string")return u;const m=l.get(d.tool_use_id);return m?(o.add(d.tool_use_id),{...u,toolUseCtx:m}):u}).filter(u=>{if(u.eventType!=="tool_use")return!0;const d=a.get(u);return d&&typeof d.id=="string"?!o.has(d.id):!0})}function TM({sessionId:n,session:a,isActive:l,onKill:o}){return h.jsxs("div",{className:D.header,children:[h.jsxs("span",{children:["Session: ",n.slice(0,8),a&&` | ${a.runtime} | ${a.status}`]}),h.jsxs("span",{className:D.headerInfo,children:[a&&h.jsx("span",{children:a.prompt.length>60?a.prompt.slice(0,60)+"...":a.prompt}),l&&h.jsx("button",{onClick:()=>o(n),title:"Stop session",className:D.killButton,children:"×"})]})]})}function EM({eventsDropped:n}){return n<=0?h.jsx(h.Fragment,{}):h.jsxs("div",{className:D.eventOverflowWarning,role:"alert",children:["⚠ ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function CM({sessionEvents:n,session:a,eventsDropped:l,scrollRef:o}){const r=a&&["completed","failed","interrupted"].includes(a.status),u=r?`Session ${a.status} with no events recorded.`:"Waiting for events...";return h.jsxs("div",{ref:o,className:D.eventScroll,children:[n.length===0&&h.jsx("div",{className:r?D.errorMessage:D.waitingMessage,children:u}),h.jsx(EM,{eventsDropped:l}),n.map((d,m)=>h.jsx(w1,{event:d,toolUseCtx:d.toolUseCtx},`${d.sessionId}-${d.timestamp}-${m}`))]})}function AM(){const{sessionId:n}=dc(),{events:a,eventsDropped:l,sessions:o,kill:r,loadSessionEvents:u}=nn(),d=S.useRef(null),m=S.useRef(void 0),p=bM(n),g=o.find(x=>x.id===n)??void 0,v=S.useMemo(()=>{const x=n?a.filter(T=>T.sessionId===n):[];return U1(z1(x))},[a,n]);if(S.useEffect(()=>{n&&n!==m.current&&(m.current=n,u(n))},[n,u]),S.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[v.length]),!n)return h.jsx("div",{className:D.emptyState,children:"No session selected"});const b=(g==null?void 0:g.status)==="running"||(g==null?void 0:g.status)==="idle";return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:p}),h.jsx(TM,{sessionId:n,session:g,isActive:b,onKill:r}),h.jsx(CM,{sessionEvents:v,session:g,eventsDropped:l,scrollRef:d})]})}const d0=220,f0=70,jM=40,NM=60,wM="hierarchy",DM="dependency";function kM(n){return S.useMemo(()=>{if(n.length===0)return{nodes:[],edges:[]};const a=new hv.graphlib.Graph({multigraph:!0});a.setDefaultEdgeLabel(()=>({})),a.setGraph({rankdir:"TB",nodesep:jM,ranksep:NM});const l=new Map(n.map(d=>[d.id,d])),o=new Map;for(const d of n)if(d.parentTaskId&&l.has(d.parentTaskId)){const m=o.get(d.parentTaskId)||[];m.push(d),o.set(d.parentTaskId,m)}for(const d of n)a.setNode(d.id,{width:d0,height:f0});const r=[];for(const d of n){if(d.parentTaskId&&l.has(d.parentTaskId)){const m=`hierarchy-${d.parentTaskId}-${d.id}`;a.setEdge(d.parentTaskId,d.id,{},m),r.push({id:m,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:wM},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const m of d.dependsOn)if(l.has(m)){const p=`dependency-${m}-${d.id}`;a.setEdge(m,d.id,{},p),r.push({id:p,source:m,target:d.id,type:"smoothstep",data:{edgeType:DM},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return hv.layout(a),{nodes:n.map(d=>{const m=a.node(d.id),p=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:m.x-d0/2,y:m.y-f0/2},data:{task:d,childCount:p.length,doneChildCount:p.filter(g=>g.status==="complete").length,hasDependencies:d.dependsOn.length>0}}}),edges:r}},[n])}const RM="_dagContainer_js4w6_1",MM="_taskNode_js4w6_26",OM="_taskNodeBorder_js4w6_54",BM="_taskNodeContent_js4w6_60",LM="_taskNodeHeader_js4w6_70",zM="_taskNodeIcon_js4w6_77",UM="_taskNodeTitle_js4w6_82",VM="_taskNodeBadges_js4w6_90",IM="_childBadge_js4w6_95",HM="_depBadge_js4w6_107",qM="_handle_js4w6_119",GM="_emptyCta_js4w6_126",PM="_ctaDescription_js4w6_137",FM="_ctaButton_js4w6_144",fn={dagContainer:RM,taskNode:MM,taskNodeBorder:OM,taskNodeContent:BM,taskNodeHeader:LM,taskNodeIcon:zM,taskNodeTitle:UM,taskNodeBadges:VM,childBadge:IM,depBadge:HM,handle:qM,emptyCta:GM,ctaDescription:PM,ctaButton:FM};function $M({data:n}){const{task:a,childCount:l,doneChildCount:o,hasDependencies:r}=n,u=vs(a.status);return h.jsxs("div",{className:fn.taskNode,"data-task-id":a.id,"data-task-title":a.title,children:[h.jsx(mv,{type:"target",position:pv.Top,className:fn.handle}),h.jsx("div",{className:fn.taskNodeBorder,style:{backgroundColor:u.color}}),h.jsxs("div",{className:fn.taskNodeContent,children:[h.jsxs("div",{className:fn.taskNodeHeader,children:[h.jsx("span",{className:fn.taskNodeIcon,style:{color:u.color},children:u.icon}),h.jsx("span",{className:fn.taskNodeTitle,children:a.title})]}),h.jsxs("div",{className:fn.taskNodeBadges,children:[l>0&&h.jsxs("span",{className:fn.childBadge,children:[o,"/",l]}),r&&h.jsx("span",{className:fn.depBadge,children:"dep"})]})]}),h.jsx(mv,{type:"source",position:pv.Bottom,className:fn.handle})]})}const YM=Fw,KM={task:$M};function ZM({projectId:n}){const{tasks:a}=nn(),l=na(),{resolvedThemeId:o}=P0(),r=S.useMemo(()=>a.filter(v=>v.projectId===n),[a,n]),{nodes:u,edges:d}=kM(r),m=S.useMemo(()=>{const v=getComputedStyle(document.documentElement),b={};for(const[x,T]of Object.entries(YM))b[x]=v.getPropertyValue(T).trim()||"#6b7a8d";return b},[o]),p=S.useCallback((v,b)=>{l(ms(b.id))},[l]),g=S.useCallback(v=>{const b=v.data;return m[b.task.status]||m.pending},[m]);return r.length===0?h.jsxs("div",{className:fn.emptyCta,children:[h.jsx("button",{className:fn.ctaButton,onClick:()=>l($s(n)),children:"Create Task"}),h.jsx("div",{className:fn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):h.jsx("div",{className:fn.dagContainer,children:h.jsxs(tx,{nodes:u,edges:d,nodeTypes:KM,onNodeClick:p,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[h.jsx(nx,{variant:ax.Dots,gap:24,size:1,color:"var(--text-disabled)"}),h.jsx(sx,{showInteractive:!1}),h.jsx(ix,{nodeColor:g,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function XM({tasks:n,taskStatusById:a,sessionStatusByTaskId:l}){const o=new Map;for(const u of n)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const r=new Map(i0.map(u=>[u,[]]));for(const u of n){const d=Th(u.status),m=u.dependsOn.length>0&&u.dependsOn.some(A=>a.get(A)!=="complete"),p=o.get(u.id)??[],g=p.length,v=p.filter(A=>A.status==="complete").length;let b;if(d==="paused"&&l){const A=l.get(u.id);A==="idle"?b="Needs input":A==="completed"&&(b="Ready to complete")}const x={task:u,isBlocked:m,childCount:g,doneChildCount:v,pausedSubBadge:b},T=r.get(d);T?T.push(x):r.get("not_started").push(x)}for(const u of r.values())u.sort((d,m)=>d.task.sortOrder-m.task.sortOrder);return i0.map(u=>{const d=vs(u);return{status:u,label:d.label,style:d,tasks:r.get(u)??[]}})}const QM="_boardContainer_1c4y1_1",JM="_column_1c4y1_17",WM="_columnHeader_1c4y1_34",e3="_columnIcon_1c4y1_47",t3="_columnLabel_1c4y1_52",n3="_columnCount_1c4y1_57",a3="_cardList_1c4y1_67",s3="_emptyPlaceholder_1c4y1_76",i3="_card_1c4y1_67",l3="_cardHeader_1c4y1_107",o3="_cardStatusIcon_1c4y1_113",r3="_cardTitle_1c4y1_119",c3="_cardBadges_1c4y1_127",u3="_badge_1c4y1_134",d3="_blockedBadge_1c4y1_146",f3="_childBadge_1c4y1_151",h3="_depBadge_1c4y1_155",m3="_parentBadge_1c4y1_159",p3="_pausedSubBadge_1c4y1_166",g3="_personaBadge_1c4y1_170",v3="_envBadge_1c4y1_174",y3="_emptyCta_1c4y1_178",b3="_ctaButton_1c4y1_188",S3="_ctaDescription_1c4y1_204",Je={boardContainer:QM,column:JM,columnHeader:WM,columnIcon:e3,columnLabel:t3,columnCount:n3,cardList:a3,emptyPlaceholder:s3,card:i3,cardHeader:l3,cardStatusIcon:o3,cardTitle:r3,cardBadges:c3,badge:u3,blockedBadge:d3,childBadge:f3,depBadge:h3,parentBadge:m3,pausedSubBadge:p3,personaBadge:g3,envBadge:v3,emptyCta:y3,ctaButton:b3,ctaDescription:S3};function _3({projectId:n}){const{tasks:a,sessions:l,personas:o,environments:r}=nn(),u=na(),d=S.useMemo(()=>a.filter(b=>b.projectId===n),[a,n]),m=S.useMemo(()=>new Map(a.map(b=>[b.id,b.status])),[a]),p=S.useMemo(()=>new Map(d.map(b=>[b.id,b])),[d]),g=S.useMemo(()=>{const b=new Map(l.map(C=>[C.id,C])),x=new Map(o.map(C=>[C.id,C])),T=new Map(r.map(C=>[C.id,C])),A=new Map,j=new Map,N=new Map;for(const C of d)if(C.latestSessionId){const B=b.get(C.latestSessionId);if(B){if(A.set(C.id,B.status),B.personaId){const R=x.get(B.personaId);R&&j.set(C.id,R.name)}if(B.environmentId){const R=T.get(B.environmentId);R&&N.set(C.id,R.displayName)}}}return{sessionStatusByTaskId:A,personaNameByTaskId:j,environmentNameByTaskId:N}},[d,l,o,r]),v=S.useMemo(()=>XM({tasks:d,taskStatusById:m,sessionStatusByTaskId:g.sessionStatusByTaskId}),[d,m,g]);return d.length===0?h.jsxs("div",{className:Je.emptyCta,"data-testid":"board-empty-cta",children:[h.jsx("button",{className:Je.ctaButton,onClick:()=>u($s(n)),children:"Create Task"}),h.jsx("div",{className:Je.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):h.jsx("div",{className:Je.boardContainer,"data-testid":"board-container",children:v.map(b=>h.jsxs("section",{className:Je.column,"data-testid":`board-column-${b.status}`,"aria-label":`${b.label}, ${b.tasks.length} ${b.tasks.length===1?"task":"tasks"}`,children:[h.jsxs("div",{className:Je.columnHeader,children:[h.jsx("span",{className:Je.columnIcon,style:{color:b.style.color},children:b.style.icon}),h.jsx("span",{className:Je.columnLabel,children:b.label}),h.jsx("span",{className:Je.columnCount,"data-testid":`board-count-${b.status}`,children:b.tasks.length})]}),h.jsx("div",{className:Je.cardList,children:b.tasks.length===0?h.jsx("div",{className:Je.emptyPlaceholder,children:"No tasks"}):h.jsx(ys,{mode:"popLayout",children:b.tasks.map(x=>h.jsx($n.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:h.jsx(x3,{boardTask:x,tasksById:p,personaName:g.personaNameByTaskId.get(x.task.id),envName:g.environmentNameByTaskId.get(x.task.id),onClick:()=>u(ms(x.task.id))})},x.task.id))})})]},b.status))})}function x3({boardTask:n,tasksById:a,personaName:l,envName:o,onClick:r}){const{task:u,isBlocked:d,childCount:m,doneChildCount:p,pausedSubBadge:g}=n,v=vs(u.status),b=u.parentTaskId?a.get(u.parentTaskId):void 0;return h.jsxs("div",{className:Je.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:r,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),r())},children:[h.jsxs("div",{className:Je.cardHeader,children:[h.jsx("span",{className:Je.cardStatusIcon,style:{color:v.color},children:v.icon}),h.jsx("span",{className:Je.cardTitle,children:u.title})]}),h.jsxs("div",{className:Je.cardBadges,children:[b&&h.jsx("span",{className:`${Je.badge} ${Je.parentBadge}`,title:b.title,children:b.title}),m>0&&h.jsxs("span",{className:`${Je.badge} ${Je.childBadge}`,children:[p,"/",m]}),d&&h.jsx("span",{className:`${Je.badge} ${Je.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&h.jsx("span",{className:`${Je.badge} ${Je.depBadge}`,children:"dep"}),g&&h.jsx("span",{className:`${Je.badge} ${Je.pausedSubBadge}`,children:g}),l&&h.jsx("span",{className:`${Je.badge} ${Je.personaBadge}`,children:l}),o&&h.jsx("span",{className:`${Je.badge} ${Je.envBadge}`,children:o})]})]})}function T3(n){const a=n.toLowerCase();return a==="ready"||a==="running"||a==="available"||a==="connected"?D.envDotGreen:a==="provisioning"||a==="starting"||a==="pending"||a==="connecting"?D.envDotYellow:a==="error"||a==="failed"||a==="disconnected"?D.envDotRed:D.envDotGray}function h0(n){if(!n)return"";const a=new Date(n);if(isNaN(a.getTime()))return"";const o=Date.now()-a.getTime();if(o<0)return"just now";const r=Math.floor(o/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const u=Math.floor(r/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<30?`${d}d ago`:a.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function E3(){const{projectId:n}=dc(),a=na(),{tasks:l,environments:o,projects:r,archiveProject:u,updateProject:d}=nn(),[m,p]=S.useState("tasks"),[g,v]=S.useState(!1),[b,x]=S.useState(null),[T,A]=S.useState(""),[j,N]=S.useState(""),[C,B]=S.useState(!1),R=S.useRef(void 0),X=S.useRef(null),H=S.useRef(null),J=S.useRef(null),W=S.useRef(null),F=S.useRef(null),ne=S.useRef(null),ge=SM(n,r);S.useEffect(()=>{const Q=R.current;R.current=n,!(Q===void 0||Q===n)&&(b!==null||T!=="")&&(x(null),A(""))},[n,b,T]),S.useEffect(()=>{if(b===null)return;const Q=b==="name"?H.current:b==="description"?J.current:b==="repoUrl"?W.current:b==="worktreeBasePath"?ne.current:F.current;if(!Q)return;const P=window.setTimeout(()=>{Q.focus()},0);return()=>{window.clearTimeout(P)}},[b]);const U=r.find(Q=>Q.id===n),pe=l.filter(Q=>Q.projectId===n),te=pe.filter(Q=>Q.status==="complete").length,ye=pe.length,q=ye>0?Math.round(te/ye*100):0,z=100,Y=(Q,P)=>{X.current=Q,x(Q),A(P),N("")},ee=()=>{X.current=null,x(null),A(""),N("")},ke=(Q,P)=>{if(Q==="name"){const I=P.trim();if(!I)return"Name is required";if(I.length>z)return`Max ${z} characters`}if(Q==="repoUrl"){const I=P.trim();if(I&&!/^https?:\/\/.+/.test(I))return"Must be a valid http(s) URL"}return""},je=Q=>{if(!U)return;const P=T.trim(),I=ke(Q,T);if(I){N(I);return}if(Q==="name"){if(P===U.name){ee();return}d(U.id,{name:P})}else if(Q==="description"){const De=T;if(De===U.description){ee();return}d(U.id,{description:De})}else if(Q==="repoUrl"){if(P===U.repoUrl){ee();return}d(U.id,{repoUrl:P})}else if(Q==="defaultEnvironmentId"){if(T===U.defaultEnvironmentId){ee();return}d(U.id,{defaultEnvironmentId:T})}else{if(P===U.worktreeBasePath){ee();return}d(U.id,{worktreeBasePath:P})}ee()},Pe=(Q,P)=>{Q.key==="Escape"?ee():Q.key==="Enter"&&P!=="description"&&je(P)},we=Q=>U?Q==="name"?T.trim()!==U.name:Q==="description"?T!==U.description:Q==="repoUrl"?T.trim()!==U.repoUrl:Q==="defaultEnvironmentId"?T!==U.defaultEnvironmentId:T.trim()!==U.worktreeBasePath:!1,_e=o.find(Q=>Q.id===(U==null?void 0:U.defaultEnvironmentId)),Ce=b==="description"?"Tab to save · Esc to cancel":"Enter to save · Esc to cancel";return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:ge}),h.jsxs("div",{className:D.projectHeader,children:[h.jsx("span",{className:D.projectName,"data-testid":"project-name",children:b==="name"?h.jsxs("div",{className:D.editFieldWrapper,children:[h.jsx("input",{ref:H,className:`${D.editInput} ${j?D.editInputInvalid:""}`,value:T,onChange:Q=>{A(Q.target.value),N("")},onBlur:Q=>{if(X.current==="name"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="name"||je("name")},onKeyDown:Q=>Pe(Q,"name"),maxLength:z,"aria-label":"Project name","data-testid":"edit-name-input"}),we("name")&&h.jsx("span",{className:D.unsavedDot,title:"Unsaved changes"}),j&&h.jsx("span",{className:D.editError,"data-testid":"edit-error",children:j}),h.jsx("span",{className:D.editHint,children:Ce})]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:()=>Y("name",(U==null?void 0:U.name)||""),title:"Click to edit name","aria-label":`Edit project name: ${(U==null?void 0:U.name)||n}`,"data-testid":"edit-name-button",children:[(U==null?void 0:U.name)||n,h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})}),h.jsx("button",{className:D.archiveButton,onClick:()=>v(!0),title:"Archive project","data-testid":"archive-project-button",children:"Archive"})]}),h.jsxs("button",{className:D.metaToggle,onClick:()=>B(!C),"aria-expanded":!C,"aria-controls":"project-meta-panel","data-testid":"meta-toggle",children:[h.jsx("span",{className:`${D.metaToggleArrow} ${C?"":D.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!C&&h.jsxs("div",{className:D.projectMeta,"data-testid":"project-meta",id:"project-meta-panel",children:[h.jsxs("div",{className:D.metaRow,children:[h.jsx("span",{className:D.metaLabel,children:"Description"}),h.jsx("div",{className:D.metaValue,children:b==="description"?h.jsxs("div",{className:D.editFieldWrapper,children:[h.jsx("textarea",{ref:J,className:D.editTextarea,value:T,onChange:Q=>{A(Q.target.value),N("")},onBlur:Q=>{if(X.current==="description"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="description"||je("description")},onKeyDown:Q=>Pe(Q,"description"),title:"Project description","aria-label":"Project description","data-testid":"edit-description-input"}),we("description")&&h.jsx("span",{className:D.unsavedDot,title:"Unsaved changes"}),h.jsx("span",{className:D.editHint,children:Ce})]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:()=>Y("description",(U==null?void 0:U.description)||""),title:"Click to edit description","aria-label":"Edit project description","data-testid":"edit-description-button",children:[U!=null&&U.description?h.jsx("span",{className:D.overviewMarkdown,children:h.jsx(kf,{remarkPlugins:[Rf],children:U.description})}):h.jsx("span",{className:D.metaPlaceholder,children:"No description"}),h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:D.metaRow,children:[h.jsx("span",{className:D.metaLabel,children:"Repository"}),h.jsx("div",{className:D.metaValue,children:b==="repoUrl"?h.jsxs("div",{className:D.editFieldWrapper,children:[h.jsx("input",{ref:W,className:`${D.editInput} ${j?D.editInputInvalid:""}`,value:T,onChange:Q=>{A(Q.target.value),N("")},onBlur:Q=>{if(X.current==="repoUrl"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="repoUrl"||je("repoUrl")},onKeyDown:Q=>Pe(Q,"repoUrl"),placeholder:"https://github.com/...","aria-label":"Project repository URL","data-testid":"edit-repo-input"}),we("repoUrl")&&h.jsx("span",{className:D.unsavedDot,title:"Unsaved changes"}),j&&h.jsx("span",{className:D.editError,"data-testid":"edit-error",children:j}),h.jsx("span",{className:D.editHint,children:Ce})]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:Q=>{Q.preventDefault(),Y("repoUrl",(U==null?void 0:U.repoUrl)||"")},title:"Click to edit repository URL","aria-label":"Edit project repository URL","data-testid":"edit-repo-button",children:[U!=null&&U.repoUrl&&/^https?:\/\//i.test(U.repoUrl)?h.jsx("a",{className:D.repoLink,href:U.repoUrl,target:"_blank",rel:"noopener noreferrer",onClick:Q=>Q.stopPropagation(),children:U.repoUrl}):U!=null&&U.repoUrl?h.jsx("span",{children:U.repoUrl}):h.jsx("span",{className:D.metaPlaceholder,children:"No repository"}),h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:D.metaRow,children:[h.jsx("span",{className:D.metaLabel,children:"Environment"}),h.jsx("div",{className:D.metaValue,children:b==="defaultEnvironmentId"?h.jsxs("select",{ref:F,className:D.editSelect,value:T,onChange:Q=>{X.current=null,A(Q.target.value);const P=Q.target.value;U&&P!==U.defaultEnvironmentId&&d(U.id,{defaultEnvironmentId:P}),ee()},onBlur:Q=>{if(X.current==="defaultEnvironmentId"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="defaultEnvironmentId"||ee()},title:"Default environment","aria-label":"Project default environment","data-testid":"edit-env-select",children:[h.jsx("option",{value:"",children:"None"}),o.map(Q=>h.jsx("option",{value:Q.id,children:Q.displayName},Q.id))]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:()=>Y("defaultEnvironmentId",(U==null?void 0:U.defaultEnvironmentId)||""),title:"Click to change default environment","aria-label":"Edit project default environment","data-testid":"edit-env-button",children:[_e?h.jsxs("span",{className:D.envRow,children:[h.jsx("span",{className:`${D.envDot} ${T3(_e.status)}`}),_e.displayName]}):h.jsx("span",{className:D.metaPlaceholder,children:(U==null?void 0:U.defaultEnvironmentId)||"No default environment"}),h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:D.metaRow,children:[h.jsx("span",{className:D.metaLabel,children:"Worktree Base"}),h.jsx("div",{className:D.metaValue,children:b==="worktreeBasePath"?h.jsxs("div",{className:D.editFieldWrapper,children:[h.jsx("input",{ref:ne,className:`${D.editInput} ${j?D.editInputInvalid:""}`,value:T,onChange:Q=>{A(Q.target.value),N("")},onBlur:Q=>{if(X.current==="worktreeBasePath"){X.current=null;return}Q.relatedTarget instanceof HTMLElement&&Q.relatedTarget.dataset.editAction==="worktreeBasePath"||je("worktreeBasePath")},onKeyDown:Q=>Pe(Q,"worktreeBasePath"),placeholder:"/workspaces/my-repo","aria-label":"Worktree base path","data-testid":"edit-worktree-base-path-input"}),we("worktreeBasePath")&&h.jsx("span",{className:D.unsavedDot,title:"Unsaved changes"}),j&&h.jsx("span",{className:D.editError,"data-testid":"edit-error",children:j}),h.jsx("span",{className:D.editHint,children:Ce})]}):h.jsxs("button",{type:"button",className:D.metaValueClickable,onClick:()=>Y("worktreeBasePath",(U==null?void 0:U.worktreeBasePath)||""),title:"Click to edit worktree base path","aria-label":"Edit worktree base path","data-testid":"edit-worktree-base-path-button",children:[U!=null&&U.worktreeBasePath?h.jsx("span",{children:U.worktreeBasePath}):h.jsx("span",{className:D.metaPlaceholder,children:"Default (server default)"}),h.jsx("span",{className:D.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),U&&h.jsxs("div",{className:D.metaTimestamps,children:[h.jsxs("span",{className:D.metaTimestamp,children:["Created ",h0(U.createdAt)]}),U.updatedAt&&U.updatedAt!==U.createdAt&&h.jsxs("span",{className:D.metaTimestamp,children:["· Updated ",h0(U.updatedAt)]})]})]}),ye>0&&h.jsxs("div",{className:D.progressBarContainer,"data-testid":"progress-bar",children:[h.jsx("div",{className:D.progressBar,children:h.jsx("div",{className:D.progressFill,style:{width:`${q}%`}})}),h.jsxs("span",{className:D.progressLabel,children:[te,"/",ye]})]}),h.jsxs("div",{className:D.tabBar,role:"tablist","aria-label":"Project view",children:[h.jsx("button",{role:"tab","aria-selected":m==="graph",className:`${D.tab} ${m==="graph"?D.active:""}`,onClick:()=>p("graph"),children:"Graph"}),h.jsx("button",{role:"tab","aria-selected":m==="board",className:`${D.tab} ${m==="board"?D.active:""}`,onClick:()=>p("board"),"data-testid":"board-tab",children:"Board"}),h.jsx("button",{role:"tab","aria-selected":m==="tasks",className:`${D.tab} ${m==="tasks"?D.active:""}`,onClick:()=>p("tasks"),children:"Tasks"})]}),m==="tasks"&&ye>0&&h.jsxs("div",{className:D.projectSummary,children:[h.jsx("span",{className:D.projectSummaryTitle,children:`${te}/${ye} tasks complete`}),h.jsx("span",{className:D.projectSummarySubtitle,children:"Select a task or click + to create one"})]}),m==="tasks"&&ye===0&&h.jsxs("div",{className:D.emptyCta,children:[h.jsx("button",{className:D.ctaButton,onClick:()=>a($s(n)),children:"Create Task"}),h.jsx("div",{className:D.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),m==="board"&&h.jsx(_3,{projectId:n}),m==="graph"&&h.jsx(ZM,{projectId:n}),h.jsx(Sc,{isOpen:g,title:"Archive Project?",description:"This will hide the project from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{U&&(u(U.id),a("/",{replace:!0})),v(!1)},onCancel:()=>v(!1)})]})}const C3="_container_cddyd_1",A3="_header_cddyd_8",j3="_headerTitle_cddyd_35",N3="_badge_cddyd_44",w3="_headerActions_cddyd_54",D3="_body_cddyd_61",k3="_formContent_cddyd_73",R3="_section_cddyd_85",M3="_label_cddyd_91",O3="_titleInput_cddyd_98",B3="_descriptionTextarea_cddyd_131",L3="_parentContext_cddyd_167",z3="_parentLabel_cddyd_175",U3="_parentName_cddyd_182",V3="_depList_cddyd_220",I3="_depItem_cddyd_226",H3="_depItemSelected_cddyd_248",q3="_noDeps_cddyd_252",G3="_btnPrimary_cddyd_258",P3="_btnGhost_cddyd_289",gt={container:C3,header:A3,headerTitle:j3,badge:N3,headerActions:w3,body:D3,formContent:k3,section:R3,label:M3,titleInput:O3,descriptionTextarea:B3,parentContext:L3,parentLabel:z3,parentName:U3,depList:V3,depItem:I3,depItemSelected:H3,noDeps:q3,btnPrimary:G3,btnGhost:P3};function V1({mode:n,taskId:a,projectId:l,parentTaskId:o}){const{tasks:r,createTask:u,updateTask:d}=nn(),{showToast:m}=go(),p=na(),g=n==="edit",v=g&&a?r.find(U=>U.id===a):void 0,b=g?(v==null?void 0:v.projectId)??"":l??"",x=g?(v==null?void 0:v.parentTaskId)??"":o??"",T=x?r.find(U=>U.id===x):void 0,[A,j]=S.useState((v==null?void 0:v.title)??""),[N,C]=S.useState((v==null?void 0:v.description)??""),[B,R]=S.useState((v==null?void 0:v.dependsOn)??[]),X=S.useRef(!1);S.useEffect(()=>{g&&v&&!X.current&&(X.current=!0,j(v.title),C(v.description),R(v.dependsOn))},[g,v]);const H=r.filter(U=>U.projectId===b&&(!g||U.id!==a)&&U.id!==x),J=A.trim().length>0&&(!g||v!==void 0)&&(g||b.length>0),W=U=>{R(pe=>pe.includes(U)?pe.filter(te=>te!==U):[...pe,U])},F=()=>{J&&(g&&v===void 0||(g&&a?(d(a,A.trim(),N,B),m("Task updated","success"),p(ms(a),{replace:!0})):(u(b,A.trim(),N,B.length>0?B:void 0,x||void 0),m("Task created","success"),p(oo(b),{replace:!0}))))},ne=()=>{p(g&&a?ms(a):oo(b))},ge=g?"edit task":x?"child task":"new task";return h.jsxs("div",{className:gt.container,children:[h.jsxs("div",{className:gt.header,children:[h.jsxs("div",{className:gt.headerTitle,children:[h.jsx("span",{className:gt.badge,children:ge}),T&&h.jsxs("span",{className:gt.parentContext,children:[h.jsx("span",{className:gt.parentLabel,children:"Child of"}),h.jsx("span",{className:gt.parentName,children:T.title})]})]}),h.jsxs("div",{className:gt.headerActions,children:[h.jsx("button",{onClick:F,disabled:!J,className:gt.btnPrimary,"data-testid":"task-edit-save",children:g?"Save Changes":"Create"}),h.jsx("button",{onClick:ne,className:gt.btnGhost,children:"Cancel"})]})]}),h.jsx("div",{className:gt.body,children:h.jsxs("div",{className:gt.formContent,children:[h.jsxs("div",{className:gt.section,children:[h.jsx("label",{className:gt.label,htmlFor:"task-edit-title",children:"Title"}),h.jsx("input",{id:"task-edit-title",type:"text",value:A,onChange:U=>j(U.target.value),placeholder:"Task title...",autoFocus:!0,className:gt.titleInput,"data-testid":"task-edit-title",onKeyDown:U=>{U.key==="Enter"&&J&&F()}})]}),h.jsxs("div",{className:gt.section,children:[h.jsx("label",{className:gt.label,htmlFor:"task-edit-description",children:"Description"}),h.jsx("textarea",{id:"task-edit-description",value:N,onChange:U=>C(U.target.value),placeholder:"Describe the task... (markdown supported)",className:gt.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),h.jsxs("div",{className:gt.section,children:[h.jsx("div",{className:gt.label,children:"Dependencies"}),H.length===0?h.jsx("div",{className:gt.noDeps,children:"No other tasks in this project"}):h.jsx("div",{className:gt.depList,children:H.map(U=>{const pe=B.includes(U.id);return h.jsxs("label",{className:`${gt.depItem} ${pe?gt.depItemSelected:""}`,"data-testid":`dep-option-${U.id}`,children:[h.jsx("input",{type:"checkbox",checked:pe,onChange:()=>W(U.id)}),U.title,h.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",U.status,")"]})]},U.id)})})]})]})})]})}function F3(){const[n]=If(),a=n.get("project")??"",l=n.get("parent")??void 0;return a?h.jsx(V1,{mode:"new",projectId:a,parentTaskId:l}):h.jsx(Pr,{to:"/",replace:!0})}function $3(){const{taskId:n}=dc();return h.jsx(V1,{mode:"edit",taskId:n})}const Y3="_container_1pqxm_1",K3="_emptyState_1pqxm_8",Z3="_card_1pqxm_14",X3="_cardHeader_1pqxm_34",Q3="_categoryBadge_1pqxm_46",J3="_findingTitle_1pqxm_54",W3="_findingDate_1pqxm_60",e5="_findingContent_1pqxm_72",t5="_tags_1pqxm_78",n5="_tag_1pqxm_78",ra={container:Y3,emptyState:K3,card:Z3,cardHeader:X3,categoryBadge:Q3,findingTitle:J3,findingDate:W3,findingContent:e5,tags:t5,tag:n5};function a5(n){const a=new Date(n),l=new Date,o=l.getTime()-a.getTime(),r=Math.floor(o/1e3),u=Math.floor(r/60),d=Math.floor(u/60),m=Math.floor(d/24);if(r<60)return"just now";if(u<60)return`${u}m ago`;if(d<24)return`${d}h ago`;if(m===1)return"yesterday";if(m<7)return`${m} days ago`;const p=a.getFullYear()===l.getFullYear(),g=a.toLocaleString("en-US",{month:"short"}),v=a.getDate();return p?`${g} ${v}`:`${g} ${v} ${a.getFullYear()}`}const m0={architecture:{text:"var(--accent-blue)",bg:"var(--accent-blue-dim)"},api:{text:"var(--accent-green)",bg:"var(--accent-green-dim)"},bug:{text:"var(--accent-red)",bg:"var(--accent-red-dim)"},decision:{text:"var(--accent-yellow)",bg:"var(--accent-yellow-dim)"},dependency:{text:"var(--accent-purple)",bg:"var(--accent-purple-dim)"},pattern:{text:"var(--accent-cyan)",bg:"var(--accent-cyan-dim)"},general:{text:"var(--text-secondary)",bg:"var(--bg-elevated)"}};function s5({projectId:n}){const{findings:a}=nn(),l=a.filter(o=>o.projectId===n);return l.length===0?h.jsx("div",{className:ra.emptyState,children:"No findings yet. Agents will post discoveries here."}):h.jsx("div",{className:ra.container,children:l.map((o,r)=>{const u=m0[o.category]||m0.general;return h.jsxs($n.div,{className:ra.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},children:[h.jsxs("div",{className:ra.cardHeader,children:[h.jsx("span",{className:ra.categoryBadge,style:{background:u.bg,color:u.text},children:o.category}),h.jsx("span",{className:ra.findingTitle,children:o.title}),h.jsx("span",{className:ra.findingDate,title:o.createdAt,children:a5(o.createdAt)})]}),h.jsx("div",{className:ra.findingContent,children:o.content.length>300?o.content.slice(0,300)+"...":o.content}),o.tags.length>0&&h.jsx("div",{className:ra.tags,children:o.tags.map(d=>h.jsx("span",{className:ra.tag,style:{color:u.text,textShadow:`0 0 8px ${u.text}`},children:d},d))})]},o.id)})})}function qr(n){if(!n)return"—";const a=new Date(n);return isNaN(a.getTime())?"—":a.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Qd(n,a){if(!n||!a)return;const l=new Date(a).getTime()-new Date(n).getTime();if(isNaN(l)||l<0)return;const o=Math.floor(l/6e4),r=Math.floor(l%6e4/1e3);if(o===0)return`${r}s`;const u=Math.floor(o/60),d=o%60;return u===0?`${o}m ${r}s`:`${u}h ${d}m`}function i5(n){const a=n.toLowerCase();return a==="ready"||a==="running"||a==="available"||a==="connected"?D.envDotGreen:a==="provisioning"||a==="starting"||a==="pending"||a==="connecting"?D.envDotYellow:a==="error"||a==="failed"||a==="disconnected"?D.envDotRed:D.envDotGray}function l5({status:n}){const a=vs(n),l=qw(n);return h.jsx("span",{className:`${D.statusBadge} ${D[l]??D.statusPending}`,children:a.label})}function o5({task:n,tasksById:a,environments:l,projects:o,taskSessions:r}){const u=r.length>0?r[r.length-1]:void 0,d=(u==null?void 0:u.environmentId)??"",m=d?l.find(v=>v.id===d):void 0,p=o.find(v=>v.id===n.projectId),g=n.branch&&(p!=null&&p.repoUrl)?`${p.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(n.branch)}`:void 0;return h.jsxs("div",{className:D.overviewDashboard,children:[h.jsxs("div",{className:D.overviewHero,children:[h.jsx(l5,{status:n.status}),n.branch&&h.jsx("span",{className:D.overviewBranchPill,children:g?h.jsxs("a",{href:g,target:"_blank",rel:"noreferrer noopener",className:D.branchLink,children:["🔗"," ",n.branch]}):h.jsxs("span",{children:["🔗"," ",n.branch]})})]}),typeof n.description=="string"&&n.description&&h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Description"}),h.jsx("div",{className:D.overviewMarkdown,children:h.jsx(kf,{remarkPlugins:[Rf],children:n.description})})]}),d&&h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Environment"}),h.jsxs("div",{className:D.envRow,children:[m&&h.jsx("span",{className:`${D.envDot} ${i5(m.status)}`,title:m.status,"aria-label":`Status: ${m.status}`,role:"img"}),h.jsx("span",{className:D.overviewValue,children:(m==null?void 0:m.displayName)??d})]})]}),h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Dependencies"}),n.dependsOn.length===0?h.jsx("div",{className:D.overviewMuted,children:"None"}):h.jsx("div",{className:D.depList,children:n.dependsOn.map(v=>{const b=a.get(v),x=(b==null?void 0:b.status)==="complete";return h.jsxs("div",{className:`${D.depItem} ${x?D.depDone:D.depBlocked}`,children:[h.jsx("span",{children:x?"✓":"○"}),h.jsx("span",{children:(b==null?void 0:b.title)??v})]},v)})})]}),h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Timeline"}),h.jsxs("div",{className:D.timeline,children:[n.createdAt&&h.jsxs("div",{className:D.timelineRow,children:[h.jsx("span",{className:D.timelineKey,children:"Created"}),h.jsx("span",{className:D.timelineValue,children:qr(n.createdAt)})]}),n.assignedAt&&(()=>{const v=Qd(n.createdAt,n.assignedAt);return h.jsxs("div",{className:D.timelineRow,children:[h.jsx("span",{className:D.timelineKey,children:"Assigned"}),h.jsx("span",{className:D.timelineValue,children:qr(n.assignedAt)}),v!==void 0&&h.jsx("span",{className:D.timelineDelta,children:v})]})})(),n.startedAt&&(()=>{const v=Qd(n.assignedAt??n.createdAt,n.startedAt);return h.jsxs("div",{className:D.timelineRow,children:[h.jsx("span",{className:D.timelineKey,children:"Started"}),h.jsx("span",{className:D.timelineValue,children:qr(n.startedAt)}),v!==void 0&&h.jsx("span",{className:D.timelineDelta,children:v})]})})(),n.completedAt&&(()=>{const v=Qd(n.startedAt,n.completedAt);return h.jsxs("div",{className:D.timelineRow,children:[h.jsx("span",{className:D.timelineKey,children:"Completed"}),h.jsx("span",{className:D.timelineValue,children:qr(n.completedAt)}),v!==void 0&&h.jsx("span",{className:D.timelineDelta,children:v})]})})(),!n.createdAt&&!n.assignedAt&&!n.startedAt&&!n.completedAt&&h.jsx("div",{className:D.overviewMuted,children:"No timing data"})]})]}),n.reviewNotes&&h.jsxs("div",{className:D.overviewSection,children:[h.jsx("div",{className:D.overviewLabel,children:"Review Notes"}),h.jsx("div",{className:D.reviewNotes,children:n.reviewNotes})]})]})}function r5({eventsDropped:n}){return n<=0?h.jsx(h.Fragment,{}):h.jsxs("div",{className:D.eventOverflowWarning,role:"alert",children:["⚠ ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown."]})}function c5({task:n,sessionId:a,isBlocked:l,onStart:o,onResume:r,onStop:u,onComplete:d,onDelete:m,onEdit:p}){if(n.status==="not_started")return l?h.jsxs("div",{className:D.headerActions,children:[h.jsx("button",{onClick:p,className:D.btnGhost,children:"Edit"}),h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})]}):h.jsxs("div",{className:D.headerActions,children:[h.jsx("button",{onClick:o,className:D.btnPrimary,children:"Start"}),h.jsx("button",{onClick:p,className:D.btnGhost,children:"Edit"}),h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})]});if(n.status==="working")return h.jsx("div",{className:D.headerActions,children:h.jsx("button",{onClick:u,disabled:!a,className:D.btnDanger,children:"Stop"})});if(n.status==="paused")return h.jsxs("div",{className:D.headerActions,children:[h.jsx("button",{onClick:d,className:D.btnPrimary,children:"Complete"}),h.jsx("button",{onClick:r,className:D.btnGhost,children:"Resume"}),h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})]});if(n.status==="complete")return h.jsx("div",{className:D.headerActions,children:h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})});if(n.status==="failed")return h.jsxs("div",{className:D.headerActions,children:[h.jsx("button",{onClick:o,className:D.btnPrimary,children:"Retry"}),h.jsx("button",{onClick:m,className:D.btnDanger,children:"Delete"})]})}function u5({taskSessions:n,selectedSessionId:a,onSelect:l}){if(!(n.length<2))return h.jsxs("div",{className:D.attemptSelector,"data-testid":"attempt-selector",children:[h.jsx("span",{className:D.attemptLabel,children:"Attempts:"}),n.map((o,r)=>{const u=o.id===a,d=o.status==="completed"?"✓":o.status==="failed"?"✗":o.status==="running"||o.status==="idle"?"●":"";return h.jsxs("button",{className:`${D.attemptButton} ${u?D.attemptActive:""}`,onClick:()=>l(o.id),title:`Attempt #${r+1} — ${o.status}`,"aria-label":`Attempt #${r+1}, ${o.status}`,"aria-pressed":u,"data-testid":`attempt-${r+1}`,children:["#",r+1,d&&h.jsx("span",{className:D.attemptStatus,children:d})]},o.id)})]})}function Jd(){const{taskId:n}=dc(),a=hn(),l=na(),{events:o,eventsDropped:r,tasks:u,environments:d,loadSessionEvents:m,loadFindings:p,kill:g,startTask:v,resumeTask:b,completeTask:x,deleteTask:T,projects:A,taskSessions:j,loadTaskSessions:N}=nn(),C=S.useRef(null),B=S.useRef(void 0),R=S.useRef(void 0),X=S.useRef(void 0),H=S.useRef(void 0),J=S.useRef(void 0),W=a.pathname.endsWith("/stream")?"stream":a.pathname.endsWith("/findings")?"findings":"overview",[F,ne]=S.useState(W),[ge,U]=S.useState(!1),[pe,te]=S.useState(void 0),ye=S.useRef(W);W!==ye.current&&(ye.current=W,W!==F&&ne(W));const q=u.find(P=>P.id===n),z=(q==null?void 0:q.projectId)||void 0,Y=q?j[q.id]??[]:[];let ee;pe&&Y.some(P=>P.id===pe)?ee=pe:ee=(q==null?void 0:q.latestSessionId)||void 0;const ke=()=>{U(!0)},je=()=>{q&&(T(q.id),U(!1),l(oo(q.projectId),{replace:!0}))};if((q==null?void 0:q.id)!==R.current&&(R.current=q==null?void 0:q.id,pe!==void 0&&te(void 0)),S.useEffect(()=>{if(!(q!=null&&q.id))return;const P=q.id!==H.current,I=q.latestSessionId!==J.current;(P||I)&&(H.current=q.id,J.current=q.latestSessionId,N(q.id))},[q==null?void 0:q.id,q==null?void 0:q.latestSessionId,N]),(q==null?void 0:q.status)!==X.current){X.current=q==null?void 0:q.status;const P=(q==null?void 0:q.status)==="not_started"?"overview":(q==null?void 0:q.status)==="working"||(q==null?void 0:q.status)==="paused"?"stream":(q==null?void 0:q.status)==="complete"?"findings":void 0;P&&P!==F&&ne(P)}const Pe=S.useMemo(()=>new Map(u.map(P=>[P.id,P])),[u]),we=S.useMemo(()=>{const P=ee?o.filter(I=>I.sessionId===ee):[];return U1(z1(P))},[o,ee]),_e=q?q.dependsOn.some(P=>{const I=Pe.get(P);return I!==void 0&&I.status!=="complete"}):!1,Ce=S.useMemo(()=>_M(n,A,Pe),[n,A,Pe]);S.useEffect(()=>{ee&&ee!==B.current&&(B.current=ee,m(ee))},[ee,m]),S.useEffect(()=>{F==="findings"&&z&&p(z)},[F,z,p]),S.useEffect(()=>{C.current&&F==="stream"&&(C.current.scrollTop=C.current.scrollHeight)},[we.length,F]);const Q=P=>{ne(P),l(ms(n,P==="overview"?void 0:P))};return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:Ce}),h.jsxs("div",{className:D.header,children:[h.jsxs("span",{className:D.headerTitle,children:[h.jsx("span",{"data-testid":"task-title",children:(q==null?void 0:q.title)||n}),q&&h.jsx("span",{className:D.taskStatusBadge,"data-testid":"task-status",children:q.status}),(q==null?void 0:q.branch)&&h.jsx("span",{className:D.taskBranch,children:q.branch}),_e&&h.jsx("span",{className:D.taskBlockedBadge,children:"blocked"})]}),q&&h.jsx(c5,{task:q,sessionId:ee,isBlocked:_e,onStart:()=>v(q.id),onResume:()=>b(q.id),onStop:()=>ee&&g(ee),onComplete:()=>x(q.id),onDelete:ke,onEdit:()=>l(GT(q.id))})]}),h.jsxs("div",{className:D.tabBar,role:"tablist","aria-label":"Task view",children:[h.jsx("button",{role:"tab","aria-selected":F==="overview",className:`${D.tab} ${F==="overview"?D.active:""}`,onClick:()=>Q("overview"),children:"Overview"}),h.jsx("button",{role:"tab","aria-selected":F==="stream",className:`${D.tab} ${F==="stream"?D.active:""}`,onClick:()=>Q("stream"),children:"Stream"}),h.jsx("button",{role:"tab","aria-selected":F==="findings",className:`${D.tab} ${F==="findings"?D.active:""}`,onClick:()=>Q("findings"),children:"Findings"})]}),h.jsxs(ys,{mode:"wait",children:[F==="overview"&&h.jsx($n.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:D.overviewContent,children:q?h.jsx(o5,{task:q,tasksById:Pe,environments:d,projects:A,taskSessions:Y}):h.jsx("div",{className:D.waitingMessage,children:"No additional details"})},"overview"),F==="stream"&&h.jsxs($n.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[h.jsx(u5,{taskSessions:Y,selectedSessionId:ee,onSelect:P=>te(P)}),h.jsxs("div",{ref:C,className:D.eventScroll,children:[!ee&&q&&h.jsxs("div",{className:D.emptyCta,children:[h.jsx("button",{className:D.ctaButton,onClick:()=>v(q.id),children:"Start Task"}),h.jsx("div",{className:D.ctaDescription,children:"Click to begin agent execution"})]}),ee&&we.length===0&&h.jsx("div",{className:D.waitingMessage,children:"Waiting for events..."}),h.jsx(r5,{eventsDropped:r}),we.map((P,I)=>h.jsx(w1,{event:P,toolUseCtx:P.toolUseCtx},`${P.sessionId}-${P.timestamp}-${I}`))]})]},"stream"),F==="findings"&&h.jsx($n.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:D.tabContent,children:z?h.jsx(s5,{projectId:z}):h.jsx("div",{className:D.noContext,children:"Navigate to a task within a project to view findings"})},"findings")]}),q&&h.jsx(Sc,{isOpen:ge,title:"Delete Task?",description:`"${q.title}" will be permanently removed.`,onConfirm:je,onCancel:()=>U(!1)})]})}function d5(){const n=vM();return h.jsxs("div",{className:D.panelContainer,children:[h.jsx(Qi,{segments:n}),h.jsx("div",{className:D.emptyState,children:"Configure the new environment below"})]})}const f5="_layout_1sbe4_1",h5="_content_1sbe4_8",p0={layout:f5,content:h5},m5={environments:"Environments",credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About"};function p5(){const a=hn().pathname.replace(/^\/settings\/?/,"").split("/")[0],l=m5[a],o=gM(l);return h.jsxs("div",{className:p0.layout,children:[h.jsx(Qi,{segments:o}),h.jsx("div",{className:p0.content,children:h.jsx(k0,{})})]})}const g5="_nav_13n0b_1",v5="_tab_13n0b_44",y5="_tabIcon_13n0b_82",b5="_tabActive_13n0b_88",Gr={nav:g5,tab:v5,tabIcon:y5,tabActive:b5},Oa=[{path:"environments",label:"Environments",icon:"🖥️"},{path:"credentials",label:"Credentials",icon:"🔑"},{path:"personas",label:"Personas",icon:"👤"},{path:"appearance",label:"Appearance",icon:"🎨"},{path:"about",label:"About",icon:"ℹ️"}];function S5(){var d;const n=hn(),a=na(),l=S.useRef(null),o=((d=Oa.find(m=>n.pathname===`${qi}/${m.path}`))==null?void 0:d.path)??Oa[0].path,r=S.useCallback(m=>{a(`${qi}/${m}`)},[a]),u=S.useCallback(m=>{var T,A;const p=(T=l.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!p)return;const g=Array.from(p).findIndex(j=>j===document.activeElement),v=g>=0?g:Oa.findIndex(j=>j.path===o);let b=v;if(m.key==="ArrowDown")m.preventDefault(),b=(v+1)%Oa.length;else if(m.key==="ArrowUp")m.preventDefault(),b=(v-1+Oa.length)%Oa.length;else if(m.key==="Home")m.preventDefault(),b=0;else if(m.key==="End")m.preventDefault(),b=Oa.length-1;else return;const x=Oa[b].path;a(`${qi}/${x}`),(A=p[b])==null||A.focus()},[o,a]);return h.jsx("nav",{className:Gr.nav,ref:l,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:Oa.map(m=>{const p=m.path===o;return h.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Gr.tab} ${p?Gr.tabActive:""}`,onClick:()=>r(m.path),children:[h.jsx("span",{className:Gr.tabIcon,"aria-hidden":"true",children:m.icon}),m.label]},m.path)})})}const _5="_container_1nk8c_1",x5="_header_1nk8c_5",T5="_headerLabel_1nk8c_12",E5="_addButton_1nk8c_20",C5="_envRow_1nk8c_55",A5="_targeted_1nk8c_69",j5="_expanded_1nk8c_72",N5="_statusDot_1nk8c_76",w5="_pulse_1nk8c_79",D5="_envName_1nk8c_83",k5="_envActions_1nk8c_87",R5="_idleLabel_1nk8c_94",M5="_newChatButton_1nk8c_99",O5="_envActionsRow_1nk8c_126",B5="_connectButton_1nk8c_134",L5="_stopButton_1nk8c_160",z5="_deleteButton_1nk8c_186",U5="_provisionMessage_1nk8c_213",V5="_errorMessage_1nk8c_220",I5="_sessionRow_1nk8c_227",H5="_selected_1nk8c_243",q5="_sessionDot_1nk8c_248",G5="_sessionSummaryRow_1nk8c_252",P5="_sessionExpandArrow_1nk8c_272",F5="_sessionSummaryText_1nk8c_283",$5="_sessionCountBadge_1nk8c_290",Y5="_emptyCta_1nk8c_313",K5="_ctaDescription_1nk8c_326",Z5="_ctaButton_1nk8c_332",Qe={container:_5,header:x5,headerLabel:T5,addButton:E5,envRow:C5,targeted:A5,expanded:j5,statusDot:N5,pulse:w5,envName:D5,envActions:k5,idleLabel:R5,newChatButton:M5,envActionsRow:O5,connectButton:B5,stopButton:L5,deleteButton:z5,provisionMessage:U5,errorMessage:V5,sessionRow:I5,selected:H5,sessionDot:q5,sessionSummaryRow:G5,sessionExpandArrow:P5,sessionSummaryText:F5,sessionCountBadge:$5,emptyCta:Y5,ctaDescription:K5,ctaButton:Z5},X5={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"},Q5={running:"running",idle:"awaiting input",failed:"failed",interrupted:"interrupted",completed:"completed"},g0=["running","idle","failed","interrupted","completed"],J5=.2;function W5(n){const a={};for(const u of n)a[u.status]=(a[u.status]||0)+1;const l=g0.filter(u=>a[u]>0).map(u=>`${a[u]} ${Q5[u]||u}`),o=new Set(g0),r=Object.keys(a).filter(u=>!o.has(u)).sort().map(u=>`${a[u]} ${u}`);return[...l,...r].join(", ")}function eO({status:n}){const a=n==="running"?"var(--accent-green)":n==="idle"?"var(--accent-yellow)":n==="completed"?"var(--text-secondary)":n==="failed"||n==="interrupted"?"var(--accent-red)":"var(--text-tertiary)";return h.jsx("span",{className:Qe.sessionDot,style:{color:a},children:"●"})}function tO({env:n,envSessions:a,selectedSessionId:l,isNewChatTarget:o,expanded:r,onToggleExpand:u,sessionsExpanded:d,onToggleSessionsExpand:m,provisionProgress:p,onProvision:g,onStop:v,onRemove:b,navigate:x}){const[T,A]=S.useState(!1),j=X5[n.status]||"var(--text-tertiary)",N=n.status==="connected",C=n.status==="connecting",B=n.status==="disconnected"||n.status==="error";return h.jsxs("div",{children:[h.jsx(Sc,{isOpen:T,title:"Delete Environment?",description:`"${n.displayName||n.id}" will be permanently removed. This destroys the workspace and removes all data.`,onConfirm:()=>{b(n.id),A(!1)},onCancel:()=>A(!1)}),h.jsxs("div",{className:`${Qe.envRow} ${o?Qe.targeted:""} ${r?Qe.expanded:""}`,"data-testid":"env-row",onClick:u,children:[h.jsx("span",{className:`${Qe.statusDot} ${N?Qe.pulse:""}`,style:{color:j},children:"●"}),h.jsx("span",{className:Qe.envName,title:n.displayName||n.id,children:n.displayName||n.id}),h.jsxs("span",{className:Qe.envActions,children:[a.length===0&&!o&&!r&&h.jsx("span",{className:Qe.idleLabel,children:"(idle)"}),N&&h.jsx("button",{onClick:R=>{R.stopPropagation(),x(z0(n.id,n.defaultRuntime||"claude-code"))},title:"New chat",className:Qe.newChatButton,children:"+"})]})]}),r&&h.jsxs("div",{className:Qe.envActionsRow,children:[C&&p&&h.jsx("span",{className:Qe.provisionMessage,children:p.message}),n.status==="error"&&(p==null?void 0:p.stage)==="error"&&h.jsx("span",{className:Qe.errorMessage,children:p.message}),B&&h.jsx("button",{onClick:R=>{R.stopPropagation(),g(n.id)},className:Qe.connectButton,children:n.status==="error"?"Retry":"Connect"}),N&&h.jsx("button",{onClick:R=>{R.stopPropagation(),v(n.id)},className:Qe.stopButton,children:"Stop"}),!C&&h.jsx("button",{onClick:R=>{R.stopPropagation(),A(!0)},className:Qe.deleteButton,children:"Delete"})]}),a.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:Qe.sessionSummaryRow,"data-testid":"session-summary-row",role:"button",tabIndex:0,"aria-expanded":d,"aria-label":d?"Collapse sessions":"Expand sessions",onClick:m,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),m())},children:[h.jsx("span",{className:`${Qe.sessionExpandArrow} ${d?Qe.expanded:""}`,children:"▸"}),h.jsx("span",{className:Qe.sessionSummaryText,children:W5(a)}),h.jsx("span",{className:Qe.sessionCountBadge,children:a.length})]}),h.jsx(ys,{children:d&&h.jsx($n.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:J5,ease:"easeInOut"},style:{overflow:"hidden"},children:a.map(R=>h.jsxs("div",{onClick:X=>{X.stopPropagation(),x(L0(R.id))},className:`${Qe.sessionRow} ${l===R.id?Qe.selected:""}`,title:R.prompt,"data-testid":"session-row",children:[h.jsx(eO,{status:R.status})," ",R.prompt.length>24?R.prompt.slice(0,24)+"...":R.prompt]},R.id))})})]})]})}function nO(){const{environments:n,sessions:a,provisionStatus:l,provisionEnvironment:o,stopEnvironment:r,removeEnvironment:u}=nn(),d=na(),[m,p]=S.useState(null),[g,v]=S.useState(new Set),b=dn("/sessions/:sessionId"),x=dn("/sessions/new"),T=(b==null?void 0:b.params.sessionId)!=="new"?b==null?void 0:b.params.sessionId:void 0,[A]=If(),j=x?A.get("env")??void 0:void 0;return h.jsxs("div",{className:Qe.container,children:[h.jsxs("div",{className:Qe.header,children:[h.jsx("span",{className:Qe.headerLabel,children:"Environments"}),h.jsx("button",{className:Qe.addButton,onClick:()=>d(jv),title:"Add environment",children:"+ Add Environment"})]}),n.length===0&&h.jsxs("div",{className:Qe.emptyCta,children:[h.jsx("button",{className:Qe.ctaButton,onClick:()=>d(jv),children:"Add Environment"}),h.jsx("div",{className:Qe.ctaDescription,children:"Connect an environment to run agents"})]}),n.map(N=>{const C=a.filter(B=>B.environmentId===N.id);return h.jsx(tO,{env:N,envSessions:C,selectedSessionId:T,isNewChatTarget:j===N.id,expanded:m===N.id,onToggleExpand:()=>p(m===N.id?null:N.id),sessionsExpanded:g.has(N.id),onToggleSessionsExpand:()=>{v(B=>{const R=new Set(B);return R.has(N.id)?R.delete(N.id):R.add(N.id),R})},provisionProgress:l[N.id],onProvision:o,onStop:r,onRemove:u,navigate:d},N.id)})]})}function aO(){return h.jsx(nO,{})}const sO="_section_1ingb_14",iO="_sectionTitle_1ingb_26",lO="_sectionDescription_1ingb_35",oO="_tokenList_1ingb_48",rO="_tokenRow_1ingb_55",cO="_tokenBadge_1ingb_68",uO="_tokenName_1ingb_83",dO="_tokenTarget_1ingb_90",fO="_deleteButton_1ingb_99",hO="_addForm_1ingb_113",mO="_formRow_1ingb_119",pO="_input_1ingb_125",gO="_select_1ingb_155",vO="_addButton_1ingb_187",yO="_emptyStateInfo_1ingb_221",bO="_themeOptions_1ingb_229",SO="_themeOption_1ingb_229",_O="_themeOptionSelected_1ingb_254",xO="_themeOptionHeader_1ingb_259",TO="_themeOptionLabel_1ingb_266",EO="_themeOptionDesc_1ingb_273",CO="_variantToggle_1ingb_279",AO="_variantButton_1ingb_286",jO="_variantActive_1ingb_305",NO="_themeSwatches_1ingb_311",wO="_themeSwatch_1ingb_311",DO="_systemToggle_1ingb_325",kO="_systemToggleHint_1ingb_341",RO="_themeActive_1ingb_348",MO="_aboutGrid_1ingb_354",OO="_aboutItem_1ingb_360",BO="_aboutLabel_1ingb_373",LO="_aboutValue_1ingb_379",zO="_aboutDot_1ingb_387",UO="_aboutDotConnected_1ingb_394",VO="_aboutDotDisconnected_1ingb_398",he={section:sO,sectionTitle:iO,sectionDescription:lO,tokenList:oO,tokenRow:rO,tokenBadge:cO,tokenName:uO,tokenTarget:dO,deleteButton:fO,addForm:hO,formRow:mO,input:pO,select:gO,addButton:vO,emptyStateInfo:yO,themeOptions:bO,themeOption:SO,themeOptionSelected:_O,themeOptionHeader:xO,themeOptionLabel:TO,themeOptionDesc:EO,variantToggle:CO,variantButton:AO,variantActive:jO,themeSwatches:NO,themeSwatch:wO,systemToggle:DO,systemToggleHint:kO,themeActive:RO,aboutGrid:MO,aboutItem:OO,aboutLabel:BO,aboutValue:LO,aboutDot:zO,aboutDotConnected:UO,aboutDotDisconnected:VO},IO=[{key:"claude",label:"Claude",description:"Forward Claude credentials for AI agent access.",options:[{value:"off",label:"Off"},{value:"subscription",label:"Subscription"},{value:"api_key",label:"API Key"}]},{key:"github",label:"GitHub",description:"Forward GITHUB_TOKEN and GH_TOKEN for git operations.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"copilot",label:"Copilot",description:"Forward Copilot tokens (COPILOT_GITHUB_TOKEN, CLI config).",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"codex",label:"Codex",description:"Forward OPENAI_API_KEY for Codex/OpenAI access.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]}];function HO(){const{credentialProviders:n,updateCredentialProviders:a}=nn(),l=(o,r)=>{const u={...n};o==="claude"?u.claude=r:u[o]=r,a(u)};return h.jsxs("section",{className:he.section,children:[h.jsx("h3",{className:he.sectionTitle,children:"Credential Providers"}),h.jsx("p",{className:he.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),h.jsx("div",{className:he.tokenList,children:IO.map(o=>h.jsxs("div",{className:he.tokenRow,children:[h.jsx("span",{className:he.tokenName,children:o.label}),h.jsx("span",{className:he.tokenTarget,children:o.description}),h.jsx("select",{className:he.select,value:n[o.key],onChange:r=>l(o.key,r.target.value),children:o.options.map(r=>h.jsx("option",{value:r.value,children:r.label},r.value))})]},o.key))})]})}const qO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function GO(){const{tokens:n,setToken:a,deleteToken:l}=nn(),{showToast:o}=go(),[r,u]=S.useState(""),[d,m]=S.useState(""),[p,g]=S.useState("env_var"),[v,b]=S.useState(""),[x,T]=S.useState(null),A=C=>{if(C.preventDefault(),!r||!d)return;const B=p==="env_var"?v||r.toUpperCase()+"_TOKEN":"";a(r,d,p,B,p==="file"?v:""),o("Token saved successfully","success"),u(""),m(""),b("")},j=C=>{T(C)},N=()=>{x&&(l(x),o("Token deleted","info")),T(null)};return h.jsxs(h.Fragment,{children:[h.jsx(Sc,{isOpen:x!==null,title:"Delete Token?",description:x?`"${x}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>T(null)}),h.jsxs("section",{className:he.section,children:[h.jsx("h3",{className:he.sectionTitle,children:"Tokens"}),h.jsx("p",{className:he.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),n.length===0?h.jsx("div",{className:he.emptyStateInfo,children:"Add your first API token to enable service integrations."}):h.jsx("div",{className:he.tokenList,children:n.map(C=>h.jsxs("div",{className:he.tokenRow,children:[h.jsx("span",{className:he.tokenBadge,children:C.tokenType}),h.jsx("span",{className:he.tokenName,children:C.name}),h.jsx("span",{className:he.tokenTarget,children:C.tokenType==="env_var"?C.envVar:C.filePath}),h.jsx("button",{className:he.deleteButton,onClick:()=>j(C.name),title:`Delete ${C.name}`,children:"×"})]},C.name))}),h.jsxs("form",{className:he.addForm,onSubmit:A,children:[h.jsxs("div",{className:he.formRow,children:[h.jsx("input",{className:he.input,type:"text",placeholder:"Token name",value:r,onChange:C=>u(C.target.value)}),h.jsx("input",{className:he.input,type:"password",placeholder:"Value",value:d,onChange:C=>m(C.target.value)})]}),h.jsxs("div",{className:he.formRow,children:[h.jsx("select",{className:he.select,value:p,onChange:C=>g(C.target.value),children:qO.map(C=>h.jsx("option",{value:C.value,children:C.label},C.value))}),h.jsx("input",{className:he.input,type:"text",placeholder:p==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:C=>b(C.target.value)}),h.jsx("button",{className:he.addButton,type:"submit",children:"Add Token"})]})]})]})]})}function PO(){return h.jsxs(h.Fragment,{children:[h.jsx(HO,{}),h.jsx(GO,{})]})}const FO="_container_1xcp7_1",$O="_header_1xcp7_7",YO="_form_1xcp7_19",KO="_formActions_1xcp7_87",ZO="_list_1xcp7_93",XO="_card_1xcp7_99",QO="_active_1xcp7_109",JO="_cardHeader_1xcp7_113",WO="_cardActions_1xcp7_123",eB="_description_1xcp7_128",tB="_meta_1xcp7_134",nB="_promptDetails_1xcp7_151",aB="_promptText_1xcp7_163",sB="_empty_1xcp7_180",iB="_btnPrimary_1xcp7_186",lB="_btnSecondary_1xcp7_220",oB="_btnSmall_1xcp7_247",rB="_btnDanger_1xcp7_273",Mt={container:FO,header:$O,form:YO,formActions:KO,list:ZO,card:XO,active:QO,cardHeader:JO,cardActions:WO,description:eB,meta:tB,promptDetails:nB,promptText:aB,empty:sB,btnPrimary:iB,btnSecondary:lB,btnSmall:oB,btnDanger:rB};function cB(){const{personas:n,createPersona:a,updatePersona:l,deletePersona:o}=nn(),[r,u]=S.useState(null),[d,m]=S.useState(!1),[p,g]=S.useState(null),[v,b]=S.useState(""),[x,T]=S.useState(""),[A,j]=S.useState(""),[N,C]=S.useState(""),[B,R]=S.useState(""),[X,H]=S.useState(0),J=()=>{b(""),T(""),j(""),C(""),R(""),H(0)},W=()=>{J(),u(null),m(!0)},F=te=>{b(te.name),T(te.description),j(te.systemPrompt),C(te.runtime),R(te.model),H(te.maxTurns),u(te),m(!1)},ne=te=>{te.preventDefault(),!(!v.trim()||!A.trim())&&(r?(l(r.id,v,x,A,N,B,X),u(null)):(a(v,x,A,N,B,X),m(!1)),J())},ge=te=>{o(te),g(null),(r==null?void 0:r.id)===te&&(u(null),J())},U=()=>{u(null),m(!1),J()},pe=()=>h.jsxs("form",{onSubmit:ne,className:Mt.form,children:[h.jsx("h3",{children:r?"Edit Persona":"Create Persona"}),h.jsxs("label",{children:["Name",h.jsx("input",{type:"text",value:v,onChange:te=>b(te.target.value),placeholder:"e.g. Frontend Engineer",required:!0})]}),h.jsxs("label",{children:["Description",h.jsx("input",{type:"text",value:x,onChange:te=>T(te.target.value),placeholder:"Brief description..."})]}),h.jsxs("label",{children:["Runtime",h.jsxs("select",{value:N,onChange:te=>C(te.target.value),children:[h.jsx("option",{value:"",children:"Default"}),h.jsx("option",{value:"claude-code",children:"claude-code"}),h.jsx("option",{value:"codex",children:"codex"}),h.jsx("option",{value:"copilot",children:"copilot"})]})]}),h.jsxs("label",{children:["Model",h.jsx("input",{type:"text",value:B,onChange:te=>R(te.target.value),placeholder:"e.g. sonnet"})]}),h.jsxs("label",{children:["Max Turns",h.jsx("input",{type:"number",value:X,onChange:te=>H(parseInt(te.target.value,10)||0),min:0})]}),h.jsxs("label",{children:["System Prompt",h.jsx("textarea",{value:A,onChange:te=>j(te.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0})]}),h.jsxs("div",{className:Mt.formActions,children:[h.jsx("button",{type:"submit",className:Mt.btnPrimary,children:r?"Save":"Create"}),h.jsx("button",{type:"button",onClick:U,className:Mt.btnSecondary,children:"Cancel"})]})]});return h.jsxs("div",{className:Mt.container,children:[h.jsxs("div",{className:Mt.header,children:[h.jsx("h2",{children:"Personas"}),h.jsx("button",{onClick:W,className:Mt.btnPrimary,children:"+ New Persona"})]}),(d||r)&&pe(),n.length===0&&!d?h.jsx("p",{className:Mt.empty,children:"No personas yet. Create one to get started."}):h.jsx("div",{className:Mt.list,children:n.map(te=>h.jsxs("div",{className:`${Mt.card} ${(r==null?void 0:r.id)===te.id?Mt.active:""}`,children:[h.jsxs("div",{className:Mt.cardHeader,children:[h.jsx("strong",{children:te.name}),h.jsxs("div",{className:Mt.cardActions,children:[h.jsx("button",{onClick:()=>F(te),className:Mt.btnSmall,children:"Edit"}),p===te.id?h.jsxs(h.Fragment,{children:[h.jsx("button",{onClick:()=>ge(te.id),className:Mt.btnDanger,children:"Confirm"}),h.jsx("button",{onClick:()=>g(null),className:Mt.btnSmall,children:"Cancel"})]}):h.jsx("button",{onClick:()=>g(te.id),className:Mt.btnSmall,children:"Delete"})]})]}),te.description&&h.jsx("p",{className:Mt.description,children:te.description}),h.jsxs("div",{className:Mt.meta,children:[te.runtime&&h.jsxs("span",{children:["Runtime: ",te.runtime]}),te.model&&h.jsxs("span",{children:["Model: ",te.model]}),te.maxTurns>0&&h.jsxs("span",{children:["Max turns: ",te.maxTurns]})]}),h.jsxs("details",{className:Mt.promptDetails,children:[h.jsx("summary",{children:"System Prompt"}),h.jsx("pre",{className:Mt.promptText,children:te.systemPrompt})]})]},te.id))})]})}function uB(){return h.jsx(cB,{})}function dB(){const{themeId:n,resolvedThemeId:a,setTheme:l,preferSystem:o,setPreferSystem:r}=P0();return h.jsxs("section",{className:he.section,children:[h.jsx("h3",{className:he.sectionTitle,children:"Appearance"}),h.jsx("p",{className:he.sectionDescription,children:"Choose how Grackle looks across the app."}),h.jsx("div",{className:he.themeOptions,children:hc.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),m=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,p=d&&a===u.variantLightId;return h.jsxs("button",{type:"button",className:`${he.themeOption} ${m?he.themeOptionSelected:""}`,"aria-pressed":m,onClick:()=>l(u.id),children:[h.jsxs("span",{className:he.themeOptionHeader,children:[h.jsxs("span",{children:[h.jsx("span",{className:he.themeOptionLabel,children:u.label}),h.jsx("span",{className:he.themeOptionDesc,children:u.description})]}),d&&h.jsxs("span",{className:he.variantToggle,children:[h.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&p?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),r(!1),l(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r(!1),l(u.variantLightId))},"aria-label":"Light variant","aria-pressed":m&&p,children:"☼"}),h.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&!p?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),r(!1),l(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r(!1),l(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":m&&!p,children:"☾"})]})]}),u.swatches&&h.jsx("span",{className:he.themeSwatches,children:u.swatches.map((g,v)=>h.jsx("span",{className:he.themeSwatch,style:{background:g}},v))})]},u.id)})}),h.jsxs("label",{className:he.systemToggle,children:[h.jsx("input",{type:"checkbox",checked:o,onChange:u=>r(u.target.checked)}),h.jsx("span",{children:"Match system light/dark preference"})]}),h.jsx("p",{className:he.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),h.jsxs("p",{className:he.themeActive,children:["Active theme: ",h.jsx("strong",{children:a})]})]})}function fB(){return h.jsx(dB,{})}function hB(){const{connected:n,environments:a,sessions:l}=nn(),o=a.filter(d=>d.status==="connected").length,r=a.length,u=l.filter(d=>["running","idle"].includes(d.status)).length;return h.jsxs("section",{className:he.section,"data-testid":"about-panel",children:[h.jsx("h3",{className:he.sectionTitle,children:"About"}),h.jsx("p",{className:he.sectionDescription,children:"Connection status and application information."}),h.jsxs("div",{className:he.aboutGrid,children:[h.jsxs("div",{className:he.aboutItem,children:[h.jsx("span",{className:he.aboutLabel,children:"Connection"}),h.jsxs("span",{className:he.aboutValue,children:[h.jsx("span",{className:`${he.aboutDot} ${n?he.aboutDotConnected:he.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),h.jsxs("div",{className:he.aboutItem,children:[h.jsx("span",{className:he.aboutLabel,children:"Environments"}),h.jsxs("span",{className:he.aboutValue,children:[o,"/",r," connected"]})]}),h.jsxs("div",{className:he.aboutItem,children:[h.jsx("span",{className:he.aboutLabel,children:"Active Sessions"}),h.jsx("span",{className:he.aboutValue,children:u})]}),h.jsxs("div",{className:he.aboutItem,children:[h.jsx("span",{className:he.aboutLabel,children:"Version"}),h.jsx("span",{className:he.aboutValue,children:"0.33.0"})]})]})]})}function mB(){return h.jsx(hB,{})}const pB="_root_h353j_1",gB="_body_h353j_7",vB="_main_h353j_19",yB="_sidebarWrapper_h353j_26",bB="_overlay_h353j_56",Kl={root:pB,body:gB,main:vB,sidebarWrapper:yB,overlay:bB},SB=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function _B(){const{lastSpawnedId:n,environments:a}=nn(),{showToast:l}=go();_k(a,l);const o=na(),r=hn(),u=r.pathname.startsWith(qi),[d,m]=S.useState(!1),p=S.useCallback(()=>m(g=>!g),[]);return S.useEffect(()=>{m(!1)},[r.pathname]),S.useEffect(()=>{if(!d)return;const g=v=>{v.key==="Escape"&&m(!1)};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[d]),S.useEffect(()=>{n&&!r.pathname.startsWith("/tasks/")&&o(L0(n),{replace:!0})},[n,o,r.pathname]),h.jsxs("div",{className:Kl.root,children:[h.jsx(kE,{onToggleSidebar:u?void 0:p,sidebarOpen:d}),h.jsxs("div",{className:Kl.body,children:[h.jsx("div",{className:Kl.sidebarWrapper,"data-sidebar-open":d,"data-settings":u,children:u?h.jsx(S5,{}):h.jsx(qD,{})}),d&&!u&&h.jsx("div",{className:Kl.overlay,"data-testid":"drawer-overlay",onClick:()=>m(!1)}),h.jsxs("div",{className:Kl.main,children:[h.jsx(k0,{}),h.jsx(ok,{})]})]}),h.jsx(Sk,{})]})}function xB(){return h.jsx(rT,{children:h.jsxs(Ot,{element:h.jsx(_B,{}),children:[h.jsx(Ot,{index:!0,element:h.jsx(mM,{})}),h.jsx(Ot,{path:"sessions/new",element:h.jsx(xM,{})}),h.jsx(Ot,{path:"sessions/:sessionId",element:h.jsx(AM,{})}),h.jsx(Ot,{path:"projects/:projectId",element:h.jsx(E3,{})}),h.jsx(Ot,{path:"tasks/new",element:h.jsx(F3,{})}),h.jsx(Ot,{path:"tasks/:taskId",element:h.jsx(Jd,{})}),h.jsx(Ot,{path:"tasks/:taskId/stream",element:h.jsx(Jd,{})}),h.jsx(Ot,{path:"tasks/:taskId/findings",element:h.jsx(Jd,{})}),h.jsx(Ot,{path:"tasks/:taskId/edit",element:h.jsx($3,{})}),h.jsx(Ot,{path:"environments/new",element:h.jsx(d5,{})}),h.jsxs(Ot,{path:"settings",element:h.jsx(p5,{}),children:[h.jsx(Ot,{index:!0,element:h.jsx(Pr,{to:"environments",replace:!0})}),h.jsx(Ot,{path:"environments",element:h.jsx(aO,{})}),h.jsx(Ot,{path:"credentials",element:h.jsx(PO,{})}),h.jsx(Ot,{path:"tokens",element:h.jsx(Pr,{to:"../credentials",replace:!0})}),h.jsx(Ot,{path:"personas",element:h.jsx(uB,{})}),h.jsx(Ot,{path:"appearance",element:h.jsx(fB,{})}),h.jsx(Ot,{path:"about",element:h.jsx(mB,{})})]}),h.jsx(Ot,{path:"*",element:h.jsx(Pr,{to:"/",replace:!0})})]})})}function TB(){const n=SB?pE:lE;return h.jsx(_E,{children:h.jsx(vE,{children:h.jsx(n,{children:h.jsx(MT,{children:h.jsx(xB,{})})})})})}ux.createRoot(document.getElementById("root")).render(h.jsx(S.StrictMode,{children:h.jsx(TB,{})}));
package/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Grackle</title>
7
- <script type="module" crossorigin src="/assets/index-DVH7e824.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DIyazNaf.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/assets/markdown-gcy1Jmzi.js">
9
9
  <link rel="modulepreload" crossorigin href="/assets/dagview-EHk2VaeR.js">
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-WPaUM7cI.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grackle-ai/web",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "React web UI for the Grackle multi-agent coordination platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "rehype-prism-plus": "^2.0.0",
32
32
  "remark-gfm": "^4.0.0",
33
33
  "react-router": "^7.0.0",
34
- "@grackle-ai/common": "0.33.0"
34
+ "@grackle-ai/common": "0.34.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rushstack/heft": "1.2.4",