@grackle-ai/web 0.37.0 → 0.38.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
  `),W=Pd(ne.entries());!(O=W()).done;){var he=O.value,P=he[0],U=he[1];Q.push({type:"text",value:P===ne.length-1?U:U+`
89
89
  `,position:{start:{line:y+P,column:1},end:{line:y+P,column:1}}})}return y+=se,Q}if(Object.prototype.hasOwnProperty.call(I,"children")){var K=y;return I.children=V(I.children),Q.push(I),I.position={start:{line:K,column:1},end:{line:y,column:1}},Q}return Q.push(I),Q},[])})(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 E,A=(function(V){var X=/{([\d,-]+)}/,Q=V.split(",").map(function(se){return se.trim()}).join();if(X.test(Q)){var I=X.exec(Q)[1],te=ex(I);return function(se){return te.includes(se+1)}}return function(){return!1}})(m),j=(function(V){var X=_f(/showLineNumbers=(\d+)/i,{lines:1});if(X.test(V)){var Q=X.exec(V);return Number(Q.groups.lines)}return 1})(m),C=(function(V){for(var X=new Array(V),Q=0;Q<V;Q++)X[Q]={type:"element",tagName:"span",properties:{className:[]},children:[]};return X})(g.position.end.line),w=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],M=function(){var V,X,Q=E.value,I=Q[0],te=Q[1];te.properties.className=["code-line"];var se=tx(g,function(O){return O.position.start.line<=I+1&&O.position.end.line>=I+1});te.children=se.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||a.showLineNumbers===!0||typeof a.showLineNumbers=="object"&&a.showLineNumbers.includes(v))&&!w.some(function(O){return m.toLowerCase().includes(O)})&&(te.properties.line=[(I+j).toString()],te.properties.className.push("line-number")),A(I)&&te.properties.className.push("highlight-line"),(v==="diff"||(V=v)!=null&&V.includes("diff-"))&&_r(te).substring(0,1)==="-"?te.properties.className.push("deleted"):(v==="diff"||(X=v)!=null&&X.includes("diff-"))&&_r(te).substring(0,1)==="+"&&te.properties.className.push("inserted")},G=Pd(C.entries());!(E=G()).done;)M();C.length>0&&_r(C[C.length-1]).trim()===""&&C.pop(),o.children=C}}}})(W_);const fw="_systemEvent_qvd33_1",hw="_systemTimestamp_qvd33_9",pw="_textEvent_qvd33_13",mw="_toolUseEvent_qvd33_100",gw="_toolUseHeader_qvd33_121",yw="_toolUsePrefix_qvd33_128",vw="_toolUseName_qvd33_133",bw="_toolUseArgs_qvd33_138",Sw="_toolResultEvent_qvd33_149",_w="_toolResultHeader_qvd33_155",xw="_toolResultIndicatorOk_qvd33_179",Tw="_toolResultIndicatorError_qvd33_186",Ew="_toolResultLabel_qvd33_193",Cw="_toolResultToggle_qvd33_197",Aw="_toolResultCommand_qvd33_203",jw="_toolResultEllipsis_qvd33_213",Nw="_toolResultPre_qvd33_217",ww="_errorEvent_qvd33_238",Dw="_statusEvent_qvd33_247",kw="_userInputEvent_qvd33_257",Mw="_userInputContent_qvd33_264",Rw="_defaultEvent_qvd33_281",rt={systemEvent:fw,systemTimestamp:hw,textEvent:pw,toolUseEvent:mw,toolUseHeader:gw,toolUsePrefix:yw,toolUseName:vw,toolUseArgs:bw,toolResultEvent:Sw,toolResultHeader:_w,toolResultIndicatorOk:xw,toolResultIndicatorError:Tw,toolResultLabel:Ew,toolResultToggle:Cw,toolResultCommand:Aw,toolResultEllipsis:jw,toolResultPre:Nw,errorEvent:ww,statusEvent:Dw,userInputEvent:kw,userInputContent:Mw,defaultEvent:Rw};function Ow({time:n,content:a}){return h.jsxs("div",{className:rt.systemEvent,children:[h.jsxs("span",{className:rt.systemTimestamp,children:["[",n,"]"]})," ",a]})}function Bw({content:n}){return h.jsx("div",{className:rt.textEvent,children:h.jsx(Tf,{remarkPlugins:[Ef],rehypePlugins:[dw],children:n})})}function Lw({content:n}){let a="",i=n;try{const o=JSON.parse(n);a=o.tool||"",i=JSON.stringify(o.args,null,2)}catch{}return h.jsxs("div",{className:rt.toolUseEvent,children:[h.jsxs("div",{className:rt.toolUseHeader,children:[h.jsx("span",{className:rt.toolUsePrefix,children:">"}),a?h.jsx("span",{className:rt.toolUseName,children:a}):null]}),h.jsx("pre",{className:rt.toolUseArgs,children:i})]})}const t0=5;function Uw(n,a){if(a==null)return"";if(typeof a!="object")return String(a);const i=a;if(typeof i.command=="string")return i.command;if(typeof i.file_path=="string")return i.file_path;if(typeof i.pattern=="string"){const o=typeof i.path=="string"?` in ${i.path}`:"";return`${i.pattern}${o}`}if(typeof i.path=="string")return i.path;if(typeof i.query=="string")return i.query;try{const o=JSON.stringify(a);return o.length>150?`${o.slice(0,150)}…`:o}catch{return""}}function zw({content:n,raw:a,toolUseCtx:i}){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
  `),p=d.length>t0,m=o?n:d.slice(0,t0).join(`
91
- `),y=((i==null?void 0:i.tool)??"")||(u?"Tool error":"Tool output"),v=i?Uw(i.tool,i.args):"",_=h.jsxs(h.Fragment,{children:[h.jsx("span",{className:u?rt.toolResultIndicatorError:rt.toolResultIndicatorOk,"aria-label":u?"error":"success",children:u?"✗":"✓"}),h.jsx("span",{className:rt.toolResultLabel,children:y}),p&&h.jsx("span",{className:rt.toolResultToggle,"aria-hidden":"true",children:o?"▾":"▸"})]});return h.jsxs("div",{className:rt.toolResultEvent,children:[p?h.jsx("button",{className:rt.toolResultHeader,onClick:()=>{r(T=>!T)},"aria-expanded":o,children:_}):h.jsx("div",{className:rt.toolResultHeader,children:_}),v&&h.jsx("div",{className:rt.toolResultCommand,children:v}),h.jsxs("pre",{className:rt.toolResultPre,children:[m,!o&&p&&h.jsx("span",{className:rt.toolResultEllipsis,children:"…"})]})]})}function Vw({content:n}){return h.jsxs("div",{className:rt.errorEvent,children:["Error: ",n]})}function Iw({content:n}){return h.jsxs("div",{className:rt.statusEvent,children:["--- ",n," ---"]})}function Hw({content:n}){return h.jsx("div",{className:rt.userInputEvent,children:h.jsx("span",{className:rt.userInputContent,children:n})})}function Pw({content:n}){return h.jsx("div",{className:rt.defaultEvent,children:n})}function N1({event:n,toolUseCtx:a}){const i=new Date(n.timestamp).toLocaleTimeString();switch(n.eventType){case"system":return h.jsx(Ow,{time:i,content:n.content});case"text":case"output":return h.jsx(Bw,{content:n.content});case"tool_use":return h.jsx(Lw,{content:n.content});case"tool_result":return h.jsx(zw,{content:n.content,raw:n.raw,toolUseCtx:a});case"error":return h.jsx(Vw,{content:n.content});case"status":return h.jsx(Iw,{content:n.content});case"user_input":return h.jsx(Hw,{content:n.content});default:return h.jsx(Pw,{content:n.content})}}const Gw="_overlay_cmicx_1",qw="_dialog_cmicx_11",Fw="_title_cmicx_30",$w="_description_cmicx_38",Yw="_actions_cmicx_45",Kw="_cancelButton_cmicx_52",Zw="_confirmButton_cmicx_79",ws={overlay:Gw,dialog:qw,title:Fw,description:$w,actions:Yw,cancelButton:Kw,confirmButton:Zw};function lc({isOpen:n,title:a,description:i,confirmLabel:o="Delete",onConfirm:r,onCancel:u}){const d=S.useId(),p=S.useId();return h.jsx(os,{children:n&&h.jsx(Rn.div,{className:ws.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:m=>{m.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":i?p:void 0,children:h.jsxs(Rn.div,{className:ws.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:m=>m.stopPropagation(),children:[h.jsx("h3",{id:d,className:ws.title,children:a}),i&&h.jsx("p",{id:p,className:ws.description,children:i}),h.jsxs("div",{className:ws.actions,children:[h.jsx("button",{type:"button",className:ws.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),h.jsx("button",{type:"button",className:ws.confirmButton,onClick:r,children:o})]})]})})})}const Xw="_spinner_13c8l_1",Qw="_spin_13c8l_1",Jw="_sm_13c8l_14",Ww="_md_13c8l_20",eD="_lg_13c8l_26",n0={spinner:Xw,spin:Qw,sm:Jw,md:Ww,lg:eD};function a0({size:n="md",className:a,label:i="Loading",liveRegion:o=!1}){return h.jsx("span",{className:`${n0.spinner} ${n0[n]} ${a??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const xf={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 ls(n){return n==="blocked"?xf.blocked:xf[mh(n)]}const tD={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function nD(n){return tD[mh(n)]??"statusPending"}const aD=["working","paused","failed","not_started","blocked","complete"],s0=["not_started","working","paused","complete","failed"],sD={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function mh(n){return n in xf&&n!=="blocked"?n:sD[n]??"not_started"}const iD={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"},lD="_container_15oob_1",oD="_header_15oob_5",rD="_searchInput_15oob_17",cD="_searchHighlight_15oob_50",uD="_addButton_15oob_56",dD="_createForm_15oob_83",fD="_createInput_15oob_89",hD="_createButton_15oob_120",pD="_creatingHint_15oob_161",mD="_projectRow_15oob_170",gD="_selected_15oob_188",yD="_expandArrow_15oob_193",vD="_expanded_15oob_200",bD="_projectName_15oob_204",SD="_taskCount_15oob_208",_D="_newTaskButton_15oob_214",xD="_taskRow_15oob_241",TD="_taskStatusIcon_15oob_271",ED="_taskTitle_15oob_275",CD="_dependencyBadge_15oob_282",AD="_blockedBadge_15oob_294",jD="_leafSpacer_15oob_299",ND="_childCountBadge_15oob_304",wD="_addChildButton_15oob_317",DD="_emptyCta_15oob_366",kD="_ctaDescription_15oob_379",MD="_ctaButton_15oob_385",RD="_emptyTaskCta_15oob_420",OD="_headerActions_15oob_425",BD="_groupToggle_15oob_431",LD="_groupToggleActive_15oob_458",UD="_statusGroupHeader_15oob_462",zD="_statusGroupIcon_15oob_481",VD="_statusGroupLabel_15oob_485",ID="_statusGroupCount_15oob_490",HD="_createTaskLink_15oob_503",_e={container:lD,header:oD,searchInput:rD,searchHighlight:cD,addButton:uD,createForm:dD,createInput:fD,createButton:hD,creatingHint:pD,projectRow:mD,selected:gD,expandArrow:yD,expanded:vD,projectName:bD,taskCount:SD,newTaskButton:_D,taskRow:xD,taskStatusIcon:TD,taskTitle:ED,dependencyBadge:CD,blockedBadge:AD,leafSpacer:jD,childCountBadge:ND,addChildButton:wD,emptyCta:DD,ctaDescription:kD,ctaButton:MD,emptyTaskCta:RD,headerActions:OD,groupToggle:BD,groupToggleActive:LD,statusGroupHeader:UD,statusGroupIcon:zD,statusGroupLabel:VD,statusGroupCount:ID,createTaskLink:HD};function PD(n){if(n.length===0)return[];const a=[...n].sort((o,r)=>o[0]-r[0]),i=[[a[0][0],a[0][1]]];for(let o=1;o<a.length;o++){const r=i[i.length-1],[u,d]=a[o];u<=r[1]+1?r[1]=Math.max(r[1],d):i.push([u,d])}return i}function w1({text:n,indices:a}){if(!a||a.length===0)return h.jsx(h.Fragment,{children:n});const i=PD(a),o=[];let r=0;for(const[u,d]of i)u>r&&o.push(h.jsx("span",{children:n.slice(r,u)},`p${r}`)),o.push(h.jsx("mark",{className:_e.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 GD=[{name:"name",weight:2},{name:"description",weight:1}],qD=[{name:"title",weight:2},{name:"description",weight:1}],D1=34,FD=16,k1="grackle-group-by-status";function i0(){try{return localStorage.getItem(k1)==="true"}catch{return!1}}function $D(n){try{localStorage.setItem(k1,String(n))}catch{}}function YD(n,a){const i=new Map;for(const u of n){const p=u.dependsOn.length>0&&u.dependsOn.some(g=>a.get(g)!=="complete")?"blocked":u.status,m=i.get(p);m?m.push(u):i.set(p,[u])}const o=[],r=new Set;for(const u of aD){r.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((m,g)=>m.sortOrder-g.sortOrder);const p=ls(u);o.push({status:u,label:p.label,style:p,tasks:d})}}for(const[u,d]of i)if(!r.has(u)&&d.length>0){d.sort((m,g)=>m.sortOrder-g.sortOrder);const p=ls(u);o.push({status:u,label:p.label,style:p,tasks:d})}return o}function KD({group:n,isExpanded:a,onToggle:i,selectedTaskId:o,navigate:r,titleHighlights:u}){return h.jsxs("div",{"data-testid":`status-group-${n.status}`,children:[h.jsxs("div",{className:_e.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":a,onClick:i,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),i())},children:[h.jsx("span",{className:`${_e.expandArrow} ${a?_e.expanded:""}`,children:"▸"}),h.jsx("span",{className:_e.statusGroupIcon,style:{color:n.style.color},children:n.style.icon}),h.jsx("span",{className:_e.statusGroupLabel,children:n.label}),h.jsx("span",{className:_e.statusGroupCount,children:n.tasks.length})]}),h.jsx(os,{children:a&&h.jsx(Rn.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 p=ls(d.status),m=o===d.id;return h.jsxs("div",{onClick:()=>r(as(d.id)),className:`${_e.taskRow} ${m?_e.selected:""}`,style:{"--task-indent":`${D1}px`},"data-task-id":d.id,children:[h.jsx("span",{className:_e.leafSpacer}),h.jsx("span",{className:_e.taskStatusIcon,style:{color:p.color},children:p.icon}),h.jsx("span",{className:_e.taskTitle,title:d.title,children:h.jsx(w1,{text:d.title,indices:u.get(d.id)})})]},d.id)})})})]})}function ZD(n){const a=new Map(n.map(o=>[o.id,{...o,children:[]}])),i=[];for(const o of a.values())o.parentTaskId&&a.has(o.parentTaskId)?a.get(o.parentTaskId).children.push(o):i.push(o);for(const o of a.values())o.children.sort((r,u)=>r.sortOrder-u.sortOrder);return i.sort((o,r)=>o.sortOrder-r.sortOrder)}function M1({node:n,depth:a,expandedTasks:i,toggleTask:o,selectedTaskId:r,navigate:u,projectId:d,taskStatusById:p,titleHighlights:m}){const g=ls(n.status),y=n.dependsOn.length>0&&n.dependsOn.some(A=>p.get(A)!=="complete"),v=i.has(n.id),_=n.children.length>0,T=r===n.id,E=D1+a*FD;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{onClick:()=>u(as(n.id)),className:`${_e.taskRow} ${T?_e.selected:""}`,style:{"--task-indent":`${E}px`},"data-task-id":n.id,children:[_&&h.jsx("span",{className:`${_e.expandArrow} ${v?_e.expanded:""}`,role:"button",tabIndex:0,"aria-label":v?"Collapse task":"Expand task",onClick:A=>{A.stopPropagation(),o(n.id)},onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),A.stopPropagation(),o(n.id))},children:"▸"}),!_&&h.jsx("span",{className:_e.leafSpacer}),h.jsx("span",{className:_e.taskStatusIcon,style:{color:g.color},children:g.icon}),h.jsx("span",{className:_e.taskTitle,title:n.title,children:h.jsx(w1,{text:n.title,indices:m.get(n.id)})}),_&&h.jsxs("span",{className:_e.childCountBadge,children:[n.children.filter(A=>A.status==="complete").length,"/",n.children.length]}),n.dependsOn.length>0&&h.jsx("span",{className:`${_e.dependencyBadge} ${y?_e.blockedBadge:""}`,title:`Depends on: ${n.dependsOn.join(", ")}`,children:y?"blocked":"dep"}),a<vN&&h.jsx("button",{onClick:A=>{A.stopPropagation(),u(Bs(d,n.id))},title:"Add child task","aria-label":"Add child task",className:_e.addChildButton,children:"+"})]}),h.jsx(os,{children:_&&v&&h.jsx(Rn.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(A=>h.jsx(M1,{node:A,depth:a+1,expandedTasks:i,toggleTask:o,selectedTaskId:r,navigate:u,projectId:d,taskStatusById:p,titleHighlights:m},A.id))})})]})}function XD(){const{projects:n,tasks:a,loadTasks:i,createProject:o,projectCreating:r}=qt(),u=Pn(),[d,p]=S.useState(new Set),[m,g]=S.useState(new Set),[y,v]=S.useState(new Set),[_,T]=S.useState(!1),[E,A]=S.useState(""),[j,C]=S.useState(i0),[w,M]=S.useState(i0),[G,V]=S.useState(new Map),X=()=>{const F=!j;$D(F),C(F),F&&(M(!0),V(new Map))},Q=(F,me)=>{const Ae=`${F}:${me}`;V(Ie=>{const pt=new Map(Ie),xt=pt.has(Ae)?pt.get(Ae):w;return pt.set(Ae,!xt),pt})},I=(F,me)=>{const Ae=`${F}:${me}`;return G.has(Ae)?G.get(Ae):w},te=Qt("/tasks/:taskId/*"),se=Qt("/projects/:projectId"),O=(te==null?void 0:te.params.taskId)!=="new"?te==null?void 0:te.params.taskId:void 0,ne=se==null?void 0:se.params.projectId,W=S.useRef(d);W.current=d;const he=S.useMemo(()=>new Map(a.map(F=>[F.id,F.status])),[a]),P=F=>{p(me=>{const Ae=new Set(me);return Ae.has(F)?Ae.delete(F):(Ae.add(F),i(F)),Ae})},U=F=>{g(me=>{const Ae=new Set(me);return Ae.has(F)?(Ae.delete(F),v(Ie=>new Set(Ie).add(F))):(Ae.add(F),v(Ie=>{const pt=new Set(Ie);return pt.delete(F),pt})),Ae})};S.useEffect(()=>{const F=new Set(a.filter(me=>me.parentTaskId).map(me=>me.parentTaskId));F.size>0&&g(me=>{const Ae=new Set(me);for(const Ie of F)y.has(Ie)||Ae.add(Ie);return Ae})},[a,y]),S.useEffect(()=>{ne&&!W.current.has(ne)&&(p(F=>new Set(F).add(ne)),i(ne))},[ne,i]);const K=()=>{!E.trim()||r||(o(E.trim()),A(""),T(!1))},[ee,we]=S.useState(""),{directMatchTaskIds:xe,treeMatchTaskIds:Ue,visibleProjectIds:Ee,matchedProjectIds:ye,titleHighlights:Te}=S.useMemo(()=>{if(!ee.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,visibleProjectIds:null,matchedProjectIds:null,titleHighlights:new Map};const F=Wv(n,ee,GD),me=Wv(a,ee,qD),Ae=new Set(F.map(qe=>qe.item.id)),Ie=new Set(me.map(qe=>qe.item.id)),pt=new Map;for(const qe of me){const Be=qe.matches.find(Ln=>Ln.key==="title");Be&&pt.set(qe.item.id,Be.indices)}const xt=new Set(Ae);for(const qe of me)xt.add(qe.item.projectId);const Lt=new Set(Ie),Xe=new Map(a.map(qe=>[qe.id,qe]));for(const qe of[...Ie]){let Be=Xe.get(qe);for(;Be!=null&&Be.parentTaskId;)Lt.add(Be.parentTaskId),Be=Xe.get(Be.parentTaskId)}return{directMatchTaskIds:Ie,treeMatchTaskIds:Lt,visibleProjectIds:xt,matchedProjectIds:Ae,titleHighlights:pt}},[ee,n,a]),J=S.useRef(new Set);return S.useEffect(()=>{if(ee.trim())for(const F of n)!d.has(F.id)&&!J.current.has(F.id)&&(J.current.add(F.id),i(F.id))},[ee,n,d,i]),h.jsxs("div",{className:_e.container,children:[h.jsxs("div",{className:_e.header,children:[h.jsx("span",{children:"Projects"}),h.jsxs("div",{className:_e.headerActions,children:[h.jsx("button",{className:`${_e.groupToggle} ${j?_e.groupToggleActive:""}`,onClick:X,"aria-label":j?"Switch to tree view":"Group tasks by status","aria-pressed":j,title:j?"Switch to tree view":"Group tasks by status","data-testid":"group-by-status-toggle",children:"≡"}),h.jsx("button",{className:_e.addButton,onClick:()=>T(!_),"aria-label":"Create project",title:"Create project",children:"+"})]})]}),n.length>0&&h.jsx("input",{type:"text",value:ee,onChange:F=>we(F.target.value),placeholder:"Filter...","aria-label":"Filter projects and tasks",className:_e.searchInput,"data-testid":"sidebar-search"}),_&&h.jsxs("div",{className:_e.createForm,children:[h.jsx("input",{type:"text",value:E,onChange:F=>A(F.target.value),onKeyDown:F=>F.key==="Enter"&&K(),placeholder:"Project name...",autoFocus:!0,disabled:r,className:_e.createInput}),h.jsx("button",{onClick:K,className:_e.createButton,disabled:r,children:r?h.jsx(a0,{size:"sm",label:"Creating project"}):"OK"})]}),r&&h.jsxs("div",{className:_e.creatingHint,children:[h.jsx(a0,{size:"sm",label:"Creating project"}),"Creating project…"]}),n.length===0&&!_&&h.jsxs("div",{className:_e.emptyCta,children:[h.jsx("button",{className:_e.ctaButton,onClick:()=>T(!0),children:"Create Project"}),h.jsx("div",{className:_e.ctaDescription,children:"Organize your work into projects"})]}),n.map(F=>{if(Ee&&!Ee.has(F.id))return null;const me=xe!==null,Ae=d.has(F.id)||me,Ie=a.filter(Be=>Be.projectId===F.id),pt=(ye==null?void 0:ye.has(F.id))??!1,xt=me&&!pt?j?xe:Ue:null,Lt=xt?Ie.filter(Be=>xt.has(Be.id)):Ie,Xe=ne===F.id,qe=Ae&&!j?ZD(Lt):[];return h.jsxs("div",{children:[h.jsxs("div",{onClick:()=>{Xe?P(F.id):(Ae||P(F.id),u(Kl(F.id)))},className:`${_e.projectRow} ${Xe?_e.selected:""}`,children:[h.jsx("span",{className:`${_e.expandArrow} ${Ae?_e.expanded:""}`,children:"▸"}),h.jsx("span",{className:_e.projectName,title:F.name,children:F.name}),h.jsx("span",{className:_e.taskCount,children:Ie.length>0&&`${Ie.filter(Be=>Be.status==="complete").length}/${Ie.length}`}),h.jsx("button",{onClick:Be=>{Be.stopPropagation(),u(Bs(F.id))},title:"New task",className:_e.newTaskButton,children:"+"})]}),h.jsx(os,{children:Ae&&h.jsxs(Rn.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:[j?YD(Lt,he).map(Be=>h.jsx(KD,{group:Be,isExpanded:I(F.id,Be.status),onToggle:()=>Q(F.id,Be.status),selectedTaskId:O,navigate:u,titleHighlights:Te},Be.status)):qe.map(Be=>h.jsx(M1,{node:Be,depth:0,expandedTasks:m,toggleTask:U,selectedTaskId:O,navigate:u,projectId:F.id,taskStatusById:he,titleHighlights:Te},Be.id)),Lt.length===0&&h.jsx("div",{className:_e.emptyTaskCta,children:h.jsx("button",{className:_e.createTaskLink,onClick:()=>u(Bs(F.id)),children:"+ Create Task"})})]})})]},F.id)})]})}const QD="_container_lovia_1",JD="_content_lovia_40",l0={container:QD,content:JD},WD=320,R1=220,O1=600,B1="grackle-sidebar-width";function ek(){try{const n=localStorage.getItem(B1);if(n!==null){const a=Number(n);if(Number.isFinite(a)&&a>=R1&&a<=O1)return a}}catch{}return WD}function tk(n){try{localStorage.setItem(B1,String(n))}catch{}}function nk(){const[n]=S.useState(ek),a=S.useRef(null);return S.useEffect(()=>{const i=a.current;if(!i)return;const o=new ResizeObserver(r=>{for(const u of r){const d=u.borderBoxSize[0];if(d){const p=Math.round(d.inlineSize);p>=R1&&p<=O1&&tk(p)}}});return o.observe(i),()=>{o.disconnect()}},[]),h.jsx("div",{className:l0.container,ref:a,"data-testid":"sidebar",style:{width:n},children:h.jsx("div",{className:l0.content,children:h.jsx(XD,{})})})}const ak="_bar_8ghh5_1",sk="_barColumn_8ghh5_32",ik="_barRow_8ghh5_63",lk="_input_8ghh5_74",ok="_inputSmall_8ghh5_109",rk="_select_8ghh5_178",ck="_btnPrimary_8ghh5_214",uk="_btnDanger_8ghh5_245",dk="_btnGhost_8ghh5_284",fk="_badge_8ghh5_312",hk="_statusText_8ghh5_322",pk="_statusCompleted_8ghh5_327",mk="_statusFailed_8ghh5_331",gk="_statusBlocked_8ghh5_335",yk="_hintText_8ghh5_340",vk="_creatingHint_8ghh5_345",bk="_errorHint_8ghh5_353",Sk="_disconnectHint_8ghh5_359",re={bar:ak,barColumn:sk,barRow:ik,input:lk,inputSmall:ok,select:rk,btnPrimary:ck,btnDanger:uk,btnGhost:dk,badge:fk,statusText:hk,statusCompleted:pk,statusFailed:mk,statusBlocked:gk,hintText:yk,creatingHint:vk,errorHint:bk,disconnectHint:Sk};function o0({value:n,onChange:a,testId:i}){return h.jsxs("select",{"data-testid":i,value:n,onChange:o=>a(o.target.value),className:re.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 r0(n,a){if(!n)return!1;const i=a.find(o=>o.id===n);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function c0({environmentId:n,onReconnect:a}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:re.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),h.jsx("button",{type:"button",onClick:()=>a(n),className:re.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function _k(){const{spawn:n,sendInput:a,kill:i,sessions:o,tasks:r,environments:u,personas:d,addEnvironment:p,provisionEnvironment:m,codespaces:g,codespaceError:y,codespaceListError:v,codespaceCreating:_,listCodespaces:T,createCodespace:E}=qt(),{showToast:A}=ao(),j=Pn(),[C]=Mf(),w=Qt("/sessions/:sessionId"),M=Qt("/tasks/:taskId"),G=Qt("/tasks/:taskId/stream"),V=Qt("/tasks/:taskId/findings"),X=Qt("/tasks/:taskId/edit"),Q=Qt("/sessions/new"),I=Qt("/environments/new"),te=Qt("/projects/:projectId"),se=Qt("/tasks/new"),O=Qt("/"),ne=Qt("/settings/*"),W=w==null?void 0:w.params.sessionId,he=(M==null?void 0:M.params.taskId)??(G==null?void 0:G.params.taskId)??(V==null?void 0:V.params.taskId),P=!!Q,U=!!I,K=!!te,ee=!!se,we=!!X,xe=!!O&&!P&&!U&&!K&&!ee,Ue=!!ne,Ee=P?C.get("env")??"":"",ye=P?C.get("runtime")??"claude-code":"claude-code",[Te,J]=S.useState(""),[F,me]=S.useState(P?ye:"claude-code"),[Ae,Ie]=S.useState(""),pt=We=>{if(Ie(We),We){const je=d.find(gt=>gt.id===We);je!=null&&je.runtime&&me(je.runtime)}},[xt,Lt]=S.useState(""),[Xe,qe]=S.useState("local"),[Be,Ln]=S.useState("claude-code"),[Un,ea]=S.useState(""),[en,ta]=S.useState(""),[Z,ae]=S.useState(""),[oe,ue]=S.useState(""),[be,Se]=S.useState(""),[Qe,Me]=S.useState(""),[lt,Dt]=S.useState(""),[Tt,Rt]=S.useState(""),[ot,Et]=S.useState(""),[cn,mt]=S.useState("pick");S.useEffect(()=>{P&&me(ye)},[P,ye]);const Ft=W?o.find(We=>We.id===W):void 0,$t=he?r.find(We=>We.id===he):void 0,Hi=($t==null?void 0:$t.latestSessionId)||void 0,na=Hi?o.find(We=>We.id===Hi):void 0,us=$t?$t.dependsOn.some(We=>{const je=r.find(gt=>gt.id===We);return je&&je.status!=="complete"}):!1;if(xe||Ue)return h.jsx("div",{className:re.bar,children:h.jsx("span",{className:re.hintText,children:"Select a session or click + to start"})});if(we||ee)return h.jsx(h.Fragment,{});if(U){const We=ie=>{if(!ie.trim())return!0;const Ut=Number(ie);return Number.isInteger(Ut)&&Ut>=1&&Ut<=65535},je=()=>!(!xt.trim()||Xe==="ssh"&&!Un.trim()||Xe==="codespace"&&!Qe.trim()||(Xe==="local"||Xe==="ssh")&&!We(en)),gt=()=>{if(!je())return;const ie={};if(Xe==="local"){if(Un.trim()&&(ie.host=Un.trim()),en.trim()){const Ut=Number(en);Number.isInteger(Ut)&&(ie.port=Ut)}}else if(Xe==="ssh"){if(ie.host=Un.trim(),Z.trim()&&(ie.user=Z.trim()),en.trim()){const Ut=Number(en);Number.isInteger(Ut)&&(ie.sshPort=Ut)}lt.trim()&&(ie.identityFile=lt.trim())}else Xe==="docker"?(oe.trim()&&(ie.image=oe.trim()),be.trim()&&(ie.repo=be.trim())):Xe==="codespace"&&(ie.codespaceName=Qe.trim());p(xt.trim(),Xe,ie,Be),A("Environment added successfully","success"),Lt(""),qe("local"),Ln("claude-code"),ea(""),ta(""),ae(""),ue(""),Se(""),Me(""),Dt(""),Rt(""),Et(""),mt("pick"),j(ki,{replace:!0})};return h.jsxs("div",{className:re.barColumn,children:[h.jsxs("div",{className:re.barRow,children:[h.jsx("span",{className:re.badge,children:"new env"}),h.jsx("input",{type:"text",value:xt,onChange:ie=>Lt(ie.target.value),placeholder:"Environment name...",autoFocus:!0,className:re.input}),h.jsxs("select",{value:Xe,onChange:ie=>{qe(ie.target.value),ie.target.value==="codespace"&&(T(),mt("pick"),Me(""))},className:re.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(o0,{value:Be,onChange:Ln,testId:"new-environment-runtime-select"}),h.jsx("button",{onClick:gt,disabled:!je(),className:re.btnPrimary,children:"Add"})]}),h.jsxs("div",{className:re.barRow,children:[Xe==="local"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:Un,onChange:ie=>ea(ie.target.value),placeholder:"Host (optional)...",className:re.inputSmall}),h.jsx("input",{type:"number",min:1,max:65535,value:en,onChange:ie=>ta(ie.target.value),placeholder:"Port (optional)...",className:re.inputSmall})]}),Xe==="ssh"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:Un,onChange:ie=>ea(ie.target.value),placeholder:"Host (required)...",className:re.inputSmall}),h.jsx("input",{type:"text",value:Z,onChange:ie=>ae(ie.target.value),placeholder:"User (optional)...",className:re.inputSmall}),h.jsx("input",{type:"number",min:1,max:65535,value:en,onChange:ie=>ta(ie.target.value),placeholder:"SSH port (optional)...",className:re.inputSmall}),h.jsx("input",{type:"text",value:lt,onChange:ie=>Dt(ie.target.value),placeholder:"Identity file (optional)...",className:re.inputSmall})]}),Xe==="docker"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:oe,onChange:ie=>ue(ie.target.value),placeholder:"Image (optional)...",className:re.inputSmall}),h.jsx("input",{type:"text",value:be,onChange:ie=>Se(ie.target.value),placeholder:"Repo (optional)...",className:re.inputSmall})]}),Xe==="codespace"&&cn==="pick"&&h.jsxs(h.Fragment,{children:[!v&&h.jsxs("select",{value:Qe,onChange:ie=>{ie.target.value==="__create__"?(mt("create"),Me("")):(Me(ie.target.value),ie.target.value&&!xt.trim()&&Lt(ie.target.value))},disabled:_,className:re.select,children:[h.jsx("option",{value:"",children:"Select a codespace..."}),g.map(ie=>h.jsxs("option",{value:ie.name,children:[ie.name," (",ie.repository,") — ",ie.state]},ie.name)),h.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),_&&h.jsx("span",{className:re.creatingHint,children:"Creating codespace..."}),v&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:re.errorHint,children:v}),h.jsx("input",{type:"text",value:Qe,onChange:ie=>Me(ie.target.value),placeholder:"Or enter codespace name manually...",className:re.inputSmall})]}),y&&!v&&h.jsx("span",{className:re.errorHint,children:y})]}),Xe==="codespace"&&cn==="create"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:Tt,onChange:ie=>Rt(ie.target.value),placeholder:"owner/repo",className:re.inputSmall}),h.jsx("input",{type:"text",value:ot,onChange:ie=>Et(ie.target.value),placeholder:"Machine type (optional)...",className:re.inputSmall}),h.jsx("button",{onClick:()=>{Tt.trim()&&(E(Tt.trim(),ot.trim()||void 0),mt("pick"),Rt(""),Et(""))},disabled:!Tt.trim(),className:re.btnPrimary,children:"Create"}),h.jsx("button",{onClick:()=>{mt("pick"),Rt(""),Et("")},className:re.btnGhost,children:"Cancel"})]})]})]})}if(K)return h.jsx("div",{className:re.bar,children:h.jsx("span",{className:re.hintText,children:"Select a task or click + to create one"})});if(he&&$t){if($t.status==="not_started"){const We=us?$t.dependsOn.map(je=>r.find(gt=>gt.id===je)).filter(je=>je&&je.status!=="complete").map(je=>je.title):[];return h.jsx("div",{className:re.bar,children:us?h.jsxs("span",{className:re.statusBlocked,children:["Blocked by: ",We.join(", ")]}):h.jsx("span",{className:re.hintText,children:"Use the buttons above to start or manage this task"})})}if($t.status==="working"||$t.status==="paused"){if((na==null?void 0:na.status)==="idle"){const je=na.environmentId,gt=r0(je,u),ie=Ut=>{Ut.preventDefault();const aa=$t.latestSessionId||Hi;!Te.trim()||!aa||gt||(a(aa,Te),J(""))};return h.jsxs("form",{onSubmit:ie,className:re.bar,children:[gt&&je&&h.jsx(c0,{environmentId:je,onReconnect:m}),h.jsx("input",{type:"text",value:Te,onChange:Ut=>J(Ut.target.value),placeholder:"Type a message...",autoFocus:!gt,disabled:gt,className:re.input}),h.jsx("span",{title:gt?"Environment is unavailable — reconnect first":void 0,children:h.jsx("button",{type:"submit",disabled:!Te.trim()||gt,className:re.btnPrimary,children:"Send"})})]})}return h.jsx("div",{className:re.bar,children:h.jsx("input",{type:"text",disabled:!0,placeholder:"Agent is working...",className:re.input})})}if($t.status==="complete")return h.jsxs("div",{className:re.bar,children:[h.jsx("span",{className:`${re.statusText} ${re.statusCompleted}`,children:"Task completed"}),h.jsx("button",{onClick:()=>j(Bs($t.projectId)),className:re.btnPrimary,children:"+ New Task"})]});if($t.status==="failed")return h.jsx("div",{className:re.bar,children:h.jsx("span",{className:`${re.statusText} ${re.statusFailed}`,children:"Task failed"})})}if(P){const We=je=>{je.preventDefault(),!(!Te.trim()||!Ee)&&(n(Ee,Te,void 0,F,Ae),A("Session started","success"),J(""),Ie(""))};return h.jsxs("form",{onSubmit:We,className:re.bar,children:[h.jsx("span",{className:re.badge,children:"new chat"}),h.jsx("input",{type:"text",value:Te,onChange:je=>J(je.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:re.input}),h.jsx(o0,{value:F,onChange:me,testId:"new-chat-runtime-select"}),h.jsxs("select",{value:Ae,onChange:je=>pt(je.target.value),className:re.select,children:[h.jsx("option",{value:"",children:"No persona"}),d.map(je=>h.jsx("option",{value:je.id,children:je.name},je.id))]}),h.jsx("button",{type:"submit",disabled:!Te.trim()||!Ee,className:re.btnPrimary,children:"Go"})]})}if(W){const We=(Ft==null?void 0:Ft.status)==="running",je=(Ft==null?void 0:Ft.status)==="idle",gt=Ft!==void 0&&["completed","failed","interrupted"].includes(Ft.status);if(We)return h.jsxs("div",{className:re.bar,children:[h.jsx("input",{type:"text",disabled:!0,placeholder:"Agent is working...",className:re.input}),h.jsx("button",{onClick:()=>i(W),className:re.btnDanger,title:"Stop session",children:"Stop"})]});if(je){const ie=r0(Ft.environmentId,u),Ut=aa=>{aa.preventDefault(),!(!Te.trim()||ie)&&(a(W,Te),J(""))};return h.jsxs("form",{onSubmit:Ut,className:re.bar,children:[ie&&Ft.environmentId&&h.jsx(c0,{environmentId:Ft.environmentId,onReconnect:m}),h.jsx("input",{type:"text",value:Te,onChange:aa=>J(aa.target.value),placeholder:"Type a message...",autoFocus:!ie,disabled:ie,className:re.input}),h.jsx("span",{title:ie?"Environment is unavailable — reconnect first":void 0,children:h.jsx("button",{type:"submit",disabled:!Te.trim()||ie,className:re.btnPrimary,children:"Send"})}),h.jsx("button",{type:"button",onClick:()=>i(W),className:re.btnDanger,title:"Stop session",children:"Stop"})]})}if(gt)return h.jsxs("div",{className:re.bar,children:[h.jsxs("span",{className:`${re.statusText} ${re.hintText}`,children:["Session ",Ft.status]}),h.jsx("button",{onClick:()=>j(L0(Ft.environmentId,Ft.runtime)),className:re.btnPrimary,children:"+ New Chat"})]})}return h.jsx("div",{className:re.bar,children:h.jsx("span",{className:re.hintText,children:"Loading..."})})}const xk="_toast_da8ll_1",Tk="_success_da8ll_18",Ek="_icon_da8ll_22",Ck="_error_da8ll_25",Ak="_warning_da8ll_32",jk="_info_da8ll_38",Nk="_message_da8ll_53",wk="_close_da8ll_60",Bl={toast:xk,success:Tk,icon:Ek,error:Ck,warning:Ak,info:jk,message:Nk,close:wk},Dk={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function kk({toast:n,onDismiss:a}){return S.useEffect(()=>{const i=setTimeout(()=>a(n.id),n.duration);return()=>clearTimeout(i)},[n.id,n.duration,a]),h.jsxs(Rn.div,{className:`${Bl.toast} ${Bl[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:Bl.icon,"aria-hidden":"true",children:Dk[n.variant]}),h.jsx("span",{className:Bl.message,children:n.message}),h.jsx("button",{type:"button",className:Bl.close,onClick:()=>a(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const Mk="_container_qqse2_1",Rk={container:Mk};function Ok(){const{toasts:n,dismissToast:a}=ao();return h.jsx("div",{className:Rk.container,"data-testid":"toast-container",children:h.jsx(os,{children:n.map(i=>h.jsx(kk,{toast:i,onDismiss:a},i.id))})})}function Bk(n,a){const i=S.useRef(null);S.useEffect(()=>{const o=i.current;if(i.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 p=r.get(d.id);p&&p.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"&&(p.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 Lk="_panelContainer_yidfr_1",Uk="_emptyState_yidfr_8",zk="_fadeIn_yidfr_1",Vk="_projectSummary_yidfr_17",Ik="_projectSummaryTitle_yidfr_28",Hk="_projectSummarySubtitle_yidfr_32",Pk="_header_yidfr_36",Gk="_headerInfo_yidfr_69",qk="_killButton_yidfr_75",Fk="_headerTitle_yidfr_104",$k="_headerActions_yidfr_119",Yk="_taskStatusBadge_yidfr_126",Kk="_taskBranch_yidfr_135",Zk="_taskBlockedBadge_yidfr_141",Xk="_btnPrimary_yidfr_149",Qk="_btnDanger_yidfr_180",Jk="_btnGhost_yidfr_219",Wk="_rejectInput_yidfr_245",eM="_tabBar_yidfr_275",tM="_tab_yidfr_275",nM="_active_yidfr_301",aM="_eventScroll_yidfr_306",sM="_tabContent_yidfr_312",iM="_noContext_yidfr_317",lM="_overviewContent_yidfr_323",oM="_overviewDashboard_yidfr_332",rM="_overviewHero_yidfr_338",cM="_statusBadge_yidfr_345",uM="_statusPending_yidfr_357",dM="_statusAssigned_yidfr_362",fM="_statusInProgress_yidfr_367",hM="_statusReview_yidfr_372",pM="_statusDone_yidfr_377",mM="_statusFailed_yidfr_382",gM="_statusWaitingInput_yidfr_387",yM="_overviewBranchPill_yidfr_392",vM="_branchLink_yidfr_407",bM="_overviewSection_yidfr_418",SM="_overviewLabel_yidfr_424",_M="_overviewValue_yidfr_431",xM="_overviewMuted_yidfr_436",TM="_overviewMarkdown_yidfr_442",EM="_envRow_yidfr_511",CM="_envDot_yidfr_517",AM="_envDotGreen_yidfr_524",jM="_envDotYellow_yidfr_528",NM="_envDotRed_yidfr_532",wM="_envDotGray_yidfr_536",DM="_depList_yidfr_540",kM="_depItem_yidfr_546",MM="_depBlocked_yidfr_553",RM="_depDone_yidfr_557",OM="_timeline_yidfr_561",BM="_timelineRow_yidfr_567",LM="_timelineKey_yidfr_574",UM="_timelineValue_yidfr_580",zM="_timelineDelta_yidfr_584",VM="_reviewNotes_yidfr_595",IM="_overviewDescription_yidfr_606",HM="_waitingMessage_yidfr_612",PM="_errorMessage_yidfr_616",GM="_eventOverflowWarning_yidfr_620",qM="_attemptSelector_yidfr_634",FM="_attemptLabel_yidfr_650",$M="_attemptButton_yidfr_654",YM="_attemptActive_yidfr_671",KM="_attemptStatus_yidfr_677",ZM="_emptyCta_yidfr_683",XM="_ctaTitle_yidfr_695",QM="_ctaDescription_yidfr_701",JM="_ctaButton_yidfr_708",WM="_ctaLink_yidfr_743",eR="_projectHeader_yidfr_757",tR="_projectName_yidfr_782",nR="_projectMeta_yidfr_795",aR="_metaRow_yidfr_803",sR="_metaLabel_yidfr_816",iR="_metaValue_yidfr_831",lR="_metaPlaceholder_yidfr_841",oR="_editButton_yidfr_846",rR="_editInput_yidfr_862",cR="_editTextarea_yidfr_894",uR="_editSelect_yidfr_930",dR="_archiveButton_yidfr_963",fR="_repoLink_yidfr_993",hR="_metaValueClickable_yidfr_1003",pR="_editHint_yidfr_1022",mR="_editError_yidfr_1031",gR="_editInputInvalid_yidfr_1038",yR="_unsavedDot_yidfr_1043",vR="_metaToggle_yidfr_1051",bR="_metaToggleArrow_yidfr_1072",SR="_metaToggleArrowOpen_yidfr_1077",_R="_progressBarContainer_yidfr_1081",xR="_progressBar_yidfr_1081",TR="_progressFill_yidfr_1097",ER="_progressLabel_yidfr_1104",CR="_metaTimestamps_yidfr_1111",AR="_metaTimestamp_yidfr_1111",jR="_worktreeToggle_yidfr_1133",NR="_editFieldWrapper_yidfr_1148",k={panelContainer:Lk,emptyState:Uk,fadeIn:zk,projectSummary:Vk,projectSummaryTitle:Ik,projectSummarySubtitle:Hk,header:Pk,headerInfo:Gk,killButton:qk,headerTitle:Fk,headerActions:$k,taskStatusBadge:Yk,taskBranch:Kk,taskBlockedBadge:Zk,btnPrimary:Xk,btnDanger:Qk,btnGhost:Jk,rejectInput:Wk,tabBar:eM,tab:tM,active:nM,eventScroll:aM,tabContent:sM,noContext:iM,overviewContent:lM,overviewDashboard:oM,overviewHero:rM,statusBadge:cM,statusPending:uM,statusAssigned:dM,statusInProgress:fM,statusReview:hM,statusDone:pM,statusFailed:mM,statusWaitingInput:gM,overviewBranchPill:yM,branchLink:vM,overviewSection:bM,overviewLabel:SM,overviewValue:_M,overviewMuted:xM,overviewMarkdown:TM,envRow:EM,envDot:CM,envDotGreen:AM,envDotYellow:jM,envDotRed:NM,envDotGray:wM,depList:DM,depItem:kM,depBlocked:MM,depDone:RM,timeline:OM,timelineRow:BM,timelineKey:LM,timelineValue:UM,timelineDelta:zM,reviewNotes:VM,overviewDescription:IM,waitingMessage:HM,errorMessage:PM,eventOverflowWarning:GM,attemptSelector:qM,attemptLabel:FM,attemptButton:$M,attemptActive:YM,attemptStatus:KM,emptyCta:ZM,ctaTitle:XM,ctaDescription:QM,ctaButton:JM,ctaLink:WM,projectHeader:eR,projectName:tR,projectMeta:nR,metaRow:aR,metaLabel:sR,metaValue:iR,metaPlaceholder:lR,editButton:oR,editInput:rR,editTextarea:cR,editSelect:uR,archiveButton:dR,repoLink:fR,metaValueClickable:hR,editHint:pR,editError:mR,editInputInvalid:gR,unsavedDot:yR,metaToggle:vR,metaToggleArrow:bR,metaToggleArrowOpen:SR,progressBarContainer:_R,progressBar:xR,progressFill:TR,progressLabel:ER,metaTimestamps:CR,metaTimestamp:AR,worktreeToggle:jR,editFieldWrapper:NR};function wR(){const{projects:n,createProject:a}=qt();return n.length===0?h.jsxs("div",{className:k.emptyCta,children:[h.jsx("div",{className:k.ctaTitle,children:"Welcome to Grackle"}),h.jsx("div",{className:k.ctaDescription,children:"Organize your work into projects and let agents tackle the tasks."}),h.jsx("button",{className:k.ctaButton,onClick:()=>{const i=window.prompt("Project name:");i!=null&&i.trim()&&a(i.trim())},children:"Create Your First Project"})]}):h.jsx("div",{className:k.emptyState,children:"Select a project or task to get started"})}function DR(n,a){const i=[];let o=n;const r=new Set;for(;o&&a.has(o)&&!r.has(o);){r.add(o);const u=a.get(o);i.unshift(u),o=u.parentTaskId||void 0}return i}const Ls={label:"Home",url:"/"};function kR(n){return n?[Ls,{label:"Settings",url:"/settings"},{label:n,url:void 0}]:[Ls,{label:"Settings",url:void 0}]}function MR(){return[Ls,{label:"New Environment",url:void 0}]}function RR(){return[Ls,{label:"New Chat",url:void 0}]}function OR(n){return[Ls,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function BR(n,a){const i=a.find(o=>o.id===n);return[Ls,{label:(i==null?void 0:i.name)??"Project",url:void 0}]}function LR(n,a,i){const o=DR(n,i),r=i.get(n),u=r==null?void 0:r.projectId,d=u?a.find(g=>g.id===u):void 0,p=[Ls];d&&p.push({label:d.name,url:Kl(d.id)});for(let g=0;g<o.length-1;g++)p.push({label:o[g].title,url:as(o[g].id)});const m=o[o.length-1];return p.push({label:(m==null?void 0:m.title)??n,url:void 0}),p}function UR(){const n=RR();return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:n}),h.jsx("div",{className:k.emptyState,children:"Enter a prompt below to start a new session"})]})}function L1(n){const a=[];for(const i of n){const o=a[a.length-1];i.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?a[a.length-1]={...o,content:o.content+i.content}:a.push(i)}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 i=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 p=JSON.parse(u.content);i.set(d.id,{tool:p.tool,args:p.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 p=i.get(d.tool_use_id);return p?(o.add(d.tool_use_id),{...u,toolUseCtx:p}):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 zR({sessionId:n,session:a,isActive:i,onKill:o}){return h.jsxs("div",{className:k.header,children:[h.jsxs("span",{children:["Session: ",n.slice(0,8),a&&` | ${a.runtime} | ${a.status}`]}),h.jsxs("span",{className:k.headerInfo,children:[a&&h.jsx("span",{children:a.prompt.length>60?a.prompt.slice(0,60)+"...":a.prompt}),i&&h.jsx("button",{onClick:()=>o(n),title:"Stop session",className:k.killButton,children:"×"})]})]})}function VR({eventsDropped:n}){return n<=0?h.jsx(h.Fragment,{}):h.jsxs("div",{className:k.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 IR({sessionEvents:n,session:a,eventsDropped:i,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:k.eventScroll,children:[n.length===0&&h.jsx("div",{className:r?k.errorMessage:k.waitingMessage,children:u}),h.jsx(VR,{eventsDropped:i}),n.map((d,p)=>h.jsx(N1,{event:d,toolUseCtx:d.toolUseCtx},`${d.sessionId}-${d.timestamp}-${p}`))]})}function HR(){const{sessionId:n}=Qr(),{events:a,eventsDropped:i,sessions:o,kill:r,loadSessionEvents:u}=qt(),d=S.useRef(null),p=S.useRef(void 0),m=OR(n),g=o.find(_=>_.id===n)??void 0,y=S.useMemo(()=>{const _=n?a.filter(T=>T.sessionId===n):[];return U1(L1(_))},[a,n]);if(S.useEffect(()=>{n&&n!==p.current&&(p.current=n,u(n))},[n,u]),S.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[y.length]),!n)return h.jsx("div",{className:k.emptyState,children:"No session selected"});const v=(g==null?void 0:g.status)==="running"||(g==null?void 0:g.status)==="idle";return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:m}),h.jsx(zR,{sessionId:n,session:g,isActive:v,onKill:r}),h.jsx(IR,{sessionEvents:y,session:g,eventsDropped:i,scrollRef:d})]})}const u0=220,d0=70,PR=40,GR=60,qR="hierarchy",FR="dependency";function $R(n){return S.useMemo(()=>{if(n.length===0)return{nodes:[],edges:[]};const a=new dy.graphlib.Graph({multigraph:!0});a.setDefaultEdgeLabel(()=>({})),a.setGraph({rankdir:"TB",nodesep:PR,ranksep:GR});const i=new Map(n.map(d=>[d.id,d])),o=new Map;for(const d of n)if(d.parentTaskId&&i.has(d.parentTaskId)){const p=o.get(d.parentTaskId)||[];p.push(d),o.set(d.parentTaskId,p)}for(const d of n)a.setNode(d.id,{width:u0,height:d0});const r=[];for(const d of n){if(d.parentTaskId&&i.has(d.parentTaskId)){const p=`hierarchy-${d.parentTaskId}-${d.id}`;a.setEdge(d.parentTaskId,d.id,{},p),r.push({id:p,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:qR},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of d.dependsOn)if(i.has(p)){const m=`dependency-${p}-${d.id}`;a.setEdge(p,d.id,{},m),r.push({id:m,source:p,target:d.id,type:"smoothstep",data:{edgeType:FR},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return dy.layout(a),{nodes:n.map(d=>{const p=a.node(d.id),m=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:p.x-u0/2,y:p.y-d0/2},data:{task:d,childCount:m.length,doneChildCount:m.filter(g=>g.status==="complete").length,hasDependencies:d.dependsOn.length>0}}}),edges:r}},[n])}const YR="_dagContainer_js4w6_1",KR="_taskNode_js4w6_26",ZR="_taskNodeBorder_js4w6_54",XR="_taskNodeContent_js4w6_60",QR="_taskNodeHeader_js4w6_70",JR="_taskNodeIcon_js4w6_77",WR="_taskNodeTitle_js4w6_82",e3="_taskNodeBadges_js4w6_90",t3="_childBadge_js4w6_95",n3="_depBadge_js4w6_107",a3="_handle_js4w6_119",s3="_emptyCta_js4w6_126",i3="_ctaDescription_js4w6_137",l3="_ctaButton_js4w6_144",Jt={dagContainer:YR,taskNode:KR,taskNodeBorder:ZR,taskNodeContent:XR,taskNodeHeader:QR,taskNodeIcon:JR,taskNodeTitle:WR,taskNodeBadges:e3,childBadge:t3,depBadge:n3,handle:a3,emptyCta:s3,ctaDescription:i3,ctaButton:l3};function o3({data:n}){const{task:a,childCount:i,doneChildCount:o,hasDependencies:r}=n,u=ls(a.status);return h.jsxs("div",{className:Jt.taskNode,"data-task-id":a.id,"data-task-title":a.title,children:[h.jsx(fy,{type:"target",position:hy.Top,className:Jt.handle}),h.jsx("div",{className:Jt.taskNodeBorder,style:{backgroundColor:u.color}}),h.jsxs("div",{className:Jt.taskNodeContent,children:[h.jsxs("div",{className:Jt.taskNodeHeader,children:[h.jsx("span",{className:Jt.taskNodeIcon,style:{color:u.color},children:u.icon}),h.jsx("span",{className:Jt.taskNodeTitle,children:a.title})]}),h.jsxs("div",{className:Jt.taskNodeBadges,children:[i>0&&h.jsxs("span",{className:Jt.childBadge,children:[o,"/",i]}),r&&h.jsx("span",{className:Jt.depBadge,children:"dep"})]})]}),h.jsx(fy,{type:"source",position:hy.Bottom,className:Jt.handle})]})}const r3=iD,c3={task:o3};function u3({projectId:n}){const{tasks:a}=qt(),i=Pn(),{resolvedThemeId:o}=G0(),r=S.useMemo(()=>a.filter(y=>y.projectId===n),[a,n]),{nodes:u,edges:d}=$R(r),p=S.useMemo(()=>{const y=getComputedStyle(document.documentElement),v={};for(const[_,T]of Object.entries(r3))v[_]=y.getPropertyValue(T).trim()||"#6b7a8d";return v},[o]),m=S.useCallback((y,v)=>{i(as(v.id))},[i]),g=S.useCallback(y=>{const v=y.data;return p[v.task.status]||p.pending},[p]);return r.length===0?h.jsxs("div",{className:Jt.emptyCta,children:[h.jsx("button",{className:Jt.ctaButton,onClick:()=>i(Bs(n)),children:"Create Task"}),h.jsx("div",{className:Jt.ctaDescription,children:"Create tasks to see the dependency graph"})]}):h.jsx("div",{className:Jt.dagContainer,children:h.jsxs(ax,{nodes:u,edges:d,nodeTypes:c3,onNodeClick:m,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[h.jsx(sx,{variant:ix.Dots,gap:24,size:1,color:"var(--text-disabled)"}),h.jsx(lx,{showInteractive:!1}),h.jsx(ox,{nodeColor:g,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function d3({tasks:n,taskStatusById:a,sessionStatusByTaskId:i}){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(s0.map(u=>[u,[]]));for(const u of n){const d=mh(u.status),p=u.dependsOn.length>0&&u.dependsOn.some(E=>a.get(E)!=="complete"),m=o.get(u.id)??[],g=m.length,y=m.filter(E=>E.status==="complete").length;let v;if(d==="paused"&&i){const E=i.get(u.id);E==="idle"?v="Needs input":E==="completed"&&(v="Ready to complete")}const _={task:u,isBlocked:p,childCount:g,doneChildCount:y,pausedSubBadge:v},T=r.get(d);T?T.push(_):r.get("not_started").push(_)}for(const u of r.values())u.sort((d,p)=>d.task.sortOrder-p.task.sortOrder);return s0.map(u=>{const d=ls(u);return{status:u,label:d.label,style:d,tasks:r.get(u)??[]}})}const f3="_boardContainer_1c4y1_1",h3="_column_1c4y1_17",p3="_columnHeader_1c4y1_34",m3="_columnIcon_1c4y1_47",g3="_columnLabel_1c4y1_52",y3="_columnCount_1c4y1_57",v3="_cardList_1c4y1_67",b3="_emptyPlaceholder_1c4y1_76",S3="_card_1c4y1_67",_3="_cardHeader_1c4y1_107",x3="_cardStatusIcon_1c4y1_113",T3="_cardTitle_1c4y1_119",E3="_cardBadges_1c4y1_127",C3="_badge_1c4y1_134",A3="_blockedBadge_1c4y1_146",j3="_childBadge_1c4y1_151",N3="_depBadge_1c4y1_155",w3="_parentBadge_1c4y1_159",D3="_pausedSubBadge_1c4y1_166",k3="_personaBadge_1c4y1_170",M3="_envBadge_1c4y1_174",R3="_emptyCta_1c4y1_178",O3="_ctaButton_1c4y1_188",B3="_ctaDescription_1c4y1_204",Ge={boardContainer:f3,column:h3,columnHeader:p3,columnIcon:m3,columnLabel:g3,columnCount:y3,cardList:v3,emptyPlaceholder:b3,card:S3,cardHeader:_3,cardStatusIcon:x3,cardTitle:T3,cardBadges:E3,badge:C3,blockedBadge:A3,childBadge:j3,depBadge:N3,parentBadge:w3,pausedSubBadge:D3,personaBadge:k3,envBadge:M3,emptyCta:R3,ctaButton:O3,ctaDescription:B3};function L3({projectId:n}){const{tasks:a,sessions:i,personas:o,environments:r}=qt(),u=Pn(),d=S.useMemo(()=>a.filter(v=>v.projectId===n),[a,n]),p=S.useMemo(()=>new Map(a.map(v=>[v.id,v.status])),[a]),m=S.useMemo(()=>new Map(d.map(v=>[v.id,v])),[d]),g=S.useMemo(()=>{const v=new Map(i.map(C=>[C.id,C])),_=new Map(o.map(C=>[C.id,C])),T=new Map(r.map(C=>[C.id,C])),E=new Map,A=new Map,j=new Map;for(const C of d)if(C.latestSessionId){const w=v.get(C.latestSessionId);if(w){if(E.set(C.id,w.status),w.personaId){const M=_.get(w.personaId);M&&A.set(C.id,M.name)}if(w.environmentId){const M=T.get(w.environmentId);M&&j.set(C.id,M.displayName)}}}return{sessionStatusByTaskId:E,personaNameByTaskId:A,environmentNameByTaskId:j}},[d,i,o,r]),y=S.useMemo(()=>d3({tasks:d,taskStatusById:p,sessionStatusByTaskId:g.sessionStatusByTaskId}),[d,p,g]);return d.length===0?h.jsxs("div",{className:Ge.emptyCta,"data-testid":"board-empty-cta",children:[h.jsx("button",{className:Ge.ctaButton,onClick:()=>u(Bs(n)),children:"Create Task"}),h.jsx("div",{className:Ge.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):h.jsx("div",{className:Ge.boardContainer,"data-testid":"board-container",children:y.map(v=>h.jsxs("section",{className:Ge.column,"data-testid":`board-column-${v.status}`,"aria-label":`${v.label}, ${v.tasks.length} ${v.tasks.length===1?"task":"tasks"}`,children:[h.jsxs("div",{className:Ge.columnHeader,children:[h.jsx("span",{className:Ge.columnIcon,style:{color:v.style.color},children:v.style.icon}),h.jsx("span",{className:Ge.columnLabel,children:v.label}),h.jsx("span",{className:Ge.columnCount,"data-testid":`board-count-${v.status}`,children:v.tasks.length})]}),h.jsx("div",{className:Ge.cardList,children:v.tasks.length===0?h.jsx("div",{className:Ge.emptyPlaceholder,children:"No tasks"}):h.jsx(os,{mode:"popLayout",children:v.tasks.map(_=>h.jsx(Rn.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:h.jsx(U3,{boardTask:_,tasksById:m,personaName:g.personaNameByTaskId.get(_.task.id),envName:g.environmentNameByTaskId.get(_.task.id),onClick:()=>u(as(_.task.id))})},_.task.id))})})]},v.status))})}function U3({boardTask:n,tasksById:a,personaName:i,envName:o,onClick:r}){const{task:u,isBlocked:d,childCount:p,doneChildCount:m,pausedSubBadge:g}=n,y=ls(u.status),v=u.parentTaskId?a.get(u.parentTaskId):void 0;return h.jsxs("div",{className:Ge.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:r,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),r())},children:[h.jsxs("div",{className:Ge.cardHeader,children:[h.jsx("span",{className:Ge.cardStatusIcon,style:{color:y.color},children:y.icon}),h.jsx("span",{className:Ge.cardTitle,children:u.title})]}),h.jsxs("div",{className:Ge.cardBadges,children:[v&&h.jsx("span",{className:`${Ge.badge} ${Ge.parentBadge}`,title:v.title,children:v.title}),p>0&&h.jsxs("span",{className:`${Ge.badge} ${Ge.childBadge}`,children:[m,"/",p]}),d&&h.jsx("span",{className:`${Ge.badge} ${Ge.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&h.jsx("span",{className:`${Ge.badge} ${Ge.depBadge}`,children:"dep"}),g&&h.jsx("span",{className:`${Ge.badge} ${Ge.pausedSubBadge}`,children:g}),i&&h.jsx("span",{className:`${Ge.badge} ${Ge.personaBadge}`,children:i}),o&&h.jsx("span",{className:`${Ge.badge} ${Ge.envBadge}`,children:o})]})]})}function z3(n){const a=n.toLowerCase();return a==="ready"||a==="running"||a==="available"||a==="connected"?k.envDotGreen:a==="provisioning"||a==="starting"||a==="pending"||a==="connecting"?k.envDotYellow:a==="error"||a==="failed"||a==="disconnected"?k.envDotRed:k.envDotGray}function f0(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 V3(){const{projectId:n}=Qr(),a=Pn(),{tasks:i,environments:o,projects:r,archiveProject:u,updateProject:d}=qt(),[p,m]=S.useState("tasks"),[g,y]=S.useState(!1),[v,_]=S.useState(null),[T,E]=S.useState(""),[A,j]=S.useState(""),[C,w]=S.useState(!1),M=S.useRef(void 0),G=S.useRef(null),V=S.useRef(null),X=S.useRef(null),Q=S.useRef(null),I=S.useRef(null),te=S.useRef(null),se=BR(n,r);S.useEffect(()=>{const J=M.current;M.current=n,!(J===void 0||J===n)&&(v!==null||T!=="")&&(_(null),E(""))},[n,v,T]),S.useEffect(()=>{if(v===null)return;const J=v==="name"?V.current:v==="description"?X.current:v==="repoUrl"?Q.current:v==="worktreeBasePath"?te.current:I.current;if(!J)return;const F=window.setTimeout(()=>{J.focus()},0);return()=>{window.clearTimeout(F)}},[v]);const O=r.find(J=>J.id===n),ne=i.filter(J=>J.projectId===n),W=ne.filter(J=>J.status==="complete").length,he=ne.length,P=he>0?Math.round(W/he*100):0,U=100,K=(J,F)=>{G.current=J,_(J),E(F),j("")},ee=()=>{G.current=null,_(null),E(""),j("")},we=(J,F)=>{if(J==="name"){const me=F.trim();if(!me)return"Name is required";if(me.length>U)return`Max ${U} characters`}if(J==="repoUrl"){const me=F.trim();if(me&&!/^https?:\/\/.+/.test(me))return"Must be a valid http(s) URL"}return""},xe=J=>{if(!O)return;const F=T.trim(),me=we(J,T);if(me){j(me);return}if(J==="name"){if(F===O.name){ee();return}d(O.id,{name:F})}else if(J==="description"){const Ae=T;if(Ae===O.description){ee();return}d(O.id,{description:Ae})}else if(J==="repoUrl"){if(F===O.repoUrl){ee();return}d(O.id,{repoUrl:F})}else if(J==="defaultEnvironmentId"){if(T===O.defaultEnvironmentId){ee();return}d(O.id,{defaultEnvironmentId:T})}else{if(F===O.worktreeBasePath){ee();return}d(O.id,{worktreeBasePath:F})}ee()},Ue=(J,F)=>{J.key==="Escape"?ee():J.key==="Enter"&&F!=="description"&&xe(F)},Ee=J=>O?J==="name"?T.trim()!==O.name:J==="description"?T!==O.description:J==="repoUrl"?T.trim()!==O.repoUrl:J==="defaultEnvironmentId"?T!==O.defaultEnvironmentId:T.trim()!==O.worktreeBasePath:!1,ye=o.find(J=>J.id===(O==null?void 0:O.defaultEnvironmentId)),Te=v==="description"?"Tab to save · Esc to cancel":"Enter to save · Esc to cancel";return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:se}),h.jsxs("div",{className:k.projectHeader,children:[h.jsx("span",{className:k.projectName,"data-testid":"project-name",children:v==="name"?h.jsxs("div",{className:k.editFieldWrapper,children:[h.jsx("input",{ref:V,className:`${k.editInput} ${A?k.editInputInvalid:""}`,value:T,onChange:J=>{E(J.target.value),j("")},onBlur:J=>{if(G.current==="name"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.relatedTarget.dataset.editAction==="name"||xe("name")},onKeyDown:J=>Ue(J,"name"),maxLength:U,"aria-label":"Project name","data-testid":"edit-name-input"}),Ee("name")&&h.jsx("span",{className:k.unsavedDot,title:"Unsaved changes"}),A&&h.jsx("span",{className:k.editError,"data-testid":"edit-error",children:A}),h.jsx("span",{className:k.editHint,children:Te})]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:()=>K("name",(O==null?void 0:O.name)||""),title:"Click to edit name","aria-label":`Edit project name: ${(O==null?void 0:O.name)||n}`,"data-testid":"edit-name-button",children:[(O==null?void 0:O.name)||n,h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})}),h.jsx("button",{className:k.archiveButton,onClick:()=>y(!0),title:"Archive project","data-testid":"archive-project-button",children:"Archive"})]}),h.jsxs("button",{className:k.metaToggle,onClick:()=>w(!C),"aria-expanded":!C,"aria-controls":"project-meta-panel","data-testid":"meta-toggle",children:[h.jsx("span",{className:`${k.metaToggleArrow} ${C?"":k.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!C&&h.jsxs("div",{className:k.projectMeta,"data-testid":"project-meta",id:"project-meta-panel",children:[h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Description"}),h.jsx("div",{className:k.metaValue,children:v==="description"?h.jsxs("div",{className:k.editFieldWrapper,children:[h.jsx("textarea",{ref:X,className:k.editTextarea,value:T,onChange:J=>{E(J.target.value),j("")},onBlur:J=>{if(G.current==="description"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.relatedTarget.dataset.editAction==="description"||xe("description")},onKeyDown:J=>Ue(J,"description"),title:"Project description","aria-label":"Project description","data-testid":"edit-description-input"}),Ee("description")&&h.jsx("span",{className:k.unsavedDot,title:"Unsaved changes"}),h.jsx("span",{className:k.editHint,children:Te})]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:()=>K("description",(O==null?void 0:O.description)||""),title:"Click to edit description","aria-label":"Edit project description","data-testid":"edit-description-button",children:[O!=null&&O.description?h.jsx("span",{className:k.overviewMarkdown,children:h.jsx(Tf,{remarkPlugins:[Ef],children:O.description})}):h.jsx("span",{className:k.metaPlaceholder,children:"No description"}),h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Repository"}),h.jsx("div",{className:k.metaValue,children:v==="repoUrl"?h.jsxs("div",{className:k.editFieldWrapper,children:[h.jsx("input",{ref:Q,className:`${k.editInput} ${A?k.editInputInvalid:""}`,value:T,onChange:J=>{E(J.target.value),j("")},onBlur:J=>{if(G.current==="repoUrl"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.relatedTarget.dataset.editAction==="repoUrl"||xe("repoUrl")},onKeyDown:J=>Ue(J,"repoUrl"),placeholder:"https://github.com/...","aria-label":"Project repository URL","data-testid":"edit-repo-input"}),Ee("repoUrl")&&h.jsx("span",{className:k.unsavedDot,title:"Unsaved changes"}),A&&h.jsx("span",{className:k.editError,"data-testid":"edit-error",children:A}),h.jsx("span",{className:k.editHint,children:Te})]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:J=>{J.preventDefault(),K("repoUrl",(O==null?void 0:O.repoUrl)||"")},title:"Click to edit repository URL","aria-label":"Edit project repository URL","data-testid":"edit-repo-button",children:[O!=null&&O.repoUrl&&/^https?:\/\//i.test(O.repoUrl)?h.jsx("a",{className:k.repoLink,href:O.repoUrl,target:"_blank",rel:"noopener noreferrer",onClick:J=>J.stopPropagation(),children:O.repoUrl}):O!=null&&O.repoUrl?h.jsx("span",{children:O.repoUrl}):h.jsx("span",{className:k.metaPlaceholder,children:"No repository"}),h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Environment"}),h.jsx("div",{className:k.metaValue,children:v==="defaultEnvironmentId"?h.jsxs("select",{ref:I,className:k.editSelect,value:T,onChange:J=>{G.current=null,E(J.target.value);const F=J.target.value;O&&F!==O.defaultEnvironmentId&&d(O.id,{defaultEnvironmentId:F}),ee()},onBlur:J=>{if(G.current==="defaultEnvironmentId"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.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(J=>h.jsx("option",{value:J.id,children:J.displayName},J.id))]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:()=>K("defaultEnvironmentId",(O==null?void 0:O.defaultEnvironmentId)||""),title:"Click to change default environment","aria-label":"Edit project default environment","data-testid":"edit-env-button",children:[ye?h.jsxs("span",{className:k.envRow,children:[h.jsx("span",{className:`${k.envDot} ${z3(ye.status)}`}),ye.displayName]}):h.jsx("span",{className:k.metaPlaceholder,children:(O==null?void 0:O.defaultEnvironmentId)||"No default environment"}),h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Worktrees"}),h.jsx("div",{className:k.metaValue,children:h.jsxs("label",{className:k.worktreeToggle,"data-testid":"worktree-toggle",children:[h.jsx("input",{type:"checkbox",checked:(O==null?void 0:O.useWorktrees)??!0,onChange:J=>{O&&d(O.id,{useWorktrees:J.target.checked})}}),h.jsx("span",{children:"Enable worktree isolation"})]})})]}),h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Working Dir"}),h.jsx("div",{className:k.metaValue,children:v==="worktreeBasePath"?h.jsxs("div",{className:k.editFieldWrapper,children:[h.jsx("input",{ref:te,className:`${k.editInput} ${A?k.editInputInvalid:""}`,value:T,onChange:J=>{E(J.target.value),j("")},onBlur:J=>{if(G.current==="worktreeBasePath"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.relatedTarget.dataset.editAction==="worktreeBasePath"||xe("worktreeBasePath")},onKeyDown:J=>Ue(J,"worktreeBasePath"),placeholder:"/workspaces/my-repo","aria-label":"Working directory","data-testid":"edit-worktree-base-path-input"}),Ee("worktreeBasePath")&&h.jsx("span",{className:k.unsavedDot,title:"Unsaved changes"}),A&&h.jsx("span",{className:k.editError,"data-testid":"edit-error",children:A}),h.jsx("span",{className:k.editHint,children:Te})]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:()=>K("worktreeBasePath",(O==null?void 0:O.worktreeBasePath)||""),title:"Click to edit working directory","aria-label":"Edit working directory","data-testid":"edit-worktree-base-path-button",children:[O!=null&&O.worktreeBasePath?h.jsx("span",{children:O.worktreeBasePath}):h.jsx("span",{className:k.metaPlaceholder,children:"Default (server default)"}),h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),O&&h.jsxs("div",{className:k.metaTimestamps,children:[h.jsxs("span",{className:k.metaTimestamp,children:["Created ",f0(O.createdAt)]}),O.updatedAt&&O.updatedAt!==O.createdAt&&h.jsxs("span",{className:k.metaTimestamp,children:["· Updated ",f0(O.updatedAt)]})]})]}),he>0&&h.jsxs("div",{className:k.progressBarContainer,"data-testid":"progress-bar",children:[h.jsx("div",{className:k.progressBar,children:h.jsx("div",{className:k.progressFill,style:{width:`${P}%`}})}),h.jsxs("span",{className:k.progressLabel,children:[W,"/",he]})]}),h.jsxs("div",{className:k.tabBar,role:"tablist","aria-label":"Project view",children:[h.jsx("button",{role:"tab","aria-selected":p==="graph",className:`${k.tab} ${p==="graph"?k.active:""}`,onClick:()=>m("graph"),children:"Graph"}),h.jsx("button",{role:"tab","aria-selected":p==="board",className:`${k.tab} ${p==="board"?k.active:""}`,onClick:()=>m("board"),"data-testid":"board-tab",children:"Board"}),h.jsx("button",{role:"tab","aria-selected":p==="tasks",className:`${k.tab} ${p==="tasks"?k.active:""}`,onClick:()=>m("tasks"),children:"Tasks"})]}),p==="tasks"&&he>0&&h.jsxs("div",{className:k.projectSummary,children:[h.jsx("span",{className:k.projectSummaryTitle,children:`${W}/${he} tasks complete`}),h.jsx("span",{className:k.projectSummarySubtitle,children:"Select a task or click + to create one"})]}),p==="tasks"&&he===0&&h.jsxs("div",{className:k.emptyCta,children:[h.jsx("button",{className:k.ctaButton,onClick:()=>a(Bs(n)),children:"Create Task"}),h.jsx("div",{className:k.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),p==="board"&&h.jsx(L3,{projectId:n}),p==="graph"&&h.jsx(u3,{projectId:n}),h.jsx(lc,{isOpen:g,title:"Archive Project?",description:"This will hide the project from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{O&&(u(O.id),a("/",{replace:!0})),y(!1)},onCancel:()=>y(!1)})]})}const I3="_container_cddyd_1",H3="_header_cddyd_8",P3="_headerTitle_cddyd_35",G3="_badge_cddyd_44",q3="_headerActions_cddyd_54",F3="_body_cddyd_61",$3="_formContent_cddyd_73",Y3="_section_cddyd_85",K3="_label_cddyd_91",Z3="_titleInput_cddyd_98",X3="_descriptionTextarea_cddyd_131",Q3="_parentContext_cddyd_167",J3="_parentLabel_cddyd_175",W3="_parentName_cddyd_182",eO="_depList_cddyd_220",tO="_depItem_cddyd_226",nO="_depItemSelected_cddyd_248",aO="_noDeps_cddyd_252",sO="_btnPrimary_cddyd_258",iO="_btnGhost_cddyd_289",it={container:I3,header:H3,headerTitle:P3,badge:G3,headerActions:q3,body:F3,formContent:$3,section:Y3,label:K3,titleInput:Z3,descriptionTextarea:X3,parentContext:Q3,parentLabel:J3,parentName:W3,depList:eO,depItem:tO,depItemSelected:nO,noDeps:aO,btnPrimary:sO,btnGhost:iO};function z1({mode:n,taskId:a,projectId:i,parentTaskId:o}){const{tasks:r,createTask:u,updateTask:d}=qt(),{showToast:p}=ao(),m=Pn(),g=n==="edit",y=g&&a?r.find(O=>O.id===a):void 0,v=g?(y==null?void 0:y.projectId)??"":i??"",_=g?(y==null?void 0:y.parentTaskId)??"":o??"",T=_?r.find(O=>O.id===_):void 0,[E,A]=S.useState((y==null?void 0:y.title)??""),[j,C]=S.useState((y==null?void 0:y.description)??""),[w,M]=S.useState((y==null?void 0:y.dependsOn)??[]),G=S.useRef(!1);S.useEffect(()=>{g&&y&&!G.current&&(G.current=!0,A(y.title),C(y.description),M(y.dependsOn))},[g,y]);const V=r.filter(O=>O.projectId===v&&(!g||O.id!==a)&&O.id!==_),X=E.trim().length>0&&(!g||y!==void 0)&&(g||v.length>0),Q=O=>{M(ne=>ne.includes(O)?ne.filter(W=>W!==O):[...ne,O])},I=()=>{X&&(g&&y===void 0||(g&&a?(d(a,E.trim(),j,w),p("Task updated","success"),m(as(a),{replace:!0})):(u(v,E.trim(),j,w.length>0?w:void 0,_||void 0),p("Task created","success"),m(Kl(v),{replace:!0}))))},te=()=>{m(g&&a?as(a):Kl(v))},se=g?"edit task":_?"child task":"new task";return h.jsxs("div",{className:it.container,children:[h.jsxs("div",{className:it.header,children:[h.jsxs("div",{className:it.headerTitle,children:[h.jsx("span",{className:it.badge,children:se}),T&&h.jsxs("span",{className:it.parentContext,children:[h.jsx("span",{className:it.parentLabel,children:"Child of"}),h.jsx("span",{className:it.parentName,children:T.title})]})]}),h.jsxs("div",{className:it.headerActions,children:[h.jsx("button",{onClick:I,disabled:!X,className:it.btnPrimary,"data-testid":"task-edit-save",children:g?"Save Changes":"Create"}),h.jsx("button",{onClick:te,className:it.btnGhost,children:"Cancel"})]})]}),h.jsx("div",{className:it.body,children:h.jsxs("div",{className:it.formContent,children:[h.jsxs("div",{className:it.section,children:[h.jsx("label",{className:it.label,htmlFor:"task-edit-title",children:"Title"}),h.jsx("input",{id:"task-edit-title",type:"text",value:E,onChange:O=>A(O.target.value),placeholder:"Task title...",autoFocus:!0,className:it.titleInput,"data-testid":"task-edit-title",onKeyDown:O=>{O.key==="Enter"&&X&&I()}})]}),h.jsxs("div",{className:it.section,children:[h.jsx("label",{className:it.label,htmlFor:"task-edit-description",children:"Description"}),h.jsx("textarea",{id:"task-edit-description",value:j,onChange:O=>C(O.target.value),placeholder:"Describe the task... (markdown supported)",className:it.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),h.jsxs("div",{className:it.section,children:[h.jsx("div",{className:it.label,children:"Dependencies"}),V.length===0?h.jsx("div",{className:it.noDeps,children:"No other tasks in this project"}):h.jsx("div",{className:it.depList,children:V.map(O=>{const ne=w.includes(O.id);return h.jsxs("label",{className:`${it.depItem} ${ne?it.depItemSelected:""}`,"data-testid":`dep-option-${O.id}`,children:[h.jsx("input",{type:"checkbox",checked:ne,onChange:()=>Q(O.id)}),O.title,h.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",O.status,")"]})]},O.id)})})]})]})})]})}function lO(){const[n]=Mf(),a=n.get("project")??"",i=n.get("parent")??void 0;return a?h.jsx(z1,{mode:"new",projectId:a,parentTaskId:i}):h.jsx(Dr,{to:"/",replace:!0})}function oO(){const{taskId:n}=Qr();return h.jsx(z1,{mode:"edit",taskId:n})}const rO="_container_1pqxm_1",cO="_emptyState_1pqxm_8",uO="_card_1pqxm_14",dO="_cardHeader_1pqxm_34",fO="_categoryBadge_1pqxm_46",hO="_findingTitle_1pqxm_54",pO="_findingDate_1pqxm_60",mO="_findingContent_1pqxm_72",gO="_tags_1pqxm_78",yO="_tag_1pqxm_78",Yn={container:rO,emptyState:cO,card:uO,cardHeader:dO,categoryBadge:fO,findingTitle:hO,findingDate:pO,findingContent:mO,tags:gO,tag:yO};function vO(n){const a=new Date(n),i=new Date,o=i.getTime()-a.getTime(),r=Math.floor(o/1e3),u=Math.floor(r/60),d=Math.floor(u/60),p=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(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=a.getFullYear()===i.getFullYear(),g=a.toLocaleString("en-US",{month:"short"}),y=a.getDate();return m?`${g} ${y}`:`${g} ${y} ${a.getFullYear()}`}const h0={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 bO({projectId:n}){const{findings:a}=qt(),i=a.filter(o=>o.projectId===n);return i.length===0?h.jsx("div",{className:Yn.emptyState,children:"No findings yet. Agents will post discoveries here."}):h.jsx("div",{className:Yn.container,children:i.map((o,r)=>{const u=h0[o.category]||h0.general;return h.jsxs(Rn.div,{className:Yn.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},children:[h.jsxs("div",{className:Yn.cardHeader,children:[h.jsx("span",{className:Yn.categoryBadge,style:{background:u.bg,color:u.text},children:o.category}),h.jsx("span",{className:Yn.findingTitle,children:o.title}),h.jsx("span",{className:Yn.findingDate,title:o.createdAt,children:vO(o.createdAt)})]}),h.jsx("div",{className:Yn.findingContent,children:o.content.length>300?o.content.slice(0,300)+"...":o.content}),o.tags.length>0&&h.jsx("div",{className:Yn.tags,children:o.tags.map(d=>h.jsx("span",{className:Yn.tag,style:{color:u.text,textShadow:`0 0 8px ${u.text}`},children:d},d))})]},o.id)})})}function Nr(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 Gd(n,a){if(!n||!a)return;const i=new Date(a).getTime()-new Date(n).getTime();if(isNaN(i)||i<0)return;const o=Math.floor(i/6e4),r=Math.floor(i%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 SO(n){const a=n.toLowerCase();return a==="ready"||a==="running"||a==="available"||a==="connected"?k.envDotGreen:a==="provisioning"||a==="starting"||a==="pending"||a==="connecting"?k.envDotYellow:a==="error"||a==="failed"||a==="disconnected"?k.envDotRed:k.envDotGray}function _O({status:n}){const a=ls(n),i=nD(n);return h.jsx("span",{className:`${k.statusBadge} ${k[i]??k.statusPending}`,children:a.label})}function xO({task:n,tasksById:a,environments:i,projects:o,taskSessions:r}){const u=r.length>0?r[r.length-1]:void 0,d=(u==null?void 0:u.environmentId)??"",p=d?i.find(y=>y.id===d):void 0,m=o.find(y=>y.id===n.projectId),g=n.branch&&(m!=null&&m.repoUrl)?`${m.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(n.branch)}`:void 0;return h.jsxs("div",{className:k.overviewDashboard,children:[h.jsxs("div",{className:k.overviewHero,children:[h.jsx(_O,{status:n.status}),n.branch&&h.jsx("span",{className:k.overviewBranchPill,children:g?h.jsxs("a",{href:g,target:"_blank",rel:"noreferrer noopener",className:k.branchLink,children:["🔗"," ",n.branch]}):h.jsxs("span",{children:["🔗"," ",n.branch]})})]}),typeof n.description=="string"&&n.description&&h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Description"}),h.jsx("div",{className:k.overviewMarkdown,children:h.jsx(Tf,{remarkPlugins:[Ef],children:n.description})})]}),d&&h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Environment"}),h.jsxs("div",{className:k.envRow,children:[p&&h.jsx("span",{className:`${k.envDot} ${SO(p.status)}`,title:p.status,"aria-label":`Status: ${p.status}`,role:"img"}),h.jsx("span",{className:k.overviewValue,children:(p==null?void 0:p.displayName)??d})]})]}),h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Dependencies"}),n.dependsOn.length===0?h.jsx("div",{className:k.overviewMuted,children:"None"}):h.jsx("div",{className:k.depList,children:n.dependsOn.map(y=>{const v=a.get(y),_=(v==null?void 0:v.status)==="complete";return h.jsxs("div",{className:`${k.depItem} ${_?k.depDone:k.depBlocked}`,children:[h.jsx("span",{children:_?"✓":"○"}),h.jsx("span",{children:(v==null?void 0:v.title)??y})]},y)})})]}),h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Timeline"}),h.jsxs("div",{className:k.timeline,children:[n.createdAt&&h.jsxs("div",{className:k.timelineRow,children:[h.jsx("span",{className:k.timelineKey,children:"Created"}),h.jsx("span",{className:k.timelineValue,children:Nr(n.createdAt)})]}),n.assignedAt&&(()=>{const y=Gd(n.createdAt,n.assignedAt);return h.jsxs("div",{className:k.timelineRow,children:[h.jsx("span",{className:k.timelineKey,children:"Assigned"}),h.jsx("span",{className:k.timelineValue,children:Nr(n.assignedAt)}),y!==void 0&&h.jsx("span",{className:k.timelineDelta,children:y})]})})(),n.startedAt&&(()=>{const y=Gd(n.assignedAt??n.createdAt,n.startedAt);return h.jsxs("div",{className:k.timelineRow,children:[h.jsx("span",{className:k.timelineKey,children:"Started"}),h.jsx("span",{className:k.timelineValue,children:Nr(n.startedAt)}),y!==void 0&&h.jsx("span",{className:k.timelineDelta,children:y})]})})(),n.completedAt&&(()=>{const y=Gd(n.startedAt,n.completedAt);return h.jsxs("div",{className:k.timelineRow,children:[h.jsx("span",{className:k.timelineKey,children:"Completed"}),h.jsx("span",{className:k.timelineValue,children:Nr(n.completedAt)}),y!==void 0&&h.jsx("span",{className:k.timelineDelta,children:y})]})})(),!n.createdAt&&!n.assignedAt&&!n.startedAt&&!n.completedAt&&h.jsx("div",{className:k.overviewMuted,children:"No timing data"})]})]}),n.reviewNotes&&h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Review Notes"}),h.jsx("div",{className:k.reviewNotes,children:n.reviewNotes})]})]})}function TO({eventsDropped:n}){return n<=0?h.jsx(h.Fragment,{}):h.jsxs("div",{className:k.eventOverflowWarning,role:"alert",children:["⚠ ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown."]})}function EO({task:n,sessionId:a,isBlocked:i,onStart:o,onResume:r,onStop:u,onComplete:d,onDelete:p,onEdit:m}){if(n.status==="not_started")return i?h.jsxs("div",{className:k.headerActions,children:[h.jsx("button",{onClick:m,className:k.btnGhost,children:"Edit"}),h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})]}):h.jsxs("div",{className:k.headerActions,children:[h.jsx("button",{onClick:o,className:k.btnPrimary,children:"Start"}),h.jsx("button",{onClick:m,className:k.btnGhost,children:"Edit"}),h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})]});if(n.status==="working")return h.jsx("div",{className:k.headerActions,children:h.jsx("button",{onClick:u,disabled:!a,className:k.btnDanger,children:"Stop"})});if(n.status==="paused")return h.jsxs("div",{className:k.headerActions,children:[h.jsx("button",{onClick:d,className:k.btnPrimary,children:"Complete"}),h.jsx("button",{onClick:r,className:k.btnGhost,children:"Resume"}),h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})]});if(n.status==="complete")return h.jsx("div",{className:k.headerActions,children:h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})});if(n.status==="failed")return h.jsxs("div",{className:k.headerActions,children:[h.jsx("button",{onClick:o,className:k.btnPrimary,children:"Retry"}),h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})]})}function CO({taskSessions:n,selectedSessionId:a,onSelect:i}){if(!(n.length<2))return h.jsxs("div",{className:k.attemptSelector,"data-testid":"attempt-selector",children:[h.jsx("span",{className:k.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:`${k.attemptButton} ${u?k.attemptActive:""}`,onClick:()=>i(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:k.attemptStatus,children:d})]},o.id)})]})}function qd(){const{taskId:n}=Qr(),a=Wt(),i=Pn(),{events:o,eventsDropped:r,tasks:u,environments:d,loadSessionEvents:p,loadFindings:m,kill:g,startTask:y,resumeTask:v,completeTask:_,deleteTask:T,projects:E,taskSessions:A,loadTaskSessions:j}=qt(),C=S.useRef(null),w=S.useRef(void 0),M=S.useRef(void 0),G=S.useRef(void 0),V=S.useRef(void 0),X=S.useRef(void 0),Q=a.pathname.endsWith("/stream")?"stream":a.pathname.endsWith("/findings")?"findings":"overview",[I,te]=S.useState(Q),[se,O]=S.useState(!1),[ne,W]=S.useState(void 0),he=S.useRef(Q);Q!==he.current&&(he.current=Q,Q!==I&&te(Q));const P=u.find(F=>F.id===n),U=(P==null?void 0:P.projectId)||void 0,K=P?A[P.id]??[]:[];let ee;ne&&K.some(F=>F.id===ne)?ee=ne:ee=(P==null?void 0:P.latestSessionId)||void 0;const we=()=>{O(!0)},xe=()=>{P&&(T(P.id),O(!1),i(Kl(P.projectId),{replace:!0}))};if((P==null?void 0:P.id)!==M.current&&(M.current=P==null?void 0:P.id,ne!==void 0&&W(void 0)),S.useEffect(()=>{if(!(P!=null&&P.id))return;const F=P.id!==V.current,me=P.latestSessionId!==X.current;(F||me)&&(V.current=P.id,X.current=P.latestSessionId,j(P.id))},[P==null?void 0:P.id,P==null?void 0:P.latestSessionId,j]),(P==null?void 0:P.status)!==G.current){G.current=P==null?void 0:P.status;const F=(P==null?void 0:P.status)==="not_started"?"overview":(P==null?void 0:P.status)==="working"||(P==null?void 0:P.status)==="paused"?"stream":(P==null?void 0:P.status)==="complete"?"findings":void 0;F&&F!==I&&te(F)}const Ue=S.useMemo(()=>new Map(u.map(F=>[F.id,F])),[u]),Ee=S.useMemo(()=>{const F=ee?o.filter(me=>me.sessionId===ee):[];return U1(L1(F))},[o,ee]),ye=P?P.dependsOn.some(F=>{const me=Ue.get(F);return me!==void 0&&me.status!=="complete"}):!1,Te=S.useMemo(()=>LR(n,E,Ue),[n,E,Ue]);S.useEffect(()=>{ee&&ee!==w.current&&(w.current=ee,p(ee))},[ee,p]),S.useEffect(()=>{I==="findings"&&U&&m(U)},[I,U,m]),S.useEffect(()=>{C.current&&I==="stream"&&(C.current.scrollTop=C.current.scrollHeight)},[Ee.length,I]);const J=F=>{te(F),i(as(n,F==="overview"?void 0:F))};return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:Te}),h.jsxs("div",{className:k.header,children:[h.jsxs("span",{className:k.headerTitle,children:[h.jsx("span",{"data-testid":"task-title",children:(P==null?void 0:P.title)||n}),P&&h.jsx("span",{className:k.taskStatusBadge,"data-testid":"task-status",children:P.status}),(P==null?void 0:P.branch)&&h.jsx("span",{className:k.taskBranch,children:P.branch}),ye&&h.jsx("span",{className:k.taskBlockedBadge,children:"blocked"})]}),P&&h.jsx(EO,{task:P,sessionId:ee,isBlocked:ye,onStart:()=>y(P.id),onResume:()=>v(P.id),onStop:()=>ee&&g(ee),onComplete:()=>_(P.id),onDelete:we,onEdit:()=>i(FT(P.id))})]}),h.jsxs("div",{className:k.tabBar,role:"tablist","aria-label":"Task view",children:[h.jsx("button",{role:"tab","aria-selected":I==="overview",className:`${k.tab} ${I==="overview"?k.active:""}`,onClick:()=>J("overview"),children:"Overview"}),h.jsx("button",{role:"tab","aria-selected":I==="stream",className:`${k.tab} ${I==="stream"?k.active:""}`,onClick:()=>J("stream"),children:"Stream"}),h.jsx("button",{role:"tab","aria-selected":I==="findings",className:`${k.tab} ${I==="findings"?k.active:""}`,onClick:()=>J("findings"),children:"Findings"})]}),h.jsxs(os,{mode:"wait",children:[I==="overview"&&h.jsx(Rn.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:k.overviewContent,children:P?h.jsx(xO,{task:P,tasksById:Ue,environments:d,projects:E,taskSessions:K}):h.jsx("div",{className:k.waitingMessage,children:"No additional details"})},"overview"),I==="stream"&&h.jsxs(Rn.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(CO,{taskSessions:K,selectedSessionId:ee,onSelect:F=>W(F)}),h.jsxs("div",{ref:C,className:k.eventScroll,children:[!ee&&P&&h.jsxs("div",{className:k.emptyCta,children:[h.jsx("button",{className:k.ctaButton,onClick:()=>y(P.id),children:"Start Task"}),h.jsx("div",{className:k.ctaDescription,children:"Click to begin agent execution"})]}),ee&&Ee.length===0&&h.jsx("div",{className:k.waitingMessage,children:"Waiting for events..."}),h.jsx(TO,{eventsDropped:r}),Ee.map((F,me)=>h.jsx(N1,{event:F,toolUseCtx:F.toolUseCtx},`${F.sessionId}-${F.timestamp}-${me}`))]})]},"stream"),I==="findings"&&h.jsx(Rn.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:k.tabContent,children:U?h.jsx(bO,{projectId:U}):h.jsx("div",{className:k.noContext,children:"Navigate to a task within a project to view findings"})},"findings")]}),P&&h.jsx(lc,{isOpen:se,title:"Delete Task?",description:`"${P.title}" will be permanently removed.`,onConfirm:xe,onCancel:()=>O(!1)})]})}function AO(){const n=MR();return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:n}),h.jsx("div",{className:k.emptyState,children:"Configure the new environment below"})]})}const jO="_layout_1sbe4_1",NO="_content_1sbe4_8",p0={layout:jO,content:NO},wO={environments:"Environments",credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About"};function DO(){const a=Wt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=wO[a],o=kR(i);return h.jsxs("div",{className:p0.layout,children:[h.jsx(Ii,{segments:o}),h.jsx("div",{className:p0.content,children:h.jsx(D0,{})})]})}const kO="_nav_13n0b_1",MO="_tab_13n0b_44",RO="_tabIcon_13n0b_82",OO="_tabActive_13n0b_88",wr={nav:kO,tab:MO,tabIcon:RO,tabActive:OO},Ta=[{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 BO(){var d;const n=Wt(),a=Pn(),i=S.useRef(null),o=((d=Ta.find(p=>n.pathname===`${ki}/${p.path}`))==null?void 0:d.path)??Ta[0].path,r=S.useCallback(p=>{a(`${ki}/${p}`)},[a]),u=S.useCallback(p=>{var T,E;const m=(T=i.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(A=>A===document.activeElement),y=g>=0?g:Ta.findIndex(A=>A.path===o);let v=y;if(p.key==="ArrowDown")p.preventDefault(),v=(y+1)%Ta.length;else if(p.key==="ArrowUp")p.preventDefault(),v=(y-1+Ta.length)%Ta.length;else if(p.key==="Home")p.preventDefault(),v=0;else if(p.key==="End")p.preventDefault(),v=Ta.length-1;else return;const _=Ta[v].path;a(`${ki}/${_}`),(E=m[v])==null||E.focus()},[o,a]);return h.jsx("nav",{className:wr.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:Ta.map(p=>{const m=p.path===o;return h.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${wr.tab} ${m?wr.tabActive:""}`,onClick:()=>r(p.path),children:[h.jsx("span",{className:wr.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}const LO="_container_1nk8c_1",UO="_header_1nk8c_5",zO="_headerLabel_1nk8c_12",VO="_addButton_1nk8c_20",IO="_envRow_1nk8c_55",HO="_targeted_1nk8c_69",PO="_expanded_1nk8c_72",GO="_statusDot_1nk8c_76",qO="_pulse_1nk8c_79",FO="_envName_1nk8c_83",$O="_envActions_1nk8c_87",YO="_idleLabel_1nk8c_94",KO="_newChatButton_1nk8c_99",ZO="_envActionsRow_1nk8c_126",XO="_connectButton_1nk8c_134",QO="_stopButton_1nk8c_160",JO="_deleteButton_1nk8c_186",WO="_provisionMessage_1nk8c_213",eB="_errorMessage_1nk8c_220",tB="_sessionRow_1nk8c_227",nB="_selected_1nk8c_243",aB="_sessionDot_1nk8c_248",sB="_sessionSummaryRow_1nk8c_252",iB="_sessionExpandArrow_1nk8c_272",lB="_sessionSummaryText_1nk8c_283",oB="_sessionCountBadge_1nk8c_290",rB="_emptyCta_1nk8c_313",cB="_ctaDescription_1nk8c_326",uB="_ctaButton_1nk8c_332",Pe={container:LO,header:UO,headerLabel:zO,addButton:VO,envRow:IO,targeted:HO,expanded:PO,statusDot:GO,pulse:qO,envName:FO,envActions:$O,idleLabel:YO,newChatButton:KO,envActionsRow:ZO,connectButton:XO,stopButton:QO,deleteButton:JO,provisionMessage:WO,errorMessage:eB,sessionRow:tB,selected:nB,sessionDot:aB,sessionSummaryRow:sB,sessionExpandArrow:iB,sessionSummaryText:lB,sessionCountBadge:oB,emptyCta:rB,ctaDescription:cB,ctaButton:uB},dB={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"},fB={running:"running",idle:"awaiting input",failed:"failed",interrupted:"interrupted",completed:"completed"},m0=["running","idle","failed","interrupted","completed"],hB=.2;function pB(n){const a={};for(const u of n)a[u.status]=(a[u.status]||0)+1;const i=m0.filter(u=>a[u]>0).map(u=>`${a[u]} ${fB[u]||u}`),o=new Set(m0),r=Object.keys(a).filter(u=>!o.has(u)).sort().map(u=>`${a[u]} ${u}`);return[...i,...r].join(", ")}function mB({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:Pe.sessionDot,style:{color:a},children:"●"})}function gB({env:n,envSessions:a,selectedSessionId:i,isNewChatTarget:o,expanded:r,onToggleExpand:u,sessionsExpanded:d,onToggleSessionsExpand:p,provisionProgress:m,onProvision:g,onStop:y,onRemove:v,navigate:_}){const[T,E]=S.useState(!1),A=dB[n.status]||"var(--text-tertiary)",j=n.status==="connected",C=n.status==="connecting",w=n.status==="disconnected"||n.status==="error";return h.jsxs("div",{children:[h.jsx(lc,{isOpen:T,title:"Delete Environment?",description:`"${n.displayName||n.id}" will be permanently removed. This destroys the workspace and removes all data.`,onConfirm:()=>{v(n.id),E(!1)},onCancel:()=>E(!1)}),h.jsxs("div",{className:`${Pe.envRow} ${o?Pe.targeted:""} ${r?Pe.expanded:""}`,"data-testid":"env-row",onClick:u,children:[h.jsx("span",{className:`${Pe.statusDot} ${j?Pe.pulse:""}`,style:{color:A},children:"●"}),h.jsx("span",{className:Pe.envName,title:n.displayName||n.id,children:n.displayName||n.id}),h.jsxs("span",{className:Pe.envActions,children:[a.length===0&&!o&&!r&&h.jsx("span",{className:Pe.idleLabel,children:"(idle)"}),j&&h.jsx("button",{onClick:M=>{M.stopPropagation(),_(L0(n.id,n.defaultRuntime||"claude-code"))},title:"New chat",className:Pe.newChatButton,children:"+"})]})]}),r&&h.jsxs("div",{className:Pe.envActionsRow,children:[C&&m&&h.jsx("span",{className:Pe.provisionMessage,children:m.message}),n.status==="error"&&(m==null?void 0:m.stage)==="error"&&h.jsx("span",{className:Pe.errorMessage,children:m.message}),w&&h.jsx("button",{onClick:M=>{M.stopPropagation(),g(n.id)},className:Pe.connectButton,children:n.status==="error"?"Retry":"Connect"}),j&&h.jsx("button",{onClick:M=>{M.stopPropagation(),y(n.id)},className:Pe.stopButton,children:"Stop"}),!C&&h.jsx("button",{onClick:M=>{M.stopPropagation(),E(!0)},className:Pe.deleteButton,children:"Delete"})]}),a.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:Pe.sessionSummaryRow,"data-testid":"session-summary-row",role:"button",tabIndex:0,"aria-expanded":d,"aria-label":d?"Collapse sessions":"Expand sessions",onClick:p,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),p())},children:[h.jsx("span",{className:`${Pe.sessionExpandArrow} ${d?Pe.expanded:""}`,children:"▸"}),h.jsx("span",{className:Pe.sessionSummaryText,children:pB(a)}),h.jsx("span",{className:Pe.sessionCountBadge,children:a.length})]}),h.jsx(os,{children:d&&h.jsx(Rn.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:hB,ease:"easeInOut"},style:{overflow:"hidden"},children:a.map(M=>h.jsxs("div",{onClick:G=>{G.stopPropagation(),_(B0(M.id))},className:`${Pe.sessionRow} ${i===M.id?Pe.selected:""}`,title:M.prompt,"data-testid":"session-row",children:[h.jsx(mB,{status:M.status})," ",M.prompt.length>24?M.prompt.slice(0,24)+"...":M.prompt]},M.id))})})]})]})}function yB(){const{environments:n,sessions:a,provisionStatus:i,provisionEnvironment:o,stopEnvironment:r,removeEnvironment:u}=qt(),d=Pn(),[p,m]=S.useState(null),[g,y]=S.useState(new Set),v=Qt("/sessions/:sessionId"),_=Qt("/sessions/new"),T=(v==null?void 0:v.params.sessionId)!=="new"?v==null?void 0:v.params.sessionId:void 0,[E]=Mf(),A=_?E.get("env")??void 0:void 0;return h.jsxs("div",{className:Pe.container,children:[h.jsxs("div",{className:Pe.header,children:[h.jsx("span",{className:Pe.headerLabel,children:"Environments"}),h.jsx("button",{className:Pe.addButton,onClick:()=>d(Cy),title:"Add environment",children:"+ Add Environment"})]}),n.length===0&&h.jsxs("div",{className:Pe.emptyCta,children:[h.jsx("button",{className:Pe.ctaButton,onClick:()=>d(Cy),children:"Add Environment"}),h.jsx("div",{className:Pe.ctaDescription,children:"Connect an environment to run agents"})]}),n.map(j=>{const C=a.filter(w=>w.environmentId===j.id);return h.jsx(gB,{env:j,envSessions:C,selectedSessionId:T,isNewChatTarget:A===j.id,expanded:p===j.id,onToggleExpand:()=>m(p===j.id?null:j.id),sessionsExpanded:g.has(j.id),onToggleSessionsExpand:()=>{y(w=>{const M=new Set(w);return M.has(j.id)?M.delete(j.id):M.add(j.id),M})},provisionProgress:i[j.id],onProvision:o,onStop:r,onRemove:u,navigate:d},j.id)})]})}function vB(){return h.jsx(yB,{})}const bB="_section_1ingb_14",SB="_sectionTitle_1ingb_26",_B="_sectionDescription_1ingb_35",xB="_tokenList_1ingb_48",TB="_tokenRow_1ingb_55",EB="_tokenBadge_1ingb_68",CB="_tokenName_1ingb_83",AB="_tokenTarget_1ingb_90",jB="_deleteButton_1ingb_99",NB="_addForm_1ingb_113",wB="_formRow_1ingb_119",DB="_input_1ingb_125",kB="_select_1ingb_155",MB="_addButton_1ingb_187",RB="_emptyStateInfo_1ingb_221",OB="_themeOptions_1ingb_229",BB="_themeOption_1ingb_229",LB="_themeOptionSelected_1ingb_254",UB="_themeOptionHeader_1ingb_259",zB="_themeOptionLabel_1ingb_266",VB="_themeOptionDesc_1ingb_273",IB="_variantToggle_1ingb_279",HB="_variantButton_1ingb_286",PB="_variantActive_1ingb_305",GB="_themeSwatches_1ingb_311",qB="_themeSwatch_1ingb_311",FB="_systemToggle_1ingb_325",$B="_systemToggleHint_1ingb_341",YB="_themeActive_1ingb_348",KB="_aboutGrid_1ingb_354",ZB="_aboutItem_1ingb_360",XB="_aboutLabel_1ingb_373",QB="_aboutValue_1ingb_379",JB="_aboutDot_1ingb_387",WB="_aboutDotConnected_1ingb_394",e5="_aboutDotDisconnected_1ingb_398",ce={section:bB,sectionTitle:SB,sectionDescription:_B,tokenList:xB,tokenRow:TB,tokenBadge:EB,tokenName:CB,tokenTarget:AB,deleteButton:jB,addForm:NB,formRow:wB,input:DB,select:kB,addButton:MB,emptyStateInfo:RB,themeOptions:OB,themeOption:BB,themeOptionSelected:LB,themeOptionHeader:UB,themeOptionLabel:zB,themeOptionDesc:VB,variantToggle:IB,variantButton:HB,variantActive:PB,themeSwatches:GB,themeSwatch:qB,systemToggle:FB,systemToggleHint:$B,themeActive:YB,aboutGrid:KB,aboutItem:ZB,aboutLabel:XB,aboutValue:QB,aboutDot:JB,aboutDotConnected:WB,aboutDotDisconnected:e5},t5=[{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 n5(){const{credentialProviders:n,updateCredentialProviders:a}=qt(),i=(o,r)=>{const u={...n};o==="claude"?u.claude=r:u[o]=r,a(u)};return h.jsxs("section",{className:ce.section,children:[h.jsx("h3",{className:ce.sectionTitle,children:"Credential Providers"}),h.jsx("p",{className:ce.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:ce.tokenList,children:t5.map(o=>h.jsxs("div",{className:ce.tokenRow,children:[h.jsx("span",{className:ce.tokenName,children:o.label}),h.jsx("span",{className:ce.tokenTarget,children:o.description}),h.jsx("select",{className:ce.select,value:n[o.key],onChange:r=>i(o.key,r.target.value),children:o.options.map(r=>h.jsx("option",{value:r.value,children:r.label},r.value))})]},o.key))})]})}const a5=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function s5(){const{tokens:n,setToken:a,deleteToken:i}=qt(),{showToast:o}=ao(),[r,u]=S.useState(""),[d,p]=S.useState(""),[m,g]=S.useState("env_var"),[y,v]=S.useState(""),[_,T]=S.useState(null),E=C=>{if(C.preventDefault(),!r||!d)return;const w=m==="env_var"?y||r.toUpperCase()+"_TOKEN":"";a(r,d,m,w,m==="file"?y:""),o("Token saved successfully","success"),u(""),p(""),v("")},A=C=>{T(C)},j=()=>{_&&(i(_),o("Token deleted","info")),T(null)};return h.jsxs(h.Fragment,{children:[h.jsx(lc,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:j,onCancel:()=>T(null)}),h.jsxs("section",{className:ce.section,children:[h.jsx("h3",{className:ce.sectionTitle,children:"Tokens"}),h.jsx("p",{className:ce.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),n.length===0?h.jsx("div",{className:ce.emptyStateInfo,children:"Add your first API token to enable service integrations."}):h.jsx("div",{className:ce.tokenList,children:n.map(C=>h.jsxs("div",{className:ce.tokenRow,children:[h.jsx("span",{className:ce.tokenBadge,children:C.tokenType}),h.jsx("span",{className:ce.tokenName,children:C.name}),h.jsx("span",{className:ce.tokenTarget,children:C.tokenType==="env_var"?C.envVar:C.filePath}),h.jsx("button",{className:ce.deleteButton,onClick:()=>A(C.name),title:`Delete ${C.name}`,children:"×"})]},C.name))}),h.jsxs("form",{className:ce.addForm,onSubmit:E,children:[h.jsxs("div",{className:ce.formRow,children:[h.jsx("input",{className:ce.input,type:"text",placeholder:"Token name",value:r,onChange:C=>u(C.target.value)}),h.jsx("input",{className:ce.input,type:"password",placeholder:"Value",value:d,onChange:C=>p(C.target.value)})]}),h.jsxs("div",{className:ce.formRow,children:[h.jsx("select",{className:ce.select,value:m,onChange:C=>g(C.target.value),children:a5.map(C=>h.jsx("option",{value:C.value,children:C.label},C.value))}),h.jsx("input",{className:ce.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:y,onChange:C=>v(C.target.value)}),h.jsx("button",{className:ce.addButton,type:"submit",children:"Add Token"})]})]})]})]})}function i5(){return h.jsxs(h.Fragment,{children:[h.jsx(n5,{}),h.jsx(s5,{})]})}const l5="_container_1xcp7_1",o5="_header_1xcp7_7",r5="_form_1xcp7_19",c5="_formActions_1xcp7_87",u5="_list_1xcp7_93",d5="_card_1xcp7_99",f5="_active_1xcp7_109",h5="_cardHeader_1xcp7_113",p5="_cardActions_1xcp7_123",m5="_description_1xcp7_128",g5="_meta_1xcp7_134",y5="_promptDetails_1xcp7_151",v5="_promptText_1xcp7_163",b5="_empty_1xcp7_180",S5="_btnPrimary_1xcp7_186",_5="_btnSecondary_1xcp7_220",x5="_btnSmall_1xcp7_247",T5="_btnDanger_1xcp7_273",bt={container:l5,header:o5,form:r5,formActions:c5,list:u5,card:d5,active:f5,cardHeader:h5,cardActions:p5,description:m5,meta:g5,promptDetails:y5,promptText:v5,empty:b5,btnPrimary:S5,btnSecondary:_5,btnSmall:x5,btnDanger:T5};function E5(){const{personas:n,createPersona:a,updatePersona:i,deletePersona:o}=qt(),[r,u]=S.useState(null),[d,p]=S.useState(!1),[m,g]=S.useState(null),[y,v]=S.useState(""),[_,T]=S.useState(""),[E,A]=S.useState(""),[j,C]=S.useState(""),[w,M]=S.useState(""),[G,V]=S.useState(0),X=()=>{v(""),T(""),A(""),C(""),M(""),V(0)},Q=()=>{X(),u(null),p(!0)},I=W=>{v(W.name),T(W.description),A(W.systemPrompt),C(W.runtime),M(W.model),V(W.maxTurns),u(W),p(!1)},te=W=>{W.preventDefault(),!(!y.trim()||!E.trim())&&(r?(i(r.id,y,_,E,j,w,G),u(null)):(a(y,_,E,j,w,G),p(!1)),X())},se=W=>{o(W),g(null),(r==null?void 0:r.id)===W&&(u(null),X())},O=()=>{u(null),p(!1),X()},ne=()=>h.jsxs("form",{onSubmit:te,className:bt.form,children:[h.jsx("h3",{children:r?"Edit Persona":"Create Persona"}),h.jsxs("label",{children:["Name",h.jsx("input",{type:"text",value:y,onChange:W=>v(W.target.value),placeholder:"e.g. Frontend Engineer",required:!0})]}),h.jsxs("label",{children:["Description",h.jsx("input",{type:"text",value:_,onChange:W=>T(W.target.value),placeholder:"Brief description..."})]}),h.jsxs("label",{children:["Runtime",h.jsxs("select",{value:j,onChange:W=>C(W.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:w,onChange:W=>M(W.target.value),placeholder:"e.g. sonnet"})]}),h.jsxs("label",{children:["Max Turns",h.jsx("input",{type:"number",value:G,onChange:W=>V(parseInt(W.target.value,10)||0),min:0})]}),h.jsxs("label",{children:["System Prompt",h.jsx("textarea",{value:E,onChange:W=>A(W.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0})]}),h.jsxs("div",{className:bt.formActions,children:[h.jsx("button",{type:"submit",className:bt.btnPrimary,children:r?"Save":"Create"}),h.jsx("button",{type:"button",onClick:O,className:bt.btnSecondary,children:"Cancel"})]})]});return h.jsxs("div",{className:bt.container,children:[h.jsxs("div",{className:bt.header,children:[h.jsx("h2",{children:"Personas"}),h.jsx("button",{onClick:Q,className:bt.btnPrimary,children:"+ New Persona"})]}),(d||r)&&ne(),n.length===0&&!d?h.jsx("p",{className:bt.empty,children:"No personas yet. Create one to get started."}):h.jsx("div",{className:bt.list,children:n.map(W=>h.jsxs("div",{className:`${bt.card} ${(r==null?void 0:r.id)===W.id?bt.active:""}`,children:[h.jsxs("div",{className:bt.cardHeader,children:[h.jsx("strong",{children:W.name}),h.jsxs("div",{className:bt.cardActions,children:[h.jsx("button",{onClick:()=>I(W),className:bt.btnSmall,children:"Edit"}),m===W.id?h.jsxs(h.Fragment,{children:[h.jsx("button",{onClick:()=>se(W.id),className:bt.btnDanger,children:"Confirm"}),h.jsx("button",{onClick:()=>g(null),className:bt.btnSmall,children:"Cancel"})]}):h.jsx("button",{onClick:()=>g(W.id),className:bt.btnSmall,children:"Delete"})]})]}),W.description&&h.jsx("p",{className:bt.description,children:W.description}),h.jsxs("div",{className:bt.meta,children:[W.runtime&&h.jsxs("span",{children:["Runtime: ",W.runtime]}),W.model&&h.jsxs("span",{children:["Model: ",W.model]}),W.maxTurns>0&&h.jsxs("span",{children:["Max turns: ",W.maxTurns]})]}),h.jsxs("details",{className:bt.promptDetails,children:[h.jsx("summary",{children:"System Prompt"}),h.jsx("pre",{className:bt.promptText,children:W.systemPrompt})]})]},W.id))})]})}function C5(){return h.jsx(E5,{})}function A5(){const{themeId:n,resolvedThemeId:a,setTheme:i,preferSystem:o,setPreferSystem:r}=G0();return h.jsxs("section",{className:ce.section,children:[h.jsx("h3",{className:ce.sectionTitle,children:"Appearance"}),h.jsx("p",{className:ce.sectionDescription,children:"Choose how Grackle looks across the app."}),h.jsx("div",{className:ce.themeOptions,children:Wr.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),p=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,m=d&&a===u.variantLightId;return h.jsxs("button",{type:"button",className:`${ce.themeOption} ${p?ce.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(u.id),children:[h.jsxs("span",{className:ce.themeOptionHeader,children:[h.jsxs("span",{children:[h.jsx("span",{className:ce.themeOptionLabel,children:u.label}),h.jsx("span",{className:ce.themeOptionDesc,children:u.description})]}),d&&h.jsxs("span",{className:ce.variantToggle,children:[h.jsx("span",{role:"button",tabIndex:0,className:`${ce.variantButton} ${p&&m?ce.variantActive:""}`,onClick:g=>{g.stopPropagation(),r(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),h.jsx("span",{role:"button",tabIndex:0,className:`${ce.variantButton} ${p&&!m?ce.variantActive:""}`,onClick:g=>{g.stopPropagation(),r(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),u.swatches&&h.jsx("span",{className:ce.themeSwatches,children:u.swatches.map((g,y)=>h.jsx("span",{className:ce.themeSwatch,style:{background:g}},y))})]},u.id)})}),h.jsxs("label",{className:ce.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:ce.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),h.jsxs("p",{className:ce.themeActive,children:["Active theme: ",h.jsx("strong",{children:a})]})]})}function j5(){return h.jsx(A5,{})}function N5(){const{connected:n,environments:a,sessions:i}=qt(),o=a.filter(d=>d.status==="connected").length,r=a.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return h.jsxs("section",{className:ce.section,"data-testid":"about-panel",children:[h.jsx("h3",{className:ce.sectionTitle,children:"About"}),h.jsx("p",{className:ce.sectionDescription,children:"Connection status and application information."}),h.jsxs("div",{className:ce.aboutGrid,children:[h.jsxs("div",{className:ce.aboutItem,children:[h.jsx("span",{className:ce.aboutLabel,children:"Connection"}),h.jsxs("span",{className:ce.aboutValue,children:[h.jsx("span",{className:`${ce.aboutDot} ${n?ce.aboutDotConnected:ce.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),h.jsxs("div",{className:ce.aboutItem,children:[h.jsx("span",{className:ce.aboutLabel,children:"Environments"}),h.jsxs("span",{className:ce.aboutValue,children:[o,"/",r," connected"]})]}),h.jsxs("div",{className:ce.aboutItem,children:[h.jsx("span",{className:ce.aboutLabel,children:"Active Sessions"}),h.jsx("span",{className:ce.aboutValue,children:u})]}),h.jsxs("div",{className:ce.aboutItem,children:[h.jsx("span",{className:ce.aboutLabel,children:"Version"}),h.jsx("span",{className:ce.aboutValue,children:"0.36.0"})]})]})]})}function w5(){return h.jsx(N5,{})}const D5="_root_h353j_1",k5="_body_h353j_7",M5="_main_h353j_19",R5="_sidebarWrapper_h353j_26",O5="_overlay_h353j_56",Ll={root:D5,body:k5,main:M5,sidebarWrapper:R5,overlay:O5},B5=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function L5(){const{lastSpawnedId:n,environments:a}=qt(),{showToast:i}=ao();Bk(a,i);const o=Pn(),r=Wt(),u=r.pathname.startsWith(ki),[d,p]=S.useState(!1),m=S.useCallback(()=>p(g=>!g),[]);return S.useEffect(()=>{p(!1)},[r.pathname]),S.useEffect(()=>{if(!d)return;const g=y=>{y.key==="Escape"&&p(!1)};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[d]),S.useEffect(()=>{n&&!r.pathname.startsWith("/tasks/")&&o(B0(n),{replace:!0})},[n,o,r.pathname]),h.jsxs("div",{className:Ll.root,children:[h.jsx(FE,{onToggleSidebar:u?void 0:m,sidebarOpen:d}),h.jsxs("div",{className:Ll.body,children:[h.jsx("div",{className:Ll.sidebarWrapper,"data-sidebar-open":d,"data-settings":u,children:u?h.jsx(BO,{}):h.jsx(nk,{})}),d&&!u&&h.jsx("div",{className:Ll.overlay,"data-testid":"drawer-overlay",onClick:()=>p(!1)}),h.jsxs("div",{className:Ll.main,children:[h.jsx(D0,{}),h.jsx(_k,{})]})]}),h.jsx(Ok,{})]})}function U5(){return h.jsx(uT,{children:h.jsxs(St,{element:h.jsx(L5,{}),children:[h.jsx(St,{index:!0,element:h.jsx(wR,{})}),h.jsx(St,{path:"sessions/new",element:h.jsx(UR,{})}),h.jsx(St,{path:"sessions/:sessionId",element:h.jsx(HR,{})}),h.jsx(St,{path:"projects/:projectId",element:h.jsx(V3,{})}),h.jsx(St,{path:"tasks/new",element:h.jsx(lO,{})}),h.jsx(St,{path:"tasks/:taskId",element:h.jsx(qd,{})}),h.jsx(St,{path:"tasks/:taskId/stream",element:h.jsx(qd,{})}),h.jsx(St,{path:"tasks/:taskId/findings",element:h.jsx(qd,{})}),h.jsx(St,{path:"tasks/:taskId/edit",element:h.jsx(oO,{})}),h.jsx(St,{path:"environments/new",element:h.jsx(AO,{})}),h.jsxs(St,{path:"settings",element:h.jsx(DO,{}),children:[h.jsx(St,{index:!0,element:h.jsx(Dr,{to:"environments",replace:!0})}),h.jsx(St,{path:"environments",element:h.jsx(vB,{})}),h.jsx(St,{path:"credentials",element:h.jsx(i5,{})}),h.jsx(St,{path:"tokens",element:h.jsx(Dr,{to:"../credentials",replace:!0})}),h.jsx(St,{path:"personas",element:h.jsx(C5,{})}),h.jsx(St,{path:"appearance",element:h.jsx(j5,{})}),h.jsx(St,{path:"about",element:h.jsx(w5,{})})]}),h.jsx(St,{path:"*",element:h.jsx(Dr,{to:"/",replace:!0})})]})})}function z5(){const n=B5?wE:SE;return h.jsx(BE,{children:h.jsx(kE,{children:h.jsx(n,{children:h.jsx(BT,{children:h.jsx(U5,{})})})})})}fx.createRoot(document.getElementById("root")).render(h.jsx(S.StrictMode,{children:h.jsx(z5,{})}));
91
+ `),y=((i==null?void 0:i.tool)??"")||(u?"Tool error":"Tool output"),v=i?Uw(i.tool,i.args):"",_=h.jsxs(h.Fragment,{children:[h.jsx("span",{className:u?rt.toolResultIndicatorError:rt.toolResultIndicatorOk,"aria-label":u?"error":"success",children:u?"✗":"✓"}),h.jsx("span",{className:rt.toolResultLabel,children:y}),p&&h.jsx("span",{className:rt.toolResultToggle,"aria-hidden":"true",children:o?"▾":"▸"})]});return h.jsxs("div",{className:rt.toolResultEvent,children:[p?h.jsx("button",{className:rt.toolResultHeader,onClick:()=>{r(T=>!T)},"aria-expanded":o,children:_}):h.jsx("div",{className:rt.toolResultHeader,children:_}),v&&h.jsx("div",{className:rt.toolResultCommand,children:v}),h.jsxs("pre",{className:rt.toolResultPre,children:[m,!o&&p&&h.jsx("span",{className:rt.toolResultEllipsis,children:"…"})]})]})}function Vw({content:n}){return h.jsxs("div",{className:rt.errorEvent,children:["Error: ",n]})}function Iw({content:n}){return h.jsxs("div",{className:rt.statusEvent,children:["--- ",n," ---"]})}function Hw({content:n}){return h.jsx("div",{className:rt.userInputEvent,children:h.jsx("span",{className:rt.userInputContent,children:n})})}function Pw({content:n}){return h.jsx("div",{className:rt.defaultEvent,children:n})}function N1({event:n,toolUseCtx:a}){const i=new Date(n.timestamp).toLocaleTimeString();switch(n.eventType){case"system":return h.jsx(Ow,{time:i,content:n.content});case"text":case"output":return h.jsx(Bw,{content:n.content});case"tool_use":return h.jsx(Lw,{content:n.content});case"tool_result":return h.jsx(zw,{content:n.content,raw:n.raw,toolUseCtx:a});case"error":return h.jsx(Vw,{content:n.content});case"status":return h.jsx(Iw,{content:n.content});case"user_input":return h.jsx(Hw,{content:n.content});default:return h.jsx(Pw,{content:n.content})}}const Gw="_overlay_cmicx_1",qw="_dialog_cmicx_11",Fw="_title_cmicx_30",$w="_description_cmicx_38",Yw="_actions_cmicx_45",Kw="_cancelButton_cmicx_52",Zw="_confirmButton_cmicx_79",ws={overlay:Gw,dialog:qw,title:Fw,description:$w,actions:Yw,cancelButton:Kw,confirmButton:Zw};function lc({isOpen:n,title:a,description:i,confirmLabel:o="Delete",onConfirm:r,onCancel:u}){const d=S.useId(),p=S.useId();return h.jsx(os,{children:n&&h.jsx(Rn.div,{className:ws.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:m=>{m.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":i?p:void 0,children:h.jsxs(Rn.div,{className:ws.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:m=>m.stopPropagation(),children:[h.jsx("h3",{id:d,className:ws.title,children:a}),i&&h.jsx("p",{id:p,className:ws.description,children:i}),h.jsxs("div",{className:ws.actions,children:[h.jsx("button",{type:"button",className:ws.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),h.jsx("button",{type:"button",className:ws.confirmButton,onClick:r,children:o})]})]})})})}const Xw="_spinner_13c8l_1",Qw="_spin_13c8l_1",Jw="_sm_13c8l_14",Ww="_md_13c8l_20",eD="_lg_13c8l_26",n0={spinner:Xw,spin:Qw,sm:Jw,md:Ww,lg:eD};function a0({size:n="md",className:a,label:i="Loading",liveRegion:o=!1}){return h.jsx("span",{className:`${n0.spinner} ${n0[n]} ${a??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const xf={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 ls(n){return n==="blocked"?xf.blocked:xf[mh(n)]}const tD={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function nD(n){return tD[mh(n)]??"statusPending"}const aD=["working","paused","failed","not_started","blocked","complete"],s0=["not_started","working","paused","complete","failed"],sD={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function mh(n){return n in xf&&n!=="blocked"?n:sD[n]??"not_started"}const iD={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"},lD="_container_15oob_1",oD="_header_15oob_5",rD="_searchInput_15oob_17",cD="_searchHighlight_15oob_50",uD="_addButton_15oob_56",dD="_createForm_15oob_83",fD="_createInput_15oob_89",hD="_createButton_15oob_120",pD="_creatingHint_15oob_161",mD="_projectRow_15oob_170",gD="_selected_15oob_188",yD="_expandArrow_15oob_193",vD="_expanded_15oob_200",bD="_projectName_15oob_204",SD="_taskCount_15oob_208",_D="_newTaskButton_15oob_214",xD="_taskRow_15oob_241",TD="_taskStatusIcon_15oob_271",ED="_taskTitle_15oob_275",CD="_dependencyBadge_15oob_282",AD="_blockedBadge_15oob_294",jD="_leafSpacer_15oob_299",ND="_childCountBadge_15oob_304",wD="_addChildButton_15oob_317",DD="_emptyCta_15oob_366",kD="_ctaDescription_15oob_379",MD="_ctaButton_15oob_385",RD="_emptyTaskCta_15oob_420",OD="_headerActions_15oob_425",BD="_groupToggle_15oob_431",LD="_groupToggleActive_15oob_458",UD="_statusGroupHeader_15oob_462",zD="_statusGroupIcon_15oob_481",VD="_statusGroupLabel_15oob_485",ID="_statusGroupCount_15oob_490",HD="_createTaskLink_15oob_503",_e={container:lD,header:oD,searchInput:rD,searchHighlight:cD,addButton:uD,createForm:dD,createInput:fD,createButton:hD,creatingHint:pD,projectRow:mD,selected:gD,expandArrow:yD,expanded:vD,projectName:bD,taskCount:SD,newTaskButton:_D,taskRow:xD,taskStatusIcon:TD,taskTitle:ED,dependencyBadge:CD,blockedBadge:AD,leafSpacer:jD,childCountBadge:ND,addChildButton:wD,emptyCta:DD,ctaDescription:kD,ctaButton:MD,emptyTaskCta:RD,headerActions:OD,groupToggle:BD,groupToggleActive:LD,statusGroupHeader:UD,statusGroupIcon:zD,statusGroupLabel:VD,statusGroupCount:ID,createTaskLink:HD};function PD(n){if(n.length===0)return[];const a=[...n].sort((o,r)=>o[0]-r[0]),i=[[a[0][0],a[0][1]]];for(let o=1;o<a.length;o++){const r=i[i.length-1],[u,d]=a[o];u<=r[1]+1?r[1]=Math.max(r[1],d):i.push([u,d])}return i}function w1({text:n,indices:a}){if(!a||a.length===0)return h.jsx(h.Fragment,{children:n});const i=PD(a),o=[];let r=0;for(const[u,d]of i)u>r&&o.push(h.jsx("span",{children:n.slice(r,u)},`p${r}`)),o.push(h.jsx("mark",{className:_e.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 GD=[{name:"name",weight:2},{name:"description",weight:1}],qD=[{name:"title",weight:2},{name:"description",weight:1}],D1=34,FD=16,k1="grackle-group-by-status";function i0(){try{return localStorage.getItem(k1)==="true"}catch{return!1}}function $D(n){try{localStorage.setItem(k1,String(n))}catch{}}function YD(n,a){const i=new Map;for(const u of n){const p=u.dependsOn.length>0&&u.dependsOn.some(g=>a.get(g)!=="complete")?"blocked":u.status,m=i.get(p);m?m.push(u):i.set(p,[u])}const o=[],r=new Set;for(const u of aD){r.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((m,g)=>m.sortOrder-g.sortOrder);const p=ls(u);o.push({status:u,label:p.label,style:p,tasks:d})}}for(const[u,d]of i)if(!r.has(u)&&d.length>0){d.sort((m,g)=>m.sortOrder-g.sortOrder);const p=ls(u);o.push({status:u,label:p.label,style:p,tasks:d})}return o}function KD({group:n,isExpanded:a,onToggle:i,selectedTaskId:o,navigate:r,titleHighlights:u}){return h.jsxs("div",{"data-testid":`status-group-${n.status}`,children:[h.jsxs("div",{className:_e.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":a,onClick:i,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),i())},children:[h.jsx("span",{className:`${_e.expandArrow} ${a?_e.expanded:""}`,children:"▸"}),h.jsx("span",{className:_e.statusGroupIcon,style:{color:n.style.color},children:n.style.icon}),h.jsx("span",{className:_e.statusGroupLabel,children:n.label}),h.jsx("span",{className:_e.statusGroupCount,children:n.tasks.length})]}),h.jsx(os,{children:a&&h.jsx(Rn.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 p=ls(d.status),m=o===d.id;return h.jsxs("div",{onClick:()=>r(as(d.id)),className:`${_e.taskRow} ${m?_e.selected:""}`,style:{"--task-indent":`${D1}px`},"data-task-id":d.id,children:[h.jsx("span",{className:_e.leafSpacer}),h.jsx("span",{className:_e.taskStatusIcon,style:{color:p.color},children:p.icon}),h.jsx("span",{className:_e.taskTitle,title:d.title,children:h.jsx(w1,{text:d.title,indices:u.get(d.id)})})]},d.id)})})})]})}function ZD(n){const a=new Map(n.map(o=>[o.id,{...o,children:[]}])),i=[];for(const o of a.values())o.parentTaskId&&a.has(o.parentTaskId)?a.get(o.parentTaskId).children.push(o):i.push(o);for(const o of a.values())o.children.sort((r,u)=>r.sortOrder-u.sortOrder);return i.sort((o,r)=>o.sortOrder-r.sortOrder)}function M1({node:n,depth:a,expandedTasks:i,toggleTask:o,selectedTaskId:r,navigate:u,projectId:d,taskStatusById:p,titleHighlights:m}){const g=ls(n.status),y=n.dependsOn.length>0&&n.dependsOn.some(A=>p.get(A)!=="complete"),v=i.has(n.id),_=n.children.length>0,T=r===n.id,E=D1+a*FD;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{onClick:()=>u(as(n.id)),className:`${_e.taskRow} ${T?_e.selected:""}`,style:{"--task-indent":`${E}px`},"data-task-id":n.id,children:[_&&h.jsx("span",{className:`${_e.expandArrow} ${v?_e.expanded:""}`,role:"button",tabIndex:0,"aria-label":v?"Collapse task":"Expand task",onClick:A=>{A.stopPropagation(),o(n.id)},onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),A.stopPropagation(),o(n.id))},children:"▸"}),!_&&h.jsx("span",{className:_e.leafSpacer}),h.jsx("span",{className:_e.taskStatusIcon,style:{color:g.color},children:g.icon}),h.jsx("span",{className:_e.taskTitle,title:n.title,children:h.jsx(w1,{text:n.title,indices:m.get(n.id)})}),_&&h.jsxs("span",{className:_e.childCountBadge,children:[n.children.filter(A=>A.status==="complete").length,"/",n.children.length]}),n.dependsOn.length>0&&h.jsx("span",{className:`${_e.dependencyBadge} ${y?_e.blockedBadge:""}`,title:`Depends on: ${n.dependsOn.join(", ")}`,children:y?"blocked":"dep"}),a<vN&&h.jsx("button",{onClick:A=>{A.stopPropagation(),u(Bs(d,n.id))},title:"Add child task","aria-label":"Add child task",className:_e.addChildButton,children:"+"})]}),h.jsx(os,{children:_&&v&&h.jsx(Rn.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(A=>h.jsx(M1,{node:A,depth:a+1,expandedTasks:i,toggleTask:o,selectedTaskId:r,navigate:u,projectId:d,taskStatusById:p,titleHighlights:m},A.id))})})]})}function XD(){const{projects:n,tasks:a,loadTasks:i,createProject:o,projectCreating:r}=qt(),u=Pn(),[d,p]=S.useState(new Set),[m,g]=S.useState(new Set),[y,v]=S.useState(new Set),[_,T]=S.useState(!1),[E,A]=S.useState(""),[j,C]=S.useState(i0),[w,M]=S.useState(i0),[G,V]=S.useState(new Map),X=()=>{const F=!j;$D(F),C(F),F&&(M(!0),V(new Map))},Q=(F,me)=>{const Ae=`${F}:${me}`;V(Ie=>{const pt=new Map(Ie),xt=pt.has(Ae)?pt.get(Ae):w;return pt.set(Ae,!xt),pt})},I=(F,me)=>{const Ae=`${F}:${me}`;return G.has(Ae)?G.get(Ae):w},te=Qt("/tasks/:taskId/*"),se=Qt("/projects/:projectId"),O=(te==null?void 0:te.params.taskId)!=="new"?te==null?void 0:te.params.taskId:void 0,ne=se==null?void 0:se.params.projectId,W=S.useRef(d);W.current=d;const he=S.useMemo(()=>new Map(a.map(F=>[F.id,F.status])),[a]),P=F=>{p(me=>{const Ae=new Set(me);return Ae.has(F)?Ae.delete(F):(Ae.add(F),i(F)),Ae})},U=F=>{g(me=>{const Ae=new Set(me);return Ae.has(F)?(Ae.delete(F),v(Ie=>new Set(Ie).add(F))):(Ae.add(F),v(Ie=>{const pt=new Set(Ie);return pt.delete(F),pt})),Ae})};S.useEffect(()=>{const F=new Set(a.filter(me=>me.parentTaskId).map(me=>me.parentTaskId));F.size>0&&g(me=>{const Ae=new Set(me);for(const Ie of F)y.has(Ie)||Ae.add(Ie);return Ae})},[a,y]),S.useEffect(()=>{ne&&!W.current.has(ne)&&(p(F=>new Set(F).add(ne)),i(ne))},[ne,i]);const K=()=>{!E.trim()||r||(o(E.trim()),A(""),T(!1))},[ee,we]=S.useState(""),{directMatchTaskIds:xe,treeMatchTaskIds:Ue,visibleProjectIds:Ee,matchedProjectIds:ye,titleHighlights:Te}=S.useMemo(()=>{if(!ee.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,visibleProjectIds:null,matchedProjectIds:null,titleHighlights:new Map};const F=Wv(n,ee,GD),me=Wv(a,ee,qD),Ae=new Set(F.map(qe=>qe.item.id)),Ie=new Set(me.map(qe=>qe.item.id)),pt=new Map;for(const qe of me){const Be=qe.matches.find(Ln=>Ln.key==="title");Be&&pt.set(qe.item.id,Be.indices)}const xt=new Set(Ae);for(const qe of me)xt.add(qe.item.projectId);const Lt=new Set(Ie),Xe=new Map(a.map(qe=>[qe.id,qe]));for(const qe of[...Ie]){let Be=Xe.get(qe);for(;Be!=null&&Be.parentTaskId;)Lt.add(Be.parentTaskId),Be=Xe.get(Be.parentTaskId)}return{directMatchTaskIds:Ie,treeMatchTaskIds:Lt,visibleProjectIds:xt,matchedProjectIds:Ae,titleHighlights:pt}},[ee,n,a]),J=S.useRef(new Set);return S.useEffect(()=>{if(ee.trim())for(const F of n)!d.has(F.id)&&!J.current.has(F.id)&&(J.current.add(F.id),i(F.id))},[ee,n,d,i]),h.jsxs("div",{className:_e.container,children:[h.jsxs("div",{className:_e.header,children:[h.jsx("span",{children:"Projects"}),h.jsxs("div",{className:_e.headerActions,children:[h.jsx("button",{className:`${_e.groupToggle} ${j?_e.groupToggleActive:""}`,onClick:X,"aria-label":j?"Switch to tree view":"Group tasks by status","aria-pressed":j,title:j?"Switch to tree view":"Group tasks by status","data-testid":"group-by-status-toggle",children:"≡"}),h.jsx("button",{className:_e.addButton,onClick:()=>T(!_),"aria-label":"Create project",title:"Create project",children:"+"})]})]}),n.length>0&&h.jsx("input",{type:"text",value:ee,onChange:F=>we(F.target.value),placeholder:"Filter...","aria-label":"Filter projects and tasks",className:_e.searchInput,"data-testid":"sidebar-search"}),_&&h.jsxs("div",{className:_e.createForm,children:[h.jsx("input",{type:"text",value:E,onChange:F=>A(F.target.value),onKeyDown:F=>F.key==="Enter"&&K(),placeholder:"Project name...",autoFocus:!0,disabled:r,className:_e.createInput}),h.jsx("button",{onClick:K,className:_e.createButton,disabled:r,children:r?h.jsx(a0,{size:"sm",label:"Creating project"}):"OK"})]}),r&&h.jsxs("div",{className:_e.creatingHint,children:[h.jsx(a0,{size:"sm",label:"Creating project"}),"Creating project…"]}),n.length===0&&!_&&h.jsxs("div",{className:_e.emptyCta,children:[h.jsx("button",{className:_e.ctaButton,onClick:()=>T(!0),children:"Create Project"}),h.jsx("div",{className:_e.ctaDescription,children:"Organize your work into projects"})]}),n.map(F=>{if(Ee&&!Ee.has(F.id))return null;const me=xe!==null,Ae=d.has(F.id)||me,Ie=a.filter(Be=>Be.projectId===F.id),pt=(ye==null?void 0:ye.has(F.id))??!1,xt=me&&!pt?j?xe:Ue:null,Lt=xt?Ie.filter(Be=>xt.has(Be.id)):Ie,Xe=ne===F.id,qe=Ae&&!j?ZD(Lt):[];return h.jsxs("div",{children:[h.jsxs("div",{onClick:()=>{Xe?P(F.id):(Ae||P(F.id),u(Kl(F.id)))},className:`${_e.projectRow} ${Xe?_e.selected:""}`,children:[h.jsx("span",{className:`${_e.expandArrow} ${Ae?_e.expanded:""}`,children:"▸"}),h.jsx("span",{className:_e.projectName,title:F.name,children:F.name}),h.jsx("span",{className:_e.taskCount,children:Ie.length>0&&`${Ie.filter(Be=>Be.status==="complete").length}/${Ie.length}`}),h.jsx("button",{onClick:Be=>{Be.stopPropagation(),u(Bs(F.id))},title:"New task",className:_e.newTaskButton,children:"+"})]}),h.jsx(os,{children:Ae&&h.jsxs(Rn.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:[j?YD(Lt,he).map(Be=>h.jsx(KD,{group:Be,isExpanded:I(F.id,Be.status),onToggle:()=>Q(F.id,Be.status),selectedTaskId:O,navigate:u,titleHighlights:Te},Be.status)):qe.map(Be=>h.jsx(M1,{node:Be,depth:0,expandedTasks:m,toggleTask:U,selectedTaskId:O,navigate:u,projectId:F.id,taskStatusById:he,titleHighlights:Te},Be.id)),Lt.length===0&&h.jsx("div",{className:_e.emptyTaskCta,children:h.jsx("button",{className:_e.createTaskLink,onClick:()=>u(Bs(F.id)),children:"+ Create Task"})})]})})]},F.id)})]})}const QD="_container_lovia_1",JD="_content_lovia_40",l0={container:QD,content:JD},WD=320,R1=220,O1=600,B1="grackle-sidebar-width";function ek(){try{const n=localStorage.getItem(B1);if(n!==null){const a=Number(n);if(Number.isFinite(a)&&a>=R1&&a<=O1)return a}}catch{}return WD}function tk(n){try{localStorage.setItem(B1,String(n))}catch{}}function nk(){const[n]=S.useState(ek),a=S.useRef(null);return S.useEffect(()=>{const i=a.current;if(!i)return;const o=new ResizeObserver(r=>{for(const u of r){const d=u.borderBoxSize[0];if(d){const p=Math.round(d.inlineSize);p>=R1&&p<=O1&&tk(p)}}});return o.observe(i),()=>{o.disconnect()}},[]),h.jsx("div",{className:l0.container,ref:a,"data-testid":"sidebar",style:{width:n},children:h.jsx("div",{className:l0.content,children:h.jsx(XD,{})})})}const ak="_bar_8ghh5_1",sk="_barColumn_8ghh5_32",ik="_barRow_8ghh5_63",lk="_input_8ghh5_74",ok="_inputSmall_8ghh5_109",rk="_select_8ghh5_178",ck="_btnPrimary_8ghh5_214",uk="_btnDanger_8ghh5_245",dk="_btnGhost_8ghh5_284",fk="_badge_8ghh5_312",hk="_statusText_8ghh5_322",pk="_statusCompleted_8ghh5_327",mk="_statusFailed_8ghh5_331",gk="_statusBlocked_8ghh5_335",yk="_hintText_8ghh5_340",vk="_creatingHint_8ghh5_345",bk="_errorHint_8ghh5_353",Sk="_disconnectHint_8ghh5_359",re={bar:ak,barColumn:sk,barRow:ik,input:lk,inputSmall:ok,select:rk,btnPrimary:ck,btnDanger:uk,btnGhost:dk,badge:fk,statusText:hk,statusCompleted:pk,statusFailed:mk,statusBlocked:gk,hintText:yk,creatingHint:vk,errorHint:bk,disconnectHint:Sk};function o0({value:n,onChange:a,testId:i}){return h.jsxs("select",{"data-testid":i,value:n,onChange:o=>a(o.target.value),className:re.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 r0(n,a){if(!n)return!1;const i=a.find(o=>o.id===n);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function c0({environmentId:n,onReconnect:a}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:re.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),h.jsx("button",{type:"button",onClick:()=>a(n),className:re.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function _k(){const{spawn:n,sendInput:a,kill:i,sessions:o,tasks:r,environments:u,personas:d,addEnvironment:p,provisionEnvironment:m,codespaces:g,codespaceError:y,codespaceListError:v,codespaceCreating:_,listCodespaces:T,createCodespace:E}=qt(),{showToast:A}=ao(),j=Pn(),[C]=Mf(),w=Qt("/sessions/:sessionId"),M=Qt("/tasks/:taskId"),G=Qt("/tasks/:taskId/stream"),V=Qt("/tasks/:taskId/findings"),X=Qt("/tasks/:taskId/edit"),Q=Qt("/sessions/new"),I=Qt("/environments/new"),te=Qt("/projects/:projectId"),se=Qt("/tasks/new"),O=Qt("/"),ne=Qt("/settings/*"),W=w==null?void 0:w.params.sessionId,he=(M==null?void 0:M.params.taskId)??(G==null?void 0:G.params.taskId)??(V==null?void 0:V.params.taskId),P=!!Q,U=!!I,K=!!te,ee=!!se,we=!!X,xe=!!O&&!P&&!U&&!K&&!ee,Ue=!!ne,Ee=P?C.get("env")??"":"",ye=P?C.get("runtime")??"claude-code":"claude-code",[Te,J]=S.useState(""),[F,me]=S.useState(P?ye:"claude-code"),[Ae,Ie]=S.useState(""),pt=We=>{if(Ie(We),We){const je=d.find(gt=>gt.id===We);je!=null&&je.runtime&&me(je.runtime)}},[xt,Lt]=S.useState(""),[Xe,qe]=S.useState("local"),[Be,Ln]=S.useState("claude-code"),[Un,ea]=S.useState(""),[en,ta]=S.useState(""),[Z,ae]=S.useState(""),[oe,ue]=S.useState(""),[be,Se]=S.useState(""),[Qe,Me]=S.useState(""),[lt,Dt]=S.useState(""),[Tt,Rt]=S.useState(""),[ot,Et]=S.useState(""),[cn,mt]=S.useState("pick");S.useEffect(()=>{P&&me(ye)},[P,ye]);const Ft=W?o.find(We=>We.id===W):void 0,$t=he?r.find(We=>We.id===he):void 0,Hi=($t==null?void 0:$t.latestSessionId)||void 0,na=Hi?o.find(We=>We.id===Hi):void 0,us=$t?$t.dependsOn.some(We=>{const je=r.find(gt=>gt.id===We);return je&&je.status!=="complete"}):!1;if(xe||Ue)return h.jsx("div",{className:re.bar,children:h.jsx("span",{className:re.hintText,children:"Select a session or click + to start"})});if(we||ee)return h.jsx(h.Fragment,{});if(U){const We=ie=>{if(!ie.trim())return!0;const Ut=Number(ie);return Number.isInteger(Ut)&&Ut>=1&&Ut<=65535},je=()=>!(!xt.trim()||Xe==="ssh"&&!Un.trim()||Xe==="codespace"&&!Qe.trim()||(Xe==="local"||Xe==="ssh")&&!We(en)),gt=()=>{if(!je())return;const ie={};if(Xe==="local"){if(Un.trim()&&(ie.host=Un.trim()),en.trim()){const Ut=Number(en);Number.isInteger(Ut)&&(ie.port=Ut)}}else if(Xe==="ssh"){if(ie.host=Un.trim(),Z.trim()&&(ie.user=Z.trim()),en.trim()){const Ut=Number(en);Number.isInteger(Ut)&&(ie.sshPort=Ut)}lt.trim()&&(ie.identityFile=lt.trim())}else Xe==="docker"?(oe.trim()&&(ie.image=oe.trim()),be.trim()&&(ie.repo=be.trim())):Xe==="codespace"&&(ie.codespaceName=Qe.trim());p(xt.trim(),Xe,ie,Be),A("Environment added successfully","success"),Lt(""),qe("local"),Ln("claude-code"),ea(""),ta(""),ae(""),ue(""),Se(""),Me(""),Dt(""),Rt(""),Et(""),mt("pick"),j(ki,{replace:!0})};return h.jsxs("div",{className:re.barColumn,children:[h.jsxs("div",{className:re.barRow,children:[h.jsx("span",{className:re.badge,children:"new env"}),h.jsx("input",{type:"text",value:xt,onChange:ie=>Lt(ie.target.value),placeholder:"Environment name...",autoFocus:!0,className:re.input}),h.jsxs("select",{value:Xe,onChange:ie=>{qe(ie.target.value),ie.target.value==="codespace"&&(T(),mt("pick"),Me(""))},className:re.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(o0,{value:Be,onChange:Ln,testId:"new-environment-runtime-select"}),h.jsx("button",{onClick:gt,disabled:!je(),className:re.btnPrimary,children:"Add"})]}),h.jsxs("div",{className:re.barRow,children:[Xe==="local"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:Un,onChange:ie=>ea(ie.target.value),placeholder:"Host (optional)...",className:re.inputSmall}),h.jsx("input",{type:"number",min:1,max:65535,value:en,onChange:ie=>ta(ie.target.value),placeholder:"Port (optional)...",className:re.inputSmall})]}),Xe==="ssh"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:Un,onChange:ie=>ea(ie.target.value),placeholder:"Host (required)...",className:re.inputSmall}),h.jsx("input",{type:"text",value:Z,onChange:ie=>ae(ie.target.value),placeholder:"User (optional)...",className:re.inputSmall}),h.jsx("input",{type:"number",min:1,max:65535,value:en,onChange:ie=>ta(ie.target.value),placeholder:"SSH port (optional)...",className:re.inputSmall}),h.jsx("input",{type:"text",value:lt,onChange:ie=>Dt(ie.target.value),placeholder:"Identity file (optional)...",className:re.inputSmall})]}),Xe==="docker"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:oe,onChange:ie=>ue(ie.target.value),placeholder:"Image (optional)...",className:re.inputSmall}),h.jsx("input",{type:"text",value:be,onChange:ie=>Se(ie.target.value),placeholder:"Repo (optional)...",className:re.inputSmall})]}),Xe==="codespace"&&cn==="pick"&&h.jsxs(h.Fragment,{children:[!v&&h.jsxs("select",{value:Qe,onChange:ie=>{ie.target.value==="__create__"?(mt("create"),Me("")):(Me(ie.target.value),ie.target.value&&!xt.trim()&&Lt(ie.target.value))},disabled:_,className:re.select,children:[h.jsx("option",{value:"",children:"Select a codespace..."}),g.map(ie=>h.jsxs("option",{value:ie.name,children:[ie.name," (",ie.repository,") — ",ie.state]},ie.name)),h.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),_&&h.jsx("span",{className:re.creatingHint,children:"Creating codespace..."}),v&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:re.errorHint,children:v}),h.jsx("input",{type:"text",value:Qe,onChange:ie=>Me(ie.target.value),placeholder:"Or enter codespace name manually...",className:re.inputSmall})]}),y&&!v&&h.jsx("span",{className:re.errorHint,children:y})]}),Xe==="codespace"&&cn==="create"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"text",value:Tt,onChange:ie=>Rt(ie.target.value),placeholder:"owner/repo",className:re.inputSmall}),h.jsx("input",{type:"text",value:ot,onChange:ie=>Et(ie.target.value),placeholder:"Machine type (optional)...",className:re.inputSmall}),h.jsx("button",{onClick:()=>{Tt.trim()&&(E(Tt.trim(),ot.trim()||void 0),mt("pick"),Rt(""),Et(""))},disabled:!Tt.trim(),className:re.btnPrimary,children:"Create"}),h.jsx("button",{onClick:()=>{mt("pick"),Rt(""),Et("")},className:re.btnGhost,children:"Cancel"})]})]})]})}if(K)return h.jsx("div",{className:re.bar,children:h.jsx("span",{className:re.hintText,children:"Select a task or click + to create one"})});if(he&&$t){if($t.status==="not_started"){const We=us?$t.dependsOn.map(je=>r.find(gt=>gt.id===je)).filter(je=>je&&je.status!=="complete").map(je=>je.title):[];return h.jsx("div",{className:re.bar,children:us?h.jsxs("span",{className:re.statusBlocked,children:["Blocked by: ",We.join(", ")]}):h.jsx("span",{className:re.hintText,children:"Use the buttons above to start or manage this task"})})}if($t.status==="working"||$t.status==="paused"){if((na==null?void 0:na.status)==="idle"){const je=na.environmentId,gt=r0(je,u),ie=Ut=>{Ut.preventDefault();const aa=$t.latestSessionId||Hi;!Te.trim()||!aa||gt||(a(aa,Te),J(""))};return h.jsxs("form",{onSubmit:ie,className:re.bar,children:[gt&&je&&h.jsx(c0,{environmentId:je,onReconnect:m}),h.jsx("input",{type:"text",value:Te,onChange:Ut=>J(Ut.target.value),placeholder:"Type a message...",autoFocus:!gt,disabled:gt,className:re.input}),h.jsx("span",{title:gt?"Environment is unavailable — reconnect first":void 0,children:h.jsx("button",{type:"submit",disabled:!Te.trim()||gt,className:re.btnPrimary,children:"Send"})})]})}return h.jsx("div",{className:re.bar,children:h.jsx("input",{type:"text",disabled:!0,placeholder:"Agent is working...",className:re.input})})}if($t.status==="complete")return h.jsxs("div",{className:re.bar,children:[h.jsx("span",{className:`${re.statusText} ${re.statusCompleted}`,children:"Task completed"}),h.jsx("button",{onClick:()=>j(Bs($t.projectId)),className:re.btnPrimary,children:"+ New Task"})]});if($t.status==="failed")return h.jsx("div",{className:re.bar,children:h.jsx("span",{className:`${re.statusText} ${re.statusFailed}`,children:"Task failed"})})}if(P){const We=je=>{je.preventDefault(),!(!Te.trim()||!Ee)&&(n(Ee,Te,void 0,F,Ae),A("Session started","success"),J(""),Ie(""))};return h.jsxs("form",{onSubmit:We,className:re.bar,children:[h.jsx("span",{className:re.badge,children:"new chat"}),h.jsx("input",{type:"text",value:Te,onChange:je=>J(je.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:re.input}),h.jsx(o0,{value:F,onChange:me,testId:"new-chat-runtime-select"}),h.jsxs("select",{value:Ae,onChange:je=>pt(je.target.value),className:re.select,children:[h.jsx("option",{value:"",children:"No persona"}),d.map(je=>h.jsx("option",{value:je.id,children:je.name},je.id))]}),h.jsx("button",{type:"submit",disabled:!Te.trim()||!Ee,className:re.btnPrimary,children:"Go"})]})}if(W){const We=(Ft==null?void 0:Ft.status)==="running",je=(Ft==null?void 0:Ft.status)==="idle",gt=Ft!==void 0&&["completed","failed","interrupted"].includes(Ft.status);if(We)return h.jsxs("div",{className:re.bar,children:[h.jsx("input",{type:"text",disabled:!0,placeholder:"Agent is working...",className:re.input}),h.jsx("button",{onClick:()=>i(W),className:re.btnDanger,title:"Stop session",children:"Stop"})]});if(je){const ie=r0(Ft.environmentId,u),Ut=aa=>{aa.preventDefault(),!(!Te.trim()||ie)&&(a(W,Te),J(""))};return h.jsxs("form",{onSubmit:Ut,className:re.bar,children:[ie&&Ft.environmentId&&h.jsx(c0,{environmentId:Ft.environmentId,onReconnect:m}),h.jsx("input",{type:"text",value:Te,onChange:aa=>J(aa.target.value),placeholder:"Type a message...",autoFocus:!ie,disabled:ie,className:re.input}),h.jsx("span",{title:ie?"Environment is unavailable — reconnect first":void 0,children:h.jsx("button",{type:"submit",disabled:!Te.trim()||ie,className:re.btnPrimary,children:"Send"})}),h.jsx("button",{type:"button",onClick:()=>i(W),className:re.btnDanger,title:"Stop session",children:"Stop"})]})}if(gt)return h.jsxs("div",{className:re.bar,children:[h.jsxs("span",{className:`${re.statusText} ${re.hintText}`,children:["Session ",Ft.status]}),h.jsx("button",{onClick:()=>j(L0(Ft.environmentId,Ft.runtime)),className:re.btnPrimary,children:"+ New Chat"})]})}return h.jsx("div",{className:re.bar,children:h.jsx("span",{className:re.hintText,children:"Loading..."})})}const xk="_toast_da8ll_1",Tk="_success_da8ll_18",Ek="_icon_da8ll_22",Ck="_error_da8ll_25",Ak="_warning_da8ll_32",jk="_info_da8ll_38",Nk="_message_da8ll_53",wk="_close_da8ll_60",Bl={toast:xk,success:Tk,icon:Ek,error:Ck,warning:Ak,info:jk,message:Nk,close:wk},Dk={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function kk({toast:n,onDismiss:a}){return S.useEffect(()=>{const i=setTimeout(()=>a(n.id),n.duration);return()=>clearTimeout(i)},[n.id,n.duration,a]),h.jsxs(Rn.div,{className:`${Bl.toast} ${Bl[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:Bl.icon,"aria-hidden":"true",children:Dk[n.variant]}),h.jsx("span",{className:Bl.message,children:n.message}),h.jsx("button",{type:"button",className:Bl.close,onClick:()=>a(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const Mk="_container_qqse2_1",Rk={container:Mk};function Ok(){const{toasts:n,dismissToast:a}=ao();return h.jsx("div",{className:Rk.container,"data-testid":"toast-container",children:h.jsx(os,{children:n.map(i=>h.jsx(kk,{toast:i,onDismiss:a},i.id))})})}function Bk(n,a){const i=S.useRef(null);S.useEffect(()=>{const o=i.current;if(i.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 p=r.get(d.id);p&&p.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"&&(p.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 Lk="_panelContainer_yidfr_1",Uk="_emptyState_yidfr_8",zk="_fadeIn_yidfr_1",Vk="_projectSummary_yidfr_17",Ik="_projectSummaryTitle_yidfr_28",Hk="_projectSummarySubtitle_yidfr_32",Pk="_header_yidfr_36",Gk="_headerInfo_yidfr_69",qk="_killButton_yidfr_75",Fk="_headerTitle_yidfr_104",$k="_headerActions_yidfr_119",Yk="_taskStatusBadge_yidfr_126",Kk="_taskBranch_yidfr_135",Zk="_taskBlockedBadge_yidfr_141",Xk="_btnPrimary_yidfr_149",Qk="_btnDanger_yidfr_180",Jk="_btnGhost_yidfr_219",Wk="_rejectInput_yidfr_245",eM="_tabBar_yidfr_275",tM="_tab_yidfr_275",nM="_active_yidfr_301",aM="_eventScroll_yidfr_306",sM="_tabContent_yidfr_312",iM="_noContext_yidfr_317",lM="_overviewContent_yidfr_323",oM="_overviewDashboard_yidfr_332",rM="_overviewHero_yidfr_338",cM="_statusBadge_yidfr_345",uM="_statusPending_yidfr_357",dM="_statusAssigned_yidfr_362",fM="_statusInProgress_yidfr_367",hM="_statusReview_yidfr_372",pM="_statusDone_yidfr_377",mM="_statusFailed_yidfr_382",gM="_statusWaitingInput_yidfr_387",yM="_overviewBranchPill_yidfr_392",vM="_branchLink_yidfr_407",bM="_overviewSection_yidfr_418",SM="_overviewLabel_yidfr_424",_M="_overviewValue_yidfr_431",xM="_overviewMuted_yidfr_436",TM="_overviewMarkdown_yidfr_442",EM="_envRow_yidfr_511",CM="_envDot_yidfr_517",AM="_envDotGreen_yidfr_524",jM="_envDotYellow_yidfr_528",NM="_envDotRed_yidfr_532",wM="_envDotGray_yidfr_536",DM="_depList_yidfr_540",kM="_depItem_yidfr_546",MM="_depBlocked_yidfr_553",RM="_depDone_yidfr_557",OM="_timeline_yidfr_561",BM="_timelineRow_yidfr_567",LM="_timelineKey_yidfr_574",UM="_timelineValue_yidfr_580",zM="_timelineDelta_yidfr_584",VM="_reviewNotes_yidfr_595",IM="_overviewDescription_yidfr_606",HM="_waitingMessage_yidfr_612",PM="_errorMessage_yidfr_616",GM="_eventOverflowWarning_yidfr_620",qM="_attemptSelector_yidfr_634",FM="_attemptLabel_yidfr_650",$M="_attemptButton_yidfr_654",YM="_attemptActive_yidfr_671",KM="_attemptStatus_yidfr_677",ZM="_emptyCta_yidfr_683",XM="_ctaTitle_yidfr_695",QM="_ctaDescription_yidfr_701",JM="_ctaButton_yidfr_708",WM="_ctaLink_yidfr_743",eR="_projectHeader_yidfr_757",tR="_projectName_yidfr_782",nR="_projectMeta_yidfr_795",aR="_metaRow_yidfr_803",sR="_metaLabel_yidfr_816",iR="_metaValue_yidfr_831",lR="_metaPlaceholder_yidfr_841",oR="_editButton_yidfr_846",rR="_editInput_yidfr_862",cR="_editTextarea_yidfr_894",uR="_editSelect_yidfr_930",dR="_archiveButton_yidfr_963",fR="_repoLink_yidfr_993",hR="_metaValueClickable_yidfr_1003",pR="_editHint_yidfr_1022",mR="_editError_yidfr_1031",gR="_editInputInvalid_yidfr_1038",yR="_unsavedDot_yidfr_1043",vR="_metaToggle_yidfr_1051",bR="_metaToggleArrow_yidfr_1072",SR="_metaToggleArrowOpen_yidfr_1077",_R="_progressBarContainer_yidfr_1081",xR="_progressBar_yidfr_1081",TR="_progressFill_yidfr_1097",ER="_progressLabel_yidfr_1104",CR="_metaTimestamps_yidfr_1111",AR="_metaTimestamp_yidfr_1111",jR="_worktreeToggle_yidfr_1133",NR="_editFieldWrapper_yidfr_1148",k={panelContainer:Lk,emptyState:Uk,fadeIn:zk,projectSummary:Vk,projectSummaryTitle:Ik,projectSummarySubtitle:Hk,header:Pk,headerInfo:Gk,killButton:qk,headerTitle:Fk,headerActions:$k,taskStatusBadge:Yk,taskBranch:Kk,taskBlockedBadge:Zk,btnPrimary:Xk,btnDanger:Qk,btnGhost:Jk,rejectInput:Wk,tabBar:eM,tab:tM,active:nM,eventScroll:aM,tabContent:sM,noContext:iM,overviewContent:lM,overviewDashboard:oM,overviewHero:rM,statusBadge:cM,statusPending:uM,statusAssigned:dM,statusInProgress:fM,statusReview:hM,statusDone:pM,statusFailed:mM,statusWaitingInput:gM,overviewBranchPill:yM,branchLink:vM,overviewSection:bM,overviewLabel:SM,overviewValue:_M,overviewMuted:xM,overviewMarkdown:TM,envRow:EM,envDot:CM,envDotGreen:AM,envDotYellow:jM,envDotRed:NM,envDotGray:wM,depList:DM,depItem:kM,depBlocked:MM,depDone:RM,timeline:OM,timelineRow:BM,timelineKey:LM,timelineValue:UM,timelineDelta:zM,reviewNotes:VM,overviewDescription:IM,waitingMessage:HM,errorMessage:PM,eventOverflowWarning:GM,attemptSelector:qM,attemptLabel:FM,attemptButton:$M,attemptActive:YM,attemptStatus:KM,emptyCta:ZM,ctaTitle:XM,ctaDescription:QM,ctaButton:JM,ctaLink:WM,projectHeader:eR,projectName:tR,projectMeta:nR,metaRow:aR,metaLabel:sR,metaValue:iR,metaPlaceholder:lR,editButton:oR,editInput:rR,editTextarea:cR,editSelect:uR,archiveButton:dR,repoLink:fR,metaValueClickable:hR,editHint:pR,editError:mR,editInputInvalid:gR,unsavedDot:yR,metaToggle:vR,metaToggleArrow:bR,metaToggleArrowOpen:SR,progressBarContainer:_R,progressBar:xR,progressFill:TR,progressLabel:ER,metaTimestamps:CR,metaTimestamp:AR,worktreeToggle:jR,editFieldWrapper:NR};function wR(){const{projects:n,createProject:a}=qt();return n.length===0?h.jsxs("div",{className:k.emptyCta,children:[h.jsx("div",{className:k.ctaTitle,children:"Welcome to Grackle"}),h.jsx("div",{className:k.ctaDescription,children:"Organize your work into projects and let agents tackle the tasks."}),h.jsx("button",{className:k.ctaButton,onClick:()=>{const i=window.prompt("Project name:");i!=null&&i.trim()&&a(i.trim())},children:"Create Your First Project"})]}):h.jsx("div",{className:k.emptyState,children:"Select a project or task to get started"})}function DR(n,a){const i=[];let o=n;const r=new Set;for(;o&&a.has(o)&&!r.has(o);){r.add(o);const u=a.get(o);i.unshift(u),o=u.parentTaskId||void 0}return i}const Ls={label:"Home",url:"/"};function kR(n){return n?[Ls,{label:"Settings",url:"/settings"},{label:n,url:void 0}]:[Ls,{label:"Settings",url:void 0}]}function MR(){return[Ls,{label:"New Environment",url:void 0}]}function RR(){return[Ls,{label:"New Chat",url:void 0}]}function OR(n){return[Ls,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function BR(n,a){const i=a.find(o=>o.id===n);return[Ls,{label:(i==null?void 0:i.name)??"Project",url:void 0}]}function LR(n,a,i){const o=DR(n,i),r=i.get(n),u=r==null?void 0:r.projectId,d=u?a.find(g=>g.id===u):void 0,p=[Ls];d&&p.push({label:d.name,url:Kl(d.id)});for(let g=0;g<o.length-1;g++)p.push({label:o[g].title,url:as(o[g].id)});const m=o[o.length-1];return p.push({label:(m==null?void 0:m.title)??n,url:void 0}),p}function UR(){const n=RR();return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:n}),h.jsx("div",{className:k.emptyState,children:"Enter a prompt below to start a new session"})]})}function L1(n){const a=[];for(const i of n){const o=a[a.length-1];i.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?a[a.length-1]={...o,content:o.content+i.content}:a.push(i)}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 i=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 p=JSON.parse(u.content);i.set(d.id,{tool:p.tool,args:p.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 p=i.get(d.tool_use_id);return p?(o.add(d.tool_use_id),{...u,toolUseCtx:p}):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 zR({sessionId:n,session:a,isActive:i,onKill:o}){return h.jsxs("div",{className:k.header,children:[h.jsxs("span",{children:["Session: ",n.slice(0,8),a&&` | ${a.runtime} | ${a.status}`]}),h.jsxs("span",{className:k.headerInfo,children:[a&&h.jsx("span",{children:a.prompt.length>60?a.prompt.slice(0,60)+"...":a.prompt}),i&&h.jsx("button",{onClick:()=>o(n),title:"Stop session",className:k.killButton,children:"×"})]})]})}function VR({eventsDropped:n}){return n<=0?h.jsx(h.Fragment,{}):h.jsxs("div",{className:k.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 IR({sessionEvents:n,session:a,eventsDropped:i,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:k.eventScroll,children:[n.length===0&&h.jsx("div",{className:r?k.errorMessage:k.waitingMessage,children:u}),h.jsx(VR,{eventsDropped:i}),n.map((d,p)=>h.jsx(N1,{event:d,toolUseCtx:d.toolUseCtx},`${d.sessionId}-${d.timestamp}-${p}`))]})}function HR(){const{sessionId:n}=Qr(),{events:a,eventsDropped:i,sessions:o,kill:r,loadSessionEvents:u}=qt(),d=S.useRef(null),p=S.useRef(void 0),m=OR(n),g=o.find(_=>_.id===n)??void 0,y=S.useMemo(()=>{const _=n?a.filter(T=>T.sessionId===n):[];return U1(L1(_))},[a,n]);if(S.useEffect(()=>{n&&n!==p.current&&(p.current=n,u(n))},[n,u]),S.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[y.length]),!n)return h.jsx("div",{className:k.emptyState,children:"No session selected"});const v=(g==null?void 0:g.status)==="running"||(g==null?void 0:g.status)==="idle";return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:m}),h.jsx(zR,{sessionId:n,session:g,isActive:v,onKill:r}),h.jsx(IR,{sessionEvents:y,session:g,eventsDropped:i,scrollRef:d})]})}const u0=220,d0=70,PR=40,GR=60,qR="hierarchy",FR="dependency";function $R(n){return S.useMemo(()=>{if(n.length===0)return{nodes:[],edges:[]};const a=new dy.graphlib.Graph({multigraph:!0});a.setDefaultEdgeLabel(()=>({})),a.setGraph({rankdir:"TB",nodesep:PR,ranksep:GR});const i=new Map(n.map(d=>[d.id,d])),o=new Map;for(const d of n)if(d.parentTaskId&&i.has(d.parentTaskId)){const p=o.get(d.parentTaskId)||[];p.push(d),o.set(d.parentTaskId,p)}for(const d of n)a.setNode(d.id,{width:u0,height:d0});const r=[];for(const d of n){if(d.parentTaskId&&i.has(d.parentTaskId)){const p=`hierarchy-${d.parentTaskId}-${d.id}`;a.setEdge(d.parentTaskId,d.id,{},p),r.push({id:p,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:qR},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of d.dependsOn)if(i.has(p)){const m=`dependency-${p}-${d.id}`;a.setEdge(p,d.id,{},m),r.push({id:m,source:p,target:d.id,type:"smoothstep",data:{edgeType:FR},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return dy.layout(a),{nodes:n.map(d=>{const p=a.node(d.id),m=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:p.x-u0/2,y:p.y-d0/2},data:{task:d,childCount:m.length,doneChildCount:m.filter(g=>g.status==="complete").length,hasDependencies:d.dependsOn.length>0}}}),edges:r}},[n])}const YR="_dagContainer_js4w6_1",KR="_taskNode_js4w6_26",ZR="_taskNodeBorder_js4w6_54",XR="_taskNodeContent_js4w6_60",QR="_taskNodeHeader_js4w6_70",JR="_taskNodeIcon_js4w6_77",WR="_taskNodeTitle_js4w6_82",e3="_taskNodeBadges_js4w6_90",t3="_childBadge_js4w6_95",n3="_depBadge_js4w6_107",a3="_handle_js4w6_119",s3="_emptyCta_js4w6_126",i3="_ctaDescription_js4w6_137",l3="_ctaButton_js4w6_144",Jt={dagContainer:YR,taskNode:KR,taskNodeBorder:ZR,taskNodeContent:XR,taskNodeHeader:QR,taskNodeIcon:JR,taskNodeTitle:WR,taskNodeBadges:e3,childBadge:t3,depBadge:n3,handle:a3,emptyCta:s3,ctaDescription:i3,ctaButton:l3};function o3({data:n}){const{task:a,childCount:i,doneChildCount:o,hasDependencies:r}=n,u=ls(a.status);return h.jsxs("div",{className:Jt.taskNode,"data-task-id":a.id,"data-task-title":a.title,children:[h.jsx(fy,{type:"target",position:hy.Top,className:Jt.handle}),h.jsx("div",{className:Jt.taskNodeBorder,style:{backgroundColor:u.color}}),h.jsxs("div",{className:Jt.taskNodeContent,children:[h.jsxs("div",{className:Jt.taskNodeHeader,children:[h.jsx("span",{className:Jt.taskNodeIcon,style:{color:u.color},children:u.icon}),h.jsx("span",{className:Jt.taskNodeTitle,children:a.title})]}),h.jsxs("div",{className:Jt.taskNodeBadges,children:[i>0&&h.jsxs("span",{className:Jt.childBadge,children:[o,"/",i]}),r&&h.jsx("span",{className:Jt.depBadge,children:"dep"})]})]}),h.jsx(fy,{type:"source",position:hy.Bottom,className:Jt.handle})]})}const r3=iD,c3={task:o3};function u3({projectId:n}){const{tasks:a}=qt(),i=Pn(),{resolvedThemeId:o}=G0(),r=S.useMemo(()=>a.filter(y=>y.projectId===n),[a,n]),{nodes:u,edges:d}=$R(r),p=S.useMemo(()=>{const y=getComputedStyle(document.documentElement),v={};for(const[_,T]of Object.entries(r3))v[_]=y.getPropertyValue(T).trim()||"#6b7a8d";return v},[o]),m=S.useCallback((y,v)=>{i(as(v.id))},[i]),g=S.useCallback(y=>{const v=y.data;return p[v.task.status]||p.pending},[p]);return r.length===0?h.jsxs("div",{className:Jt.emptyCta,children:[h.jsx("button",{className:Jt.ctaButton,onClick:()=>i(Bs(n)),children:"Create Task"}),h.jsx("div",{className:Jt.ctaDescription,children:"Create tasks to see the dependency graph"})]}):h.jsx("div",{className:Jt.dagContainer,children:h.jsxs(ax,{nodes:u,edges:d,nodeTypes:c3,onNodeClick:m,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[h.jsx(sx,{variant:ix.Dots,gap:24,size:1,color:"var(--text-disabled)"}),h.jsx(lx,{showInteractive:!1}),h.jsx(ox,{nodeColor:g,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function d3({tasks:n,taskStatusById:a,sessionStatusByTaskId:i}){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(s0.map(u=>[u,[]]));for(const u of n){const d=mh(u.status),p=u.dependsOn.length>0&&u.dependsOn.some(E=>a.get(E)!=="complete"),m=o.get(u.id)??[],g=m.length,y=m.filter(E=>E.status==="complete").length;let v;if(d==="paused"&&i){const E=i.get(u.id);E==="idle"?v="Needs input":E==="completed"&&(v="Ready to complete")}const _={task:u,isBlocked:p,childCount:g,doneChildCount:y,pausedSubBadge:v},T=r.get(d);T?T.push(_):r.get("not_started").push(_)}for(const u of r.values())u.sort((d,p)=>d.task.sortOrder-p.task.sortOrder);return s0.map(u=>{const d=ls(u);return{status:u,label:d.label,style:d,tasks:r.get(u)??[]}})}const f3="_boardContainer_1c4y1_1",h3="_column_1c4y1_17",p3="_columnHeader_1c4y1_34",m3="_columnIcon_1c4y1_47",g3="_columnLabel_1c4y1_52",y3="_columnCount_1c4y1_57",v3="_cardList_1c4y1_67",b3="_emptyPlaceholder_1c4y1_76",S3="_card_1c4y1_67",_3="_cardHeader_1c4y1_107",x3="_cardStatusIcon_1c4y1_113",T3="_cardTitle_1c4y1_119",E3="_cardBadges_1c4y1_127",C3="_badge_1c4y1_134",A3="_blockedBadge_1c4y1_146",j3="_childBadge_1c4y1_151",N3="_depBadge_1c4y1_155",w3="_parentBadge_1c4y1_159",D3="_pausedSubBadge_1c4y1_166",k3="_personaBadge_1c4y1_170",M3="_envBadge_1c4y1_174",R3="_emptyCta_1c4y1_178",O3="_ctaButton_1c4y1_188",B3="_ctaDescription_1c4y1_204",Ge={boardContainer:f3,column:h3,columnHeader:p3,columnIcon:m3,columnLabel:g3,columnCount:y3,cardList:v3,emptyPlaceholder:b3,card:S3,cardHeader:_3,cardStatusIcon:x3,cardTitle:T3,cardBadges:E3,badge:C3,blockedBadge:A3,childBadge:j3,depBadge:N3,parentBadge:w3,pausedSubBadge:D3,personaBadge:k3,envBadge:M3,emptyCta:R3,ctaButton:O3,ctaDescription:B3};function L3({projectId:n}){const{tasks:a,sessions:i,personas:o,environments:r}=qt(),u=Pn(),d=S.useMemo(()=>a.filter(v=>v.projectId===n),[a,n]),p=S.useMemo(()=>new Map(a.map(v=>[v.id,v.status])),[a]),m=S.useMemo(()=>new Map(d.map(v=>[v.id,v])),[d]),g=S.useMemo(()=>{const v=new Map(i.map(C=>[C.id,C])),_=new Map(o.map(C=>[C.id,C])),T=new Map(r.map(C=>[C.id,C])),E=new Map,A=new Map,j=new Map;for(const C of d)if(C.latestSessionId){const w=v.get(C.latestSessionId);if(w){if(E.set(C.id,w.status),w.personaId){const M=_.get(w.personaId);M&&A.set(C.id,M.name)}if(w.environmentId){const M=T.get(w.environmentId);M&&j.set(C.id,M.displayName)}}}return{sessionStatusByTaskId:E,personaNameByTaskId:A,environmentNameByTaskId:j}},[d,i,o,r]),y=S.useMemo(()=>d3({tasks:d,taskStatusById:p,sessionStatusByTaskId:g.sessionStatusByTaskId}),[d,p,g]);return d.length===0?h.jsxs("div",{className:Ge.emptyCta,"data-testid":"board-empty-cta",children:[h.jsx("button",{className:Ge.ctaButton,onClick:()=>u(Bs(n)),children:"Create Task"}),h.jsx("div",{className:Ge.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):h.jsx("div",{className:Ge.boardContainer,"data-testid":"board-container",children:y.map(v=>h.jsxs("section",{className:Ge.column,"data-testid":`board-column-${v.status}`,"aria-label":`${v.label}, ${v.tasks.length} ${v.tasks.length===1?"task":"tasks"}`,children:[h.jsxs("div",{className:Ge.columnHeader,children:[h.jsx("span",{className:Ge.columnIcon,style:{color:v.style.color},children:v.style.icon}),h.jsx("span",{className:Ge.columnLabel,children:v.label}),h.jsx("span",{className:Ge.columnCount,"data-testid":`board-count-${v.status}`,children:v.tasks.length})]}),h.jsx("div",{className:Ge.cardList,children:v.tasks.length===0?h.jsx("div",{className:Ge.emptyPlaceholder,children:"No tasks"}):h.jsx(os,{mode:"popLayout",children:v.tasks.map(_=>h.jsx(Rn.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:h.jsx(U3,{boardTask:_,tasksById:m,personaName:g.personaNameByTaskId.get(_.task.id),envName:g.environmentNameByTaskId.get(_.task.id),onClick:()=>u(as(_.task.id))})},_.task.id))})})]},v.status))})}function U3({boardTask:n,tasksById:a,personaName:i,envName:o,onClick:r}){const{task:u,isBlocked:d,childCount:p,doneChildCount:m,pausedSubBadge:g}=n,y=ls(u.status),v=u.parentTaskId?a.get(u.parentTaskId):void 0;return h.jsxs("div",{className:Ge.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:r,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),r())},children:[h.jsxs("div",{className:Ge.cardHeader,children:[h.jsx("span",{className:Ge.cardStatusIcon,style:{color:y.color},children:y.icon}),h.jsx("span",{className:Ge.cardTitle,children:u.title})]}),h.jsxs("div",{className:Ge.cardBadges,children:[v&&h.jsx("span",{className:`${Ge.badge} ${Ge.parentBadge}`,title:v.title,children:v.title}),p>0&&h.jsxs("span",{className:`${Ge.badge} ${Ge.childBadge}`,children:[m,"/",p]}),d&&h.jsx("span",{className:`${Ge.badge} ${Ge.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&h.jsx("span",{className:`${Ge.badge} ${Ge.depBadge}`,children:"dep"}),g&&h.jsx("span",{className:`${Ge.badge} ${Ge.pausedSubBadge}`,children:g}),i&&h.jsx("span",{className:`${Ge.badge} ${Ge.personaBadge}`,children:i}),o&&h.jsx("span",{className:`${Ge.badge} ${Ge.envBadge}`,children:o})]})]})}function z3(n){const a=n.toLowerCase();return a==="ready"||a==="running"||a==="available"||a==="connected"?k.envDotGreen:a==="provisioning"||a==="starting"||a==="pending"||a==="connecting"?k.envDotYellow:a==="error"||a==="failed"||a==="disconnected"?k.envDotRed:k.envDotGray}function f0(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 V3(){const{projectId:n}=Qr(),a=Pn(),{tasks:i,environments:o,projects:r,archiveProject:u,updateProject:d}=qt(),[p,m]=S.useState("tasks"),[g,y]=S.useState(!1),[v,_]=S.useState(null),[T,E]=S.useState(""),[A,j]=S.useState(""),[C,w]=S.useState(!1),M=S.useRef(void 0),G=S.useRef(null),V=S.useRef(null),X=S.useRef(null),Q=S.useRef(null),I=S.useRef(null),te=S.useRef(null),se=BR(n,r);S.useEffect(()=>{const J=M.current;M.current=n,!(J===void 0||J===n)&&(v!==null||T!=="")&&(_(null),E(""))},[n,v,T]),S.useEffect(()=>{if(v===null)return;const J=v==="name"?V.current:v==="description"?X.current:v==="repoUrl"?Q.current:v==="worktreeBasePath"?te.current:I.current;if(!J)return;const F=window.setTimeout(()=>{J.focus()},0);return()=>{window.clearTimeout(F)}},[v]);const O=r.find(J=>J.id===n),ne=i.filter(J=>J.projectId===n),W=ne.filter(J=>J.status==="complete").length,he=ne.length,P=he>0?Math.round(W/he*100):0,U=100,K=(J,F)=>{G.current=J,_(J),E(F),j("")},ee=()=>{G.current=null,_(null),E(""),j("")},we=(J,F)=>{if(J==="name"){const me=F.trim();if(!me)return"Name is required";if(me.length>U)return`Max ${U} characters`}if(J==="repoUrl"){const me=F.trim();if(me&&!/^https?:\/\/.+/.test(me))return"Must be a valid http(s) URL"}return""},xe=J=>{if(!O)return;const F=T.trim(),me=we(J,T);if(me){j(me);return}if(J==="name"){if(F===O.name){ee();return}d(O.id,{name:F})}else if(J==="description"){const Ae=T;if(Ae===O.description){ee();return}d(O.id,{description:Ae})}else if(J==="repoUrl"){if(F===O.repoUrl){ee();return}d(O.id,{repoUrl:F})}else if(J==="defaultEnvironmentId"){if(T===O.defaultEnvironmentId){ee();return}d(O.id,{defaultEnvironmentId:T})}else{if(F===O.worktreeBasePath){ee();return}d(O.id,{worktreeBasePath:F})}ee()},Ue=(J,F)=>{J.key==="Escape"?ee():J.key==="Enter"&&F!=="description"&&xe(F)},Ee=J=>O?J==="name"?T.trim()!==O.name:J==="description"?T!==O.description:J==="repoUrl"?T.trim()!==O.repoUrl:J==="defaultEnvironmentId"?T!==O.defaultEnvironmentId:T.trim()!==O.worktreeBasePath:!1,ye=o.find(J=>J.id===(O==null?void 0:O.defaultEnvironmentId)),Te=v==="description"?"Tab to save · Esc to cancel":"Enter to save · Esc to cancel";return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:se}),h.jsxs("div",{className:k.projectHeader,children:[h.jsx("span",{className:k.projectName,"data-testid":"project-name",children:v==="name"?h.jsxs("div",{className:k.editFieldWrapper,children:[h.jsx("input",{ref:V,className:`${k.editInput} ${A?k.editInputInvalid:""}`,value:T,onChange:J=>{E(J.target.value),j("")},onBlur:J=>{if(G.current==="name"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.relatedTarget.dataset.editAction==="name"||xe("name")},onKeyDown:J=>Ue(J,"name"),maxLength:U,"aria-label":"Project name","data-testid":"edit-name-input"}),Ee("name")&&h.jsx("span",{className:k.unsavedDot,title:"Unsaved changes"}),A&&h.jsx("span",{className:k.editError,"data-testid":"edit-error",children:A}),h.jsx("span",{className:k.editHint,children:Te})]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:()=>K("name",(O==null?void 0:O.name)||""),title:"Click to edit name","aria-label":`Edit project name: ${(O==null?void 0:O.name)||n}`,"data-testid":"edit-name-button",children:[(O==null?void 0:O.name)||n,h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})}),h.jsx("button",{className:k.archiveButton,onClick:()=>y(!0),title:"Archive project","data-testid":"archive-project-button",children:"Archive"})]}),h.jsxs("button",{className:k.metaToggle,onClick:()=>w(!C),"aria-expanded":!C,"aria-controls":"project-meta-panel","data-testid":"meta-toggle",children:[h.jsx("span",{className:`${k.metaToggleArrow} ${C?"":k.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!C&&h.jsxs("div",{className:k.projectMeta,"data-testid":"project-meta",id:"project-meta-panel",children:[h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Description"}),h.jsx("div",{className:k.metaValue,children:v==="description"?h.jsxs("div",{className:k.editFieldWrapper,children:[h.jsx("textarea",{ref:X,className:k.editTextarea,value:T,onChange:J=>{E(J.target.value),j("")},onBlur:J=>{if(G.current==="description"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.relatedTarget.dataset.editAction==="description"||xe("description")},onKeyDown:J=>Ue(J,"description"),title:"Project description","aria-label":"Project description","data-testid":"edit-description-input"}),Ee("description")&&h.jsx("span",{className:k.unsavedDot,title:"Unsaved changes"}),h.jsx("span",{className:k.editHint,children:Te})]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:()=>K("description",(O==null?void 0:O.description)||""),title:"Click to edit description","aria-label":"Edit project description","data-testid":"edit-description-button",children:[O!=null&&O.description?h.jsx("span",{className:k.overviewMarkdown,children:h.jsx(Tf,{remarkPlugins:[Ef],children:O.description})}):h.jsx("span",{className:k.metaPlaceholder,children:"No description"}),h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Repository"}),h.jsx("div",{className:k.metaValue,children:v==="repoUrl"?h.jsxs("div",{className:k.editFieldWrapper,children:[h.jsx("input",{ref:Q,className:`${k.editInput} ${A?k.editInputInvalid:""}`,value:T,onChange:J=>{E(J.target.value),j("")},onBlur:J=>{if(G.current==="repoUrl"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.relatedTarget.dataset.editAction==="repoUrl"||xe("repoUrl")},onKeyDown:J=>Ue(J,"repoUrl"),placeholder:"https://github.com/...","aria-label":"Project repository URL","data-testid":"edit-repo-input"}),Ee("repoUrl")&&h.jsx("span",{className:k.unsavedDot,title:"Unsaved changes"}),A&&h.jsx("span",{className:k.editError,"data-testid":"edit-error",children:A}),h.jsx("span",{className:k.editHint,children:Te})]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:J=>{J.preventDefault(),K("repoUrl",(O==null?void 0:O.repoUrl)||"")},title:"Click to edit repository URL","aria-label":"Edit project repository URL","data-testid":"edit-repo-button",children:[O!=null&&O.repoUrl&&/^https?:\/\//i.test(O.repoUrl)?h.jsx("a",{className:k.repoLink,href:O.repoUrl,target:"_blank",rel:"noopener noreferrer",onClick:J=>J.stopPropagation(),children:O.repoUrl}):O!=null&&O.repoUrl?h.jsx("span",{children:O.repoUrl}):h.jsx("span",{className:k.metaPlaceholder,children:"No repository"}),h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Environment"}),h.jsx("div",{className:k.metaValue,children:v==="defaultEnvironmentId"?h.jsxs("select",{ref:I,className:k.editSelect,value:T,onChange:J=>{G.current=null,E(J.target.value);const F=J.target.value;O&&F!==O.defaultEnvironmentId&&d(O.id,{defaultEnvironmentId:F}),ee()},onBlur:J=>{if(G.current==="defaultEnvironmentId"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.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(J=>h.jsx("option",{value:J.id,children:J.displayName},J.id))]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:()=>K("defaultEnvironmentId",(O==null?void 0:O.defaultEnvironmentId)||""),title:"Click to change default environment","aria-label":"Edit project default environment","data-testid":"edit-env-button",children:[ye?h.jsxs("span",{className:k.envRow,children:[h.jsx("span",{className:`${k.envDot} ${z3(ye.status)}`}),ye.displayName]}):h.jsx("span",{className:k.metaPlaceholder,children:(O==null?void 0:O.defaultEnvironmentId)||"No default environment"}),h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Worktrees"}),h.jsx("div",{className:k.metaValue,children:h.jsxs("label",{className:k.worktreeToggle,"data-testid":"worktree-toggle",children:[h.jsx("input",{type:"checkbox",checked:(O==null?void 0:O.useWorktrees)??!0,onChange:J=>{O&&d(O.id,{useWorktrees:J.target.checked})}}),h.jsx("span",{children:"Enable worktree isolation"})]})})]}),h.jsxs("div",{className:k.metaRow,children:[h.jsx("span",{className:k.metaLabel,children:"Working Dir"}),h.jsx("div",{className:k.metaValue,children:v==="worktreeBasePath"?h.jsxs("div",{className:k.editFieldWrapper,children:[h.jsx("input",{ref:te,className:`${k.editInput} ${A?k.editInputInvalid:""}`,value:T,onChange:J=>{E(J.target.value),j("")},onBlur:J=>{if(G.current==="worktreeBasePath"){G.current=null;return}J.relatedTarget instanceof HTMLElement&&J.relatedTarget.dataset.editAction==="worktreeBasePath"||xe("worktreeBasePath")},onKeyDown:J=>Ue(J,"worktreeBasePath"),placeholder:"/workspaces/my-repo","aria-label":"Working directory","data-testid":"edit-worktree-base-path-input"}),Ee("worktreeBasePath")&&h.jsx("span",{className:k.unsavedDot,title:"Unsaved changes"}),A&&h.jsx("span",{className:k.editError,"data-testid":"edit-error",children:A}),h.jsx("span",{className:k.editHint,children:Te})]}):h.jsxs("button",{type:"button",className:k.metaValueClickable,onClick:()=>K("worktreeBasePath",(O==null?void 0:O.worktreeBasePath)||""),title:"Click to edit working directory","aria-label":"Edit working directory","data-testid":"edit-worktree-base-path-button",children:[O!=null&&O.worktreeBasePath?h.jsx("span",{children:O.worktreeBasePath}):h.jsx("span",{className:k.metaPlaceholder,children:"Default (server default)"}),h.jsx("span",{className:k.editButton,"aria-hidden":"true",children:"✏️"})]})})]}),O&&h.jsxs("div",{className:k.metaTimestamps,children:[h.jsxs("span",{className:k.metaTimestamp,children:["Created ",f0(O.createdAt)]}),O.updatedAt&&O.updatedAt!==O.createdAt&&h.jsxs("span",{className:k.metaTimestamp,children:["· Updated ",f0(O.updatedAt)]})]})]}),he>0&&h.jsxs("div",{className:k.progressBarContainer,"data-testid":"progress-bar",children:[h.jsx("div",{className:k.progressBar,children:h.jsx("div",{className:k.progressFill,style:{width:`${P}%`}})}),h.jsxs("span",{className:k.progressLabel,children:[W,"/",he]})]}),h.jsxs("div",{className:k.tabBar,role:"tablist","aria-label":"Project view",children:[h.jsx("button",{role:"tab","aria-selected":p==="graph",className:`${k.tab} ${p==="graph"?k.active:""}`,onClick:()=>m("graph"),children:"Graph"}),h.jsx("button",{role:"tab","aria-selected":p==="board",className:`${k.tab} ${p==="board"?k.active:""}`,onClick:()=>m("board"),"data-testid":"board-tab",children:"Board"}),h.jsx("button",{role:"tab","aria-selected":p==="tasks",className:`${k.tab} ${p==="tasks"?k.active:""}`,onClick:()=>m("tasks"),children:"Tasks"})]}),p==="tasks"&&he>0&&h.jsxs("div",{className:k.projectSummary,children:[h.jsx("span",{className:k.projectSummaryTitle,children:`${W}/${he} tasks complete`}),h.jsx("span",{className:k.projectSummarySubtitle,children:"Select a task or click + to create one"})]}),p==="tasks"&&he===0&&h.jsxs("div",{className:k.emptyCta,children:[h.jsx("button",{className:k.ctaButton,onClick:()=>a(Bs(n)),children:"Create Task"}),h.jsx("div",{className:k.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),p==="board"&&h.jsx(L3,{projectId:n}),p==="graph"&&h.jsx(u3,{projectId:n}),h.jsx(lc,{isOpen:g,title:"Archive Project?",description:"This will hide the project from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{O&&(u(O.id),a("/",{replace:!0})),y(!1)},onCancel:()=>y(!1)})]})}const I3="_container_cddyd_1",H3="_header_cddyd_8",P3="_headerTitle_cddyd_35",G3="_badge_cddyd_44",q3="_headerActions_cddyd_54",F3="_body_cddyd_61",$3="_formContent_cddyd_73",Y3="_section_cddyd_85",K3="_label_cddyd_91",Z3="_titleInput_cddyd_98",X3="_descriptionTextarea_cddyd_131",Q3="_parentContext_cddyd_167",J3="_parentLabel_cddyd_175",W3="_parentName_cddyd_182",eO="_depList_cddyd_220",tO="_depItem_cddyd_226",nO="_depItemSelected_cddyd_248",aO="_noDeps_cddyd_252",sO="_btnPrimary_cddyd_258",iO="_btnGhost_cddyd_289",it={container:I3,header:H3,headerTitle:P3,badge:G3,headerActions:q3,body:F3,formContent:$3,section:Y3,label:K3,titleInput:Z3,descriptionTextarea:X3,parentContext:Q3,parentLabel:J3,parentName:W3,depList:eO,depItem:tO,depItemSelected:nO,noDeps:aO,btnPrimary:sO,btnGhost:iO};function z1({mode:n,taskId:a,projectId:i,parentTaskId:o}){const{tasks:r,createTask:u,updateTask:d}=qt(),{showToast:p}=ao(),m=Pn(),g=n==="edit",y=g&&a?r.find(O=>O.id===a):void 0,v=g?(y==null?void 0:y.projectId)??"":i??"",_=g?(y==null?void 0:y.parentTaskId)??"":o??"",T=_?r.find(O=>O.id===_):void 0,[E,A]=S.useState((y==null?void 0:y.title)??""),[j,C]=S.useState((y==null?void 0:y.description)??""),[w,M]=S.useState((y==null?void 0:y.dependsOn)??[]),G=S.useRef(!1);S.useEffect(()=>{g&&y&&!G.current&&(G.current=!0,A(y.title),C(y.description),M(y.dependsOn))},[g,y]);const V=r.filter(O=>O.projectId===v&&(!g||O.id!==a)&&O.id!==_),X=E.trim().length>0&&(!g||y!==void 0)&&(g||v.length>0),Q=O=>{M(ne=>ne.includes(O)?ne.filter(W=>W!==O):[...ne,O])},I=()=>{X&&(g&&y===void 0||(g&&a?(d(a,E.trim(),j,w),p("Task updated","success"),m(as(a),{replace:!0})):(u(v,E.trim(),j,w.length>0?w:void 0,_||void 0),p("Task created","success"),m(Kl(v),{replace:!0}))))},te=()=>{m(g&&a?as(a):Kl(v))},se=g?"edit task":_?"child task":"new task";return h.jsxs("div",{className:it.container,children:[h.jsxs("div",{className:it.header,children:[h.jsxs("div",{className:it.headerTitle,children:[h.jsx("span",{className:it.badge,children:se}),T&&h.jsxs("span",{className:it.parentContext,children:[h.jsx("span",{className:it.parentLabel,children:"Child of"}),h.jsx("span",{className:it.parentName,children:T.title})]})]}),h.jsxs("div",{className:it.headerActions,children:[h.jsx("button",{onClick:I,disabled:!X,className:it.btnPrimary,"data-testid":"task-edit-save",children:g?"Save Changes":"Create"}),h.jsx("button",{onClick:te,className:it.btnGhost,children:"Cancel"})]})]}),h.jsx("div",{className:it.body,children:h.jsxs("div",{className:it.formContent,children:[h.jsxs("div",{className:it.section,children:[h.jsx("label",{className:it.label,htmlFor:"task-edit-title",children:"Title"}),h.jsx("input",{id:"task-edit-title",type:"text",value:E,onChange:O=>A(O.target.value),placeholder:"Task title...",autoFocus:!0,className:it.titleInput,"data-testid":"task-edit-title",onKeyDown:O=>{O.key==="Enter"&&X&&I()}})]}),h.jsxs("div",{className:it.section,children:[h.jsx("label",{className:it.label,htmlFor:"task-edit-description",children:"Description"}),h.jsx("textarea",{id:"task-edit-description",value:j,onChange:O=>C(O.target.value),placeholder:"Describe the task... (markdown supported)",className:it.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),h.jsxs("div",{className:it.section,children:[h.jsx("div",{className:it.label,children:"Dependencies"}),V.length===0?h.jsx("div",{className:it.noDeps,children:"No other tasks in this project"}):h.jsx("div",{className:it.depList,children:V.map(O=>{const ne=w.includes(O.id);return h.jsxs("label",{className:`${it.depItem} ${ne?it.depItemSelected:""}`,"data-testid":`dep-option-${O.id}`,children:[h.jsx("input",{type:"checkbox",checked:ne,onChange:()=>Q(O.id)}),O.title,h.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",O.status,")"]})]},O.id)})})]})]})})]})}function lO(){const[n]=Mf(),a=n.get("project")??"",i=n.get("parent")??void 0;return a?h.jsx(z1,{mode:"new",projectId:a,parentTaskId:i}):h.jsx(Dr,{to:"/",replace:!0})}function oO(){const{taskId:n}=Qr();return h.jsx(z1,{mode:"edit",taskId:n})}const rO="_container_1pqxm_1",cO="_emptyState_1pqxm_8",uO="_card_1pqxm_14",dO="_cardHeader_1pqxm_34",fO="_categoryBadge_1pqxm_46",hO="_findingTitle_1pqxm_54",pO="_findingDate_1pqxm_60",mO="_findingContent_1pqxm_72",gO="_tags_1pqxm_78",yO="_tag_1pqxm_78",Yn={container:rO,emptyState:cO,card:uO,cardHeader:dO,categoryBadge:fO,findingTitle:hO,findingDate:pO,findingContent:mO,tags:gO,tag:yO};function vO(n){const a=new Date(n),i=new Date,o=i.getTime()-a.getTime(),r=Math.floor(o/1e3),u=Math.floor(r/60),d=Math.floor(u/60),p=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(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=a.getFullYear()===i.getFullYear(),g=a.toLocaleString("en-US",{month:"short"}),y=a.getDate();return m?`${g} ${y}`:`${g} ${y} ${a.getFullYear()}`}const h0={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 bO({projectId:n}){const{findings:a}=qt(),i=a.filter(o=>o.projectId===n);return i.length===0?h.jsx("div",{className:Yn.emptyState,children:"No findings yet. Agents will post discoveries here."}):h.jsx("div",{className:Yn.container,children:i.map((o,r)=>{const u=h0[o.category]||h0.general;return h.jsxs(Rn.div,{className:Yn.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},children:[h.jsxs("div",{className:Yn.cardHeader,children:[h.jsx("span",{className:Yn.categoryBadge,style:{background:u.bg,color:u.text},children:o.category}),h.jsx("span",{className:Yn.findingTitle,children:o.title}),h.jsx("span",{className:Yn.findingDate,title:o.createdAt,children:vO(o.createdAt)})]}),h.jsx("div",{className:Yn.findingContent,children:o.content.length>300?o.content.slice(0,300)+"...":o.content}),o.tags.length>0&&h.jsx("div",{className:Yn.tags,children:o.tags.map(d=>h.jsx("span",{className:Yn.tag,style:{color:u.text,textShadow:`0 0 8px ${u.text}`},children:d},d))})]},o.id)})})}function Nr(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 Gd(n,a){if(!n||!a)return;const i=new Date(a).getTime()-new Date(n).getTime();if(isNaN(i)||i<0)return;const o=Math.floor(i/6e4),r=Math.floor(i%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 SO(n){const a=n.toLowerCase();return a==="ready"||a==="running"||a==="available"||a==="connected"?k.envDotGreen:a==="provisioning"||a==="starting"||a==="pending"||a==="connecting"?k.envDotYellow:a==="error"||a==="failed"||a==="disconnected"?k.envDotRed:k.envDotGray}function _O({status:n}){const a=ls(n),i=nD(n);return h.jsx("span",{className:`${k.statusBadge} ${k[i]??k.statusPending}`,children:a.label})}function xO({task:n,tasksById:a,environments:i,projects:o,taskSessions:r}){const u=r.length>0?r[r.length-1]:void 0,d=(u==null?void 0:u.environmentId)??"",p=d?i.find(y=>y.id===d):void 0,m=o.find(y=>y.id===n.projectId),g=n.branch&&(m!=null&&m.repoUrl)?`${m.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(n.branch)}`:void 0;return h.jsxs("div",{className:k.overviewDashboard,children:[h.jsxs("div",{className:k.overviewHero,children:[h.jsx(_O,{status:n.status}),n.branch&&h.jsx("span",{className:k.overviewBranchPill,children:g?h.jsxs("a",{href:g,target:"_blank",rel:"noreferrer noopener",className:k.branchLink,children:["🔗"," ",n.branch]}):h.jsxs("span",{children:["🔗"," ",n.branch]})})]}),typeof n.description=="string"&&n.description&&h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Description"}),h.jsx("div",{className:k.overviewMarkdown,children:h.jsx(Tf,{remarkPlugins:[Ef],children:n.description})})]}),d&&h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Environment"}),h.jsxs("div",{className:k.envRow,children:[p&&h.jsx("span",{className:`${k.envDot} ${SO(p.status)}`,title:p.status,"aria-label":`Status: ${p.status}`,role:"img"}),h.jsx("span",{className:k.overviewValue,children:(p==null?void 0:p.displayName)??d})]})]}),h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Dependencies"}),n.dependsOn.length===0?h.jsx("div",{className:k.overviewMuted,children:"None"}):h.jsx("div",{className:k.depList,children:n.dependsOn.map(y=>{const v=a.get(y),_=(v==null?void 0:v.status)==="complete";return h.jsxs("div",{className:`${k.depItem} ${_?k.depDone:k.depBlocked}`,children:[h.jsx("span",{children:_?"✓":"○"}),h.jsx("span",{children:(v==null?void 0:v.title)??y})]},y)})})]}),h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Timeline"}),h.jsxs("div",{className:k.timeline,children:[n.createdAt&&h.jsxs("div",{className:k.timelineRow,children:[h.jsx("span",{className:k.timelineKey,children:"Created"}),h.jsx("span",{className:k.timelineValue,children:Nr(n.createdAt)})]}),n.assignedAt&&(()=>{const y=Gd(n.createdAt,n.assignedAt);return h.jsxs("div",{className:k.timelineRow,children:[h.jsx("span",{className:k.timelineKey,children:"Assigned"}),h.jsx("span",{className:k.timelineValue,children:Nr(n.assignedAt)}),y!==void 0&&h.jsx("span",{className:k.timelineDelta,children:y})]})})(),n.startedAt&&(()=>{const y=Gd(n.assignedAt??n.createdAt,n.startedAt);return h.jsxs("div",{className:k.timelineRow,children:[h.jsx("span",{className:k.timelineKey,children:"Started"}),h.jsx("span",{className:k.timelineValue,children:Nr(n.startedAt)}),y!==void 0&&h.jsx("span",{className:k.timelineDelta,children:y})]})})(),n.completedAt&&(()=>{const y=Gd(n.startedAt,n.completedAt);return h.jsxs("div",{className:k.timelineRow,children:[h.jsx("span",{className:k.timelineKey,children:"Completed"}),h.jsx("span",{className:k.timelineValue,children:Nr(n.completedAt)}),y!==void 0&&h.jsx("span",{className:k.timelineDelta,children:y})]})})(),!n.createdAt&&!n.assignedAt&&!n.startedAt&&!n.completedAt&&h.jsx("div",{className:k.overviewMuted,children:"No timing data"})]})]}),n.reviewNotes&&h.jsxs("div",{className:k.overviewSection,children:[h.jsx("div",{className:k.overviewLabel,children:"Review Notes"}),h.jsx("div",{className:k.reviewNotes,children:n.reviewNotes})]})]})}function TO({eventsDropped:n}){return n<=0?h.jsx(h.Fragment,{}):h.jsxs("div",{className:k.eventOverflowWarning,role:"alert",children:["⚠ ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown."]})}function EO({task:n,sessionId:a,isBlocked:i,onStart:o,onResume:r,onStop:u,onComplete:d,onDelete:p,onEdit:m}){if(n.status==="not_started")return i?h.jsxs("div",{className:k.headerActions,children:[h.jsx("button",{onClick:m,className:k.btnGhost,children:"Edit"}),h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})]}):h.jsxs("div",{className:k.headerActions,children:[h.jsx("button",{onClick:o,className:k.btnPrimary,children:"Start"}),h.jsx("button",{onClick:m,className:k.btnGhost,children:"Edit"}),h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})]});if(n.status==="working")return h.jsx("div",{className:k.headerActions,children:h.jsx("button",{onClick:u,disabled:!a,className:k.btnDanger,children:"Stop"})});if(n.status==="paused")return h.jsxs("div",{className:k.headerActions,children:[h.jsx("button",{onClick:d,className:k.btnPrimary,children:"Complete"}),h.jsx("button",{onClick:r,className:k.btnGhost,children:"Resume"}),h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})]});if(n.status==="complete")return h.jsx("div",{className:k.headerActions,children:h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})});if(n.status==="failed")return h.jsxs("div",{className:k.headerActions,children:[h.jsx("button",{onClick:o,className:k.btnPrimary,children:"Retry"}),h.jsx("button",{onClick:p,className:k.btnDanger,children:"Delete"})]})}function CO({taskSessions:n,selectedSessionId:a,onSelect:i}){if(!(n.length<2))return h.jsxs("div",{className:k.attemptSelector,"data-testid":"attempt-selector",children:[h.jsx("span",{className:k.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:`${k.attemptButton} ${u?k.attemptActive:""}`,onClick:()=>i(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:k.attemptStatus,children:d})]},o.id)})]})}function qd(){const{taskId:n}=Qr(),a=Wt(),i=Pn(),{events:o,eventsDropped:r,tasks:u,environments:d,loadSessionEvents:p,loadFindings:m,kill:g,startTask:y,resumeTask:v,completeTask:_,deleteTask:T,projects:E,taskSessions:A,loadTaskSessions:j}=qt(),C=S.useRef(null),w=S.useRef(void 0),M=S.useRef(void 0),G=S.useRef(void 0),V=S.useRef(void 0),X=S.useRef(void 0),Q=a.pathname.endsWith("/stream")?"stream":a.pathname.endsWith("/findings")?"findings":"overview",[I,te]=S.useState(Q),[se,O]=S.useState(!1),[ne,W]=S.useState(void 0),he=S.useRef(Q);Q!==he.current&&(he.current=Q,Q!==I&&te(Q));const P=u.find(F=>F.id===n),U=(P==null?void 0:P.projectId)||void 0,K=P?A[P.id]??[]:[];let ee;ne&&K.some(F=>F.id===ne)?ee=ne:ee=(P==null?void 0:P.latestSessionId)||void 0;const we=()=>{O(!0)},xe=()=>{P&&(T(P.id),O(!1),i(Kl(P.projectId),{replace:!0}))};if((P==null?void 0:P.id)!==M.current&&(M.current=P==null?void 0:P.id,ne!==void 0&&W(void 0)),S.useEffect(()=>{if(!(P!=null&&P.id))return;const F=P.id!==V.current,me=P.latestSessionId!==X.current;(F||me)&&(V.current=P.id,X.current=P.latestSessionId,j(P.id))},[P==null?void 0:P.id,P==null?void 0:P.latestSessionId,j]),(P==null?void 0:P.status)!==G.current){G.current=P==null?void 0:P.status;const F=(P==null?void 0:P.status)==="not_started"?"overview":(P==null?void 0:P.status)==="working"||(P==null?void 0:P.status)==="paused"?"stream":(P==null?void 0:P.status)==="complete"?"findings":void 0;F&&F!==I&&te(F)}const Ue=S.useMemo(()=>new Map(u.map(F=>[F.id,F])),[u]),Ee=S.useMemo(()=>{const F=ee?o.filter(me=>me.sessionId===ee):[];return U1(L1(F))},[o,ee]),ye=P?P.dependsOn.some(F=>{const me=Ue.get(F);return me!==void 0&&me.status!=="complete"}):!1,Te=S.useMemo(()=>LR(n,E,Ue),[n,E,Ue]);S.useEffect(()=>{ee&&ee!==w.current&&(w.current=ee,p(ee))},[ee,p]),S.useEffect(()=>{I==="findings"&&U&&m(U)},[I,U,m]),S.useEffect(()=>{C.current&&I==="stream"&&(C.current.scrollTop=C.current.scrollHeight)},[Ee.length,I]);const J=F=>{te(F),i(as(n,F==="overview"?void 0:F))};return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:Te}),h.jsxs("div",{className:k.header,children:[h.jsxs("span",{className:k.headerTitle,children:[h.jsx("span",{"data-testid":"task-title",children:(P==null?void 0:P.title)||n}),P&&h.jsx("span",{className:k.taskStatusBadge,"data-testid":"task-status",children:P.status}),(P==null?void 0:P.branch)&&h.jsx("span",{className:k.taskBranch,children:P.branch}),ye&&h.jsx("span",{className:k.taskBlockedBadge,children:"blocked"})]}),P&&h.jsx(EO,{task:P,sessionId:ee,isBlocked:ye,onStart:()=>y(P.id),onResume:()=>v(P.id),onStop:()=>ee&&g(ee),onComplete:()=>_(P.id),onDelete:we,onEdit:()=>i(FT(P.id))})]}),h.jsxs("div",{className:k.tabBar,role:"tablist","aria-label":"Task view",children:[h.jsx("button",{role:"tab","aria-selected":I==="overview",className:`${k.tab} ${I==="overview"?k.active:""}`,onClick:()=>J("overview"),children:"Overview"}),h.jsx("button",{role:"tab","aria-selected":I==="stream",className:`${k.tab} ${I==="stream"?k.active:""}`,onClick:()=>J("stream"),children:"Stream"}),h.jsx("button",{role:"tab","aria-selected":I==="findings",className:`${k.tab} ${I==="findings"?k.active:""}`,onClick:()=>J("findings"),children:"Findings"})]}),h.jsxs(os,{mode:"wait",children:[I==="overview"&&h.jsx(Rn.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:k.overviewContent,children:P?h.jsx(xO,{task:P,tasksById:Ue,environments:d,projects:E,taskSessions:K}):h.jsx("div",{className:k.waitingMessage,children:"No additional details"})},"overview"),I==="stream"&&h.jsxs(Rn.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(CO,{taskSessions:K,selectedSessionId:ee,onSelect:F=>W(F)}),h.jsxs("div",{ref:C,className:k.eventScroll,children:[!ee&&P&&h.jsxs("div",{className:k.emptyCta,children:[h.jsx("button",{className:k.ctaButton,onClick:()=>y(P.id),children:"Start Task"}),h.jsx("div",{className:k.ctaDescription,children:"Click to begin agent execution"})]}),ee&&Ee.length===0&&h.jsx("div",{className:k.waitingMessage,children:"Waiting for events..."}),h.jsx(TO,{eventsDropped:r}),Ee.map((F,me)=>h.jsx(N1,{event:F,toolUseCtx:F.toolUseCtx},`${F.sessionId}-${F.timestamp}-${me}`))]})]},"stream"),I==="findings"&&h.jsx(Rn.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:k.tabContent,children:U?h.jsx(bO,{projectId:U}):h.jsx("div",{className:k.noContext,children:"Navigate to a task within a project to view findings"})},"findings")]}),P&&h.jsx(lc,{isOpen:se,title:"Delete Task?",description:`"${P.title}" will be permanently removed.`,onConfirm:xe,onCancel:()=>O(!1)})]})}function AO(){const n=MR();return h.jsxs("div",{className:k.panelContainer,children:[h.jsx(Ii,{segments:n}),h.jsx("div",{className:k.emptyState,children:"Configure the new environment below"})]})}const jO="_layout_1sbe4_1",NO="_content_1sbe4_8",p0={layout:jO,content:NO},wO={environments:"Environments",credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About"};function DO(){const a=Wt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=wO[a],o=kR(i);return h.jsxs("div",{className:p0.layout,children:[h.jsx(Ii,{segments:o}),h.jsx("div",{className:p0.content,children:h.jsx(D0,{})})]})}const kO="_nav_13n0b_1",MO="_tab_13n0b_44",RO="_tabIcon_13n0b_82",OO="_tabActive_13n0b_88",wr={nav:kO,tab:MO,tabIcon:RO,tabActive:OO},Ta=[{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 BO(){var d;const n=Wt(),a=Pn(),i=S.useRef(null),o=((d=Ta.find(p=>n.pathname===`${ki}/${p.path}`))==null?void 0:d.path)??Ta[0].path,r=S.useCallback(p=>{a(`${ki}/${p}`)},[a]),u=S.useCallback(p=>{var T,E;const m=(T=i.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(A=>A===document.activeElement),y=g>=0?g:Ta.findIndex(A=>A.path===o);let v=y;if(p.key==="ArrowDown")p.preventDefault(),v=(y+1)%Ta.length;else if(p.key==="ArrowUp")p.preventDefault(),v=(y-1+Ta.length)%Ta.length;else if(p.key==="Home")p.preventDefault(),v=0;else if(p.key==="End")p.preventDefault(),v=Ta.length-1;else return;const _=Ta[v].path;a(`${ki}/${_}`),(E=m[v])==null||E.focus()},[o,a]);return h.jsx("nav",{className:wr.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:Ta.map(p=>{const m=p.path===o;return h.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${wr.tab} ${m?wr.tabActive:""}`,onClick:()=>r(p.path),children:[h.jsx("span",{className:wr.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}const LO="_container_1nk8c_1",UO="_header_1nk8c_5",zO="_headerLabel_1nk8c_12",VO="_addButton_1nk8c_20",IO="_envRow_1nk8c_55",HO="_targeted_1nk8c_69",PO="_expanded_1nk8c_72",GO="_statusDot_1nk8c_76",qO="_pulse_1nk8c_79",FO="_envName_1nk8c_83",$O="_envActions_1nk8c_87",YO="_idleLabel_1nk8c_94",KO="_newChatButton_1nk8c_99",ZO="_envActionsRow_1nk8c_126",XO="_connectButton_1nk8c_134",QO="_stopButton_1nk8c_160",JO="_deleteButton_1nk8c_186",WO="_provisionMessage_1nk8c_213",eB="_errorMessage_1nk8c_220",tB="_sessionRow_1nk8c_227",nB="_selected_1nk8c_243",aB="_sessionDot_1nk8c_248",sB="_sessionSummaryRow_1nk8c_252",iB="_sessionExpandArrow_1nk8c_272",lB="_sessionSummaryText_1nk8c_283",oB="_sessionCountBadge_1nk8c_290",rB="_emptyCta_1nk8c_313",cB="_ctaDescription_1nk8c_326",uB="_ctaButton_1nk8c_332",Pe={container:LO,header:UO,headerLabel:zO,addButton:VO,envRow:IO,targeted:HO,expanded:PO,statusDot:GO,pulse:qO,envName:FO,envActions:$O,idleLabel:YO,newChatButton:KO,envActionsRow:ZO,connectButton:XO,stopButton:QO,deleteButton:JO,provisionMessage:WO,errorMessage:eB,sessionRow:tB,selected:nB,sessionDot:aB,sessionSummaryRow:sB,sessionExpandArrow:iB,sessionSummaryText:lB,sessionCountBadge:oB,emptyCta:rB,ctaDescription:cB,ctaButton:uB},dB={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"},fB={running:"running",idle:"awaiting input",failed:"failed",interrupted:"interrupted",completed:"completed"},m0=["running","idle","failed","interrupted","completed"],hB=.2;function pB(n){const a={};for(const u of n)a[u.status]=(a[u.status]||0)+1;const i=m0.filter(u=>a[u]>0).map(u=>`${a[u]} ${fB[u]||u}`),o=new Set(m0),r=Object.keys(a).filter(u=>!o.has(u)).sort().map(u=>`${a[u]} ${u}`);return[...i,...r].join(", ")}function mB({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:Pe.sessionDot,style:{color:a},children:"●"})}function gB({env:n,envSessions:a,selectedSessionId:i,isNewChatTarget:o,expanded:r,onToggleExpand:u,sessionsExpanded:d,onToggleSessionsExpand:p,provisionProgress:m,onProvision:g,onStop:y,onRemove:v,navigate:_}){const[T,E]=S.useState(!1),A=dB[n.status]||"var(--text-tertiary)",j=n.status==="connected",C=n.status==="connecting",w=n.status==="disconnected"||n.status==="error";return h.jsxs("div",{children:[h.jsx(lc,{isOpen:T,title:"Delete Environment?",description:`"${n.displayName||n.id}" will be permanently removed. This destroys the workspace and removes all data.`,onConfirm:()=>{v(n.id),E(!1)},onCancel:()=>E(!1)}),h.jsxs("div",{className:`${Pe.envRow} ${o?Pe.targeted:""} ${r?Pe.expanded:""}`,"data-testid":"env-row",onClick:u,children:[h.jsx("span",{className:`${Pe.statusDot} ${j?Pe.pulse:""}`,style:{color:A},children:"●"}),h.jsx("span",{className:Pe.envName,title:n.displayName||n.id,children:n.displayName||n.id}),h.jsxs("span",{className:Pe.envActions,children:[a.length===0&&!o&&!r&&h.jsx("span",{className:Pe.idleLabel,children:"(idle)"}),j&&h.jsx("button",{onClick:M=>{M.stopPropagation(),_(L0(n.id,n.defaultRuntime||"claude-code"))},title:"New chat",className:Pe.newChatButton,children:"+"})]})]}),r&&h.jsxs("div",{className:Pe.envActionsRow,children:[C&&m&&h.jsx("span",{className:Pe.provisionMessage,children:m.message}),n.status==="error"&&(m==null?void 0:m.stage)==="error"&&h.jsx("span",{className:Pe.errorMessage,children:m.message}),w&&h.jsx("button",{onClick:M=>{M.stopPropagation(),g(n.id)},className:Pe.connectButton,children:n.status==="error"?"Retry":"Connect"}),j&&h.jsx("button",{onClick:M=>{M.stopPropagation(),y(n.id)},className:Pe.stopButton,children:"Stop"}),!C&&h.jsx("button",{onClick:M=>{M.stopPropagation(),E(!0)},className:Pe.deleteButton,children:"Delete"})]}),a.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:Pe.sessionSummaryRow,"data-testid":"session-summary-row",role:"button",tabIndex:0,"aria-expanded":d,"aria-label":d?"Collapse sessions":"Expand sessions",onClick:p,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),p())},children:[h.jsx("span",{className:`${Pe.sessionExpandArrow} ${d?Pe.expanded:""}`,children:"▸"}),h.jsx("span",{className:Pe.sessionSummaryText,children:pB(a)}),h.jsx("span",{className:Pe.sessionCountBadge,children:a.length})]}),h.jsx(os,{children:d&&h.jsx(Rn.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:hB,ease:"easeInOut"},style:{overflow:"hidden"},children:a.map(M=>h.jsxs("div",{onClick:G=>{G.stopPropagation(),_(B0(M.id))},className:`${Pe.sessionRow} ${i===M.id?Pe.selected:""}`,title:M.prompt,"data-testid":"session-row",children:[h.jsx(mB,{status:M.status})," ",M.prompt.length>24?M.prompt.slice(0,24)+"...":M.prompt]},M.id))})})]})]})}function yB(){const{environments:n,sessions:a,provisionStatus:i,provisionEnvironment:o,stopEnvironment:r,removeEnvironment:u}=qt(),d=Pn(),[p,m]=S.useState(null),[g,y]=S.useState(new Set),v=Qt("/sessions/:sessionId"),_=Qt("/sessions/new"),T=(v==null?void 0:v.params.sessionId)!=="new"?v==null?void 0:v.params.sessionId:void 0,[E]=Mf(),A=_?E.get("env")??void 0:void 0;return h.jsxs("div",{className:Pe.container,children:[h.jsxs("div",{className:Pe.header,children:[h.jsx("span",{className:Pe.headerLabel,children:"Environments"}),h.jsx("button",{className:Pe.addButton,onClick:()=>d(Cy),title:"Add environment",children:"+ Add Environment"})]}),n.length===0&&h.jsxs("div",{className:Pe.emptyCta,children:[h.jsx("button",{className:Pe.ctaButton,onClick:()=>d(Cy),children:"Add Environment"}),h.jsx("div",{className:Pe.ctaDescription,children:"Connect an environment to run agents"})]}),n.map(j=>{const C=a.filter(w=>w.environmentId===j.id);return h.jsx(gB,{env:j,envSessions:C,selectedSessionId:T,isNewChatTarget:A===j.id,expanded:p===j.id,onToggleExpand:()=>m(p===j.id?null:j.id),sessionsExpanded:g.has(j.id),onToggleSessionsExpand:()=>{y(w=>{const M=new Set(w);return M.has(j.id)?M.delete(j.id):M.add(j.id),M})},provisionProgress:i[j.id],onProvision:o,onStop:r,onRemove:u,navigate:d},j.id)})]})}function vB(){return h.jsx(yB,{})}const bB="_section_1ingb_14",SB="_sectionTitle_1ingb_26",_B="_sectionDescription_1ingb_35",xB="_tokenList_1ingb_48",TB="_tokenRow_1ingb_55",EB="_tokenBadge_1ingb_68",CB="_tokenName_1ingb_83",AB="_tokenTarget_1ingb_90",jB="_deleteButton_1ingb_99",NB="_addForm_1ingb_113",wB="_formRow_1ingb_119",DB="_input_1ingb_125",kB="_select_1ingb_155",MB="_addButton_1ingb_187",RB="_emptyStateInfo_1ingb_221",OB="_themeOptions_1ingb_229",BB="_themeOption_1ingb_229",LB="_themeOptionSelected_1ingb_254",UB="_themeOptionHeader_1ingb_259",zB="_themeOptionLabel_1ingb_266",VB="_themeOptionDesc_1ingb_273",IB="_variantToggle_1ingb_279",HB="_variantButton_1ingb_286",PB="_variantActive_1ingb_305",GB="_themeSwatches_1ingb_311",qB="_themeSwatch_1ingb_311",FB="_systemToggle_1ingb_325",$B="_systemToggleHint_1ingb_341",YB="_themeActive_1ingb_348",KB="_aboutGrid_1ingb_354",ZB="_aboutItem_1ingb_360",XB="_aboutLabel_1ingb_373",QB="_aboutValue_1ingb_379",JB="_aboutDot_1ingb_387",WB="_aboutDotConnected_1ingb_394",e5="_aboutDotDisconnected_1ingb_398",ce={section:bB,sectionTitle:SB,sectionDescription:_B,tokenList:xB,tokenRow:TB,tokenBadge:EB,tokenName:CB,tokenTarget:AB,deleteButton:jB,addForm:NB,formRow:wB,input:DB,select:kB,addButton:MB,emptyStateInfo:RB,themeOptions:OB,themeOption:BB,themeOptionSelected:LB,themeOptionHeader:UB,themeOptionLabel:zB,themeOptionDesc:VB,variantToggle:IB,variantButton:HB,variantActive:PB,themeSwatches:GB,themeSwatch:qB,systemToggle:FB,systemToggleHint:$B,themeActive:YB,aboutGrid:KB,aboutItem:ZB,aboutLabel:XB,aboutValue:QB,aboutDot:JB,aboutDotConnected:WB,aboutDotDisconnected:e5},t5=[{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 n5(){const{credentialProviders:n,updateCredentialProviders:a}=qt(),i=(o,r)=>{const u={...n};o==="claude"?u.claude=r:u[o]=r,a(u)};return h.jsxs("section",{className:ce.section,children:[h.jsx("h3",{className:ce.sectionTitle,children:"Credential Providers"}),h.jsx("p",{className:ce.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:ce.tokenList,children:t5.map(o=>h.jsxs("div",{className:ce.tokenRow,children:[h.jsx("span",{className:ce.tokenName,children:o.label}),h.jsx("span",{className:ce.tokenTarget,children:o.description}),h.jsx("select",{className:ce.select,value:n[o.key],onChange:r=>i(o.key,r.target.value),children:o.options.map(r=>h.jsx("option",{value:r.value,children:r.label},r.value))})]},o.key))})]})}const a5=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function s5(){const{tokens:n,setToken:a,deleteToken:i}=qt(),{showToast:o}=ao(),[r,u]=S.useState(""),[d,p]=S.useState(""),[m,g]=S.useState("env_var"),[y,v]=S.useState(""),[_,T]=S.useState(null),E=C=>{if(C.preventDefault(),!r||!d)return;const w=m==="env_var"?y||r.toUpperCase()+"_TOKEN":"";a(r,d,m,w,m==="file"?y:""),o("Token saved successfully","success"),u(""),p(""),v("")},A=C=>{T(C)},j=()=>{_&&(i(_),o("Token deleted","info")),T(null)};return h.jsxs(h.Fragment,{children:[h.jsx(lc,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:j,onCancel:()=>T(null)}),h.jsxs("section",{className:ce.section,children:[h.jsx("h3",{className:ce.sectionTitle,children:"Tokens"}),h.jsx("p",{className:ce.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),n.length===0?h.jsx("div",{className:ce.emptyStateInfo,children:"Add your first API token to enable service integrations."}):h.jsx("div",{className:ce.tokenList,children:n.map(C=>h.jsxs("div",{className:ce.tokenRow,children:[h.jsx("span",{className:ce.tokenBadge,children:C.tokenType}),h.jsx("span",{className:ce.tokenName,children:C.name}),h.jsx("span",{className:ce.tokenTarget,children:C.tokenType==="env_var"?C.envVar:C.filePath}),h.jsx("button",{className:ce.deleteButton,onClick:()=>A(C.name),title:`Delete ${C.name}`,children:"×"})]},C.name))}),h.jsxs("form",{className:ce.addForm,onSubmit:E,children:[h.jsxs("div",{className:ce.formRow,children:[h.jsx("input",{className:ce.input,type:"text",placeholder:"Token name",value:r,onChange:C=>u(C.target.value)}),h.jsx("input",{className:ce.input,type:"password",placeholder:"Value",value:d,onChange:C=>p(C.target.value)})]}),h.jsxs("div",{className:ce.formRow,children:[h.jsx("select",{className:ce.select,value:m,onChange:C=>g(C.target.value),children:a5.map(C=>h.jsx("option",{value:C.value,children:C.label},C.value))}),h.jsx("input",{className:ce.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:y,onChange:C=>v(C.target.value)}),h.jsx("button",{className:ce.addButton,type:"submit",children:"Add Token"})]})]})]})]})}function i5(){return h.jsxs(h.Fragment,{children:[h.jsx(n5,{}),h.jsx(s5,{})]})}const l5="_container_1xcp7_1",o5="_header_1xcp7_7",r5="_form_1xcp7_19",c5="_formActions_1xcp7_87",u5="_list_1xcp7_93",d5="_card_1xcp7_99",f5="_active_1xcp7_109",h5="_cardHeader_1xcp7_113",p5="_cardActions_1xcp7_123",m5="_description_1xcp7_128",g5="_meta_1xcp7_134",y5="_promptDetails_1xcp7_151",v5="_promptText_1xcp7_163",b5="_empty_1xcp7_180",S5="_btnPrimary_1xcp7_186",_5="_btnSecondary_1xcp7_220",x5="_btnSmall_1xcp7_247",T5="_btnDanger_1xcp7_273",bt={container:l5,header:o5,form:r5,formActions:c5,list:u5,card:d5,active:f5,cardHeader:h5,cardActions:p5,description:m5,meta:g5,promptDetails:y5,promptText:v5,empty:b5,btnPrimary:S5,btnSecondary:_5,btnSmall:x5,btnDanger:T5};function E5(){const{personas:n,createPersona:a,updatePersona:i,deletePersona:o}=qt(),[r,u]=S.useState(null),[d,p]=S.useState(!1),[m,g]=S.useState(null),[y,v]=S.useState(""),[_,T]=S.useState(""),[E,A]=S.useState(""),[j,C]=S.useState(""),[w,M]=S.useState(""),[G,V]=S.useState(0),X=()=>{v(""),T(""),A(""),C(""),M(""),V(0)},Q=()=>{X(),u(null),p(!0)},I=W=>{v(W.name),T(W.description),A(W.systemPrompt),C(W.runtime),M(W.model),V(W.maxTurns),u(W),p(!1)},te=W=>{W.preventDefault(),!(!y.trim()||!E.trim())&&(r?(i(r.id,y,_,E,j,w,G),u(null)):(a(y,_,E,j,w,G),p(!1)),X())},se=W=>{o(W),g(null),(r==null?void 0:r.id)===W&&(u(null),X())},O=()=>{u(null),p(!1),X()},ne=()=>h.jsxs("form",{onSubmit:te,className:bt.form,children:[h.jsx("h3",{children:r?"Edit Persona":"Create Persona"}),h.jsxs("label",{children:["Name",h.jsx("input",{type:"text",value:y,onChange:W=>v(W.target.value),placeholder:"e.g. Frontend Engineer",required:!0})]}),h.jsxs("label",{children:["Description",h.jsx("input",{type:"text",value:_,onChange:W=>T(W.target.value),placeholder:"Brief description..."})]}),h.jsxs("label",{children:["Runtime",h.jsxs("select",{value:j,onChange:W=>C(W.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:w,onChange:W=>M(W.target.value),placeholder:"e.g. sonnet"})]}),h.jsxs("label",{children:["Max Turns",h.jsx("input",{type:"number",value:G,onChange:W=>V(parseInt(W.target.value,10)||0),min:0})]}),h.jsxs("label",{children:["System Prompt",h.jsx("textarea",{value:E,onChange:W=>A(W.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0})]}),h.jsxs("div",{className:bt.formActions,children:[h.jsx("button",{type:"submit",className:bt.btnPrimary,children:r?"Save":"Create"}),h.jsx("button",{type:"button",onClick:O,className:bt.btnSecondary,children:"Cancel"})]})]});return h.jsxs("div",{className:bt.container,children:[h.jsxs("div",{className:bt.header,children:[h.jsx("h2",{children:"Personas"}),h.jsx("button",{onClick:Q,className:bt.btnPrimary,children:"+ New Persona"})]}),(d||r)&&ne(),n.length===0&&!d?h.jsx("p",{className:bt.empty,children:"No personas yet. Create one to get started."}):h.jsx("div",{className:bt.list,children:n.map(W=>h.jsxs("div",{className:`${bt.card} ${(r==null?void 0:r.id)===W.id?bt.active:""}`,children:[h.jsxs("div",{className:bt.cardHeader,children:[h.jsx("strong",{children:W.name}),h.jsxs("div",{className:bt.cardActions,children:[h.jsx("button",{onClick:()=>I(W),className:bt.btnSmall,children:"Edit"}),m===W.id?h.jsxs(h.Fragment,{children:[h.jsx("button",{onClick:()=>se(W.id),className:bt.btnDanger,children:"Confirm"}),h.jsx("button",{onClick:()=>g(null),className:bt.btnSmall,children:"Cancel"})]}):h.jsx("button",{onClick:()=>g(W.id),className:bt.btnSmall,children:"Delete"})]})]}),W.description&&h.jsx("p",{className:bt.description,children:W.description}),h.jsxs("div",{className:bt.meta,children:[W.runtime&&h.jsxs("span",{children:["Runtime: ",W.runtime]}),W.model&&h.jsxs("span",{children:["Model: ",W.model]}),W.maxTurns>0&&h.jsxs("span",{children:["Max turns: ",W.maxTurns]})]}),h.jsxs("details",{className:bt.promptDetails,children:[h.jsx("summary",{children:"System Prompt"}),h.jsx("pre",{className:bt.promptText,children:W.systemPrompt})]})]},W.id))})]})}function C5(){return h.jsx(E5,{})}function A5(){const{themeId:n,resolvedThemeId:a,setTheme:i,preferSystem:o,setPreferSystem:r}=G0();return h.jsxs("section",{className:ce.section,children:[h.jsx("h3",{className:ce.sectionTitle,children:"Appearance"}),h.jsx("p",{className:ce.sectionDescription,children:"Choose how Grackle looks across the app."}),h.jsx("div",{className:ce.themeOptions,children:Wr.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),p=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,m=d&&a===u.variantLightId;return h.jsxs("button",{type:"button",className:`${ce.themeOption} ${p?ce.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(u.id),children:[h.jsxs("span",{className:ce.themeOptionHeader,children:[h.jsxs("span",{children:[h.jsx("span",{className:ce.themeOptionLabel,children:u.label}),h.jsx("span",{className:ce.themeOptionDesc,children:u.description})]}),d&&h.jsxs("span",{className:ce.variantToggle,children:[h.jsx("span",{role:"button",tabIndex:0,className:`${ce.variantButton} ${p&&m?ce.variantActive:""}`,onClick:g=>{g.stopPropagation(),r(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),h.jsx("span",{role:"button",tabIndex:0,className:`${ce.variantButton} ${p&&!m?ce.variantActive:""}`,onClick:g=>{g.stopPropagation(),r(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),u.swatches&&h.jsx("span",{className:ce.themeSwatches,children:u.swatches.map((g,y)=>h.jsx("span",{className:ce.themeSwatch,style:{background:g}},y))})]},u.id)})}),h.jsxs("label",{className:ce.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:ce.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),h.jsxs("p",{className:ce.themeActive,children:["Active theme: ",h.jsx("strong",{children:a})]})]})}function j5(){return h.jsx(A5,{})}function N5(){const{connected:n,environments:a,sessions:i}=qt(),o=a.filter(d=>d.status==="connected").length,r=a.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return h.jsxs("section",{className:ce.section,"data-testid":"about-panel",children:[h.jsx("h3",{className:ce.sectionTitle,children:"About"}),h.jsx("p",{className:ce.sectionDescription,children:"Connection status and application information."}),h.jsxs("div",{className:ce.aboutGrid,children:[h.jsxs("div",{className:ce.aboutItem,children:[h.jsx("span",{className:ce.aboutLabel,children:"Connection"}),h.jsxs("span",{className:ce.aboutValue,children:[h.jsx("span",{className:`${ce.aboutDot} ${n?ce.aboutDotConnected:ce.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),h.jsxs("div",{className:ce.aboutItem,children:[h.jsx("span",{className:ce.aboutLabel,children:"Environments"}),h.jsxs("span",{className:ce.aboutValue,children:[o,"/",r," connected"]})]}),h.jsxs("div",{className:ce.aboutItem,children:[h.jsx("span",{className:ce.aboutLabel,children:"Active Sessions"}),h.jsx("span",{className:ce.aboutValue,children:u})]}),h.jsxs("div",{className:ce.aboutItem,children:[h.jsx("span",{className:ce.aboutLabel,children:"Version"}),h.jsx("span",{className:ce.aboutValue,children:"0.37.0"})]})]})]})}function w5(){return h.jsx(N5,{})}const D5="_root_h353j_1",k5="_body_h353j_7",M5="_main_h353j_19",R5="_sidebarWrapper_h353j_26",O5="_overlay_h353j_56",Ll={root:D5,body:k5,main:M5,sidebarWrapper:R5,overlay:O5},B5=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function L5(){const{lastSpawnedId:n,environments:a}=qt(),{showToast:i}=ao();Bk(a,i);const o=Pn(),r=Wt(),u=r.pathname.startsWith(ki),[d,p]=S.useState(!1),m=S.useCallback(()=>p(g=>!g),[]);return S.useEffect(()=>{p(!1)},[r.pathname]),S.useEffect(()=>{if(!d)return;const g=y=>{y.key==="Escape"&&p(!1)};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[d]),S.useEffect(()=>{n&&!r.pathname.startsWith("/tasks/")&&o(B0(n),{replace:!0})},[n,o,r.pathname]),h.jsxs("div",{className:Ll.root,children:[h.jsx(FE,{onToggleSidebar:u?void 0:m,sidebarOpen:d}),h.jsxs("div",{className:Ll.body,children:[h.jsx("div",{className:Ll.sidebarWrapper,"data-sidebar-open":d,"data-settings":u,children:u?h.jsx(BO,{}):h.jsx(nk,{})}),d&&!u&&h.jsx("div",{className:Ll.overlay,"data-testid":"drawer-overlay",onClick:()=>p(!1)}),h.jsxs("div",{className:Ll.main,children:[h.jsx(D0,{}),h.jsx(_k,{})]})]}),h.jsx(Ok,{})]})}function U5(){return h.jsx(uT,{children:h.jsxs(St,{element:h.jsx(L5,{}),children:[h.jsx(St,{index:!0,element:h.jsx(wR,{})}),h.jsx(St,{path:"sessions/new",element:h.jsx(UR,{})}),h.jsx(St,{path:"sessions/:sessionId",element:h.jsx(HR,{})}),h.jsx(St,{path:"projects/:projectId",element:h.jsx(V3,{})}),h.jsx(St,{path:"tasks/new",element:h.jsx(lO,{})}),h.jsx(St,{path:"tasks/:taskId",element:h.jsx(qd,{})}),h.jsx(St,{path:"tasks/:taskId/stream",element:h.jsx(qd,{})}),h.jsx(St,{path:"tasks/:taskId/findings",element:h.jsx(qd,{})}),h.jsx(St,{path:"tasks/:taskId/edit",element:h.jsx(oO,{})}),h.jsx(St,{path:"environments/new",element:h.jsx(AO,{})}),h.jsxs(St,{path:"settings",element:h.jsx(DO,{}),children:[h.jsx(St,{index:!0,element:h.jsx(Dr,{to:"environments",replace:!0})}),h.jsx(St,{path:"environments",element:h.jsx(vB,{})}),h.jsx(St,{path:"credentials",element:h.jsx(i5,{})}),h.jsx(St,{path:"tokens",element:h.jsx(Dr,{to:"../credentials",replace:!0})}),h.jsx(St,{path:"personas",element:h.jsx(C5,{})}),h.jsx(St,{path:"appearance",element:h.jsx(j5,{})}),h.jsx(St,{path:"about",element:h.jsx(w5,{})})]}),h.jsx(St,{path:"*",element:h.jsx(Dr,{to:"/",replace:!0})})]})})}function z5(){const n=B5?wE:SE;return h.jsx(BE,{children:h.jsx(kE,{children:h.jsx(n,{children:h.jsx(BT,{children:h.jsx(U5,{})})})})})}fx.createRoot(document.getElementById("root")).render(h.jsx(S.StrictMode,{children:h.jsx(z5,{})}));
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-BtSsBhaG.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CRz40Z1g.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-B3Un6NJh.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grackle-ai/web",
3
- "version": "0.37.0",
3
+ "version": "0.38.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.37.0"
34
+ "@grackle-ai/common": "0.38.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rushstack/heft": "1.2.4",