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