@lovelybunch/api 1.0.75-alpha.2 → 1.0.75-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/terminal/terminal-manager.js +9 -2
- package/dist/routes/api/v1/events/status/route.d.ts +1 -1
- package/dist/routes/api/v1/jobs/[id]/run/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/[id]/runs/[runId]/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/status/route.d.ts +1 -1
- package/dist/routes/api/v1/proposals/[id]/route.d.ts +8 -8
- package/package.json +4 -4
- package/static/assets/{ActivityPage-Cr4Adhtq.js → ActivityPage-yYFOuzQj.js} +1 -1
- package/static/assets/{AgentDetailPage-NkpmJjNT.js → AgentDetailPage-DCR5YNVU.js} +1 -1
- package/static/assets/{AgentEditPage-D7AiUjwA.js → AgentEditPage-BGXjFdsw.js} +1 -1
- package/static/assets/{AgentsPage-9xKFyGGL.js → AgentsPage-CaZmNTwQ.js} +1 -1
- package/static/assets/{AgentsSettingsPage-Dj-HuL78.js → AgentsSettingsPage-DA2tHcvH.js} +1 -1
- package/static/assets/ApiKeysSettingsPage-B6CA2v5l.js +2 -0
- package/static/assets/{ArchitectureEditPage-B0C-1qRZ.js → ArchitectureEditPage-CEX952rR.js} +1 -1
- package/static/assets/{ArchitecturePage-CskvR090.js → ArchitecturePage-BxY4P_Xn.js} +1 -1
- package/static/assets/{AuthSettingsPage-DvaqGyUi.js → AuthSettingsPage-B-42QxmU.js} +1 -1
- package/static/assets/{CallbackPage-zFxlz7kI.js → CallbackPage-Xtkl5mdQ.js} +1 -1
- package/static/assets/{CodePage-CgxQpGSJ.js → CodePage-BNxCMq_6.js} +1 -1
- package/static/assets/{CollapsibleSection-CZW08ZKh.js → CollapsibleSection-4qw69Qp5.js} +1 -1
- package/static/assets/{DashboardPage-COeTibbV.js → DashboardPage-B8O0l-he.js} +9 -9
- package/static/assets/{GitPage-oEi9w-hk.js → GitPage-C3c2ooKQ.js} +1 -1
- package/static/assets/{GitSettingsPage-BnPfdhTA.js → GitSettingsPage-BADM0xMN.js} +1 -1
- package/static/assets/{IdentityPage-Cua8aLR0.js → IdentityPage-DHUEAJq9.js} +1 -1
- package/static/assets/{ImplementationStepsEditor-CyvJGM66.js → ImplementationStepsEditor-IxfIwOlC.js} +1 -1
- package/static/assets/{IntegrationsSettingsPage-C9__C_tB.js → IntegrationsSettingsPage-7iQ0M2_s.js} +1 -1
- package/static/assets/{JobDetailPage-BWx8UZd_.js → JobDetailPage-B48lZ009.js} +1 -1
- package/static/assets/{KnowledgeDetailPage-BFh6kBpe.js → KnowledgeDetailPage-B-6aGk_w.js} +1 -1
- package/static/assets/{KnowledgeEditPage-y3Wi396w.js → KnowledgeEditPage-yo3WtN52.js} +1 -1
- package/static/assets/{KnowledgePage-CpuHKEdX.js → KnowledgePage-ChbES9g4.js} +1 -1
- package/static/assets/{LoginPage-BjaxhLcD.js → LoginPage-BVoYZHnb.js} +1 -1
- package/static/assets/{McpSettingsPage-C5PK67QZ.js → McpSettingsPage-_Zh_Qyb6.js} +1 -1
- package/static/assets/{NewAgentPage-ClQZ4e2q.js → NewAgentPage-arnp7pqe.js} +1 -1
- package/static/assets/{NewKnowledgePage-JunSFFzT.js → NewKnowledgePage-9I1FJEeC.js} +1 -1
- package/static/assets/{NewProposalPage-BGQY4vQl.js → NewProposalPage-Cz9LB9L4.js} +1 -1
- package/static/assets/{ProjectEditPage-BbdJOl5X.js → ProjectEditPage-Dz7yAjOv.js} +1 -1
- package/static/assets/{ProjectPage-3OntoNbq.js → ProjectPage-D9qnpm4P.js} +1 -1
- package/static/assets/{PromptsSettingsPage-Dynk-a14.js → PromptsSettingsPage-CAlhDjm4.js} +1 -1
- package/static/assets/ProposalDetailPage-DLOy1zqo.js +1 -0
- package/static/assets/{ProposalEditPage-DvSBzBsa.js → ProposalEditPage-C_2kX6mc.js} +1 -1
- package/static/assets/ProposalsPage-DA-bHZ41.js +17 -0
- package/static/assets/{ResourcesPage-DzOgzqML.js → ResourcesPage-BnbcdKlh.js} +1 -1
- package/static/assets/{RoleEditPage-xVF7hGh5.js → RoleEditPage-CzUKSXGz.js} +1 -1
- package/static/assets/{RolePage-CrIG3o0W.js → RolePage-DCeSbr3Q.js} +1 -1
- package/static/assets/{RulesSettingsPage-Cvgwk4Ag.js → RulesSettingsPage-DC4WUqQG.js} +1 -1
- package/static/assets/{SchedulePage-BJP6J8AN.js → SchedulePage-C0TCr4ln.js} +1 -1
- package/static/assets/{SourceInput-BUwwPoS8.js → SourceInput-DSQiXByy.js} +1 -1
- package/static/assets/{TagInput-nkfZlUWc.js → TagInput-CTRVtznt.js} +1 -1
- package/static/assets/{TerminalPage-gmDler5A.js → TerminalPage-NA90GXv6.js} +1 -1
- package/static/assets/TerminalSessionPage-lYji3uKH.js +13 -0
- package/static/assets/{UserPreferencesPage-Sx7qJbGE.js → UserPreferencesPage-ZDNBaYV_.js} +1 -1
- package/static/assets/{UserSettingsPage-DzLFJZGl.js → UserSettingsPage-S5Cp3lAu.js} +1 -1
- package/static/assets/{UtilitiesPage-Bk_tpZIU.js → UtilitiesPage-DHQMIUAT.js} +1 -1
- package/static/assets/{alert-rryEJd9j.js → alert-DrBQkmi_.js} +1 -1
- package/static/assets/{arrow-down-BMFUtIE3.js → arrow-down--USTBjYI.js} +1 -1
- package/static/assets/{arrow-left-VCCT3jZw.js → arrow-left-FN8jcXkb.js} +1 -1
- package/static/assets/{arrow-up-DFFtVRCW.js → arrow-up-CiCJRdGW.js} +1 -1
- package/static/assets/{badge-CiH2OuTe.js → badge-DRh3rRQu.js} +1 -1
- package/static/assets/{browser-modal-DHDmCl54.js → browser-modal-qHl2PIdG.js} +1 -1
- package/static/assets/{calendar-BK9Swtme.js → calendar-CaJejXR8.js} +1 -1
- package/static/assets/{card-B1w4zvds.js → card-D76uvpWc.js} +1 -1
- package/static/assets/{chevron-left-CGwZTSs2.js → chevron-left-xuZFss_E.js} +1 -1
- package/static/assets/{chevrons-up-AJ8jYSs5.js → chevrons-up-D7jd_Ktr.js} +1 -1
- package/static/assets/{circle-alert-3u8tIhSK.js → circle-alert-TRE_RDZ5.js} +1 -1
- package/static/assets/{circle-check-PsumpemW.js → circle-check-DDmlur4r.js} +1 -1
- package/static/assets/{circle-check-big-D6vRERf1.js → circle-check-big-DcB3o-ep.js} +1 -1
- package/static/assets/{circle-play-u7kgzh9e.js → circle-play-DymCP_-b.js} +1 -1
- package/static/assets/{circle-x-KHdyqN0c.js → circle-x-DWYSgfOn.js} +1 -1
- package/static/assets/{clipboard-CDRBqaZo.js → clipboard-CSidJDm8.js} +1 -1
- package/static/assets/{clock-CtMC0ymf.js → clock-Djvcm6zD.js} +1 -1
- package/static/assets/{download-DoydMFSH.js → download-COUif_Db.js} +1 -1
- package/static/assets/droid-Cef-tD7d.js +15 -0
- package/static/assets/{eye-Chrleq_G.js → eye-dXmhy-Xz.js} +1 -1
- package/static/assets/{folder-git-2-snelGVlk.js → folder-git-2-DIe6Wu6M.js} +1 -1
- package/static/assets/{index-3wZrFTdl.js → index-BxthLB0X.js} +4 -4
- package/static/assets/index-C8_b70Ej.css +2 -0
- package/static/assets/info-CR0AZ8de.js +6 -0
- package/static/assets/{label-C3WSTIyx.js → label-DfOp08y2.js} +1 -1
- package/static/assets/{markdown-editor-CU67ABnM.js → markdown-editor-BF59F19G.js} +1 -1
- package/static/assets/{pause-TcYxeiAk.js → pause-BBJMyVwt.js} +1 -1
- package/static/assets/{play-DVmnMPTC.js → play-BgcqwqoN.js} +1 -1
- package/static/assets/{plus-CZn0_tNm.js → plus-BGVZ9Q6B.js} +1 -1
- package/static/assets/{radio-group-COwda0W5.js → radio-group-CwrrMGEK.js} +1 -1
- package/static/assets/{refresh-cw-CbXq5Ai_.js → refresh-cw-LsRR5OFh.js} +1 -1
- package/static/assets/{search-uIFy7Nf3.js → search-BXJIrj0s.js} +1 -1
- package/static/assets/status-utils-BDOyevaX.js +1 -0
- package/static/assets/{switch-D1qMlMAm.js → switch-C2fktd0p.js} +1 -1
- package/static/assets/{tabs-CPUuRnHE.js → tabs-D285Glmh.js} +1 -1
- package/static/assets/{tag-CllkgvWM.js → tag-p9Me66vI.js} +1 -1
- package/static/assets/{terminal-preview-DjxxurOo.js → terminal-preview-B-ZNhh2N.js} +1 -1
- package/static/assets/{use-terminal-CGL7SCNO.js → use-terminal-CPGjZeDg.js} +1 -1
- package/static/assets/{zap-6uLoaMfY.js → zap-DJOf5Vvp.js} +1 -1
- package/static/index.html +2 -2
- package/static/assets/ApiKeysSettingsPage-vU1wUbIY.js +0 -7
- package/static/assets/ProposalDetailPage-BTp5nJNV.js +0 -1
- package/static/assets/ProposalsPage-BBnEWZi-.js +0 -17
- package/static/assets/TerminalSessionPage-1F9k8Hc5.js +0 -13
- package/static/assets/droid-BvMEm3eg.js +0 -8
- package/static/assets/index-CzjbtPHw.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,ba as E,au as K,ao as T,j as a,ap as N,bb as U,as as y,at as g,bc as V,ar as w,bd as z,ax as H,aw as $,e as I,be as W}from"./index-
|
|
1
|
+
import{r as n,ba as E,au as K,ao as T,j as a,ap as N,bb as U,as as y,at as g,bc as V,ar as w,bd as z,ax as H,aw as $,e as I,be as W}from"./index-BxthLB0X.js";var C="Radio",[X,_]=N(C),[Y,J]=X(C),j=n.forwardRef((r,t)=>{const{__scopeRadio:e,name:d,checked:o=!1,required:s,disabled:i,value:p="on",onCheck:f,form:R,...v}=r,[l,m]=n.useState(null),c=g(t,x=>m(x)),u=n.useRef(!1),b=l?R||!!l.closest("form"):!0;return a.jsxs(Y,{scope:e,checked:o,disabled:i,children:[a.jsx(y.button,{type:"button",role:"radio","aria-checked":o,"data-state":S(o),"data-disabled":i?"":void 0,disabled:i,value:p,...v,ref:c,onClick:w(r.onClick,x=>{o||f?.(),b&&(u.current=x.isPropagationStopped(),u.current||x.stopPropagation())})}),b&&a.jsx(P,{control:l,bubbles:!u.current,name:d,value:p,checked:o,required:s,disabled:i,form:R,style:{transform:"translateX(-100%)"}})]})});j.displayName=C;var k="RadioIndicator",G=n.forwardRef((r,t)=>{const{__scopeRadio:e,forceMount:d,...o}=r,s=J(k,e);return a.jsx(z,{present:d||s.checked,children:a.jsx(y.span,{"data-state":S(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});G.displayName=k;var Q="RadioBubbleInput",P=n.forwardRef(({__scopeRadio:r,control:t,checked:e,bubbles:d=!0,...o},s)=>{const i=n.useRef(null),p=g(i,s),f=H(e),R=$(t);return n.useEffect(()=>{const v=i.current;if(!v)return;const l=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(l,"checked").set;if(f!==e&&c){const u=new Event("click",{bubbles:d});c.call(v,e),v.dispatchEvent(u)}},[f,e,d]),a.jsx(y.input,{type:"radio","aria-hidden":!0,defaultChecked:e,...o,tabIndex:-1,ref:p,style:{...o.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});P.displayName=Q;function S(r){return r?"checked":"unchecked"}var Z=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],h="RadioGroup",[ee,de]=N(h,[E,_]),A=E(),D=_(),[oe,re]=ee(h),M=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,name:d,defaultValue:o,value:s,required:i=!1,disabled:p=!1,orientation:f,dir:R,loop:v=!0,onValueChange:l,...m}=r,c=A(e),u=K(R),[b,x]=T({prop:s,defaultProp:o??null,onChange:l,caller:h});return a.jsx(oe,{scope:e,name:d,required:i,disabled:p,value:b,onValueChange:x,children:a.jsx(U,{asChild:!0,...c,orientation:f,dir:u,loop:v,children:a.jsx(y.div,{role:"radiogroup","aria-required":i,"aria-orientation":f,"data-disabled":p?"":void 0,dir:u,...m,ref:t})})})});M.displayName=h;var O="RadioGroupItem",F=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,disabled:d,...o}=r,s=re(O,e),i=s.disabled||d,p=A(e),f=D(e),R=n.useRef(null),v=g(t,R),l=s.value===o.value,m=n.useRef(!1);return n.useEffect(()=>{const c=b=>{Z.includes(b.key)&&(m.current=!0)},u=()=>m.current=!1;return document.addEventListener("keydown",c),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",u)}},[]),a.jsx(V,{asChild:!0,...p,focusable:!i,active:l,children:a.jsx(j,{disabled:i,required:s.required,checked:l,...f,...o,name:s.name,ref:v,onCheck:()=>s.onValueChange(o.value),onKeyDown:w(c=>{c.key==="Enter"&&c.preventDefault()}),onFocus:w(o.onFocus,()=>{m.current&&R.current?.click()})})})});F.displayName=O;var ae="RadioGroupIndicator",L=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,...d}=r,o=D(e);return a.jsx(G,{...o,...d,ref:t})});L.displayName=ae;var q=M,B=F,te=L;const se=n.forwardRef(({className:r,...t},e)=>a.jsx(q,{className:I("grid gap-2",r),...t,ref:e}));se.displayName=q.displayName;const ne=n.forwardRef(({className:r,...t},e)=>a.jsx(B,{ref:e,className:I("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),...t,children:a.jsx(te,{className:"flex items-center justify-center",children:a.jsx(W,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ne.displayName=B.displayName;export{se as R,ne as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c=["draft","backlog","ready","queued","active","blocked","review","done","canceled","duplicate"],t=["draft","backlog","ready","queued","active","blocked","review"];function d(e){return{draft:"Draft",backlog:"Backlog",ready:"Ready",queued:"Queued",active:"Active",blocked:"Blocked",review:"Review",done:"Done",canceled:"Canceled",duplicate:"Duplicate"}[e]??e}function r(e){switch(e){case"ready":case"done":return"default";case"review":case"active":case"queued":return"secondary";case"canceled":case"blocked":case"duplicate":return"destructive";default:return"outline"}}export{t as A,c as C,d as a,r as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,e as i}from"./index-
|
|
1
|
+
import{r as c,j as e,e as i}from"./index-BxthLB0X.js";const d=c.forwardRef(({className:s,onCheckedChange:r,onChange:t,...o},n)=>{const l=a=>{t?.(a),r?.(a.target.checked)};return e.jsxs("label",{className:i("relative inline-flex cursor-pointer",s),children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",onChange:l,ref:n,...o}),e.jsx("div",{className:"block bg-gray-300 w-9 h-5 rounded-full transition-colors duration-200 ease-in-out peer-checked:bg-blue-600"}),e.jsx("div",{className:"absolute left-0 top-0 bg-white w-4 h-4 rounded-full mt-0.5 ml-0.5 transition-transform duration-200 ease-in-out transform peer-checked:translate-x-4 shadow"})]})});d.displayName="Switch";export{d as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,au as F,ao as $,j as c,ap as D,b9 as V,as as g,ba as y,bb as k,bc as G,ar as m,bd as L,e as T}from"./index-
|
|
1
|
+
import{r as l,au as F,ao as $,j as c,ap as D,b9 as V,as as g,ba as y,bb as k,bc as G,ar as m,bd as L,e as T}from"./index-BxthLB0X.js";var p="Tabs",[K,Q]=D(p,[y]),h=y(),[B,x]=K(p),N=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,onValueChange:r,defaultValue:d,orientation:n="horizontal",dir:u,activationMode:f="automatic",...v}=e,i=F(u),[s,b]=$({prop:o,onChange:r,defaultProp:d??"",caller:p});return c.jsx(B,{scope:t,baseId:V(),value:s,onValueChange:b,orientation:n,dir:i,activationMode:f,children:c.jsx(g.div,{dir:i,"data-orientation":n,...v,ref:a})})});N.displayName=p;var C="TabsList",I=l.forwardRef((e,a)=>{const{__scopeTabs:t,loop:o=!0,...r}=e,d=x(C,t),n=h(t);return c.jsx(k,{asChild:!0,...n,orientation:d.orientation,dir:d.dir,loop:o,children:c.jsx(g.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:a})})});I.displayName=C;var R="TabsTrigger",j=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,disabled:r=!1,...d}=e,n=x(R,t),u=h(t),f=A(n.baseId,o),v=E(n.baseId,o),i=o===n.value;return c.jsx(G,{asChild:!0,...u,focusable:!r,active:i,children:c.jsx(g.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":v,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:f,...d,ref:a,onMouseDown:m(e.onMouseDown,s=>{!r&&s.button===0&&s.ctrlKey===!1?n.onValueChange(o):s.preventDefault()}),onKeyDown:m(e.onKeyDown,s=>{[" ","Enter"].includes(s.key)&&n.onValueChange(o)}),onFocus:m(e.onFocus,()=>{const s=n.activationMode!=="manual";!i&&!r&&s&&n.onValueChange(o)})})})});j.displayName=R;var w="TabsContent",_=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,forceMount:r,children:d,...n}=e,u=x(w,t),f=A(u.baseId,o),v=E(u.baseId,o),i=o===u.value,s=l.useRef(i);return l.useEffect(()=>{const b=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(b)},[]),c.jsx(L,{present:r||i,children:({present:b})=>c.jsx(g.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!b,id:v,tabIndex:0,...n,ref:a,style:{...e.style,animationDuration:s.current?"0s":void 0},children:b&&d})})});_.displayName=w;function A(e,a){return`${e}-trigger-${a}`}function E(e,a){return`${e}-content-${a}`}var q=N,S=I,M=j,P=_;const U=q,z=l.forwardRef(({className:e,...a},t)=>c.jsx(S,{ref:t,className:T("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));z.displayName=S.displayName;const H=l.forwardRef(({className:e,...a},t)=>c.jsx(M,{ref:t,className:T("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));H.displayName=M.displayName;const O=l.forwardRef(({className:e,...a},t)=>c.jsx(P,{ref:t,className:T("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));O.displayName=P.displayName;export{U as T,z as a,H as b,O as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,ag as j,j as u}from"./index-
|
|
1
|
+
import{r as t,ag as j,j as u}from"./index-BxthLB0X.js";import{x as k,a as B}from"./xterm-DTxiCjtJ.js";function A({sessionId:l,className:p,heightPx:d=160,maxScrollback:m=200}){const h=t.useRef(null),v=t.useRef(null),w=t.useRef(null),y=t.useRef(null),[x,R]=t.useState(!0),o=t.useRef([]),i=t.useRef(null);return t.useEffect(()=>{const a=h.current;if(!a||!l)return;const e=new k.Terminal({disableStdin:!0,cursorBlink:!1,convertEol:!0,scrollback:Math.max(50,Math.min(m,1e3)),fontSize:12,fontFamily:"'IBM Plex Mono', 'Source Code Pro', 'Fira Code', ui-monospace, Menlo, Monaco, monospace",lineHeight:1.25,letterSpacing:.3,theme:{background:"#1a1b26",foreground:"#c0caf5",cursor:"#c0caf5",selectionBackground:"#33467c",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}}),f=new B.FitAddon;e.loadAddon(f),e.open(a),a.style.height=`${d}px`,v.current=e,w.current=f;const s=()=>{try{const n=a.getBoundingClientRect();n.width>8&&n.height>8&&e.element&&f.fit()}catch{}},S=setTimeout(()=>s(),100),g=new ResizeObserver(()=>s());g.observe(a);const b=()=>{document.visibilityState==="visible"&&setTimeout(s,50)};document.addEventListener("visibilitychange",b);const c=new WebSocket(`${j}/ws/terminal-preview/${l}`);y.current=c,c.onopen=()=>R(!1);const E=()=>{i.current=null;const n=o.current;if(n.length){o.current=[];try{e.write(n.join(""))}catch{}}},F=()=>{i.current===null&&(i.current=requestAnimationFrame(E))};return c.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}if(r?.type==="snapshot"){if(e.reset(),o.current=[],r.data)try{e.write(r.data)}catch{}s()}else r?.type==="data"&&r.data&&(o.current.push(String(r.data)),F())},c.onclose=()=>{},c.onerror=()=>{},()=>{clearTimeout(S),g.disconnect(),document.removeEventListener("visibilitychange",b);try{c.close()}catch{}i.current!==null&&cancelAnimationFrame(i.current),i.current=null,o.current=[],e.dispose()}},[l,d,m]),u.jsxs("div",{className:`relative w-full ${p||""}`.trim(),children:[x&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/60 z-10",children:u.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading preview…"})}),u.jsx("div",{ref:h,className:"border border-muted rounded overflow-hidden"})]})}export{A as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,al as b,A as f}from"./index-
|
|
1
|
+
import{r as i,al as b,A as f}from"./index-BxthLB0X.js";function j(){const[y,u]=i.useState([]),[m,c]=i.useState(!1),[g,o]=i.useState(null),{refresh:p}=b(),d=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=await fetch(`${f}/api/v1/terminal/${s}/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableLogging:n||!1,startupCommand:r})});if(!e.ok){const a=await e.json();throw new Error(a.error||"Failed to create terminal session")}const t=await e.json();return await p(),t.sessionId}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),null}finally{c(!1)}},[p]),S=i.useCallback(async s=>{try{c(!0),o(null);let n;if(s.startsWith("session-")){const e=s.split("-");n=`${e[0]}-${e[1]}`}else{const e=s.split("-");n=`${e[0]}-${e[1]}`}const r=await fetch(`${f}/api/v1/terminal/${n}/destroy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s})});if(!r.ok){const e=await r.json();throw new Error(e.error||"Failed to destroy terminal session")}return u(e=>e.filter(t=>t.id!==s)),await p(),!0}catch(n){const r=n instanceof Error?n.message:"Unknown error";return o(r),!1}finally{c(!1)}},[p]),$=i.useCallback(async(s,n,r)=>{try{o(null);let e;if(s.startsWith("session-")){const a=s.split("-");e=`${a[0]}-${a[1]}`}else{const a=s.split("-");e=`${a[0]}-${a[1]}`}const t=await fetch(`${f}/api/v1/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,cols:n,rows:r})});if(!t.ok){const a=await t.json();throw new Error(a.error||"Failed to resize terminal session")}return!0}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),!1}},[]),k=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=new URLSearchParams;s&&e.set("proposalId",s),n&&(e.set("withPreview","true"),r&&Number.isFinite(r)&&e.set("lines",String(r)));const t=`${f}/api/v1/terminal/sessions${e.toString()?`?${e.toString()}`:""}`,a=await fetch(t);if(!a.ok){const l=await a.json();throw new Error(l.error||"Failed to fetch terminal sessions")}const w=await a.json();u(w.sessions)}catch(e){const t=e instanceof Error?e.message:"Unknown error";o(t)}finally{c(!1)}},[]),E=i.useCallback(async(s,n=8)=>{try{o(null);const r=new URLSearchParams;r.set("sessionId",s),r.set("withPreview","true"),r.set("lines",String(n)),r.set("colorize","true");const e=`${f}/api/v1/terminal/sessions?${r.toString()}`,t=await fetch(e);if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to fetch preview")}const a=await t.json(),w=Array.isArray(a?.sessions)&&a.sessions[0]?.preview?a.sessions[0].preview:[];return u(l=>l.map(h=>h.id===s?{...h,preview:w}:h)),w}catch(r){const e=r instanceof Error?r.message:"Unknown error";return o(e),[]}},[]);return{sessions:y,loading:m,error:g,createSession:d,destroySession:S,resizeSession:$,refreshSessions:k,fetchPreview:E}}export{j as u};
|
package/static/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
|
|
10
10
|
<title>Coconut - Agentic Development Environment</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-BxthLB0X.js"></script>
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C8_b70Ej.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body class="font-inter">
|
|
15
15
|
<div id="root"></div>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{c as R,H as W,r as t,b6 as y,j as e,B as a,b7 as X,W as Y,D as j,b as g,d as v,f,g as A,I as F,a6 as N,an as _,N as i}from"./index-3wZrFTdl.js";import{C as J,b as G,c as Q,d as V,a as Z}from"./card-B1w4zvds.js";import{L as w}from"./label-C3WSTIyx.js";import{B as ee}from"./badge-CiH2OuTe.js";import{A as I,a as C}from"./alert-rryEJd9j.js";import{P as se}from"./plus-CZn0_tNm.js";import{C as te}from"./circle-alert-3u8tIhSK.js";/**
|
|
2
|
-
* @license lucide-react v0.542.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ae=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],L=R("info",ae);function he(){const{authEnabled:n}=W(),[k,P]=t.useState([]),[b,K]=t.useState(!0),[M,o]=t.useState(!1),[O,d]=t.useState(!1),[h,D]=t.useState(""),[x,E]=t.useState("never"),[c,S]=t.useState(null),[m,l]=t.useState(null);t.useEffect(()=>{p()},[]);const p=async()=>{K(!0);try{const s=await y("/api/v1/api-keys");s.success&&P(s.data?.apiKeys||[])}catch(s){console.error("Failed to load API keys:",s),P([])}finally{K(!1)}},U=async()=>{if(!h.trim()){i({title:"Error",description:"Please provide a name for the API key",variant:"destructive"});return}try{const s={name:h,scopes:["*"]};x!=="never"&&(s.expiresIn=x);const r=await y("/api/v1/api-keys",{method:"POST",body:JSON.stringify(s)});r.success&&(S(r.data),o(!1),d(!0),D(""),E("never"),await p(),i({title:"API Key Created",description:"Make sure to copy your API key now. You won't be able to see it again!"}))}catch(s){console.error("Failed to create API key:",s),i({title:"Error",description:"Failed to create API key",variant:"destructive"})}},B=async s=>{try{(await y(`/api/v1/api-keys/${s}`,{method:"DELETE"})).success&&(await p(),l(null),i({title:"API Key Deleted",description:"The API key has been permanently deleted"}))}catch(r){console.error("Failed to delete API key:",r),i({title:"Error",description:"Failed to delete API key",variant:"destructive"})}},H=async s=>{try{await navigator.clipboard.writeText(s),i({title:"Copied",description:"API key copied to clipboard"})}catch{i({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},u=s=>new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),$=s=>s?new Date(s)<new Date:!1,q=typeof window<"u"?window.location.origin:"http://localhost:3000",z=c?`curl -H "X-API-Key: ${c.key}" \\
|
|
7
|
-
+ ${q}/api/v1/proposals`:"",T=n?null:e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["Authentication is currently disabled. API keys will only be required once you enable authentication in the ",e.jsx("a",{href:"/settings/authentication",className:"underline",children:"Authentication settings"}),"."]})]});return!n&&b?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access"})]}),T]}):b?e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access to your Coconut instance"})]}),T,n&&e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["API keys provide programmatic access to your Coconut instance. Use them in CI/CD pipelines or automation scripts by including the key in the ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"X-API-Key"})," header."]})]}),e.jsxs(J,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Q,{children:"Active API Keys"}),e.jsx(V,{children:"API keys you've created for programmatic access"})]}),e.jsxs(a,{onClick:()=>o(!0),disabled:!n,children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Create API Key"]})]})}),e.jsx(Z,{children:k.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(X,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),e.jsx("p",{children:"No API keys yet"}),e.jsx("p",{className:"text-sm",children:"Create an API key to get started with programmatic access"})]}):e.jsx("div",{className:"space-y-4",children:k.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"font-medium",children:s.name}),$(s.expiresAt)&&e.jsx(ee,{variant:"destructive",children:"Expired"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:s.keyPreview}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Created: ",u(s.createdAt)]}),s.expiresAt&&e.jsxs("span",{children:["Expires: ",u(s.expiresAt)]}),s.lastUsedAt&&e.jsxs("span",{children:["Last used: ",u(s.lastUsedAt)]})]})]}),e.jsx(a,{variant:"ghost",size:"icon",onClick:()=>l(s.id),children:e.jsx(Y,{className:"h-4 w-4 text-destructive"})})]},s.id))})})]}),e.jsx(j,{open:M,onOpenChange:o,children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Create API Key"}),e.jsx(A,{children:"Create a new API key for programmatic access. The key will only be shown once."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyName",children:"Name"}),e.jsx(F,{id:"keyName",placeholder:"CI/CD Pipeline",value:h,onChange:s=>D(s.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A descriptive name to identify this API key"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyExpiry",children:"Expiration"}),e.jsxs("select",{id:"keyExpiry",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:x,onChange:s=>E(s.target.value),children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"30d",children:"30 days"}),e.jsx("option",{value:"90d",children:"90 days"}),e.jsx("option",{value:"1y",children:"1 year"})]})]})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),e.jsx(a,{onClick:U,disabled:!n,children:"Create API Key"})]})]})}),e.jsx(j,{open:O,onOpenChange:d,children:e.jsxs(g,{className:"sm:max-w-[600px]",children:[e.jsxs(v,{children:[e.jsx(f,{children:"API Key Created"}),e.jsx(A,{children:"Make sure to copy your API key now. You won't be able to see it again!"})]}),e.jsxs(I,{variant:"destructive",className:"my-4",children:[e.jsx(te,{className:"h-4 w-4"}),e.jsx(C,{children:"This is the only time you will see this key. Store it securely."})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{children:"API Key"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{readOnly:!0,value:c.key,className:"font-mono text-sm"}),e.jsx(a,{variant:"outline",size:"icon",onClick:()=>H(c.key),children:e.jsx(_,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"mb-2",children:"Usage example:"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md whitespace-pre-wrap break-words",children:e.jsx("code",{className:"font-mono text-xs",children:z})})]})]}),e.jsx(N,{children:e.jsx(a,{onClick:()=>{d(!1),S(null)},children:"I've Saved My Key"})})]})}),e.jsx(j,{open:!!m,onOpenChange:s=>!s&&l(null),children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Delete API Key"}),e.jsx(A,{children:"Are you sure you want to delete this API key? This action cannot be undone and any scripts using this key will stop working."})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),e.jsx(a,{variant:"destructive",onClick:()=>m&&B(m),children:"Delete API Key"})]})]})})]})}export{he as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as re,u as ne,r as l,a as le,j as e,B as n,L as h,R as ie,U as oe,V as ce,W as de,Y as me,Z as he,_ as xe,$ as pe,a0 as ue,a1 as je,a2 as fe,a3 as I,a4 as F,q as ge,D as R,a5 as B,b as V,d as z,f as H,g as q,h as ve,i as Ne,k as Ce,l as ye,m as c,a6 as J,w as we,a7 as Se,A as g}from"./index-3wZrFTdl.js";import{c as be}from"./clipboard-B9ndUJKl.js";import{C as d,b as x,a as m,c as u,d as _}from"./card-B1w4zvds.js";import{B as p}from"./badge-CiH2OuTe.js";import{L as M}from"./label-C3WSTIyx.js";import{A as S}from"./arrow-left-VCCT3jZw.js";import{C as De,a as Ae}from"./clipboard-CDRBqaZo.js";import{D as ke}from"./download-DoydMFSH.js";import{C as Te}from"./calendar-BK9Swtme.js";import{C as Ee}from"./clock-CtMC0ymf.js";function Q(r){switch(r){case"ready":case"done":return"default";case"review":case"active":case"queued":return"secondary";case"canceled":return"destructive";default:return"outline"}}function W(r){switch(r){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function ze(){const{id:r}=re(),Y=ne(),[s,v]=l.useState(null),[Z,b]=l.useState(!0),[N,D]=l.useState(null),[A,k]=l.useState(!1),[T,E]=l.useState(!1),[P,$]=l.useState(!1),[j,C]=l.useState(""),[G,y]=l.useState(!1),[K,w]=l.useState(!1),[f,U]=l.useState("draft"),[X,L]=l.useState(!1),{toast:O}=le();l.useEffect(()=>{async function a(){if(r)try{b(!0);const o=await(await fetch(`${g}/api/v1/proposals/${r}`)).json();o.success?v(o.data):D(o.error?.message||"Failed to fetch proposal")}catch(t){D(t instanceof Error?t.message:"Unknown error")}finally{b(!1)}}a()},[r]);const ee=async()=>{if(r){k(!0);try{const t=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"DELETE"})).json();t.success?Y("/proposals"):alert(t.error?.message||"Failed to delete proposal")}catch(a){alert(`Error deleting proposal: ${a instanceof Error?a.message:"Unknown error"}`)}finally{k(!1)}}},se=async()=>{if(!(!s||!r||f===s.status)){E(!0);try{const t=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:f})})).json();t.success?(v(t.data),y(!1)):alert(t.error?.message||"Failed to update status")}catch(a){alert(`Error updating status: ${a instanceof Error?a.message:"Unknown error"}`)}finally{E(!1)}}},ae=async()=>{if(!(!s||!r||!j.trim())){$(!0);try{const a={id:`comment-${Date.now()}`,text:j,author:"current-user",timestamp:new Date().toISOString()},t=[...s.metadata.comments||[],a],i=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:t})})).json();i.success?(v(i.data),C(""),w(!1)):alert(i.error?.message||"Failed to add comment")}catch(a){alert(`Error adding comment: ${a instanceof Error?a.message:"Unknown error"}`)}finally{$(!1)}}},te=()=>{if(!s)return;const a={...s,exportedAt:new Date().toISOString()},t=new Blob([JSON.stringify(a,null,2)],{type:"application/json"}),o=URL.createObjectURL(t),i=document.createElement("a");i.href=o,i.download=`proposal-${s.id}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)};return Z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(h,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]})}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})]})]}):N||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:N||"Proposal not found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(h,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:N||"Proposal not found"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['The proposal with ID "',r,'" could not be found.']}),e.jsx(n,{asChild:!0,className:"mt-4",children:e.jsx(h,{to:"/proposals",children:"Back to Proposals"})})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.intent}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(h,{to:"/proposals",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})}),e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(h,{to:`/proposals/${r}/edit`,children:[e.jsx(ie,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(oe,{children:[e.jsx(ce,{asChild:!0,children:e.jsxs(n,{variant:"destructive",size:"sm",disabled:A,children:[e.jsx(de,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:A?"Deleting...":"Delete"})]})}),e.jsxs(me,{children:[e.jsxs(he,{children:[e.jsx(xe,{children:"Are you absolutely sure?"}),e.jsxs(pe,{children:["This action cannot be undone. This will permanently delete the change proposal",e.jsxs("span",{className:"font-semibold",children:[' "',s.intent,'"']})," and remove it from the system."]})]}),e.jsxs(ue,{children:[e.jsx(je,{children:"Cancel"}),e.jsx(fe,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Proposal"})]})]})]})]})]}),e.jsxs("button",{type:"button",onClick:async()=>{const a=`.nut/proposals/${s.id}.md`;try{await be(a),L(!0),O({title:"Copied!",description:`${a} copied to clipboard`}),setTimeout(()=>L(!1),2e3)}catch(t){console.error("Failed to copy path:",t),O({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono",children:[e.jsx("span",{children:`.nut/proposals/${s.id}.md`}),X?e.jsx(De,{className:"h-3.5 w-3.5"}):e.jsx(Ae,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(u,{children:"Task Details"}),e.jsxs("div",{className:"flex gap-2",children:[s.metadata.priority&&e.jsx(p,{variant:W(s.metadata.priority),children:s.metadata.priority}),e.jsx(p,{variant:Q(s.status),children:s.status})]})]})}),e.jsx(m,{className:"space-y-4",children:s.content?e.jsx(I,{children:s.content}):e.jsx("p",{className:"text-muted-foreground",children:"No detailed content available for this proposal."})})]}),s.planSteps&&s.planSteps.length>0&&e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsx(u,{children:"Implementation Steps"}),e.jsxs(_,{children:[s.planSteps.length," step",s.planSteps.length!==1?"s":""," planned"]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-3",children:s.planSteps.map((a,t)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium",children:t+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:a.description}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:e.jsx(p,{variant:"outline",className:"text-xs",children:a.status})})]})]},a.id))})})]}),s.metadata.comments&&s.metadata.comments.length>0&&e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsx(u,{children:"Comments"}),e.jsxs(_,{children:[s.metadata.comments.length," comment",s.metadata.comments.length!==1?"s":""]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-4",children:s.metadata.comments.map((a,t)=>e.jsxs("div",{className:"border-l-2 border-muted pl-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(F,{className:"h-3 w-3"}),e.jsx("span",{children:a.author}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(a.timestamp).toLocaleString()})]}),e.jsx(I,{className:"prose-sm prose-p:mb-2 prose-ul:my-2 prose-ol:my-2",children:a.text})]},a.id||t))})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"Task Actions"})}),e.jsxs(m,{className:"space-y-2",children:[e.jsx(n,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(h,{to:`/terminal/${r}`,children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Prepare Agent"]})}),e.jsxs(R,{open:G,onOpenChange:y,children:[e.jsx(B,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",onClick:()=>U(s?.status||"draft"),children:"Change Status"})}),e.jsxs(V,{children:[e.jsxs(z,{children:[e.jsx(H,{children:"Change Proposal Status"}),e.jsx(q,{children:"Update the status of this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(M,{htmlFor:"status",children:"Status"}),e.jsxs(ve,{value:f,onValueChange:a=>U(a),children:[e.jsx(Ne,{children:e.jsx(Ce,{placeholder:"Select status"})}),e.jsxs(ye,{children:[e.jsx(c,{value:"draft",children:"Draft"}),e.jsx(c,{value:"proposed",children:"Proposed"}),e.jsx(c,{value:"in-review",children:"In Review"}),e.jsx(c,{value:"approved",children:"Approved"}),e.jsx(c,{value:"code-complete",children:"Code Complete"}),e.jsx(c,{value:"merged",children:"Merged"}),e.jsx(c,{value:"rejected",children:"Rejected"})]})]})]})}),e.jsxs(J,{children:[e.jsx(n,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e.jsx(n,{onClick:se,disabled:T||f===s?.status,children:T?"Updating...":"Update Status"})]})]})]}),e.jsxs(R,{open:K,onOpenChange:w,children:[e.jsx(B,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",children:"Add Comment"})}),e.jsxs(V,{children:[e.jsxs(z,{children:[e.jsx(H,{children:"Add Comment"}),e.jsx(q,{children:"Add a comment to this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(M,{htmlFor:"comment",children:"Comment"}),e.jsx(we,{id:"comment",placeholder:"Enter your comment...",value:j,onChange:a=>C(a.target.value),rows:4})]})}),e.jsxs(J,{children:[e.jsx(n,{variant:"outline",onClick:()=>{w(!1),C("")},children:"Cancel"}),e.jsx(n,{onClick:ae,disabled:P||!j.trim(),children:P?"Adding...":"Add Comment"})]})]})]}),e.jsxs(n,{variant:"outline",className:"w-full justify-start",onClick:te,children:[e.jsx(ke,{className:"h-4 w-4 mr-2"}),"Export"]})]})]}),e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"Information"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Author:"}),e.jsx("span",{children:s.author.name})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Te,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Created:"}),e.jsx("span",{children:new Date(s.metadata.createdAt).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ee,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Updated:"}),e.jsx("span",{children:new Date(s.metadata.updatedAt).toLocaleString()})]}),e.jsx(Se,{}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Status:"}),e.jsx("div",{className:"mt-1",children:e.jsx(p,{variant:Q(s.status),children:s.status})})]}),s.metadata.priority&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Priority:"}),e.jsx("div",{className:"mt-1",children:e.jsx(p,{variant:W(s.metadata.priority),children:s.metadata.priority})})]}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:s.metadata.tags.map(a=>e.jsx(p,{variant:"outline",className:"text-xs",children:a},a))})]})]})]})]})]})]})}export{ze as default};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{c as xe,O as _e,u as Ie,z as Le,r as j,j as t,B as V,L as Y,I as Re,X,K as Te,x as Oe,P as $e,v as Pe,h as ie,i as ae,k as ce,l as ue,m as w,G as Ke,A as ze}from"./index-3wZrFTdl.js";import{C as J,b as Ve,a as Z,c as We}from"./card-B1w4zvds.js";import{B as q}from"./badge-CiH2OuTe.js";import{P as ee}from"./plus-CZn0_tNm.js";import{S as Ue}from"./search-uIFy7Nf3.js";/**
|
|
2
|
-
* @license lucide-react v0.542.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ge=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],He=xe("arrow-down-wide-narrow",Ge);/**
|
|
7
|
-
* @license lucide-react v0.542.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Qe=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],Ye=xe("arrow-up-narrow-wide",Qe);/**
|
|
12
|
-
* @license lucide-react v0.542.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Xe=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ae=xe("funnel",Xe);function T(s){return Array.isArray?Array.isArray(s):be(s)==="[object Array]"}function Je(s){if(typeof s=="string")return s;let e=s+"";return e=="0"&&1/s==-1/0?"-0":e}function Ze(s){return s==null?"":Je(s)}function R(s){return typeof s=="string"}function ve(s){return typeof s=="number"}function qe(s){return s===!0||s===!1||et(s)&&be(s)=="[object Boolean]"}function Ee(s){return typeof s=="object"}function et(s){return Ee(s)&&s!==null}function k(s){return s!=null}function le(s){return!s.trim().length}function be(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const tt="Incorrect 'index' type",st=s=>`Invalid value for key ${s}`,rt=s=>`Pattern length exceeds max of ${s}.`,nt=s=>`Missing ${s} property in key`,it=s=>`Property 'weight' in key '${s}' must be a positive integer`,je=Object.prototype.hasOwnProperty;class at{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let i=Fe(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Fe(s){let e=null,r=null,n=null,i=1,a=null;if(R(s)||T(s))n=s,e=ye(s),r=oe(s);else{if(!je.call(s,"name"))throw new Error(nt("name"));const c=s.name;if(n=c,je.call(s,"weight")&&(i=s.weight,i<=0))throw new Error(it(c));e=ye(c),r=oe(c),a=s.getFn}return{path:e,id:r,weight:i,src:n,getFn:a}}function ye(s){return T(s)?s:s.split(".")}function oe(s){return T(s)?s.join("."):s}function ct(s,e){let r=[],n=!1;const i=(a,c,l)=>{if(k(a))if(!c[l])r.push(a);else{let o=c[l];const h=a[o];if(!k(h))return;if(l===c.length-1&&(R(h)||ve(h)||qe(h)))r.push(Ze(h));else if(T(h)){n=!0;for(let d=0,m=h.length;d<m;d+=1)i(h[d],c,l+1)}else c.length&&i(h,c,l+1)}};return i(s,R(e)?e.split("."):e,0),n?r:r[0]}const ut={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},lt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(s,e)=>s.score===e.score?s.idx<e.idx?-1:1:s.score<e.score?-1:1},ot={location:0,threshold:.6,distance:100},ht={useExtendedSearch:!1,getFn:ct,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var f={...lt,...ut,...ot,...ht};const dt=/[^ ]+/g;function ft(s=1,e=3){const r=new Map,n=Math.pow(10,e);return{get(i){const a=i.match(dt).length;if(r.has(a))return r.get(a);const c=1/Math.pow(a,.5*s),l=parseFloat(Math.round(c*n)/n);return r.set(a,l),l},clear(){r.clear()}}}class pe{constructor({getFn:e=f.getFn,fieldNormWeight:r=f.fieldNormWeight}={}){this.norm=ft(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,R(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){const r=this.size();R(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!k(e)||le(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((i,a)=>{let c=i.getFn?i.getFn(e):this.getFn(e,i.path);if(k(c)){if(T(c)){let l=[];const o=[{nestedArrIndex:-1,value:c}];for(;o.length;){const{nestedArrIndex:h,value:d}=o.pop();if(k(d))if(R(d)&&!le(d)){let m={v:d,i:h,n:this.norm.get(d)};l.push(m)}else T(d)&&d.forEach((m,x)=>{o.push({nestedArrIndex:x,value:m})})}n.$[a]=l}else if(R(c)&&!le(c)){let l={v:c,n:this.norm.get(c)};n.$[a]=l}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Me(s,e,{getFn:r=f.getFn,fieldNormWeight:n=f.fieldNormWeight}={}){const i=new pe({getFn:r,fieldNormWeight:n});return i.setKeys(s.map(Fe)),i.setSources(e),i.create(),i}function mt(s,{getFn:e=f.getFn,fieldNormWeight:r=f.fieldNormWeight}={}){const{keys:n,records:i}=s,a=new pe({getFn:e,fieldNormWeight:r});return a.setKeys(n),a.setIndexRecords(i),a}function te(s,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:i=f.distance,ignoreLocation:a=f.ignoreLocation}={}){const c=e/s.length;if(a)return c;const l=Math.abs(n-r);return i?c+l/i:l?1:c}function gt(s=[],e=f.minMatchCharLength){let r=[],n=-1,i=-1,a=0;for(let c=s.length;a<c;a+=1){let l=s[a];l&&n===-1?n=a:!l&&n!==-1&&(i=a-1,i-n+1>=e&&r.push([n,i]),n=-1)}return s[a-1]&&a-n>=e&&r.push([n,a-1]),r}const W=32;function xt(s,e,r,{location:n=f.location,distance:i=f.distance,threshold:a=f.threshold,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,includeMatches:o=f.includeMatches,ignoreLocation:h=f.ignoreLocation}={}){if(e.length>W)throw new Error(rt(W));const d=e.length,m=s.length,x=Math.max(0,Math.min(n,m));let g=a,A=x;const C=l>1||o,M=C?Array(m):[];let E;for(;(E=s.indexOf(e,A))>-1;){let F=te(e,{currentLocation:E,expectedLocation:x,distance:i,ignoreLocation:h});if(g=Math.min(F,g),A=E+d,C){let S=0;for(;S<d;)M[E+S]=1,S+=1}}A=-1;let _=[],b=1,L=d+m;const G=1<<d-1;for(let F=0;F<d;F+=1){let S=0,y=L;for(;S<y;)te(e,{errors:F,currentLocation:x+y,expectedLocation:x,distance:i,ignoreLocation:h})<=g?S=y:L=y,y=Math.floor((L-S)/2+S);L=y;let z=Math.max(1,x-y+1),O=c?m:Math.min(x+y,m)+d,I=Array(O+2);I[O+1]=(1<<F)-1;for(let D=O;D>=z;D-=1){let $=D-1,Q=r[s.charAt($)];if(C&&(M[$]=+!!Q),I[D]=(I[D+1]<<1|1)&Q,F&&(I[D]|=(_[D+1]|_[D])<<1|1|_[D+1]),I[D]&G&&(b=te(e,{errors:F,currentLocation:$,expectedLocation:x,distance:i,ignoreLocation:h}),b<=g)){if(g=b,A=$,A<=x)break;z=Math.max(1,2*x-A)}}if(te(e,{errors:F+1,currentLocation:x,expectedLocation:x,distance:i,ignoreLocation:h})>g)break;_=I}const H={isMatch:A>=0,score:Math.max(.001,b)};if(C){const F=gt(M,l);F.length?o&&(H.indices=F):H.isMatch=!1}return H}function pt(s){let e={};for(let r=0,n=s.length;r<n;r+=1){const i=s.charAt(r);e[i]=(e[i]||0)|1<<n-r-1}return e}const se=String.prototype.normalize?(s=>s.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(s=>s);class De{constructor(e,{location:r=f.location,threshold:n=f.threshold,distance:i=f.distance,includeMatches:a=f.includeMatches,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,isCaseSensitive:o=f.isCaseSensitive,ignoreDiacritics:h=f.ignoreDiacritics,ignoreLocation:d=f.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:c,minMatchCharLength:l,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d},e=o?e:e.toLowerCase(),e=h?se(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const m=(g,A)=>{this.chunks.push({pattern:g,alphabet:pt(g),startIndex:A})},x=this.pattern.length;if(x>W){let g=0;const A=x%W,C=x-A;for(;g<C;)m(this.pattern.substr(g,W),g),g+=W;if(A){const M=x-W;m(this.pattern.substr(M),M)}}else m(this.pattern,0)}searchIn(e){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i}=this.options;if(e=r?e:e.toLowerCase(),e=n?se(e):e,this.pattern===e){let C={isMatch:!0,score:0};return i&&(C.indices=[[0,e.length-1]]),C}const{location:a,distance:c,threshold:l,findAllMatches:o,minMatchCharLength:h,ignoreLocation:d}=this.options;let m=[],x=0,g=!1;this.chunks.forEach(({pattern:C,alphabet:M,startIndex:E})=>{const{isMatch:_,score:b,indices:L}=xt(e,C,M,{location:a+E,distance:c,threshold:l,findAllMatches:o,minMatchCharLength:h,includeMatches:i,ignoreLocation:d});_&&(g=!0),x+=b,_&&L&&(m=[...m,...L])});let A={isMatch:g,score:g?x/this.chunks.length:1};return g&&i&&(A.indices=m),A}}class K{constructor(e){this.pattern=e}static isMultiMatch(e){return Ce(e,this.multiRegex)}static isSingleMatch(e){return Ce(e,this.singleRegex)}search(){}}function Ce(s,e){const r=s.match(e);return r?r[1]:null}class At extends K{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class jt extends K{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class yt extends K{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class Ct extends K{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class wt extends K{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Nt extends K{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Be extends K{constructor(e,{location:r=f.location,threshold:n=f.threshold,distance:i=f.distance,includeMatches:a=f.includeMatches,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,isCaseSensitive:o=f.isCaseSensitive,ignoreDiacritics:h=f.ignoreDiacritics,ignoreLocation:d=f.ignoreLocation}={}){super(e),this._bitapSearch=new De(e,{location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:c,minMatchCharLength:l,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class ke extends K{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n;const i=[],a=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+a,i.push([n,r-1]);const c=!!i.length;return{isMatch:c,score:c?0:1,indices:i}}}const he=[At,ke,yt,Ct,Nt,wt,jt,Be],we=he.length,vt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Et="|";function bt(s,e={}){return s.split(Et).map(r=>{let n=r.trim().split(vt).filter(a=>a&&!!a.trim()),i=[];for(let a=0,c=n.length;a<c;a+=1){const l=n[a];let o=!1,h=-1;for(;!o&&++h<we;){const d=he[h];let m=d.isMultiMatch(l);m&&(i.push(new d(m,e)),o=!0)}if(!o)for(h=-1;++h<we;){const d=he[h];let m=d.isSingleMatch(l);if(m){i.push(new d(m,e));break}}}return i})}const Ft=new Set([Be.type,ke.type]);class Mt{constructor(e,{isCaseSensitive:r=f.isCaseSensitive,ignoreDiacritics:n=f.ignoreDiacritics,includeMatches:i=f.includeMatches,minMatchCharLength:a=f.minMatchCharLength,ignoreLocation:c=f.ignoreLocation,findAllMatches:l=f.findAllMatches,location:o=f.location,threshold:h=f.threshold,distance:d=f.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:a,findAllMatches:l,ignoreLocation:c,location:o,threshold:h,distance:d},e=r?e:e.toLowerCase(),e=n?se(e):e,this.pattern=e,this.query=bt(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:a}=this.options;e=i?e:e.toLowerCase(),e=a?se(e):e;let c=0,l=[],o=0;for(let h=0,d=r.length;h<d;h+=1){const m=r[h];l.length=0,c=0;for(let x=0,g=m.length;x<g;x+=1){const A=m[x],{isMatch:C,indices:M,score:E}=A.search(e);if(C){if(c+=1,o+=E,n){const _=A.constructor.type;Ft.has(_)?l=[...l,...M]:l.push(M)}}else{o=0,c=0,l.length=0;break}}if(c){let x={isMatch:!0,score:o/c};return n&&(x.indices=l),x}}return{isMatch:!1,score:1}}}const de=[];function Dt(...s){de.push(...s)}function fe(s,e){for(let r=0,n=de.length;r<n;r+=1){let i=de[r];if(i.condition(s,e))return new i(s,e)}return new De(s,e)}const re={AND:"$and",OR:"$or"},me={PATH:"$path",PATTERN:"$val"},ge=s=>!!(s[re.AND]||s[re.OR]),Bt=s=>!!s[me.PATH],kt=s=>!T(s)&&Ee(s)&&!ge(s),Ne=s=>({[re.AND]:Object.keys(s).map(e=>({[e]:s[e]}))});function Se(s,e,{auto:r=!0}={}){const n=i=>{let a=Object.keys(i);const c=Bt(i);if(!c&&a.length>1&&!ge(i))return n(Ne(i));if(kt(i)){const o=c?i[me.PATH]:a[0],h=c?i[me.PATTERN]:i[o];if(!R(h))throw new Error(st(o));const d={keyId:oe(o),pattern:h};return r&&(d.searcher=fe(h,e)),d}let l={children:[],operator:a[0]};return a.forEach(o=>{const h=i[o];T(h)&&h.forEach(d=>{l.children.push(n(d))})}),l};return ge(s)||(s=Ne(s)),n(s)}function St(s,{ignoreFieldNorm:e=f.ignoreFieldNorm}){s.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:a,score:c})=>{const l=i?i.weight:null;n*=Math.pow(c===0&&l?Number.EPSILON:c,(l||1)*(e?1:a))}),r.score=n})}function _t(s,e){const r=s.matches;e.matches=[],k(r)&&r.forEach(n=>{if(!k(n.indices)||!n.indices.length)return;const{indices:i,value:a}=n;let c={indices:i,value:a};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function It(s,e){e.score=s.score}function Lt(s,e,{includeMatches:r=f.includeMatches,includeScore:n=f.includeScore}={}){const i=[];return r&&i.push(_t),n&&i.push(It),s.map(a=>{const{idx:c}=a,l={item:e[c],refIndex:c};return i.length&&i.forEach(o=>{o(a,l)}),l})}class U{constructor(e,r={},n){this.options={...f,...r},this.options.useExtendedSearch,this._keyStore=new at(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof pe))throw new Error(tt);this._myIndex=r||Me(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){k(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const r=[];for(let n=0,i=this._docs.length;n<i;n+=1){const a=this._docs[n];e(a,n)&&(this.removeAt(n),n-=1,i-=1,r.push(a))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:a,sortFn:c,ignoreFieldNorm:l}=this.options;let o=R(e)?R(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return St(o,{ignoreFieldNorm:l}),a&&o.sort(c),ve(r)&&r>-1&&(o=o.slice(0,r)),Lt(o,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){const r=fe(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:c,n:l})=>{if(!k(a))return;const{isMatch:o,score:h,indices:d}=r.searchIn(a);o&&i.push({item:a,idx:c,matches:[{score:h,value:a,norm:l,indices:d}]})}),i}_searchLogical(e){const r=Se(e,this.options),n=(l,o,h)=>{if(!l.children){const{keyId:m,searcher:x}=l,g=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(o,m),searcher:x});return g&&g.length?[{idx:h,item:o,matches:g}]:[]}const d=[];for(let m=0,x=l.children.length;m<x;m+=1){const g=l.children[m],A=n(g,o,h);if(A.length)d.push(...A);else if(l.operator===re.AND)return[]}return d},i=this._myIndex.records,a={},c=[];return i.forEach(({$:l,i:o})=>{if(k(l)){let h=n(r,l,o);h.length&&(a[o]||(a[o]={idx:o,item:l,matches:[]},c.push(a[o])),h.forEach(({matches:d})=>{a[o].matches.push(...d)}))}}),c}_searchObjectList(e){const r=fe(e,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:c,i:l})=>{if(!k(c))return;let o=[];n.forEach((h,d)=>{o.push(...this._findMatches({key:h,value:c[d],searcher:r}))}),o.length&&a.push({idx:l,item:c,matches:o})}),a}_findMatches({key:e,value:r,searcher:n}){if(!k(r))return[];let i=[];if(T(r))r.forEach(({v:a,i:c,n:l})=>{if(!k(a))return;const{isMatch:o,score:h,indices:d}=n.searchIn(a);o&&i.push({score:h,key:e,value:a,idx:c,norm:l,indices:d})});else{const{v:a,n:c}=r,{isMatch:l,score:o,indices:h}=n.searchIn(a);l&&i.push({score:o,key:e,value:a,norm:c,indices:h})}return i}}U.version="7.1.0";U.createIndex=Me;U.parseIndex=mt;U.config=f;U.parseQuery=Se;Dt(Mt);function Rt(s){switch(s){case"ready":case"done":return"default";case"review":case"active":case"queued":return"secondary";case"canceled":return"destructive";default:return"outline"}}function Tt(s){switch(s){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function Vt(){const[s]=_e(),e=Ie(),r=Le(),[n,i]=j.useState([]),[a,c]=j.useState([]),[l,o]=j.useState(!0),[h,d]=j.useState(null),[m,x]=j.useState(s.get("status")||"active"),[g,A]=j.useState(s.get("priority")||"all"),[C,M]=j.useState(s.get("search")||""),[E,_]=j.useState(s.get("sortBy")||"created"),[b,L]=j.useState(s.get("order")||"desc"),[G,H]=j.useState(!1),F=j.useRef(null),S=[m!=="active",g!=="all",E!=="created",b!=="desc"].filter(Boolean).length,y=j.useCallback(u=>{const p=new URLSearchParams(s);Object.entries(u).forEach(([B,P])=>{P&&P!=="all"&&P!=="active"&&P!==""?p.set(B,P):p.delete(B)});const N=p.toString(),v=N?`?${N}`:"";e(`${r.pathname}${v}`)},[s,e,r.pathname]),z=j.useCallback(u=>{x(u),y({status:u==="active"?null:u})},[y]),O=j.useCallback(u=>{A(u),y({priority:u==="all"?null:u})},[y]),I=j.useCallback(u=>{M(u),y({search:u||null})},[y]),ne=j.useCallback(u=>{_(u),y({sortBy:u==="created"?null:u})},[y]),D=j.useCallback(()=>{const u=b==="asc"?"desc":"asc";L(u),y({order:u==="desc"?null:u})},[b,y]),$=j.useCallback(u=>{if(u.key==="s"||u.key==="S"){const p=document.activeElement;p?.tagName==="INPUT"||p?.tagName==="TEXTAREA"||p?.getAttribute("contenteditable")==="true"||(u.preventDefault(),F.current?.focus())}},[]);j.useEffect(()=>(document.addEventListener("keydown",$),()=>{document.removeEventListener("keydown",$)}),[$]);const Q=j.useMemo(()=>{const u={keys:[{name:"intent",weight:.4},{name:"id",weight:.3},{name:"author.name",weight:.2},{name:"metadata.tags",weight:.1}],threshold:.3,includeScore:!0};return new U(n,u)},[n]);return j.useEffect(()=>{async function u(){try{o(!0);const N=await(await fetch(`${ze}/api/v1/proposals`)).json();N.success?(i(N.data),c(N.data)):d(N.error?.message||"Failed to fetch proposals")}catch(p){d(p instanceof Error?p.message:"Unknown error")}finally{o(!1)}}u()},[]),j.useEffect(()=>{let u=n;if(m==="active"?u=u.filter(p=>["draft","proposed","in-review","approved","code-complete"].includes(p.status)):m==="approved"?u=u.filter(p=>["approved","code-complete"].includes(p.status)):m!=="all"&&(u=u.filter(p=>p.status===m)),g!=="all"&&(u=u.filter(p=>p.metadata.priority===g)),C.trim()){const p=Q.search(C),N=new Set(p.map(v=>v.item.id));u=u.filter(v=>N.has(v.id))}u=u.sort((p,N)=>{let v,B;switch(E){case"created":{v=new Date(p.metadata.createdAt).getTime(),B=new Date(N.metadata.createdAt).getTime();break}case"updated":{v=new Date(p.metadata.updatedAt).getTime(),B=new Date(N.metadata.updatedAt).getTime();break}case"status":{v=p.status,B=N.status;break}case"priority":{const P={critical:4,high:3,medium:2,low:1};v=P[p.metadata.priority]||0,B=P[N.metadata.priority]||0;break}case"intent":{v=(p.title||p.intent||"").toLowerCase(),B=(N.title||N.intent||"").toLowerCase();break}default:v=new Date(p.metadata.createdAt).getTime(),B=new Date(N.metadata.createdAt).getTime()}return b==="asc"?v<B?-1:v>B?1:0:v>B?-1:v<B?1:0}),c(u)},[n,m,g,C,E,b,Q]),l?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your project"})]}),t.jsx(V,{asChild:!0,children:t.jsxs(Y,{to:"/proposals/new",children:[t.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsx("div",{className:"space-y-4",children:[...Array(3)].map((u,p)=>t.jsx(J,{children:t.jsx(Ve,{children:t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"h-6 bg-muted rounded w-3/4 animate-pulse"}),t.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]}),t.jsx("div",{className:"h-6 bg-muted rounded w-20 animate-pulse"})]})})},p))})]}):h?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your project"})]}),t.jsx(V,{asChild:!0,children:t.jsxs(Y,{to:"/proposals/new",children:[t.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsx("div",{className:"text-center",children:t.jsxs("p",{className:"text-destructive",children:["Error: ",h]})})})})]}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your project"})]}),t.jsx(V,{asChild:!0,children:t.jsxs(Y,{to:"/proposals/new",children:[t.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"relative",children:[t.jsx(Ue,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t.jsx(Re,{ref:F,placeholder:"Search tasks...",value:C,onChange:u=>I(u.target.value),className:"pl-9 pr-20 h-11 bg-muted/40 border-muted-foreground/20 focus:bg-background transition-colors"}),t.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:C?t.jsx("button",{onClick:()=>I(""),className:"h-5 w-5 rounded-full bg-muted-foreground/20 hover:bg-muted-foreground/30 flex items-center justify-center transition-colors",children:t.jsx(X,{className:"h-3 w-3"})}):t.jsx(Te,{children:t.jsx(Oe,{children:"S"})})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>H(!G),className:"flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg border border-muted-foreground/20 hover:bg-muted/50 transition-colors",children:[t.jsx(Ae,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Filters & Sort"}),t.jsx("span",{className:"sm:hidden",children:"Filters"}),S>0&&t.jsx("span",{className:"flex items-center justify-center h-5 w-5 text-xs font-bold rounded-full bg-primary text-primary-foreground",children:S}),G?t.jsx($e,{className:"h-4 w-4 ml-1"}):t.jsx(Pe,{className:"h-4 w-4 ml-1"})]}),t.jsxs("div",{className:"flex-1 flex items-center gap-2 overflow-x-auto scrollbar-hide",children:[m!=="active"&&t.jsxs("button",{onClick:()=>z("active"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-blue-500/15 text-blue-600 dark:text-blue-400 hover:bg-blue-500/25 transition-colors whitespace-nowrap",children:[m,t.jsx(X,{className:"h-3 w-3"})]}),g!=="all"&&t.jsxs("button",{onClick:()=>O("all"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors whitespace-nowrap",children:[g," priority",t.jsx(X,{className:"h-3 w-3"})]}),(E!=="created"||b!=="desc")&&t.jsxs("button",{onClick:()=>{ne("created"),L("desc"),y({sortBy:null,order:null})},className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-purple-500/15 text-purple-600 dark:text-purple-400 hover:bg-purple-500/25 transition-colors whitespace-nowrap",children:[E," ",b==="asc"?"↑":"↓",t.jsx(X,{className:"h-3 w-3"})]})]}),t.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[a.length," result",a.length!==1?"s":""]})]}),G&&t.jsxs("div",{className:"p-4 rounded-lg border border-muted-foreground/20 bg-muted/30 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsxs(ie,{value:m,onValueChange:z,children:[t.jsx(ae,{className:"w-full bg-background",children:t.jsx(ce,{placeholder:"Filter by status"})}),t.jsxs(ue,{children:[t.jsx(w,{value:"active",children:"Active (Default)"}),t.jsx(w,{value:"all",children:"All statuses"}),t.jsx(w,{value:"draft",children:"Draft"}),t.jsx(w,{value:"proposed",children:"Proposed"}),t.jsx(w,{value:"in-review",children:"In Review"}),t.jsx(w,{value:"approved",children:"Approved"}),t.jsx(w,{value:"code-complete",children:"Code Complete"}),t.jsx(w,{value:"merged",children:"Merged"}),t.jsx(w,{value:"rejected",children:"Rejected"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Priority"}),t.jsxs(ie,{value:g,onValueChange:O,children:[t.jsx(ae,{className:"w-full bg-background",children:t.jsx(ce,{placeholder:"Filter by priority"})}),t.jsxs(ue,{children:[t.jsx(w,{value:"all",children:"All priorities"}),t.jsx(w,{value:"low",children:"Low"}),t.jsx(w,{value:"medium",children:"Medium"}),t.jsx(w,{value:"high",children:"High"}),t.jsx(w,{value:"critical",children:"Critical"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Sort By"}),t.jsxs(ie,{value:E,onValueChange:u=>ne(u),children:[t.jsx(ae,{className:"w-full bg-background",children:t.jsx(ce,{})}),t.jsxs(ue,{children:[t.jsx(w,{value:"created",children:"Created Date"}),t.jsx(w,{value:"updated",children:"Updated Date"}),t.jsx(w,{value:"status",children:"Status"}),t.jsx(w,{value:"priority",children:"Priority"}),t.jsx(w,{value:"intent",children:"Title"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Order"}),t.jsx(V,{variant:"outline",onClick:D,className:"w-full justify-between bg-background",children:b==="asc"?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Ascending"}),t.jsx(Ye,{className:"h-4 w-4"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Descending"}),t.jsx(He,{className:"h-4 w-4"})]})})]})]}),S>0&&t.jsx("div",{className:"pt-2 border-t border-muted-foreground/10",children:t.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>{z("active"),O("all"),I("")},className:"text-muted-foreground hover:text-foreground",children:[t.jsx(X,{className:"h-3 w-3 mr-1"}),"Reset all filters"]})})]})]}),a.length===0&&n.length>0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(Ae,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals match your filters"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Try adjusting your status or priority filters."}),t.jsx(V,{variant:"outline",className:"mt-4",onClick:()=>{z("active"),O("all"),I("")},children:"Clear Filters"})]})})}):n.length===0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(Ke,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals yet"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first change proposal to get started."}),t.jsx(V,{asChild:!0,className:"mt-4",children:t.jsxs(Y,{to:"/proposals/new",children:[t.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]})})}):t.jsx("div",{className:"space-y-4",children:a.map(u=>t.jsx(Y,{to:`/proposals/${u.id}`,className:"block",children:t.jsx(J,{className:"hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:t.jsx(Z,{className:"py-4",children:t.jsx("div",{className:"flex justify-between items-start gap-4",children:t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsx(We,{className:"text-base leading-tight",children:u.intent}),t.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[u.metadata.priority&&t.jsx(q,{variant:Tt(u.metadata.priority),className:"text-xs",children:u.metadata.priority}),t.jsx(q,{variant:Rt(u.status),className:"text-xs",children:u.status})]})]}),u.content&&t.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[u.content.split(`
|
|
17
|
-
`).slice(0,2).join(" ").substring(0,150),u.content.length>150?"...":""]}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"text-xs text-muted-foreground",children:[u.id," • by ",u.author.name," • ",new Date(u.metadata.createdAt).toLocaleDateString()]}),t.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[u.planSteps.length>0&&t.jsxs("span",{children:[u.planSteps.length," step",u.planSteps.length!==1?"s":""]}),u.evidence.length>0&&t.jsxs("span",{children:[u.evidence.length," evidence"]}),u.metadata.tags&&u.metadata.tags.length>0&&t.jsxs("span",{children:[u.metadata.tags.length," tag",u.metadata.tags.length!==1?"s":""]})]})]}),u.metadata.tags&&u.metadata.tags.length>0&&t.jsxs("div",{className:"flex gap-1 mt-2",children:[u.metadata.tags.slice(0,3).map(p=>t.jsx(q,{variant:"outline",className:"text-xs",children:p},p)),u.metadata.tags.length>3&&t.jsxs(q,{variant:"outline",className:"text-xs",children:["+",u.metadata.tags.length-3]})]})]})})})})},u.id))})]})}export{Vt as default};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{c as qe,j as e,B as S,aa as Ee,ab as Pe,ac as Le,ad as Me,ae as We,af as Ze,x as ce,r as n,ag as Ye,Q as Ke,z as Xe,u as Qe,a as et,q as ue,T as je,ah as $e,h as ve,i as ye,k as we,l as Ne,m as H,X as Oe,s as tt,p as Ie,ai as _e,v as ke,D as rt,b as st,d as nt,f as at,aj as ze,A as oe}from"./index-3wZrFTdl.js";import{C as it,a as ct}from"./card-B1w4zvds.js";import{B as De}from"./badge-CiH2OuTe.js";import{R as ot,a as Se}from"./radio-group-COwda0W5.js";import{C as lt}from"./CollapsibleSection-CZW08ZKh.js";import{L as he}from"./label-C3WSTIyx.js";import{u as dt}from"./use-terminal-CGL7SCNO.js";import{x as mt,a as ut}from"./xterm-DTxiCjtJ.js";import{A as ht}from"./arrow-down-BMFUtIE3.js";/* empty css */import{b as Fe,a as xt,c as gt,d as ft}from"./droid-BvMEm3eg.js";import{R as pt}from"./refresh-cw-CbXq5Ai_.js";import{P as Ce}from"./play-DVmnMPTC.js";import{P as Ae}from"./plus-CZn0_tNm.js";import{Z as bt}from"./zap-6uLoaMfY.js";/**
|
|
2
|
-
* @license lucide-react v0.542.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const jt=[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],vt=qe("book-marked",jt);/**
|
|
7
|
-
* @license lucide-react v0.542.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const yt=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Je=qe("message-square",yt);var Te={exports:{}},Ue;function wt(){return Ue||(Ue=1,(function(r,E){(function(R,j){r.exports=j()})(self,(()=>(()=>{var R={6:(d,w)=>{function x(o){try{const i=new URL(o),c=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return o.toLocaleLowerCase().startsWith(c.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(w,"__esModule",{value:!0}),w.LinkComputer=w.WebLinkProvider=void 0,w.WebLinkProvider=class{constructor(o,i,c,u={}){this._terminal=o,this._regex=i,this._handler=c,this._options=u}provideLinks(o,i){const c=C.computeLink(o,this._regex,this._terminal,this._handler);i(this._addCallbacks(c))}_addCallbacks(o){return o.map((i=>(i.leave=this._options.leave,i.hover=(c,u)=>{if(this._options.hover){const{range:f}=i;this._options.hover(c,u,f)}},i)))}};class C{static computeLink(i,c,u,f){const U=new RegExp(c.source,(c.flags||"")+"g"),[h,m]=C._getWindowedLineStrings(i-1,u),A=h.join("");let N;const P=[];for(;N=U.exec(A);){const M=N[0];if(!x(M))continue;const[D,k]=C._mapStrIdx(u,m,0,N.index),[K,G]=C._mapStrIdx(u,D,k,M.length);if(D===-1||k===-1||K===-1||G===-1)continue;const $={start:{x:k+1,y:D+1},end:{x:G,y:K+1}};P.push({range:$,text:M,activate:f})}return P}static _getWindowedLineStrings(i,c){let u,f=i,U=i,h=0,m="";const A=[];if(u=c.buffer.active.getLine(i)){const N=u.translateToString(!0);if(u.isWrapped&&N[0]!==" "){for(h=0;(u=c.buffer.active.getLine(--f))&&h<2048&&(m=u.translateToString(!0),h+=m.length,A.push(m),u.isWrapped&&m.indexOf(" ")===-1););A.reverse()}for(A.push(N),h=0;(u=c.buffer.active.getLine(++U))&&u.isWrapped&&h<2048&&(m=u.translateToString(!0),h+=m.length,A.push(m),m.indexOf(" ")===-1););}return[A,f]}static _mapStrIdx(i,c,u,f){const U=i.buffer.active,h=U.getNullCell();let m=u;for(;f;){const A=U.getLine(c);if(!A)return[-1,-1];for(let N=m;N<A.length;++N){A.getCell(N,h);const P=h.getChars();if(h.getWidth()&&(f-=P.length||1,N===A.length-1&&P==="")){const M=U.getLine(c+1);M&&M.isWrapped&&(M.getCell(0,h),h.getWidth()===2&&(f+=1))}if(f<0)return[c,N]}c++,m=0}return[c,m]}}w.LinkComputer=C}},j={};function v(d){var w=j[d];if(w!==void 0)return w.exports;var x=j[d]={exports:{}};return R[d](x,x.exports,v),x.exports}var y={};return(()=>{var d=y;Object.defineProperty(d,"__esModule",{value:!0}),d.WebLinksAddon=void 0;const w=v(6),x=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function C(o,i){const c=window.open();if(c){try{c.opener=null}catch{}c.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}d.WebLinksAddon=class{constructor(o=C,i={}){this._handler=o,this._options=i}activate(o){this._terminal=o;const i=this._options,c=i.urlRegex||x;this._linkProvider=this._terminal.registerLinkProvider(new w.WebLinkProvider(this._terminal,c,this._handler,i))}dispose(){this._linkProvider?.dispose()}}})(),y})()))})(Te)),Te.exports}var Nt=wt();const kt=[{label:"Save to knowledge base",command:"Save this to the knowledge base (.nut/context/knowledge/) using the following schema as reference .nut/.schema/knowledge.schema.md",description:"Save content to knowledge base with schema reference"},{label:"Update project document",command:"Update the project document (.nut/context/project.md) using the following schema as reference .nut/.schema/project.schema.md",description:"Update project.md using schema reference"},{label:"Update architecture document",command:"Update the architecture document (.nut/context/architecture.md) using the following schema as reference .nut/.schema/architecture.schema.md",description:"Update architecture.md using schema reference"}];function St({onJumpToBottom:r,onSnippet:E,onSendKey:R}){return e.jsxs("div",{className:"w-full border-t border-gray-700/50 bg-[#252525] px-4 py-2.5 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r&&e.jsxs(S,{variant:"outline",size:"sm",onClick:r,className:"h-8 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] text-gray-200 hover:text-white transition-colors",title:"Jump to bottom and set focus",children:[e.jsx(ht,{className:"h-3.5 w-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Jump to Bottom"})]}),E&&e.jsxs(Ee,{children:[e.jsx(Pe,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:"h-8 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] text-gray-200 hover:text-white transition-colors",children:[e.jsx(vt,{className:"h-3.5 w-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Snippets"})]})}),e.jsxs(Le,{align:"start",className:"w-72",children:[e.jsx(Me,{children:"Command Snippets"}),e.jsx(We,{}),kt.map((j,v)=>e.jsxs(Ze,{onClick:()=>E(j.command),className:"cursor-pointer flex flex-col items-start py-2",children:[e.jsx("span",{className:"font-medium",children:j.label}),e.jsx("span",{className:"text-xs text-muted-foreground font-mono mt-0.5",children:j.command})]},v))]})]})]}),R&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>R(""),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-red-900/40 hover:border-red-700 text-gray-200 hover:text-red-300 transition-colors",title:"Send Ctrl+C (interrupt)",children:[e.jsx(ce,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"⌃"}),e.jsx(ce,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"C"})]}),e.jsxs("button",{onClick:()=>R(""),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white transition-colors",title:"Send Ctrl+Z (suspend)",children:[e.jsx(ce,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"⌃"}),e.jsx(ce,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"Z"})]}),e.jsx("button",{onClick:()=>R("\x1B"),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white transition-colors",title:"Send Escape key",children:e.jsx(ce,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"Esc"})})]})]})}function Ct({sessionId:r,onResize:E,onDestroy:R,pendingCommand:j,onCommandExecuted:v,showToolbar:y=!0,onSnippet:d}){const w=n.useRef(null),x=n.useRef(null),C=n.useRef(null),o=n.useRef(null),[i,c]=n.useState(!1),[u,f]=n.useState(null),[U,h]=n.useState(!0),m=n.useRef(0),A=5,N=n.useRef(null),P=n.useRef(null),M=n.useRef(j??null),D=n.useRef(!1),k=n.useRef(null),K=n.useRef(v),G=n.useRef(R),$=n.useRef(E);n.useEffect(()=>{K.current=v},[v]),n.useEffect(()=>{G.current=R},[R]),n.useEffect(()=>{$.current=E},[E]);const X=n.useCallback(L=>{!M.current||D.current||(k.current!==null&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{if(!M.current||D.current){k.current=null;return}o.current?.readyState===WebSocket.OPEN&&(o.current.send(JSON.stringify({type:"input",data:M.current+"\r"})),D.current=!0,K.current?.()),k.current=null},L))},[]);n.useEffect(()=>{if(M.current=j??null,D.current=!1,!M.current){k.current!==null&&(window.clearTimeout(k.current),k.current=null);return}const L=o.current?.readyState===WebSocket.OPEN;return X(L?200:800),()=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null)}},[j,r,X]),n.useEffect(()=>{c(!1),h(!0),f(null)},[r]),n.useEffect(()=>{if(!w.current||!r)return;const L=g=>{const b=g.getBoundingClientRect();return b.width>0&&b.height>0},p=new mt.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"'IBM Plex Mono', 'Source Code Pro', 'Fira Code', ui-monospace, Menlo, Monaco, monospace",lineHeight:1.35,letterSpacing:.5,convertEol:!0,theme:{background:"#1a1b26",foreground:"#c0caf5",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"#33467c",selectionForeground:"#c0caf5",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}}),re=new ut.FitAddon,W=new Nt.WebLinksAddon;p.loadAddon(re),p.loadAddon(W),p.open(w.current),x.current=p,C.current=re;let I=null,F=null;const le=()=>{if(!p||!p.element||!p.element.parentElement)return;const g=p.cols??0,b=p.rows??0;if(g>0&&b>0){o.current?.readyState===WebSocket.OPEN&&o.current.send(JSON.stringify({type:"resize",cols:g,rows:b}));const B=$.current;B&&B(g,b)}},_=()=>{const g=w.current;if(g&&L(g)&&!(!p||!p.element||!p.element.parentElement))try{const b=g.getBoundingClientRect();if(b.width<10||b.height<10)return;re.fit(),le()}catch(b){console.warn("xterm fit() failed, will retry if needed:",b)}},Z=()=>{I&&cancelAnimationFrame(I),I=requestAnimationFrame(()=>{_()})},ee=()=>{if(!r)return;N.current&&(window.clearTimeout(N.current),N.current=null);const g=`${Ye}/ws/terminal/${r}`,b=new WebSocket(g);return o.current=b,b.onopen=()=>{c(!0),f(null),m.current=0,console.log("Terminal WebSocket connected"),P.current&&window.clearInterval(P.current),P.current=window.setInterval(()=>{b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"keepalive"}))},120*1e3),Z(),setTimeout(()=>{h(!1),Z(),setTimeout(()=>Z(),50),setTimeout(()=>Z(),150)},400),X(1200)},b.onmessage=B=>{try{const z=JSON.parse(B.data);switch(z.type){case"snapshot":if(typeof z.data=="string"&&z.data.length&&x.current){const T=x.current;T.write(z.data,()=>{T.scrollToBottom()})}break;case"data":if(x.current){const T=x.current,fe=T.buffer.active.viewportY+T.rows>=T.buffer.active.baseY+T.buffer.active.cursorY;T.write(z.data,()=>{fe&&T.scrollToBottom()})}break;case"exit":x.current&&x.current.write(`\r
|
|
12
|
-
\x1B[31mProcess exited with code ${z.exitCode}\x1B[0m\r
|
|
13
|
-
`),G.current?.();break}}catch(z){console.error("Error parsing WebSocket message:",z)}},b.onclose=B=>{if(c(!1),console.log("Terminal WebSocket disconnected",B.code,B.reason),P.current&&(window.clearInterval(P.current),P.current=null),B.code!==1e3&&m.current<A&&r){m.current++;const z=Math.min(1e3*Math.pow(2,m.current-1),1e4);console.log(`Attempting to reconnect (${m.current}/${A}) in ${z}ms`),N.current=window.setTimeout(()=>{ee()},z)}else m.current>=A&&f("Connection lost. Please refresh the page to reconnect.")},b.onerror=B=>{console.error("Terminal WebSocket error:",B),m.current===0&&f("WebSocket connection failed")},b};ee(),p.onData(g=>{o.current?.readyState===WebSocket.OPEN&&o.current.send(JSON.stringify({type:"input",data:g}))});const Q=()=>{Z()},ge=new ResizeObserver(Q);w.current&&ge.observe(w.current),window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q);const de=()=>{document.visibilityState==="visible"&&(F&&clearTimeout(F),F=window.setTimeout(()=>{Z()},50))};document.addEventListener("visibilitychange",de);let se=0;const me=20,ne=()=>{const g=w.current;if(g){if(L(g)){_();return}se+=1,se<me?I=requestAnimationFrame(ne):F=window.setTimeout(()=>{_()},100)}};return I=requestAnimationFrame(ne),()=>{ge.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),document.removeEventListener("visibilitychange",de),I&&cancelAnimationFrame(I),F&&clearTimeout(F),N.current&&(window.clearTimeout(N.current),N.current=null),P.current&&(window.clearInterval(P.current),P.current=null),o.current?.readyState===WebSocket.OPEN&&o.current.close(),k.current!==null&&(window.clearTimeout(k.current),k.current=null),p.dispose()}},[r,X]);const V=n.useCallback(()=>{x.current&&(x.current.scrollToBottom(),x.current.focus())},[]),xe=n.useCallback(L=>{o.current?.readyState===WebSocket.OPEN&&(o.current.send(JSON.stringify({type:"input",data:L})),x.current&&x.current.focus())},[]),O=n.useCallback(L=>{o.current?.readyState===WebSocket.OPEN&&(o.current.send(JSON.stringify({type:"input",data:L})),x.current&&x.current.focus())},[]);return u?e.jsx("div",{className:"flex items-center justify-center h-full bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-red-600 font-medium",children:"Terminal Connection Error"}),e.jsx("div",{className:"text-red-500 text-sm mt-1",children:u})]})}):e.jsxs("div",{className:"relative h-full flex flex-col bg-[#1a1b26] overflow-hidden",children:[!i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1a1b26] bg-opacity-95 z-10 backdrop-blur-sm",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),e.jsx("div",{className:"text-gray-300 mt-2",children:"Connecting to terminal..."})]})}),i&&U&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1a1b26] bg-opacity-50 z-10 transition-opacity duration-300 backdrop-blur-sm",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-pulse rounded-full h-6 w-6 bg-blue-500 mx-auto"}),e.jsx("div",{className:"text-gray-300 text-sm mt-2",children:"Loading terminal..."})]})}),e.jsx("div",{ref:w,className:"flex-1 w-full overflow-hidden",style:{minHeight:"400px"}}),y&&e.jsx(St,{onJumpToBottom:V,onSnippet:d||xe,onSendKey:O})]})}const At=r=>r?Array.isArray(r)?r.filter(E=>typeof E=="string").map(E=>E.trim()).filter(Boolean):typeof r=="string"?r.split(",").map(E=>E.trim()).filter(Boolean):[]:[];function Ut(){const{proposalId:r}=Ke(),E=Xe(),R=Qe(),{toast:j}=et(),v=r?.startsWith("session-"),y=n.useMemo(()=>!!r&&r.startsWith("cp-"),[r]),d=n.useMemo(()=>!!r&&r.startsWith("ag-"),[r]),w=n.useMemo(()=>d&&r?r.replace("ag-","")+".md":null,[d,r]),{sessions:x,loading:C,error:o,createSession:i,destroySession:c,refreshSessions:u}=dt(),[f,U]=n.useState([]),[h,m]=n.useState(null),[A,N]=n.useState(!1),[P,M]=n.useState(null),[D,k]=n.useState("claude"),[K,G]=n.useState(!1),[$,X]=n.useState("claude"),[V,xe]=n.useState([]),[O,L]=n.useState([]),[p,re]=n.useState([]),[W,I]=n.useState([]),[F,le]=n.useState(!0),[_,Z]=n.useState(""),[ee,Q]=n.useState(!1),[ge,de]=n.useState({}),[se,me]=n.useState(null),ne=n.useRef([]),[g,b]=n.useState("current"),[B,z]=n.useState("main"),T=n.useMemo(()=>r?`terminal.cp.config.${r}`:null,[r]);n.useEffect(()=>{if(!(!y&&!d||!T))try{const t=localStorage.getItem(T);if(t){const s=JSON.parse(t);s.cliAgent&&X(s.cliAgent),Array.isArray(s.selectedMcpServers)&&L(s.selectedMcpServers),Array.isArray(s.selectedAgentIds)&&I(s.selectedAgentIds),typeof s.automationEnabled=="boolean"&&le(s.automationEnabled),typeof s.customInstruction=="string"&&Z(s.customInstruction),typeof s.createWorktree=="boolean"&&Q(s.createWorktree),s.branchMode&&b(s.branchMode)}}catch{console.error("Failed to load config",T)}},[y,d,T]);const fe=n.useCallback(()=>{if(!T)return;const t={cliAgent:$,selectedMcpServers:O,selectedAgentIds:W,automationEnabled:F,customInstruction:_,createWorktree:ee,branchMode:g};try{localStorage.setItem(T,JSON.stringify(t))}catch{console.error("Failed to persist config",T)}},[T,$,O,W,F,_,ee,g]),te=t=>`feat/cp-${t.startsWith("cp-")?t.slice(3):t}`,Ge=async t=>{try{const s=te(t),l=await(await fetch(`${oe}/api/v1/git/branches`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,from:B})})).json();if(!l.success){const J=l.error?.message||"Unknown error";return j({title:"Branch creation failed",description:J,variant:"destructive"}),!1}return j({title:"Branch created",description:`Created branch: ${s}`}),!0}catch{return j({title:"Branch creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}},Re=async t=>{try{const s=te(t),l=await(await fetch(`${oe}/api/v1/git/worktrees`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:s,from:B})})).json();if(!l.success){const J=l.error?.message||"Unknown error";return j({title:"Worktree creation failed",description:J,variant:"destructive"}),!1}return j({title:"Worktree created",description:`Created branch: ${s}`}),!0}catch{return j({title:"Worktree creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}};n.useEffect(()=>{(y||d)&&r&&(async()=>{try{const s=await fetch(`${oe}/api/v1/git/status`);if(s.ok){const l=await s.json();l?.success&&l.data?.branch&&z(l.data.branch)}const a=await fetch(`${oe}/api/v1/mcp`);if(a.ok){const l=await a.json();l?.success&&Array.isArray(l.servers)&&(xe(l.servers),L(J=>J.filter(q=>l.servers.includes(q))),l.mcpServers&&typeof l.mcpServers=="object"&&de(l.mcpServers))}}catch(s){console.error("Failed to load MCP servers",s)}try{const s=await fetch(`${oe}/api/v1/agents`);if(s.ok){const a=await s.json(),J=(Array.isArray(a?.documents)?a.documents:[]).map(q=>({id:q.filename,name:q?.metadata?.name||q.title||q.filename,tools:At(q?.metadata?.tools)}));re(J),I(q=>{const ie=q.filter(Y=>J.some(be=>be.id===Y));if(d&&w&&ie.length===0){const Y=J.find(be=>be.id===w);if(Y)return[Y.id]}return ie})}}catch(s){console.error("Failed to load agents",s)}})()},[y,d,r,w]),n.useEffect(()=>{const t=ne.current,s=W.filter(a=>!t.includes(a));s.length>0&&L(a=>{const l=new Set(a),J=V.length>0?new Set(V):void 0;return s.forEach(q=>{const ie=p.find(Y=>Y.id===q);ie&&ie.tools.forEach(Y=>{(!J||J.has(Y))&&l.add(Y)})}),Array.from(l)}),ne.current=W},[W,p,V]),n.useEffect(()=>{r&&u(r)},[r,u]),n.useEffect(()=>{if(!r)return;const s=x.filter(a=>a.proposalId===r).map(a=>a.id);U(s),!h&&s.length>0&&m(s[0]),h&&!s.includes(h)&&m(s.length>0?s[0]:null)},[x,r,h]);const ae=async t=>{if(!r)return;const s=t||void 0,a=await i(r,A,s);a&&(m(a),!s&&t&&M(t),setTimeout(()=>u(r),100))},Ve=t=>{const a={proposalId:r,contextType:y?"change-proposal":d?"agent":"general",selectedMcpServers:O,selectedAgentIds:W,automationEnabled:F,customInstruction:_};switch(t){case"claude":return Fe(a);case"gemini":return ft(a);case"codex":return gt(a);case"droid":return xt(a);default:return Fe(a)}},pe=async()=>{y&&r&&(g==="new-branch"?await Ge(r)||console.warn("Branch creation failed, continuing with terminal creation"):g==="new-worktree"&&(await Re(r)||console.warn("Worktree creation failed, continuing with terminal creation"))),y&&ee&&g==="current"&&r&&(await Re(r)||console.warn("Worktree creation failed, continuing with terminal creation"));const s=Ve(y||d?$:D);await ae(s)},Be=async t=>{if(await c(t)&&h===t){const a=f.filter(l=>l!==t);m(a.length>0?a[0]:null)}},He=t=>{Be(t)};return r?e.jsxs("div",{className:"flex flex-col h-full",children:[v&&f.length===0&&r&&e.jsx(Tt,{proposalId:r,onStart:ae,locationSearch:E.search}),e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-lg",children:y||d?e.jsx(ue,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):e.jsx(je,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:v?"Terminal":"Agent Session"}),!v&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r}),v&&e.jsxs("span",{className:"text-sm text-gray-500 font-mono",children:["(",r,")"]})]})]})}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsxs("div",{className:"hidden sm:flex items-center space-x-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 rounded-lg border",children:[e.jsx($e,{id:"enable-logging",checked:A,onCheckedChange:t=>N(t===!0)}),e.jsx("label",{htmlFor:"enable-logging",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Log sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(S,{variant:"outline",size:"sm",onClick:()=>r&&u(r),disabled:C,className:"bg-white dark:bg-gray-800",children:[e.jsx(pt,{className:`h-4 w-4 sm:mr-2 ${C?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),!v&&!y&&!d&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ve,{value:D,onValueChange:k,children:[e.jsx(ye,{className:"w-24",children:e.jsx(we,{})}),e.jsxs(Ne,{children:[e.jsx(H,{value:"claude",children:"Claude Code"}),e.jsx(H,{value:"gemini",children:"Google Gemini"}),e.jsx(H,{value:"codex",children:"OpenAI Codex"})]})]}),e.jsxs(S,{onClick:pe,disabled:C,size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ce,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Start Agent"})]})]}),!y&&!d&&(!v||f.length===0)&&e.jsxs(S,{onClick:()=>ae(),disabled:C,size:"sm",children:[e.jsx(Ae,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"New Terminal"})]})]})]})]}),o&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-1.5 bg-red-100 dark:bg-red-900/40 rounded-lg flex-shrink-0",children:e.jsx(Oe,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),e.jsx("div",{className:"text-red-800 dark:text-red-200 text-sm font-medium",children:o})]})}),f.length>0&&e.jsx("div",{className:"flex items-center gap-1 border-b dark:border-gray-700",children:f.map(t=>{const s=x.find(l=>l.id===t),a=h===t;return e.jsxs("div",{className:`flex items-center gap-2 px-4 py-3 border-b-1 cursor-pointer rounded-t-lg transition-all duration-200 ${a?"border-gray-400 bg-white dark:bg-gray-800 dark:border-gray-500 shadow-sm":"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800 hover:border-gray-300"}`,onClick:()=>m(t),children:[e.jsx("div",{className:`p-1.5 rounded-md ${a?"bg-gray-200 dark:bg-gray-700":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(je,{className:`h-3.5 w-3.5 ${a?"text-gray-700 dark:text-gray-300":"text-gray-600 dark:text-gray-400"}`})}),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["Terminal ",t.split("-").slice(-1)[0].substring(0,6)]}),e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s?.connected?"bg-green-500":"bg-gray-400"}`}),e.jsx(S,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-red-100 dark:hover:bg-red-900/30 rounded-md opacity-60 hover:opacity-100 transition-opacity",onClick:l=>{l.stopPropagation(),Be(t)},children:e.jsx(Oe,{className:"h-3 w-3"})})]},t)})}),e.jsx("div",{className:"flex-1 min-h-0",children:f.length===0?e.jsx(it,{className:"h-full border-0 shadow-lg",children:e.jsx(ct,{className:"flex items-center justify-center h-full p-8",children:e.jsxs("div",{className:"text-center w-full max-w-[33vw] min-w-[400px]",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full w-fit mx-auto mb-2",children:y||d?e.jsx(ue,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"}):e.jsx(je,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"Prepare Agent"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6 leading-relaxed",children:v?"Create a new terminal session":`Configure the agent to start working on ${r}.`}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[!v&&!y&&!d&&e.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[e.jsxs("div",{className:"w-full space-y-3",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Choose your AI agent"}),e.jsxs(ve,{value:D,onValueChange:k,children:[e.jsx(ye,{className:"w-full h-11 bg-white dark:bg-gray-800",children:e.jsx(we,{})}),e.jsxs(Ne,{children:[e.jsx(H,{value:"claude",children:"Claude Code (default)"}),e.jsx(H,{value:"gemini",children:"Google Gemini"}),e.jsx(H,{value:"codex",children:"OpenAI Codex"})]})]})]}),e.jsxs(S,{onClick:pe,disabled:C,className:"bg-green-600 hover:bg-green-700 w-full h-11 text-base font-medium",size:"lg",children:[e.jsx(Ce,{className:"h-5 w-5 mr-2"}),"Start Agent"]}),e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"}),e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 font-medium",children:"or"}),e.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"})]}),e.jsxs(S,{onClick:()=>ae(),disabled:C,variant:"outline",className:"w-full h-11 bg-white dark:bg-gray-800",size:"lg",children:[e.jsx(Ae,{className:"h-5 w-5 mr-2"}),"New Terminal"]})]}),!v&&(y||d)&&e.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsxs(S,{variant:"outline",onClick:()=>G(!0),className:"flex-1 h-11 bg-white dark:bg-gray-800",size:"lg",children:[e.jsx(tt,{className:"h-5 w-5 mr-2"}),"Configure"]}),e.jsxs(S,{onClick:pe,disabled:C,className:"flex-1 bg-green-600 hover:bg-green-700 h-11 text-base font-medium",size:"lg",children:[e.jsx(Ce,{className:"h-5 w-5 mr-2"}),"Start Agent"]})]}),e.jsxs("div",{className:"w-full space-y-3",children:[e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-500 dark:text-gray-400",children:"Current Configuration"}),e.jsxs("div",{className:"text-left text-sm text-gray-700 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Agent:"}),e.jsx("span",{className:"font-mono text-sm",children:$==="claude"?"Claude Code":$.charAt(0).toUpperCase()+$.slice(1)})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ue,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Skills:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:W.length?W.map(t=>{const s=p.find(a=>a.id===t);return e.jsx(De,{variant:"secondary",className:"font-mono text-xs",children:s?.name||t},t)}):e.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(_e,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"MCP Servers:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:O.length?O.map(t=>e.jsx(De,{variant:"secondary",className:"font-mono text-xs",children:t},t)):e.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bt,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Full Environment Access:"}),e.jsx("span",{className:"font-mono text-sm",children:F?"Enabled":"Disabled"})]}),y&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Branch:"}),e.jsx("span",{className:"font-mono text-sm",children:g==="current"?`Current (${B})`:g==="new-branch"?`New branch (${te(r||"")})`:`New worktree (${te(r||"")})`})]})]}),_&&e.jsxs("div",{className:"text-left text-sm bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsxs("div",{className:"font-medium text-blue-700 dark:text-blue-300 mb-1 flex items-center gap-2",children:[e.jsx(Je,{className:"h-3.5 w-3.5"}),"Custom Instructions"]}),e.jsx("div",{className:"text-gray-700 dark:text-gray-300 font-mono",children:_})]})]})]}),v&&f.length===0&&e.jsx("div",{className:"p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:e.jsxs(S,{onClick:()=>ae(),disabled:C,className:"w-full h-11 text-base font-medium",size:"lg",children:[e.jsx(Ae,{className:"h-5 w-5 mr-2"}),"New Terminal"]})})]})]})})}):h?e.jsx("div",{className:"h-full overflow-hidden rounded-b-lg",children:e.jsx(Ct,{sessionId:h,onDestroy:()=>He(h),pendingCommand:P,onCommandExecuted:()=>M(null),showToolbar:!0})}):null}),e.jsx(rt,{open:K,onOpenChange:G,children:e.jsxs(st,{className:"max-w-3xl max-h-[85vh] overflow-y-auto",children:[e.jsxs(nt,{children:[e.jsx(at,{children:"Configure Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Customize the agent's capabilities and configure it's environment."})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4"}),"Agent"]}),e.jsxs(ve,{value:$,onValueChange:t=>X(t),children:[e.jsx(ye,{className:"w-full",children:e.jsx(we,{placeholder:"Select agent"})}),e.jsxs(Ne,{children:[e.jsx(H,{value:"claude",children:"Claude Code"}),e.jsx(H,{value:"gemini",children:"Google Gemini"}),e.jsx(H,{value:"codex",children:"OpenAI Codex"}),e.jsx(H,{value:"droid",children:"Factory Droid"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ue,{className:"h-4 w-4"}),"Skills"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[W.length," of ",p.length," selected"]})]}),e.jsxs(Ee,{children:[e.jsx(Pe,{asChild:!0,children:e.jsxs(S,{variant:"outline",className:"w-full justify-between",children:[W.length===0?"Select skills...":W.length===p.length?"All skills selected":`${W.length} agent${W.length!==1?"s":""} selected`,e.jsx(ke,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(Le,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(Me,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Skills"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(S,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),I(p.map(s=>s.id))},children:"All"}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),I([])},children:"None"})]})]}),e.jsx(We,{}),p.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No agents found"}):p.map(t=>e.jsx(ze,{checked:W.includes(t.id),onCheckedChange:s=>{I(a=>s?a.includes(t.id)?a:[...a,t.id]:a.filter(l=>l!==t.id))},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:t.name}),t.tools.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",t.tools.join(", ")]}),t.tools.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},t.id))]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(_e,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[O.length," of ",V.length," selected"]})]}),e.jsxs(Ee,{children:[e.jsx(Pe,{asChild:!0,children:e.jsxs(S,{variant:"outline",className:"w-full justify-between",children:[O.length===0?"Select MCP servers...":O.length===V.length?"All servers selected":`${O.length} server${O.length!==1?"s":""} selected`,e.jsx(ke,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(Le,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(Me,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Servers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(S,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),L(V)},children:"All"}),e.jsx(S,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),L([])},children:"None"})]})]}),e.jsx(We,{}),V.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):V.map(t=>e.jsx(ze,{checked:O.includes(t),onCheckedChange:s=>{L(a=>s?a.includes(t)?a:[...a,t]:a.filter(l=>l!==t))},children:t},t))]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4"}),"Additional instructions"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[_.length,"/500"]})]}),e.jsx("textarea",{className:"w-full min-h-[80px] rounded-md border p-3 text-sm bg-gray-50 dark:bg-gray-900/50 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 resize-none",placeholder:"Add specific instructions to guide the agent...",value:_,onChange:t=>Z(t.target.value),rows:3}),_.length>500&&e.jsx("div",{className:"text-xs text-red-600 mt-1",children:"Custom instruction is too long (max 500 characters)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-md bg-amber-50/50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800",children:[e.jsx($e,{id:"automation",checked:F,onCheckedChange:t=>le(t===!0),className:"data-[state=checked]:bg-red-600 data-[state=checked]:border-red-600 data-[state=checked]:text-white border-red-400",disabled:$==="droid"}),e.jsx("label",{htmlFor:"automation",className:"text-sm font-medium text-red-600 dark:text-red-400 cursor-pointer",children:"Full environment access (recommended in secure environments only)"})]}),$==="droid"&&e.jsxs("p",{className:"text-xs text-muted-foreground px-1",children:[e.jsx("span",{className:"font-medium",children:"Droid:"})," Automation level is set in the REPL. Press ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-[10px] font-mono",children:"shift+tab"})," to cycle through Off → Low → Medium → High."]})]}),y&&e.jsx(lt,{title:"Advanced Settings",description:"Configure branch and worktree options",defaultOpen:!1,children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(he,{className:"text-sm font-medium mb-3 block",children:"Branch Management"}),e.jsxs(ot,{value:g,onValueChange:t=>b(t),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Se,{value:"current",id:"branch-current"}),e.jsxs(he,{htmlFor:"branch-current",className:"cursor-pointer font-normal",children:["Stay on current branch (",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:B}),")"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Se,{value:"new-branch",id:"branch-new"}),e.jsxs(he,{htmlFor:"branch-new",className:"cursor-pointer font-normal",children:["Create new branch: ",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:te(r||"")})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Se,{value:"new-worktree",id:"branch-worktree"}),e.jsxs(he,{htmlFor:"branch-worktree",className:"cursor-pointer font-normal",children:["Create new worktree: ",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:te(r||"")})]})]})]})]})})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(S,{variant:"outline",onClick:()=>G(!1),children:"Close"}),e.jsx(S,{onClick:()=>{if(_.length>500){me("Please shorten the custom instruction to 500 characters.");return}me(null),fe(),G(!1)},children:"Save"})]}),se&&e.jsx("div",{className:"text-xs text-red-600 text-right",children:se})]})]})})]}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-red-600 font-medium",children:"Invalid Proposal ID"}),e.jsx(S,{onClick:()=>R("/proposals"),className:"mt-4",children:"Back to Proposals"})]})})}function Tt({proposalId:r,onStart:E,locationSearch:R}){return n.useEffect(()=>{if(!r)return;const j=new URLSearchParams(R);if(!j.has("autostart"))return;const v=`terminal.autostart.${r}`;if(sessionStorage.getItem(v)==="done")return;sessionStorage.setItem(v,"done");const d=j.get("run")||void 0;E(d||void 0)},[r]),null}export{Ut as default};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const l="Use .nut/context/project.md and .nut/context/architecture.md for reference.";function p(e,t,n,o=!0){const s=[];return o&&(s.push(["## Task","","- Review and begin working on the following task proposal:",` .nut/proposals/${e}.md`,"- Retrieve your firstName, lastName, and email address from: .nut/config.json and use this identity to address yourself in any task updates, comments, git commits, etc."].join(`
|
|
2
|
-
`)),s.push(["## Task Lifecycle","",`- Before beginning any work: nut task update ${e} --status active`,`- Add appropriate steps with: nut task step ${e} "Step description" --author "firstName lastName"`,"",`- If you need human clarification or input: nut task update ${e} --status blocked. The clarification can be communicated as follows: nut task comment ${e} "Comments here" --author "firstName lastName". At this point please stop work.`,"",`- When implementation is complete and ready for approval: nut task update ${e} --status review`,`- Only mark the task complete once approval criteria are satisfied: nut task update ${e} --status done`].join(`
|
|
3
|
-
`)),s.push(["## Operational Rules","","- DO use the nut CLI to update task status as progress changes"," (nut --help or nut task --help for details)","- DO NOT edit files outside the scope of the approved proposal (unless instructed by the Additional Instructions below)"].join(`
|
|
4
|
-
`))),t.length>0&&s.push(["## Agents","","These agents are available to you if needed:",...t.map(i=>`- ${i}`)].join(`
|
|
5
|
-
`)),n&&n.trim()&&s.push(["## Additional Instructions","","DO strictly adhere to these additional instructions:",n.trim()].join(`
|
|
6
|
-
`)),[s.join(`
|
|
7
|
-
|
|
8
|
-
`)]}function u(e,t){const n=[];return n.push(l),e.length>0&&n.push(`Please use these agents: ${e.join(", ")}`),t&&t.trim()&&n.push(`Additional instruction: ${t.trim()}`),n}const m=e=>{const t=e.selectedAgentIds.map(d=>`.nut/agents/${d}`),o=(e.contextType==="change-proposal"?p(e.proposalId,t,e.customInstruction,e.includeDefaultInstructions??!0):u(t,e.customInstruction)).join(" "),s=[e.automationEnabled?"--dangerously-skip-permissions":""].filter(Boolean).join(" "),i=e.selectedMcpServers.map(d=>`'${d.replace(/'/g,"'\\''")}'`).join(","),a=[JSON.stringify(o)].concat(s?[JSON.stringify("--dangerously-skip-permissions")]:[]);return`node -e "${`const fs=require('fs'),{spawn}=require('child_process');const s=new Set([${i}]);const c=require('./.nut/mcp/config.json');const filtered=Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)).map(([k,v])=>[k,{...v,type:v.type||(v.url?'http':'stdio')}]);const o={mcpServers:Object.fromEntries(filtered)};fs.writeFileSync('.mcp.json',JSON.stringify(o,null,2));const p=spawn('claude',[${a.join(",")}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`},h=e=>{const t=e.selectedAgentIds.map(c=>`.nut/agents/${c}`),o=(e.contextType==="change-proposal"?p(e.proposalId,t,e.customInstruction,e.includeDefaultInstructions??!0):u(t,e.customInstruction)).join(" ");return`node -e "${`const fs=require('fs'),path=require('path'),{spawn}=require('child_process');const s=new Set([${e.selectedMcpServers.map(c=>`'${c.replace(/'/g,"'\\''")}'`).join(",")}]);const c=require('./.nut/mcp/config.json');const geminiPath=path.join(require('os').homedir(),'.gemini','settings.json');let settings={};try{settings=JSON.parse(fs.readFileSync(geminiPath,'utf8'))}catch(e){}settings.mcpServers=Object.fromEntries(Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)));fs.writeFileSync(geminiPath,JSON.stringify(settings,null,2));const p=spawn('gemini',['-i',${JSON.stringify(o)}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`},f=e=>{const t=e.selectedAgentIds.map(r=>`.nut/agents/${r}`),o=(e.contextType==="change-proposal"?p(e.proposalId,t,e.customInstruction,e.includeDefaultInstructions??!0):u(t,e.customInstruction)).join(" "),s=e.selectedMcpServers.map(r=>`'${r.replace(/'/g,"'\\''")}'`).join(","),i=[JSON.stringify(o)].concat(e.automationEnabled?[JSON.stringify("--dangerously-bypass-approvals-and-sandbox")]:[]);return`node -e "${`const fs=require('fs'),{spawn}=require('child_process');const s=new Set([${s}]);const c=require('./.nut/mcp/config.json');const filtered=Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)).map(([k,v])=>[k,{...v,type:v.type||(v.url?'http':'stdio')}]);const o={mcpServers:Object.fromEntries(filtered)};fs.writeFileSync('.mcp.json',JSON.stringify(o,null,2));const p=spawn('codex',[${i.join(",")}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`},g=e=>{const t=e.selectedAgentIds.map(r=>`.nut/agents/${r}`),o=(e.contextType==="change-proposal"?p(e.proposalId,t,e.customInstruction,e.includeDefaultInstructions??!0):u(t,e.customInstruction)).join(" "),s=e.selectedMcpServers.map(r=>`'${r.replace(/'/g,"'\\''")}'`).join(","),i=[JSON.stringify(o)];return`node -e "${`const fs=require('fs'),{spawn}=require('child_process');const s=new Set([${s}]);const c=require('./.nut/mcp/config.json');const filtered=Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)).map(([k,v])=>[k,{...v,type:v.type||(v.url?'http':'stdio')}]);const o={mcpServers:Object.fromEntries(filtered)};fs.writeFileSync('.mcp.json',JSON.stringify(o,null,2));const p=spawn('droid',[${i.join(",")}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`};export{g as a,m as b,f as c,h as d};
|