@mrpatronz/nexusflow 2.5.1 → 2.5.2
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/commands/diff.d.ts +2 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +13 -1
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/schedule.d.ts +3 -1
- package/dist/commands/schedule.d.ts.map +1 -1
- package/dist/commands/schedule.js +12 -5
- package/dist/commands/schedule.js.map +1 -1
- package/dist/commands/status.d.ts +4 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +9 -3
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/ui.d.ts +8 -0
- package/dist/commands/ui.d.ts.map +1 -1
- package/dist/commands/ui.js +41 -0
- package/dist/commands/ui.js.map +1 -1
- package/dist/core/worktree.test.js +2 -2
- package/dist/desktop-server.d.ts +1 -1
- package/dist/desktop-server.js +1 -1
- package/dist/gui/assets/{AgentsPage-gHbRof2y.js → AgentsPage-CGvhYtRS.js} +1 -1
- package/dist/gui/assets/{DashboardPage-CkXIpoFX.js → DashboardPage-BSVVVXuM.js} +1 -1
- package/dist/gui/assets/{GettingStartedPage-DRL_nbb6.js → GettingStartedPage-srl_5DA_.js} +1 -1
- package/dist/gui/assets/{ProjectsPage-C8XQ9dRr.js → ProjectsPage-BfFX3Rg1.js} +1 -1
- package/dist/gui/assets/{ScaffoldRepoInline-ys4l8ho4.js → ScaffoldRepoInline-DWsd4vxF.js} +1 -1
- package/dist/gui/assets/{SettingsPage-CRVDsRwi.js → SettingsPage-C16CjqlK.js} +1 -1
- package/dist/gui/assets/{SkillsPage-BfQu6PT3.js → SkillsPage-DKLoq_sH.js} +1 -1
- package/dist/gui/assets/{StartWorkPage-BNzeMcFc.js → StartWorkPage-D56-WIZp.js} +1 -1
- package/dist/gui/assets/{StrategiesPage-Bh6x7zhl.js → StrategiesPage-CY8xp7Lz.js} +1 -1
- package/dist/gui/assets/{WorkspacesPage-DYQt7CQ8.js → WorkspacesPage-CXtIMMUl.js} +1 -1
- package/dist/gui/assets/{alert-dialog-D7jNzvYQ.js → alert-dialog-CCwlEjU2.js} +1 -1
- package/dist/gui/assets/{index-C6qbn9Zq.js → index-pxzwuRLq.js} +2 -2
- package/dist/gui/assets/{vsc-CvlJSs-5.js → vsc-DkRhgYbO.js} +1 -1
- package/dist/gui/index.html +1 -1
- package/dist/index.js +17 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,o as ee,p as u,t as d}from"./button-BDDZnIHx.js";import{$t as f,Ct as te,Jt as p,On as ne,Xt as m,Zn as h,c as re,en as g,i as ie,l as _,ln as ae,n as v,o as oe,on as se,s as ce,wt as le,yn as y,zn as ue}from"./CSPContext-BG7no5S_.js";import{h as de}from"./store-D7ixdVck.js";import{t as fe}from"./useValueChanged-CStSGSsD.js";import{t as pe}from"./useAriaLabelledBy-DfRdwH8a.js";import{I as b,a as x}from"./index-C6qbn9Zq.js";var me=o(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),S=t(e(),1),C=S.createContext({disabled:!1});function he(){return S.useContext(C)}var w=S.createContext(void 0);function ge(e=!0){let t=S.useContext(w);if(t===void 0&&!e)throw Error(u(3));return t}function _e(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var T=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function ve(e){return S.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[T.checked]:``}:{[T.unchecked]:``}},..._}),[e.indeterminate])}var ye=S.createContext(void 0);function E(){let e=S.useContext(ye);if(e===void 0)throw Error(u(14));return e}var D=a(),be=`data-parent`,xe=S.forwardRef(function(e,t){let{checked:a,className:o,defaultChecked:l=!1,"aria-labelledby":u,disabled:d=!1,form:p,id:m,indeterminate:h=!1,inputRef:_,name:v,onCheckedChange:de,parent:b=!1,readOnly:x=!1,render:me,required:C=!1,uncheckedValue:w,value:T,nativeButton:E=!1,style:xe,...O}=e,{clearErrors:k}=ce(),{disabled:A,name:j,setDirty:Se,setFilled:M,setFocused:N,setTouched:Ce,state:P,validationMode:we,validityData:Te,validation:Ee}=re(),De=he(),{labelId:Oe,controlId:ke,registerControlId:F,getDescriptionProps:Ae}=oe(),I=ge(),L=I?.parent,R=L&&I.allValues,z=A||De.disabled||I?.disabled||d,B=j??v,V=T??B,je=g(),Me=g(),H=ke;R?H=b?Me:`${L.id}-${V}`:m&&(H=m);let U={};R&&(b?U=I.parent.getParentProps():V&&(U=I.parent.getChildProps(V)));let{checked:Ne=a,indeterminate:Pe=h,onCheckedChange:Fe,...Ie}=U,W=I?.value,Le=I?.setValue,Re=I?.defaultValue,G=S.useRef(null),K=i(()=>Symbol(`checkbox-control`)),q=S.useRef(!1),{getButtonProps:ze,buttonRef:Be}=se({disabled:z,native:E}),J=I?.validation??Ee,[Y,Ve]=ne({controlled:V&&W&&!b?W.includes(V):Ne,default:V&&Re&&!b?Re.includes(V):l,name:`Checkbox`,state:`checked`}),X=R?!!Ne:Y,Z=R&&Pe||h;ae(()=>{F!==c&&(q.current=!0,F(K.current,H))},[H,F,K]),S.useEffect(()=>{let e=K.current;return()=>{!q.current||F===c||(q.current=!1,F(e,void 0))}},[F,K]),ie(G,je,Y,void 0,!I&&!z,v);let Q=S.useRef(null),He=r(_,Q,J.inputRef,J.registerInput),Ue=pe(u,Oe,Q,!E,H??void 0);ae(()=>{Q.current&&(Q.current.indeterminate=Z,Y&&M(!0))},[Y,Z,M]),fe(Y,()=>{I||(k(B),M(Y),Se(Y!==Te.initialValue),J.change(Y))});let We=ee({checked:Y,disabled:z,form:p,name:b?void 0:B,id:E?void 0:H??void 0,required:C,ref:He,style:B?le:te,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(x){e.preventDefault();return}let t=e.currentTarget.checked,n=f(ue,e.nativeEvent);if(de?.(t,n),!n.isCanceled&&(Fe?.(t,n),!n.isCanceled&&(Ve(t),V&&W&&Le&&!b&&!R))){let e=t?[...W,V]:W.filter(e=>e!==V);Le(e,n)}},onFocus(){G.current?.focus()}},T===void 0?n:{value:(I?Y&&T:T)||``},Ae,e=>J.getValidationProps(z,e));S.useEffect(()=>{if(!L||!V)return;let e=L.disabledStatesRef.current;return e.set(V,z),()=>{e.delete(V)}},[L,z,V]);let $=S.useMemo(()=>({...P,checked:X,disabled:z,readOnly:x,required:C,indeterminate:Z}),[P,X,z,x,C,Z]),Ge=ve($),Ke=s(`span`,e,{state:$,ref:[Be,G,t,I?.registerControlRef],props:[{id:E?H??void 0:je,role:`checkbox`,"aria-checked":Z?`mixed`:X,"aria-readonly":x||void 0,"aria-required":C||void 0,"aria-labelledby":Ue,[be]:b?``:void 0,onFocus(){z||N(!0)},onBlur(){let e=Q.current;e&&(Ce(!0),N(!1),we===`onBlur`&&J.commit(I?W:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),y(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||_e(t)?.click()})},onClick(e){if(x||z)return;e.preventDefault();let t=Q.current;t&&t.dispatchEvent(new(y(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},O,Ie,ze,Ae,e=>J.getValidationProps(z,e)],stateAttributesMapping:Ge});return(0,D.jsxs)(ye.Provider,{value:$,children:[Ke,!Y&&!I&&B&&!b&&w!==void 0&&(0,D.jsx)(`input`,{type:`hidden`,form:p,name:B,value:w,disabled:z}),(0,D.jsx)(`input`,{...We,suppressHydrationWarning:!0})]})}),O=S.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,c=E(),l=c.checked||c.indeterminate,{mounted:ee,transitionStatus:u,setMounted:d}=m(l),f=S.useRef(null),te={...c,transitionStatus:u};p({open:l,ref:f,onComplete(){l||d(!1)}});let ne={...ve(c),...h,..._},re=a||ee,g=s(`span`,e,{ref:[t,f],state:te,stateAttributesMapping:ne,props:o});return re?g:null});function k({className:e,...t}){return(0,D.jsx)(xe,{className:l(`relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none`,e),"data-slot":`checkbox`,...t,children:(0,D.jsx)(O,{className:`-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground`,"data-slot":`checkbox-indicator`,render:(e,t)=>(0,D.jsx)(`span`,{...e,children:t.indeterminate?(0,D.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,D.jsx)(`path`,{d:`M5.252 12h13.496`})}):(0,D.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,D.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})})})})}function A({repos:e,selectedPaths:t,onToggle:n,loading:r,emptyHint:i,className:a}){let[o,s]=(0,S.useState)(``),c=(0,S.useMemo)(()=>{let t=o.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,o]);return(0,D.jsxs)(`div`,{className:l(`flex flex-col gap-2`,a),children:[(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(de,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(v,{value:o,onChange:e=>s(e.target.value),placeholder:`Filter repositories…`,className:`pl-8`,"aria-label":`Filter repositories`})]}),(0,D.jsx)(`div`,{className:`max-h-56 overflow-y-auto rounded-lg border border-border`,children:r?(0,D.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Scanning for repositories…`}):c.length===0?(0,D.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:i??`No repositories found.`}):(0,D.jsx)(`ul`,{className:`divide-y divide-border`,children:c.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 px-3 py-2 hover:bg-accent`,children:[(0,D.jsx)(k,{checked:t.includes(e.path),onCheckedChange:()=>n(e),"aria-label":e.name}),(0,D.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,D.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]})},e.path))})})]})}function j({onCreated:e}){let[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),s=b(),c=async()=>{o(null);try{let{repo:t}=await s.mutateAsync(r.trim());i(``),n(!1),e(t)}catch(e){o(e instanceof Error?e.message:String(e))}};return t?(0,D.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(v,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&r.trim()&&c(),placeholder:`new-repo-name`,className:`h-7 font-mono text-xs`,"aria-label":`New repository name`,autoFocus:!0}),(0,D.jsxs)(d,{size:`xs`,onClick:c,disabled:!r.trim()||s.isPending,children:[s.isPending?(0,D.jsx)(x,{}):null,`Create`]}),(0,D.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>{n(!1),o(null)},children:`Cancel`})]}),a&&(0,D.jsx)(`p`,{className:`text-xs text-destructive-foreground`,children:a})]}):(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`mt-1.5 inline-flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(me,{className:`size-3.5`}),` Scaffold a brand-new repository`]})}export{A as n,k as r,j as t};
|
|
1
|
+
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,o as ee,p as u,t as d}from"./button-BDDZnIHx.js";import{$t as f,Ct as te,Jt as p,On as ne,Xt as m,Zn as h,c as re,en as g,i as ie,l as _,ln as ae,n as v,o as oe,on as se,s as ce,wt as le,yn as y,zn as ue}from"./CSPContext-BG7no5S_.js";import{h as de}from"./store-D7ixdVck.js";import{t as fe}from"./useValueChanged-CStSGSsD.js";import{t as pe}from"./useAriaLabelledBy-DfRdwH8a.js";import{I as b,a as x}from"./index-pxzwuRLq.js";var me=o(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),S=t(e(),1),C=S.createContext({disabled:!1});function he(){return S.useContext(C)}var w=S.createContext(void 0);function ge(e=!0){let t=S.useContext(w);if(t===void 0&&!e)throw Error(u(3));return t}function _e(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var T=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function ve(e){return S.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[T.checked]:``}:{[T.unchecked]:``}},..._}),[e.indeterminate])}var ye=S.createContext(void 0);function E(){let e=S.useContext(ye);if(e===void 0)throw Error(u(14));return e}var D=a(),be=`data-parent`,xe=S.forwardRef(function(e,t){let{checked:a,className:o,defaultChecked:l=!1,"aria-labelledby":u,disabled:d=!1,form:p,id:m,indeterminate:h=!1,inputRef:_,name:v,onCheckedChange:de,parent:b=!1,readOnly:x=!1,render:me,required:C=!1,uncheckedValue:w,value:T,nativeButton:E=!1,style:xe,...O}=e,{clearErrors:k}=ce(),{disabled:A,name:j,setDirty:Se,setFilled:M,setFocused:N,setTouched:Ce,state:P,validationMode:we,validityData:Te,validation:Ee}=re(),De=he(),{labelId:Oe,controlId:ke,registerControlId:F,getDescriptionProps:Ae}=oe(),I=ge(),L=I?.parent,R=L&&I.allValues,z=A||De.disabled||I?.disabled||d,B=j??v,V=T??B,je=g(),Me=g(),H=ke;R?H=b?Me:`${L.id}-${V}`:m&&(H=m);let U={};R&&(b?U=I.parent.getParentProps():V&&(U=I.parent.getChildProps(V)));let{checked:Ne=a,indeterminate:Pe=h,onCheckedChange:Fe,...Ie}=U,W=I?.value,Le=I?.setValue,Re=I?.defaultValue,G=S.useRef(null),K=i(()=>Symbol(`checkbox-control`)),q=S.useRef(!1),{getButtonProps:ze,buttonRef:Be}=se({disabled:z,native:E}),J=I?.validation??Ee,[Y,Ve]=ne({controlled:V&&W&&!b?W.includes(V):Ne,default:V&&Re&&!b?Re.includes(V):l,name:`Checkbox`,state:`checked`}),X=R?!!Ne:Y,Z=R&&Pe||h;ae(()=>{F!==c&&(q.current=!0,F(K.current,H))},[H,F,K]),S.useEffect(()=>{let e=K.current;return()=>{!q.current||F===c||(q.current=!1,F(e,void 0))}},[F,K]),ie(G,je,Y,void 0,!I&&!z,v);let Q=S.useRef(null),He=r(_,Q,J.inputRef,J.registerInput),Ue=pe(u,Oe,Q,!E,H??void 0);ae(()=>{Q.current&&(Q.current.indeterminate=Z,Y&&M(!0))},[Y,Z,M]),fe(Y,()=>{I||(k(B),M(Y),Se(Y!==Te.initialValue),J.change(Y))});let We=ee({checked:Y,disabled:z,form:p,name:b?void 0:B,id:E?void 0:H??void 0,required:C,ref:He,style:B?le:te,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(x){e.preventDefault();return}let t=e.currentTarget.checked,n=f(ue,e.nativeEvent);if(de?.(t,n),!n.isCanceled&&(Fe?.(t,n),!n.isCanceled&&(Ve(t),V&&W&&Le&&!b&&!R))){let e=t?[...W,V]:W.filter(e=>e!==V);Le(e,n)}},onFocus(){G.current?.focus()}},T===void 0?n:{value:(I?Y&&T:T)||``},Ae,e=>J.getValidationProps(z,e));S.useEffect(()=>{if(!L||!V)return;let e=L.disabledStatesRef.current;return e.set(V,z),()=>{e.delete(V)}},[L,z,V]);let $=S.useMemo(()=>({...P,checked:X,disabled:z,readOnly:x,required:C,indeterminate:Z}),[P,X,z,x,C,Z]),Ge=ve($),Ke=s(`span`,e,{state:$,ref:[Be,G,t,I?.registerControlRef],props:[{id:E?H??void 0:je,role:`checkbox`,"aria-checked":Z?`mixed`:X,"aria-readonly":x||void 0,"aria-required":C||void 0,"aria-labelledby":Ue,[be]:b?``:void 0,onFocus(){z||N(!0)},onBlur(){let e=Q.current;e&&(Ce(!0),N(!1),we===`onBlur`&&J.commit(I?W:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),y(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||_e(t)?.click()})},onClick(e){if(x||z)return;e.preventDefault();let t=Q.current;t&&t.dispatchEvent(new(y(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},O,Ie,ze,Ae,e=>J.getValidationProps(z,e)],stateAttributesMapping:Ge});return(0,D.jsxs)(ye.Provider,{value:$,children:[Ke,!Y&&!I&&B&&!b&&w!==void 0&&(0,D.jsx)(`input`,{type:`hidden`,form:p,name:B,value:w,disabled:z}),(0,D.jsx)(`input`,{...We,suppressHydrationWarning:!0})]})}),O=S.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,c=E(),l=c.checked||c.indeterminate,{mounted:ee,transitionStatus:u,setMounted:d}=m(l),f=S.useRef(null),te={...c,transitionStatus:u};p({open:l,ref:f,onComplete(){l||d(!1)}});let ne={...ve(c),...h,..._},re=a||ee,g=s(`span`,e,{ref:[t,f],state:te,stateAttributesMapping:ne,props:o});return re?g:null});function k({className:e,...t}){return(0,D.jsx)(xe,{className:l(`relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none`,e),"data-slot":`checkbox`,...t,children:(0,D.jsx)(O,{className:`-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground`,"data-slot":`checkbox-indicator`,render:(e,t)=>(0,D.jsx)(`span`,{...e,children:t.indeterminate?(0,D.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,D.jsx)(`path`,{d:`M5.252 12h13.496`})}):(0,D.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,D.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})})})})}function A({repos:e,selectedPaths:t,onToggle:n,loading:r,emptyHint:i,className:a}){let[o,s]=(0,S.useState)(``),c=(0,S.useMemo)(()=>{let t=o.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,o]);return(0,D.jsxs)(`div`,{className:l(`flex flex-col gap-2`,a),children:[(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(de,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(v,{value:o,onChange:e=>s(e.target.value),placeholder:`Filter repositories…`,className:`pl-8`,"aria-label":`Filter repositories`})]}),(0,D.jsx)(`div`,{className:`max-h-56 overflow-y-auto rounded-lg border border-border`,children:r?(0,D.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Scanning for repositories…`}):c.length===0?(0,D.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:i??`No repositories found.`}):(0,D.jsx)(`ul`,{className:`divide-y divide-border`,children:c.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 px-3 py-2 hover:bg-accent`,children:[(0,D.jsx)(k,{checked:t.includes(e.path),onCheckedChange:()=>n(e),"aria-label":e.name}),(0,D.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,D.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]})},e.path))})})]})}function j({onCreated:e}){let[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),s=b(),c=async()=>{o(null);try{let{repo:t}=await s.mutateAsync(r.trim());i(``),n(!1),e(t)}catch(e){o(e instanceof Error?e.message:String(e))}};return t?(0,D.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(v,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&r.trim()&&c(),placeholder:`new-repo-name`,className:`h-7 font-mono text-xs`,"aria-label":`New repository name`,autoFocus:!0}),(0,D.jsxs)(d,{size:`xs`,onClick:c,disabled:!r.trim()||s.isPending,children:[s.isPending?(0,D.jsx)(x,{}):null,`Create`]}),(0,D.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>{n(!1),o(null)},children:`Cancel`})]}),a&&(0,D.jsx)(`p`,{className:`text-xs text-destructive-foreground`,children:a})]}):(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`mt-1.5 inline-flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(me,{className:`size-3.5`}),` Scaffold a brand-new repository`]})}export{A as n,k as r,j as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,b as t,c as n,d as r,g as i,i as a,m as o,n as s,o as c,p as l,t as u}from"./button-BDDZnIHx.js";import{$t as d,Ct as f,On as p,a as m,c as ee,en as te,i as ne,l as h,ln as re,n as g,o as ie,on as ae,s as oe,wt as se,yn as ce,zn as le}from"./CSPContext-BG7no5S_.js";import{t as ue}from"./useValueChanged-CStSGSsD.js";import{t as de}from"./useAriaLabelledBy-DfRdwH8a.js";import{At as _,D as v,E as y,O as b,Pt as x,T as S,Vt as C,a as w,k as T}from"./index-C6qbn9Zq.js";import{t as E}from"./badge-CAohJGj6.js";import{t as D}from"./card-BKXzd_5L.js";import{t as O}from"./label-CG5exjag.js";var k=t(e(),1),A=k.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:o,...s}=e;return a(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},s]})}),j=i(),M=s(`relative rounded-xl border px-3.5 py-3 text-card-foreground text-sm`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent dark:bg-input/32 [&_svg]:text-muted-foreground`,error:`border-destructive/32 bg-destructive/4 text-destructive-foreground [&_[data-slot=alert-description]]:text-destructive-foreground/80 [&_svg]:text-destructive`,info:`border-info/32 bg-info/4 [&_svg]:text-info`,success:`border-success/32 bg-success/4 [&_svg]:text-success`,warning:`border-warning/32 bg-warning/4 [&_svg]:text-warning`}}});function N(e){let t=e.props[`data-slot`];if(t)return t;let n=e.type;switch(n.displayName??n.name){case`AlertAction`:return`alert-action`;case`AlertTitle`:return`alert-title`;case`AlertDescription`:return`alert-description`;default:return}}function P({className:e,variant:t,children:n,...r}){let i=[],a=[],s=[];return k.Children.forEach(n,e=>{if(!(0,k.isValidElement)(e)){a.push(e);return}let t=N(e);t===`alert-action`?s.push(e):t===`alert-title`||t===`alert-description`?a.push(e):i.push(e)}),(0,j.jsx)(`div`,{className:o(M({variant:t}),e),"data-slot":`alert`,role:`alert`,...r,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i.length>0&&(0,j.jsx)(`div`,{className:`flex size-4 shrink-0 items-center justify-center [&>svg]:size-full`,children:i}),a.length>0&&(0,j.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:a}),s.length>0&&(0,j.jsx)(`div`,{className:`flex shrink-0 items-center self-center`,children:s})]})})}function F({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`font-medium`,e),"data-slot":`alert-title`,...t})}function I({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`flex flex-col gap-2.5 text-muted-foreground`,e),"data-slot":`alert-description`,...t})}function L({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`flex gap-1`,e),"data-slot":`alert-action`,...t})}F.displayName=`AlertTitle`,I.displayName=`AlertDescription`,L.displayName=`AlertAction`;function R({className:e,orientation:t=`horizontal`,...n}){return(0,j.jsx)(A,{className:o(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch`,e),"data-slot":`separator`,orientation:t,...n})}var z=k.createContext(void 0);function B(){let e=k.useContext(z);if(e===void 0)throw Error(l(63));return e}var V=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),H={...h,checked(e){return e?{[V.checked]:``}:{[V.unchecked]:``}}},U=k.forwardRef(function(e,t){let{checked:i,className:o,defaultChecked:s,"aria-labelledby":l,form:u,id:h,inputRef:g,name:_,nativeButton:v=!1,onCheckedChange:y,readOnly:b=!1,required:x=!1,disabled:S=!1,render:C,uncheckedValue:w,value:T,style:E,...D}=e,{clearErrors:O}=oe(),{state:A,setTouched:M,setDirty:N,validityData:P,setFilled:F,setFocused:I,validationMode:L,disabled:R,name:B,validation:V}=ee(),{labelId:U}=ie(),W=R||S,G=B??_,K=k.useRef(null),fe=r(K,g,V.inputRef),q=k.useRef(null),J=te(),Y=m({id:h,implicit:!1,controlRef:q}),X=v?void 0:Y,[Z,pe]=p({controlled:i,default:!!s,name:`Switch`,state:`checked`});ne(q,J,Z,void 0,!W,_),re(()=>{K.current&&F(K.current.checked)},[K,F]),ue(Z,()=>{O(G),N(Z!==P.initialValue),F(Z),V.change(Z)});let{getButtonProps:me,buttonRef:Q}=ae({disabled:W,native:v}),he=de(l,U,K,!v,X),ge={id:v?Y:J,role:`switch`,"aria-checked":Z,"aria-readonly":b||void 0,"aria-required":x||void 0,"aria-labelledby":he,onFocus(){W||I(!0)},onBlur(){let e=K.current;!e||W||(M(!0),I(!1),L===`onBlur`&&V.commit(e.checked))},onClick(e){if(b||W)return;e.preventDefault();let t=K.current;t&&t.dispatchEvent(new(ce(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},_e=c({checked:Z,disabled:W,form:u,id:X,name:G,required:x,style:G?se:f,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:fe,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(b){e.preventDefault();return}let t=e.currentTarget.checked,n=d(le,e.nativeEvent);y?.(t,n),!n.isCanceled&&pe(t)},onFocus(){q.current?.focus()}},e=>V.getValidationProps(W,e),T===void 0?n:{value:T}),$=k.useMemo(()=>({...A,checked:Z,disabled:W,readOnly:b,required:x}),[A,Z,W,b,x]),ve=a(`span`,e,{state:$,ref:[t,q,Q],props:[ge,D,me,e=>V.getValidationProps(W,e)],stateAttributesMapping:H});return(0,j.jsxs)(z.Provider,{value:$,children:[ve,!Z&&G&&w!==void 0&&(0,j.jsx)(`input`,{type:`hidden`,form:u,name:G,value:w,disabled:W}),(0,j.jsx)(`input`,{..._e,suppressHydrationWarning:!0})]})}),W=k.forwardRef(function(e,t){let{render:n,className:r,style:i,...o}=e;return a(`span`,e,{state:B(),ref:t,stateAttributesMapping:H,props:o})});function G({className:e,...t}){return(0,j.jsx)(U,{className:o(`inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 cursor-pointer items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]`,e),"data-slot":`switch`,...t,children:(0,j.jsx)(W,{className:o(`pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]`),"data-slot":`switch-thumb`})})}function K({config:e,setConfig:t,saveStatus:n,editors:r,adapters:i,saveAppConfig:a,isSettingsFormValid:o,toolsStatus:s,toolsLoading:c,updatingToolId:l,fetchToolsStatus:d,handleUpdateTool:f}){if(!e)return null;let p=r.find(t=>t.command===e.defaultEditor),m=i.find(t=>t.name===(e.storageProvider||`local`));return(0,j.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,j.jsxs)(`header`,{className:`mb-6`,children:[(0,j.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Global Settings`}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Configure your local directories, search parameters, and editor defaults.`})]}),n===`success`&&(0,j.jsxs)(P,{variant:`success`,className:`mb-6`,children:[(0,j.jsx)(C,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,j.jsxs)(P,{variant:`error`,className:`mb-6`,children:[(0,j.jsx)(_,{size:18}),` Error: Could not save configuration details to disk.`]}),(0,j.jsx)(D,{className:`mb-6 rounded-xl p-6 shadow-sm`,children:(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Development Directory`}),(0,j.jsx)(g,{type:`text`,value:e.devDir,onChange:n=>t({...e,devDir:n.target.value})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where your git projects are scanned.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Workspaces Directory`}),(0,j.jsx)(g,{type:`text`,value:e.workspacesDir,onChange:n=>t({...e,workspacesDir:n.target.value})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where unified worktree environments are spun up.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Repo Search Depth`}),(0,j.jsx)(g,{type:`number`,min:1,max:5,value:e.scanDepth,onChange:n=>t({...e,scanDepth:parseInt(n.target.value,10)})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Max directory levels deep the system will traverse for git repos.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Default Assistant`}),(0,j.jsxs)(S,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,j.jsx)(b,{"aria-label":`Default Assistant`,children:(0,j.jsx)(T,{children:e.defaultAssistant===`claude`?`Claude Code`:e.defaultAssistant===`antigravity`?`Antigravity`:e.defaultAssistant===`codex`?`Codex`:e.defaultAssistant===`copilot`?`GitHub Copilot`:e.defaultAssistant===`cursor`?`Cursor`:`None (Prompt me)`})}),(0,j.jsxs)(v,{alignItemWithTrigger:!1,children:[(0,j.jsx)(y,{value:``,children:`None (Prompt me)`}),(0,j.jsx)(y,{value:`claude`,children:`Claude Code`}),(0,j.jsx)(y,{value:`antigravity`,children:`Antigravity`}),(0,j.jsx)(y,{value:`codex`,children:`Codex`}),(0,j.jsx)(y,{value:`copilot`,children:`GitHub Copilot`}),(0,j.jsx)(y,{value:`cursor`,children:`Cursor`})]})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your preferred workspace context manager.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Preferred Editor`}),(0,j.jsxs)(S,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,j.jsx)(b,{"aria-label":`Preferred Editor`,children:(0,j.jsx)(T,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`No preference`})}),(0,j.jsxs)(v,{alignItemWithTrigger:!1,children:[(0,j.jsx)(y,{value:``,children:`No preference`}),r.map(e=>(0,j.jsxs)(y,{value:e.command,children:[e.name,` `,e.detected?`(Detected)`:`(Not found)`]},e.command))]})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Shown first in the “Open with…” workspace chooser.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 md:col-span-2`,children:[(0,j.jsx)(R,{className:`mt-1`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Workspace Storage Settings`}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose where maps, plans, and knowledge files are stored.`})]}),(0,j.jsxs)(`div`,{className:`flex max-w-md flex-col gap-1.5`,children:[(0,j.jsx)(O,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,j.jsxs)(S,{value:e.storageProvider||`local`,onValueChange:n=>{if(typeof n!=`string`)return;let r=n,a={...e,storageProvider:r},o=i.find(e=>e.name===r);o?.configFields?.length&&(a.adapterConfig||={},a.adapterConfig[r]||(a.adapterConfig[r]={}),o.configFields.forEach(e=>{a.adapterConfig[r][e.key]===void 0&&e.default!==void 0&&(a.adapterConfig[r][e.key]=e.default)})),t(a)},children:[(0,j.jsx)(b,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,j.jsx)(T,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,j.jsx)(v,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,j.jsx)(y,{value:e.name,children:e.displayName},e.name)):(0,j.jsx)(y,{value:`local`,children:`Local Workspace (Folders)`})})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m?.description||`Choose where to store maps, plans, and knowledge files. Centralized vault keeps repositories 100% clean and allows Obsidian integration.`})]}),(()=>{let n=e.storageProvider||`local`,r=i.find(e=>e.name===n);return r?.configFields?.length?(0,j.jsxs)(`div`,{className:`flex max-w-md flex-col gap-4 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,j.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[r.displayName,` Settings`]}),r.configFields.map(r=>{let i=e.adapterConfig?.[n]?.[r.key]??r.default??``,a=i=>{let a={...e.adapterConfig||{},[n]:{...e.adapterConfig?.[n]||{},[r.key]:i}};t({...e,adapterConfig:a})};return r.type===`boolean`?(0,j.jsxs)(O,{className:`flex cursor-pointer items-start gap-3 text-sm`,children:[(0,j.jsx)(G,{checked:!!i,onCheckedChange:e=>a(e)}),(0,j.jsxs)(`span`,{className:`flex flex-col`,children:[(0,j.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r.label}),r.description&&(0,j.jsx)(`span`,{className:`mt-0.5 text-xs leading-normal text-muted-foreground`,children:r.description})]})]},r.key):(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:r.label}),(0,j.jsx)(g,{type:r.type===`number`?`number`:`text`,value:i,onChange:e=>{let t=r.type===`number`?Number(e.target.value):e.target.value;a(t)}}),r.description&&(0,j.jsx)(`span`,{className:`text-xs leading-normal text-muted-foreground`,children:r.description})]},r.key)})]}):null})()]})]})}),(0,j.jsxs)(D,{className:`mt-6 rounded-xl p-6 shadow-sm`,children:[(0,j.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`AI Toolchain Updates`}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Monitor and update the CLI packages and assistants in your workflow.`})]}),(0,j.jsxs)(u,{variant:`outline`,size:`sm`,onClick:()=>d(!0),disabled:c,children:[c?(0,j.jsx)(w,{className:`size-3`}):(0,j.jsx)(x,{size:13}),c?`Checking...`:`Check Now`]})]}),c&&s.length===0?(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,j.jsx)(w,{className:`size-6`}),(0,j.jsx)(`span`,{className:`text-xs`,children:`Fetching registry version details...`})]}):s.length===0?(0,j.jsx)(`p`,{className:`py-4 text-xs text-muted-foreground`,children:`No toolchain information available.`}):(0,j.jsx)(`div`,{className:`space-y-4`,children:s.map(e=>(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[e.name,(0,j.jsx)(E,{variant:e.installed?`success`:`secondary`,size:`sm`,children:e.installed?`Installed`:`Not Installed`})]}),(0,j.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,j.jsxs)(`span`,{children:[`Installed version: `,(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.currentVersion})]}),e.installed&&(0,j.jsxs)(`span`,{children:[`Latest: `,(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.latestVersion})]})]}),(0,j.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.updateCmd})]}),(0,j.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:e.updateAvailable?(0,j.jsx)(u,{size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(E,{variant:`success`,className:`gap-1.5`,children:[(0,j.jsx)(C,{size:12}),` Up to Date`]}),(0,j.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{className:`size-3`}),` Reinstalling...`]}):`Reinstall`})]}):(0,j.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{className:`size-3`}),` Installing...`]}):`Install CLI`})})]},e.id))})]}),(0,j.jsx)(`div`,{className:`mb-10 flex justify-end pt-4`,children:(0,j.jsxs)(u,{onClick:()=>a(e),disabled:!o,children:[(0,j.jsx)(C,{size:16}),` Save Configuration`]})})]})}export{K as SettingsPage};
|
|
1
|
+
import{_ as e,b as t,c as n,d as r,g as i,i as a,m as o,n as s,o as c,p as l,t as u}from"./button-BDDZnIHx.js";import{$t as d,Ct as f,On as p,a as m,c as ee,en as te,i as ne,l as h,ln as re,n as g,o as ie,on as ae,s as oe,wt as se,yn as ce,zn as le}from"./CSPContext-BG7no5S_.js";import{t as ue}from"./useValueChanged-CStSGSsD.js";import{t as de}from"./useAriaLabelledBy-DfRdwH8a.js";import{At as _,D as v,E as y,O as b,Pt as x,T as S,Vt as C,a as w,k as T}from"./index-pxzwuRLq.js";import{t as E}from"./badge-CAohJGj6.js";import{t as D}from"./card-BKXzd_5L.js";import{t as O}from"./label-CG5exjag.js";var k=t(e(),1),A=k.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:o,...s}=e;return a(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},s]})}),j=i(),M=s(`relative rounded-xl border px-3.5 py-3 text-card-foreground text-sm`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent dark:bg-input/32 [&_svg]:text-muted-foreground`,error:`border-destructive/32 bg-destructive/4 text-destructive-foreground [&_[data-slot=alert-description]]:text-destructive-foreground/80 [&_svg]:text-destructive`,info:`border-info/32 bg-info/4 [&_svg]:text-info`,success:`border-success/32 bg-success/4 [&_svg]:text-success`,warning:`border-warning/32 bg-warning/4 [&_svg]:text-warning`}}});function N(e){let t=e.props[`data-slot`];if(t)return t;let n=e.type;switch(n.displayName??n.name){case`AlertAction`:return`alert-action`;case`AlertTitle`:return`alert-title`;case`AlertDescription`:return`alert-description`;default:return}}function P({className:e,variant:t,children:n,...r}){let i=[],a=[],s=[];return k.Children.forEach(n,e=>{if(!(0,k.isValidElement)(e)){a.push(e);return}let t=N(e);t===`alert-action`?s.push(e):t===`alert-title`||t===`alert-description`?a.push(e):i.push(e)}),(0,j.jsx)(`div`,{className:o(M({variant:t}),e),"data-slot":`alert`,role:`alert`,...r,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i.length>0&&(0,j.jsx)(`div`,{className:`flex size-4 shrink-0 items-center justify-center [&>svg]:size-full`,children:i}),a.length>0&&(0,j.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:a}),s.length>0&&(0,j.jsx)(`div`,{className:`flex shrink-0 items-center self-center`,children:s})]})})}function F({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`font-medium`,e),"data-slot":`alert-title`,...t})}function I({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`flex flex-col gap-2.5 text-muted-foreground`,e),"data-slot":`alert-description`,...t})}function L({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`flex gap-1`,e),"data-slot":`alert-action`,...t})}F.displayName=`AlertTitle`,I.displayName=`AlertDescription`,L.displayName=`AlertAction`;function R({className:e,orientation:t=`horizontal`,...n}){return(0,j.jsx)(A,{className:o(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch`,e),"data-slot":`separator`,orientation:t,...n})}var z=k.createContext(void 0);function B(){let e=k.useContext(z);if(e===void 0)throw Error(l(63));return e}var V=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),H={...h,checked(e){return e?{[V.checked]:``}:{[V.unchecked]:``}}},U=k.forwardRef(function(e,t){let{checked:i,className:o,defaultChecked:s,"aria-labelledby":l,form:u,id:h,inputRef:g,name:_,nativeButton:v=!1,onCheckedChange:y,readOnly:b=!1,required:x=!1,disabled:S=!1,render:C,uncheckedValue:w,value:T,style:E,...D}=e,{clearErrors:O}=oe(),{state:A,setTouched:M,setDirty:N,validityData:P,setFilled:F,setFocused:I,validationMode:L,disabled:R,name:B,validation:V}=ee(),{labelId:U}=ie(),W=R||S,G=B??_,K=k.useRef(null),fe=r(K,g,V.inputRef),q=k.useRef(null),J=te(),Y=m({id:h,implicit:!1,controlRef:q}),X=v?void 0:Y,[Z,pe]=p({controlled:i,default:!!s,name:`Switch`,state:`checked`});ne(q,J,Z,void 0,!W,_),re(()=>{K.current&&F(K.current.checked)},[K,F]),ue(Z,()=>{O(G),N(Z!==P.initialValue),F(Z),V.change(Z)});let{getButtonProps:me,buttonRef:Q}=ae({disabled:W,native:v}),he=de(l,U,K,!v,X),ge={id:v?Y:J,role:`switch`,"aria-checked":Z,"aria-readonly":b||void 0,"aria-required":x||void 0,"aria-labelledby":he,onFocus(){W||I(!0)},onBlur(){let e=K.current;!e||W||(M(!0),I(!1),L===`onBlur`&&V.commit(e.checked))},onClick(e){if(b||W)return;e.preventDefault();let t=K.current;t&&t.dispatchEvent(new(ce(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},_e=c({checked:Z,disabled:W,form:u,id:X,name:G,required:x,style:G?se:f,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:fe,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(b){e.preventDefault();return}let t=e.currentTarget.checked,n=d(le,e.nativeEvent);y?.(t,n),!n.isCanceled&&pe(t)},onFocus(){q.current?.focus()}},e=>V.getValidationProps(W,e),T===void 0?n:{value:T}),$=k.useMemo(()=>({...A,checked:Z,disabled:W,readOnly:b,required:x}),[A,Z,W,b,x]),ve=a(`span`,e,{state:$,ref:[t,q,Q],props:[ge,D,me,e=>V.getValidationProps(W,e)],stateAttributesMapping:H});return(0,j.jsxs)(z.Provider,{value:$,children:[ve,!Z&&G&&w!==void 0&&(0,j.jsx)(`input`,{type:`hidden`,form:u,name:G,value:w,disabled:W}),(0,j.jsx)(`input`,{..._e,suppressHydrationWarning:!0})]})}),W=k.forwardRef(function(e,t){let{render:n,className:r,style:i,...o}=e;return a(`span`,e,{state:B(),ref:t,stateAttributesMapping:H,props:o})});function G({className:e,...t}){return(0,j.jsx)(U,{className:o(`inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 cursor-pointer items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]`,e),"data-slot":`switch`,...t,children:(0,j.jsx)(W,{className:o(`pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]`),"data-slot":`switch-thumb`})})}function K({config:e,setConfig:t,saveStatus:n,editors:r,adapters:i,saveAppConfig:a,isSettingsFormValid:o,toolsStatus:s,toolsLoading:c,updatingToolId:l,fetchToolsStatus:d,handleUpdateTool:f}){if(!e)return null;let p=r.find(t=>t.command===e.defaultEditor),m=i.find(t=>t.name===(e.storageProvider||`local`));return(0,j.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,j.jsxs)(`header`,{className:`mb-6`,children:[(0,j.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Global Settings`}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Configure your local directories, search parameters, and editor defaults.`})]}),n===`success`&&(0,j.jsxs)(P,{variant:`success`,className:`mb-6`,children:[(0,j.jsx)(C,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,j.jsxs)(P,{variant:`error`,className:`mb-6`,children:[(0,j.jsx)(_,{size:18}),` Error: Could not save configuration details to disk.`]}),(0,j.jsx)(D,{className:`mb-6 rounded-xl p-6 shadow-sm`,children:(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Development Directory`}),(0,j.jsx)(g,{type:`text`,value:e.devDir,onChange:n=>t({...e,devDir:n.target.value})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where your git projects are scanned.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Workspaces Directory`}),(0,j.jsx)(g,{type:`text`,value:e.workspacesDir,onChange:n=>t({...e,workspacesDir:n.target.value})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where unified worktree environments are spun up.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Repo Search Depth`}),(0,j.jsx)(g,{type:`number`,min:1,max:5,value:e.scanDepth,onChange:n=>t({...e,scanDepth:parseInt(n.target.value,10)})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Max directory levels deep the system will traverse for git repos.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Default Assistant`}),(0,j.jsxs)(S,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,j.jsx)(b,{"aria-label":`Default Assistant`,children:(0,j.jsx)(T,{children:e.defaultAssistant===`claude`?`Claude Code`:e.defaultAssistant===`antigravity`?`Antigravity`:e.defaultAssistant===`codex`?`Codex`:e.defaultAssistant===`copilot`?`GitHub Copilot`:e.defaultAssistant===`cursor`?`Cursor`:`None (Prompt me)`})}),(0,j.jsxs)(v,{alignItemWithTrigger:!1,children:[(0,j.jsx)(y,{value:``,children:`None (Prompt me)`}),(0,j.jsx)(y,{value:`claude`,children:`Claude Code`}),(0,j.jsx)(y,{value:`antigravity`,children:`Antigravity`}),(0,j.jsx)(y,{value:`codex`,children:`Codex`}),(0,j.jsx)(y,{value:`copilot`,children:`GitHub Copilot`}),(0,j.jsx)(y,{value:`cursor`,children:`Cursor`})]})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your preferred workspace context manager.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:`Preferred Editor`}),(0,j.jsxs)(S,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,j.jsx)(b,{"aria-label":`Preferred Editor`,children:(0,j.jsx)(T,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`No preference`})}),(0,j.jsxs)(v,{alignItemWithTrigger:!1,children:[(0,j.jsx)(y,{value:``,children:`No preference`}),r.map(e=>(0,j.jsxs)(y,{value:e.command,children:[e.name,` `,e.detected?`(Detected)`:`(Not found)`]},e.command))]})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Shown first in the “Open with…” workspace chooser.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 md:col-span-2`,children:[(0,j.jsx)(R,{className:`mt-1`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Workspace Storage Settings`}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose where maps, plans, and knowledge files are stored.`})]}),(0,j.jsxs)(`div`,{className:`flex max-w-md flex-col gap-1.5`,children:[(0,j.jsx)(O,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,j.jsxs)(S,{value:e.storageProvider||`local`,onValueChange:n=>{if(typeof n!=`string`)return;let r=n,a={...e,storageProvider:r},o=i.find(e=>e.name===r);o?.configFields?.length&&(a.adapterConfig||={},a.adapterConfig[r]||(a.adapterConfig[r]={}),o.configFields.forEach(e=>{a.adapterConfig[r][e.key]===void 0&&e.default!==void 0&&(a.adapterConfig[r][e.key]=e.default)})),t(a)},children:[(0,j.jsx)(b,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,j.jsx)(T,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,j.jsx)(v,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,j.jsx)(y,{value:e.name,children:e.displayName},e.name)):(0,j.jsx)(y,{value:`local`,children:`Local Workspace (Folders)`})})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m?.description||`Choose where to store maps, plans, and knowledge files. Centralized vault keeps repositories 100% clean and allows Obsidian integration.`})]}),(()=>{let n=e.storageProvider||`local`,r=i.find(e=>e.name===n);return r?.configFields?.length?(0,j.jsxs)(`div`,{className:`flex max-w-md flex-col gap-4 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,j.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[r.displayName,` Settings`]}),r.configFields.map(r=>{let i=e.adapterConfig?.[n]?.[r.key]??r.default??``,a=i=>{let a={...e.adapterConfig||{},[n]:{...e.adapterConfig?.[n]||{},[r.key]:i}};t({...e,adapterConfig:a})};return r.type===`boolean`?(0,j.jsxs)(O,{className:`flex cursor-pointer items-start gap-3 text-sm`,children:[(0,j.jsx)(G,{checked:!!i,onCheckedChange:e=>a(e)}),(0,j.jsxs)(`span`,{className:`flex flex-col`,children:[(0,j.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r.label}),r.description&&(0,j.jsx)(`span`,{className:`mt-0.5 text-xs leading-normal text-muted-foreground`,children:r.description})]})]},r.key):(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(O,{className:`text-sm`,children:r.label}),(0,j.jsx)(g,{type:r.type===`number`?`number`:`text`,value:i,onChange:e=>{let t=r.type===`number`?Number(e.target.value):e.target.value;a(t)}}),r.description&&(0,j.jsx)(`span`,{className:`text-xs leading-normal text-muted-foreground`,children:r.description})]},r.key)})]}):null})()]})]})}),(0,j.jsxs)(D,{className:`mt-6 rounded-xl p-6 shadow-sm`,children:[(0,j.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`AI Toolchain Updates`}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Monitor and update the CLI packages and assistants in your workflow.`})]}),(0,j.jsxs)(u,{variant:`outline`,size:`sm`,onClick:()=>d(!0),disabled:c,children:[c?(0,j.jsx)(w,{className:`size-3`}):(0,j.jsx)(x,{size:13}),c?`Checking...`:`Check Now`]})]}),c&&s.length===0?(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,j.jsx)(w,{className:`size-6`}),(0,j.jsx)(`span`,{className:`text-xs`,children:`Fetching registry version details...`})]}):s.length===0?(0,j.jsx)(`p`,{className:`py-4 text-xs text-muted-foreground`,children:`No toolchain information available.`}):(0,j.jsx)(`div`,{className:`space-y-4`,children:s.map(e=>(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[e.name,(0,j.jsx)(E,{variant:e.installed?`success`:`secondary`,size:`sm`,children:e.installed?`Installed`:`Not Installed`})]}),(0,j.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,j.jsxs)(`span`,{children:[`Installed version: `,(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.currentVersion})]}),e.installed&&(0,j.jsxs)(`span`,{children:[`Latest: `,(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.latestVersion})]})]}),(0,j.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.updateCmd})]}),(0,j.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:e.updateAvailable?(0,j.jsx)(u,{size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(E,{variant:`success`,className:`gap-1.5`,children:[(0,j.jsx)(C,{size:12}),` Up to Date`]}),(0,j.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{className:`size-3`}),` Reinstalling...`]}):`Reinstall`})]}):(0,j.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{className:`size-3`}),` Installing...`]}):`Install CLI`})})]},e.id))})]}),(0,j.jsx)(`div`,{className:`mb-10 flex justify-end pt-4`,children:(0,j.jsxs)(u,{onClick:()=>a(e),disabled:!o,children:[(0,j.jsx)(C,{size:16}),` Save Configuration`]})})]})}export{K as SettingsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{n as o}from"./CSPContext-BG7no5S_.js";import{t as ee}from"./chevron-down-qTL8HPug.js";import{a as s,c as te,i as ne,l as re,n as ie,o as ae,r as c,s as l,t as oe,u as se}from"./square-DlIYnlSq.js";import{t as u}from"./code-xml-jFAa3-TT.js";import{t as ce}from"./cpu-Cdwd84Jz.js";import{a as le,h as ue,m as de}from"./store-D7ixdVck.js";import{t as d}from"./trash-2-CtR35_eF.js";import{t as f}from"./zap-CWG_Lvki.js";import{$ as fe,B as pe,Ft as p,Ht as m,Lt as me,Mt as he,N as ge,V as _e,Vt as h,X as ve,Z as ye,a as be,c as g,d as _,et as xe,f as v,jt as y,l as b,o as x,ot as Se,p as Ce,s as S,st as we}from"./index-
|
|
1
|
+
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{n as o}from"./CSPContext-BG7no5S_.js";import{t as ee}from"./chevron-down-qTL8HPug.js";import{a as s,c as te,i as ne,l as re,n as ie,o as ae,r as c,s as l,t as oe,u as se}from"./square-DlIYnlSq.js";import{t as u}from"./code-xml-jFAa3-TT.js";import{t as ce}from"./cpu-Cdwd84Jz.js";import{a as le,h as ue,m as de}from"./store-D7ixdVck.js";import{t as d}from"./trash-2-CtR35_eF.js";import{t as f}from"./zap-CWG_Lvki.js";import{$ as fe,B as pe,Ft as p,Ht as m,Lt as me,Mt as he,N as ge,V as _e,Vt as h,X as ve,Z as ye,a as be,c as g,d as _,et as xe,f as v,jt as y,l as b,o as x,ot as Se,p as Ce,s as S,st as we}from"./index-pxzwuRLq.js";import{t as C}from"./badge-CAohJGj6.js";import{t as Te}from"./card-BKXzd_5L.js";import{a as Ee,i as De,n as Oe,r as ke,t as Ae}from"./empty-BdlgbifD.js";import{t as w}from"./label-CG5exjag.js";import{t as je}from"./textarea-BNRuIXNs.js";var Me=r(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Ne=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Pe=r(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Fe=r(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Ie=r(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),T=t(e(),1),E=n(),D={"git-pull-request":ae,"flask-conical":l,package:ne,database:re,"shield-check":c,terminal:y,zap:f,cpu:ce,layers:s,boxes:m,code:u},Le=[{label:`Blue`,value:`#3b82f6`},{label:`Green`,value:`#10b981`},{label:`Purple`,value:`#8b5cf6`},{label:`Amber`,value:`#f59e0b`},{label:`Red`,value:`#ef4444`},{label:`Cyan`,value:`#06b6d4`},{label:`Pink`,value:`#ec4899`},{label:`Emerald`,value:`#059669`}];function O({showToast:e}){let[t,n]=(0,T.useState)(`global`),[r,s]=(0,T.useState)(``),[ne,re]=(0,T.useState)({}),[ae,c]=(0,T.useState)(!1),[l,u]=(0,T.useState)(null),[ce,f]=(0,T.useState)(!1),[y,O]=(0,T.useState)(null),[Re,k]=(0,T.useState)(!1),[A,j]=(0,T.useState)(`edit`),[ze,M]=(0,T.useState)(!1),[N,P]=(0,T.useState)(null),[Be,F]=(0,T.useState)(!1),[I,L]=(0,T.useState)(null),[R,Ve]=(0,T.useState)(null),[z,B]=(0,T.useState)(null),{data:V=[],isLoading:He}=fe(),{data:H=[],isLoading:Ue}=xe(t===`global`?void 0:t),{data:We=[]}=we(),{data:U,isLoading:Ge,isError:Ke}=Se(t===`global`?``:t),[W,G]=(0,T.useState)(null),qe=ye(),Je=_e(),K=ve(),Ye=pe(),q=ge(),J=t!==`global`,Y=new Set(W??U?.enabledSkills??[]),X=!J||!Ge&&!Ke&&!!U;(0,T.useEffect)(()=>{if(!J){G(null);return}U&&G([...U.enabledSkills])},[J,t,U]);let Xe=e=>{re(t=>({...t,[e]:!t[e]}))},Z=H.filter(e=>{if(!r.trim())return!0;let t=r.toLowerCase();return e.title?.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))}),Ze=V.reduce((e,t)=>(e[t.id]=Z.filter(e=>e.category===t.id),e),{}),Q=Z.filter(e=>!e.category||!V.some(t=>t.id===e.category)),Qe=e=>{u(e||{name:``,description:``,icon:`boxes`,color:`#3b82f6`,custom:!0}),c(!0)},$e=async()=>{if(!(!l||!l.name?.trim()))try{await qe.mutateAsync({id:l.id,name:l.name.trim(),description:l.description,icon:l.icon,color:l.color}),e?.(`Category saved successfully`,`success`),c(!1),u(null)}catch(t){e?.(`Failed to save category`,`error`),console.error(t)}},et=(e,t)=>{t.stopPropagation(),L({type:`category`,id:e.id,title:e.name}),F(!0)},$=(e,t)=>{O(e||{name:``,title:``,category:t||(V[0]?.id??`pull-requests`),description:``,tags:[],allowedTools:[],content:`# Skill Title
|
|
2
2
|
|
|
3
3
|
Instructions and playbook for the AI assistant.
|
|
4
4
|
`,custom:!0}),k(!!e),j(`edit`),f(!0)},tt=e=>{if(!y)return;let t={...y,title:e};!Re&&!y.id&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),O(t)},nt=async()=>{if(!y||!y.name?.trim()||!y.description?.trim()||!y.content?.trim()){e?.(`Skill name, trigger description, and content are required`,`error`);return}try{await K.mutateAsync({id:y.id,name:y.name.trim(),title:y.title||y.name,category:y.category||`general`,description:y.description||``,tags:y.tags||[],allowedTools:y.allowedTools||[],content:y.content}),e?.(`Skill package saved successfully`,`success`),f(!1),O(null)}catch(t){e?.(`Failed to save skill`,`error`),console.error(t)}},rt=(e,t)=>{t.stopPropagation(),L({type:`skill`,id:e.id,title:e.title||e.name}),F(!0)},it=async()=>{if(I)try{I.type===`category`?(await Je.mutateAsync(I.id),e?.(`Category deleted`,`info`)):(await Ye.mutateAsync(I.id),e?.(`Skill package deleted`,`info`)),F(!1),L(null)}catch(t){e?.(`Failed to delete item`,`error`),console.error(t)}},at=e=>{if(!J||!X||W===null)return;let t=new Set(W);t.has(e)?t.delete(e):t.add(e),G(Array.from(t))},ot=()=>{if(!y||y.custom!==!1)return;let e=`${y.name}-copy`;O({...y,id:void 0,name:e,title:`${y.title||y.name} Copy`,allowedTools:[],custom:!0,sourcePath:void 0,references:void 0,scripts:void 0}),k(!0)},st=(e,t)=>{if(!J||!X||W===null)return;let n=Ze[e]||[],r=new Set(W);for(let e of n)t?r.add(e.id):r.delete(e.id);G(Array.from(r))},ct=async()=>{if(!(!U||W===null||!J))try{await q.mutateAsync({workspaceId:t,expectedRevision:U.revision??0,enabledSkills:W,enabledAgents:U.enabledAgents??[],enabledCategories:V.map(e=>e.id)}),e?.(`Skill selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save skill selection`,`error`)}},lt=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`,Ve(t)},ut=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,z!==t&&B(t)},dt=()=>{B(null)},ft=async(t,n)=>{t.preventDefault(),B(null);let r=t.dataTransfer.getData(`text/plain`)||R;if(Ve(null),!r)return;let i=H.find(e=>e.id===r);!i||!i.custom||J||i.category===n||(await K.mutateAsync({id:i.id,name:i.name,title:i.title,description:i.description,tags:i.tags,allowedTools:i.allowedTools,content:i.content,category:n}),e?.(`Skill re-categorized`,`success`))},pt=(e,t)=>{t.stopPropagation(),P(e),M(!0)},mt=async t=>{if(!N||N.category===t){M(!1),P(null);return}await K.mutateAsync({id:N.id,name:N.name,title:N.title,description:N.description,tags:N.tags,allowedTools:N.allowedTools,content:N.content,category:t}),e?.(`Skill moved to category`,`success`),M(!1),P(null)};return(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col h-full overflow-hidden bg-background text-foreground`,children:[(0,E.jsxs)(`div`,{className:`p-6 border-b border-border flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-card/40 backdrop-blur-sm`,children:[(0,E.jsx)(`div`,{children:(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,E.jsx)(m,{className:`h-6 w-6`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Skill Library`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create, organize, and assign reusable Agent Skill packages.`})]})]})}),(0,E.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,E.jsx)(a,{render:(0,E.jsx)(le,{to:`/agents`}),variant:`outline`,size:`sm`,children:`Codex Agents`}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/50 rounded-lg px-3 py-1.5 border border-border`,children:[(0,E.jsx)(me,{className:`h-4 w-4 text-muted-foreground`}),(0,E.jsx)(w,{htmlFor:`skill-scope`,className:`text-xs font-medium text-muted-foreground`,children:`Scope:`}),(0,E.jsxs)(`select`,{id:`skill-scope`,value:t,onChange:e=>n(e.target.value),className:`bg-transparent text-xs font-semibold focus:outline-none cursor-pointer text-foreground`,children:[(0,E.jsx)(`option`,{value:`global`,className:`bg-popover text-popover-foreground`,children:`🌐 Global Skills Catalog`}),We.map(e=>(0,E.jsxs)(`option`,{value:e.id,className:`bg-popover text-popover-foreground`,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))]})]}),J&&(0,E.jsx)(a,{size:`sm`,onClick:ct,disabled:!X||q.isPending||W===null,children:q.isPending?`Saving…`:`Save selection`}),!J&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>Qe(),className:`flex items-center gap-1.5`,children:[(0,E.jsx)(p,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`New Category`})]}),(0,E.jsxs)(a,{variant:`default`,size:`sm`,onClick:()=>$(),className:`flex items-center gap-1.5`,children:[(0,E.jsx)(he,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`New Skill`})]})]})]})]}),(0,E.jsxs)(`div`,{className:`px-6 py-3 border-b border-border/60 bg-muted/20 flex items-center justify-between gap-4`,children:[(0,E.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,E.jsx)(ue,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,E.jsx)(o,{value:r,onChange:e=>s(e.target.value),placeholder:`Search skills by keyword, tag, or tool...`,className:`pl-9 pr-8 h-9 text-xs`}),r&&(0,E.jsx)(`button`,{onClick:()=>s(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(de,{className:`h-3.5 w-3.5`})})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,E.jsxs)(`span`,{children:[`Showing `,(0,E.jsx)(`strong`,{className:`text-foreground`,children:Z.length}),` of`,` `,(0,E.jsx)(`strong`,{className:`text-foreground`,children:H.length}),` skills`]}),J&&(0,E.jsxs)(C,{variant:`secondary`,className:`text-[10px] uppercase font-mono`,children:[`Workspace Mode (`,Y.size,` active)`]})]})]}),(0,E.jsx)(Ce,{className:`flex-1 p-6`,children:He||Ue||J&&Ge?(0,E.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,E.jsx)(be,{}),(0,E.jsx)(`span`,{className:`text-sm`,children:`Loading skills catalog...`})]}):J&&Ke?(0,E.jsx)(Ae,{className:`py-12 border border-dashed rounded-xl`,children:(0,E.jsxs)(ke,{children:[(0,E.jsx)(Ee,{children:`Workspace resources could not be loaded`}),(0,E.jsx)(Oe,{children:`Assignment controls are disabled so an existing selection cannot be overwritten.`})]})}):Z.length===0&&r?(0,E.jsxs)(Ae,{className:`py-12 border border-dashed rounded-xl`,children:[(0,E.jsx)(De,{children:(0,E.jsx)(ue,{className:`h-8 w-8 text-muted-foreground/60`})}),(0,E.jsxs)(ke,{children:[(0,E.jsx)(Ee,{children:`No matching skills found`}),(0,E.jsxs)(Oe,{children:[`No skills matched your search query "`,r,`".`]})]}),(0,E.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>s(``),children:`Clear Search`})]}):(0,E.jsxs)(`div`,{className:`space-y-6 max-w-7xl mx-auto pb-12`,children:[V.map(e=>{let t=D[e.icon||`boxes`]||m,n=Ze[e.id]||[],r=!!ne[e.id],o=z===e.id,s=n.length>0&&n.every(e=>Y.has(e.id));return(0,E.jsxs)(`div`,{onDragOver:t=>ut(t,e.id),onDragLeave:dt,onDrop:t=>ft(t,e.id),className:i(`border rounded-xl transition-all duration-150 overflow-hidden bg-card/60`,o?`border-primary ring-2 ring-primary/20 bg-primary/5`:`border-border`),children:[(0,E.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>Xe(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Xe(e.id))},className:`p-4 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors border-b border-border/40 select-none`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`p-2 rounded-lg text-white shadow-sm flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,E.jsx)(t,{className:`h-4 w-4`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`h2`,{className:`font-semibold text-sm tracking-tight`,children:e.name}),(0,E.jsxs)(C,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[n.length,` `,n.length===1?`skill`:`skills`]}),e.isTemplate&&!e.custom&&(0,E.jsx)(C,{variant:`secondary`,className:`text-[9px] px-1 py-0 uppercase`,children:`Template`})]}),e.description&&(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[J&&n.length>0&&(0,E.jsxs)(a,{variant:`ghost`,size:`xs`,onClick:()=>st(e.id,!s),className:`h-7 text-xs mr-2 text-muted-foreground hover:text-foreground`,title:s?`Deselect all in category`:`Select all in category`,children:[s?(0,E.jsx)(ie,{className:`h-3.5 w-3.5 mr-1 text-primary`}):(0,E.jsx)(oe,{className:`h-3.5 w-3.5 mr-1`}),(0,E.jsx)(`span`,{children:s?`Deselect All`:`Select All`})]}),!J&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>$(void 0,e.id),title:`Add skill to this category`,children:(0,E.jsx)(p,{className:`h-3.5 w-3.5`})}),!J&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>Qe(e),title:`Edit category`,children:(0,E.jsx)(Fe,{className:`h-3 w-3`})}),!J&&e.custom&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>et(e,t),title:`Delete category`,className:`text-destructive hover:text-destructive`,children:(0,E.jsx)(d,{className:`h-3 w-3`})}),(0,E.jsx)(`div`,{className:`p-1 text-muted-foreground`,children:r?(0,E.jsx)(se,{className:`h-4 w-4`}):(0,E.jsx)(ee,{className:`h-4 w-4`})})]})]}),!r&&(0,E.jsx)(`div`,{className:`p-4 bg-background/50`,children:n.length===0?(0,E.jsxs)(`div`,{className:`border border-dashed border-border/80 rounded-lg p-6 text-center text-xs text-muted-foreground`,children:[`No skills in this category.`,!J&&(0,E.jsxs)(E.Fragment,{children:[` `,`Drag a custom skill here, or click`,` `,(0,E.jsx)(`button`,{onClick:()=>$(void 0,e.id),className:`text-primary underline font-medium`,children:`+ Add Skill`})]})]}):(0,E.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:n.map(e=>{let t=Y.has(e.id);return(0,E.jsxs)(Te,{draggable:!J&&!!e.custom,onDragStart:t=>{!J&&e.custom&<(t,e.id)},onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:i(`group relative cursor-pointer hover:border-primary/60 transition-all p-3.5 flex flex-col justify-between select-none shadow-sm`,J&&!t&&`opacity-60 bg-muted/20`,R===e.id&&`opacity-40 border-dashed`),children:[(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground group-hover:text-foreground cursor-grab active:cursor-grabbing`,title:`Drag to reorder or re-categorize`,"aria-label":`Drag handle`,children:[(0,E.jsx)(Pe,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground`,children:e.title||e.name})]}),J?(0,E.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),at(e.id)},disabled:!X||q.isPending,className:i(`h-5 px-2 rounded-md flex items-center gap-1 text-[10px] font-semibold transition-colors`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-muted/80`),children:[(0,E.jsx)(h,{className:i(`h-3 w-3`,!t&&`opacity-0`)}),(0,E.jsx)(`span`,{children:t?`Enabled`:`Disabled`})]}):(0,E.jsx)(C,{variant:`outline`,className:`text-[10px] font-mono`,children:e.custom?`Custom`:`Template`})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-3 leading-relaxed`,children:e.description||`No description provided.`})]}),(0,E.jsxs)(`div`,{className:`pt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags?.slice(0,2).map(e=>(0,E.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)),e.allowedTools&&e.allowedTools.length>0&&(0,E.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,E.jsx)(Ie,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[!J&&e.custom&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>pt(e,t),title:`Move to another category`,className:`h-6 w-6 text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(Me,{className:`h-3 w-3`})}),!J&&e.custom&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>rt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive`,children:(0,E.jsx)(d,{className:`h-3 w-3`})})]})]})]},e.id)})})})]},e.id)}),Q.length>0&&(0,E.jsxs)(`div`,{className:`border border-border/80 rounded-xl overflow-hidden bg-card/60`,children:[(0,E.jsx)(`div`,{className:`p-4 bg-muted/30 border-b border-border/40 flex items-center justify-between`,children:(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}),(0,E.jsx)(`h2`,{className:`font-semibold text-sm`,children:`Uncategorized Skills`}),(0,E.jsx)(C,{variant:`outline`,className:`text-[10px]`,children:Q.length})]})}),(0,E.jsx)(`div`,{className:`p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:Q.map(e=>(0,E.jsxs)(Te,{onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:`p-3.5 cursor-pointer hover:border-primary/60`,children:[(0,E.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,E.jsx)(`div`,{className:`font-mono text-xs font-bold`,children:e.title||e.name}),J&&(0,E.jsx)(a,{size:`xs`,variant:Y.has(e.id)?`default`:`outline`,disabled:!X||q.isPending,onClick:t=>{t.stopPropagation(),at(e.id)},children:Y.has(e.id)?`Enabled`:`Disabled`})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]},e.id))})]})]})}),(0,E.jsx)(x,{open:ae,onOpenChange:c,children:(0,E.jsxs)(_,{className:`sm:max-w-lg`,children:[(0,E.jsxs)(b,{children:[(0,E.jsx)(v,{children:l?.id?`Edit Skill Category`:`Create Skill Category`}),(0,E.jsx)(S,{children:`Categories group related procedural skills and agent tools into clean visual boxes.`})]}),(0,E.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`cat-name`,className:`text-xs font-medium`,children:`Category Name`}),(0,E.jsx)(o,{id:`cat-name`,value:l?.name||``,onChange:e=>u(t=>t?{...t,name:e.target.value}:null),placeholder:`e.g. Pull Requests & Review`,className:`mt-1 text-xs`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`cat-desc`,className:`text-xs font-medium`,children:`Description`}),(0,E.jsx)(o,{id:`cat-desc`,value:l?.description||``,onChange:e=>u(t=>t?{...t,description:e.target.value}:null),placeholder:`Brief summary of what skills belong in this box...`,className:`mt-1 text-xs`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{className:`text-xs font-medium`,children:`Icon`}),(0,E.jsx)(`div`,{className:`grid grid-cols-6 gap-2 mt-1.5`,children:Object.keys(D).map(e=>{let t=D[e];return(0,E.jsx)(`button`,{type:`button`,onClick:()=>u(t=>t?{...t,icon:e}:null),className:i(`p-2.5 rounded-lg border flex items-center justify-center transition-colors`,(l?.icon||`boxes`)===e?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted text-muted-foreground`),children:(0,E.jsx)(t,{className:`h-4 w-4`})},e)})})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{className:`text-xs font-medium`,children:`Color Accent`}),(0,E.jsx)(`div`,{className:`flex items-center gap-2 mt-1.5 flex-wrap`,children:Le.map(e=>{let t=l?.color===e.value;return(0,E.jsx)(`button`,{type:`button`,"aria-label":`Select color ${e.label}`,onClick:()=>u(t=>t?{...t,color:e.value}:null),className:i(`w-7 h-7 rounded-full transition-transform flex items-center justify-center shadow-sm`,t?`scale-110 ring-2 ring-primary ring-offset-2`:`hover:scale-105`),style:{backgroundColor:e.value},children:t&&(0,E.jsx)(h,{className:`h-3.5 w-3.5 text-white`})},e.value)})})]})]}),(0,E.jsxs)(g,{children:[(0,E.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>c(!1),children:`Cancel`}),(0,E.jsx)(a,{variant:`default`,size:`sm`,onClick:$e,disabled:!l?.name?.trim(),children:`Save Category`})]})]})}),(0,E.jsx)(x,{open:ce,onOpenChange:f,children:(0,E.jsxs)(_,{className:`sm:max-w-3xl max-h-[90vh] flex flex-col`,children:[(0,E.jsx)(b,{children:(0,E.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(v,{children:y?.id?`Edit Skill Package`:`Create New Skill`}),(0,E.jsx)(S,{children:`Configure SKILL.md metadata triggers and markdown playbook instructions.`})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/60 p-1 rounded-lg border border-border text-xs`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>j(`edit`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,A===`edit`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,E.jsx)(te,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`Edit`})]}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>j(`preview`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,A===`preview`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,E.jsx)(Ne,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`Preview`})]})]})]})}),(0,E.jsx)(Ce,{className:`flex-1 pr-4 py-2`,children:A===`edit`?(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,E.jsx)(o,{id:`skill-title`,value:y?.title||``,onChange:e=>tt(e.target.value),placeholder:`e.g. Pull Request Reviewer`,className:`mt-1 text-xs`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,E.jsx)(o,{id:`skill-name`,value:y?.name||``,disabled:!!y?.id,onChange:e=>{k(!0),O(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. pr-review-toolkit`,className:`mt-1 text-xs font-mono`})]})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-cat`,className:`text-xs font-medium`,children:`Category Box`}),(0,E.jsx)(`select`,{id:`skill-cat`,value:y?.category||``,onChange:e=>O(t=>t?{...t,category:e.target.value}:null),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-primary`,children:V.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-tags`,className:`text-xs font-medium`,children:`Tags (comma separated)`}),(0,E.jsx)(o,{id:`skill-tags`,value:y?.tags?.join(`, `)||``,onChange:e=>O(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. git, pr, quality`,className:`mt-1 text-xs font-mono`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (for AI Autonomous Discovery)`}),(0,E.jsx)(o,{id:`skill-desc`,value:y?.description||``,onChange:e=>O(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when reviewing PR diffs or when user asks for a PR audit...`,className:`mt-1 text-xs`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-content`,className:`text-xs font-medium`,children:`Playbook Instructions (Markdown)`}),(0,E.jsx)(je,{id:`skill-content`,value:y?.content||``,onChange:e=>O(t=>t?{...t,content:e.target.value}:null),rows:12,placeholder:`# Playbook Title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{n as o}from"./CSPContext-BG7no5S_.js";import{t as s}from"./bot-C2HWrAft.js";import{t as c}from"./chevron-down-qTL8HPug.js";import{t as l}from"./code-xml-jFAa3-TT.js";import{n as u,r as d,t as f}from"./ScaffoldRepoInline-ys4l8ho4.js";import{t as p}from"./git-branch-Cfj9D8yW.js";import{a as m,d as h,f as g}from"./store-D7ixdVck.js";import{t as _}from"./zap-CWG_Lvki.js";import{Bt as v,Ct as y,D as b,Dt as x,E as S,Et as ee,G as C,Ht as te,J as ne,Kt as w,L as T,Lt as re,M as ie,Mt as ae,O as oe,Ot as E,P as se,Pt as D,Rt as ce,St as O,T as le,Tt as ue,Vt as k,a as A,bt as de,ct as fe,d as j,et as pe,f as me,it as M,j as he,jt as N,k as ge,l as P,n as _e,nt as ve,o as ye,q as F,rt as I,s as L,t as R,u as z,wt as be,yt as B,zt as V}from"./index-C6qbn9Zq.js";import{t as xe}from"./badge-CAohJGj6.js";import{a as H,i as U,n as W,r as Se,t as Ce}from"./empty-BdlgbifD.js";import{t as we}from"./textarea-BNRuIXNs.js";import{n as Te,t as G}from"./vsc-CvlJSs-5.js";var Ee=r(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),De=r(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),Oe=r(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),K=t(e(),1),q={status:`idle`,steps:[]};function ke(){let[e,t]=(0,K.useState)(q),n=(0,K.useRef)(null),r=w(),i=(0,K.useCallback)(()=>{n.current?.close(),n.current=null},[]);return(0,K.useEffect)(()=>i,[i]),{progress:e,start:(0,K.useCallback)(e=>{i(),t({status:`running`,steps:[]});let a=new EventSource(`/api/workspace/create-stream/${encodeURIComponent(e)}`);n.current=a;let o=0;a.addEventListener(`progress`,n=>{o=0;try{let a=JSON.parse(n.data);t({status:a.status===`completed`||a.status===`failed`?a.status:`running`,steps:a.steps??[],error:a.error,workspacePath:a.workspacePath,workspaceId:a.feature?.id??e}),(a.status===`completed`||a.status===`failed`)&&(i(),r.invalidateQueries({queryKey:[`workspaces`]}),r.invalidateQueries({queryKey:[`workspaces-status`]}))}catch{}}),a.onerror=()=>{o+=1,!(a.readyState!==EventSource.CLOSED&&o<5)&&(t(e=>e.status===`running`?{...e,status:`failed`,error:e.error??`Lost connection to the creation stream.`}:e),i())}},[i,r]),reset:(0,K.useCallback)(()=>{i(),t(q)},[i])}}var J=n(),Y=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Ae={codex:E,claude:B,vscode:G,"vscode-insiders":Te,cursor:de,antigravity:De,powershell:N,cmd:N,terminal:N,intellij:O,webstorm:ue,pycharm:y,sublime:be,zed:x,windsurf:ee},X={codex:`bg-foreground text-background`,claude:`bg-[#D97757] text-white`,vscode:`bg-[#007ACC] text-white`,"vscode-insiders":`bg-[#24A148] text-white`,cursor:`bg-zinc-950 text-white dark:bg-white dark:text-zinc-950`,antigravity:`bg-violet-600 text-white`,powershell:`bg-sky-700 text-white`,cmd:`bg-zinc-800 text-amber-400`,terminal:`bg-zinc-800 text-emerald-400`,intellij:`bg-fuchsia-600 text-white`,webstorm:`bg-cyan-600 text-white`,pycharm:`bg-lime-600 text-zinc-950`,sublime:`bg-orange-500 text-white`,zed:`bg-red-600 text-white`,windsurf:`bg-teal-600 text-white`};function Z({icon:e}){let t=Ae[e]??l;return(0,J.jsx)(`span`,{className:i(`grid size-10 shrink-0 place-items-center rounded-xl shadow-sm`,X[e]),"aria-hidden":`true`,children:(0,J.jsx)(t,{className:`size-5`})})}function Q({target:e,busy:t,launching:n,preferred:r,onLaunch:a}){return(0,J.jsxs)(`button`,{type:`button`,disabled:!e.available||t,onClick:()=>a(e),"aria-label":`Open workspace in ${e.name}`,className:i(`flex min-h-20 w-full items-center gap-3 rounded-xl border p-3 text-left outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,`cursor-pointer border-border bg-card hover:border-primary/40 hover:bg-accent/60`),children:[(0,J.jsx)(Z,{icon:e.icon}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),n?(0,J.jsx)(A,{className:`size-4`}):r?(0,J.jsx)(xe,{size:`sm`,variant:`secondary`,children:`Preferred`}):null]}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})}function je({session:e,busy:t,launching:n,onResume:r}){let a=e.desktopHandoff.method===`direct`,o=a?`Codex Desktop`:`Claude Desktop`;return(0,J.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>r(e),"aria-label":a?`Resume ${e.title} in Codex Desktop`:`Move ${e.title} to Claude Desktop`,className:i(`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/25 bg-primary/5 p-3 text-left outline-none transition-colors`,`hover:border-primary/45 hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-65`),children:[(0,J.jsx)(Z,{icon:a?`codex`:`claude`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium text-foreground`,title:e.title,children:e.title}),n?(0,J.jsx)(A,{className:`size-4 shrink-0`}):a?(0,J.jsx)(ce,{className:`size-4 shrink-0 text-muted-foreground`}):(0,J.jsx)(V,{className:`size-4 shrink-0 text-muted-foreground`})]}),(0,J.jsxs)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:[a?`Open this existing task in ${o}`:`Resume in Claude Code, then type /desktop`,` · `,new Date(e.updatedAt).toLocaleString()]})]})]})}function Me({workspaceId:e,workspacePath:t,isVsCode:n=!1,className:r}){let[i,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(null),[d,f]=(0,K.useState)(null),p=(0,K.useRef)(!1),m=I(),h=M(e,i),g=se().data?.config,_=m.data?.filter(e=>e.available)??[],v=_.filter(e=>e.kind===`ai-app`),y=g?.defaultEditor?{code:`vscode`,"code-insiders":`vscode-insiders`,cursor:`cursor`,antigravity:`antigravity`,idea:`intellij`,webstorm:`webstorm`,charm:`pycharm`,subl:`sublime`,zed:`zed`,windsurf:`windsurf`}[g.defaultEditor]:void 0,b=_.filter(e=>e.kind===`editor`).toSorted((e,t)=>Number(t.id===y)-Number(e.id===y)),x=new Set(_.map(e=>e.id)),S=(h.data??[]).filter(e=>e.desktopHandoff&&x.has(e.desktopHandoff.targetId)),ee=n||_.length>0,C=async t=>{if(!p.current){p.current=!0,u(null),f(null),c(t.id);try{await fe(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await m.refetch()}finally{c(null),p.current=!1}}},te=async t=>{if(!(p.current||!t.desktopHandoff||!Y.test(t.id))){p.current=!0,u(null),f(null),c(`session:${t.id}`);try{if(t.desktopHandoff.method===`guided`){await R(`claude --resume ${t.id}`),f(`Claude resume command copied. With a Claude subscription login, run it in this workspace, then type /desktop in Claude to move the session into Claude Desktop.`);return}await fe(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.desktopHandoff.targetId,action:`resume`,sessionId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await Promise.all([m.refetch(),h.refetch()])}finally{c(null),p.current=!1}}},ne=()=>{window.parent.postMessage({type:`openWorkspaceFolder`,workspacePath:t},`*`),o(!1)},w=()=>Promise.all([m.refetch(),h.refetch()]),T=m.isFetching||h.isFetching;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(a,{variant:`outline`,className:r,onClick:()=>o(!0),children:[(0,J.jsx)(Oe,{}),`Open with…`]}),(0,J.jsx)(ye,{open:i,onOpenChange:e=>{o(e),e||(u(null),f(null))},children:(0,J.jsxs)(j,{className:`max-w-2xl`,"aria-busy":s!==null,children:[(0,J.jsxs)(P,{children:[(0,J.jsx)(me,{children:`Open workspace with…`}),(0,J.jsx)(L,{children:`Continue recent AI work or start in an installed coding app or editor. AI apps may use their own online services.`})]}),(0,J.jsxs)(z,{className:`space-y-5`,children:[l&&(0,J.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive-foreground`,children:l}),d&&(0,J.jsx)(`div`,{role:`status`,className:`rounded-lg border border-primary/25 bg-primary/5 px-3 py-2 text-sm text-foreground`,children:d}),h.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,J.jsx)(A,{className:`size-4`}),` Checking recent sessions…`]}):S.length>0?(0,J.jsxs)(`section`,{"aria-labelledby":`recent-sessions-heading`,children:[(0,J.jsx)(`h3`,{id:`recent-sessions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Continue recent work`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:S.map(e=>(0,J.jsx)(je,{session:e,busy:s!==null,launching:s===`session:${e.id}`,onResume:te},`${e.assistant}:${e.id}`))})]}):h.isError?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent sessions could not be checked. Starting new work is still available.`}):null,n&&(0,J.jsxs)(`section`,{"aria-labelledby":`current-editor-heading`,children:[(0,J.jsx)(`h3`,{id:`current-editor-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Current window`}),(0,J.jsxs)(`button`,{type:`button`,disabled:s!==null,onClick:ne,className:`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/30 bg-primary/5 p-3 text-left outline-none transition-colors hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-65`,children:[(0,J.jsx)(Z,{icon:`vscode`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:`Current VS Code window`}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:`Open through the installed NexusFlow extension.`})]})]})]}),m.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,J.jsx)(A,{}),` Checking apps on this computer…`]}):m.isError?(0,J.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive-foreground`,children:m.error instanceof Error?m.error.message:`Could not check available apps.`}):(0,J.jsxs)(J.Fragment,{children:[v.length>0&&(0,J.jsxs)(`section`,{"aria-labelledby":`ai-apps-heading`,children:[(0,J.jsx)(`h3`,{id:`ai-apps-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`AI coding apps`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:v.map(e=>(0,J.jsx)(Q,{target:e,busy:s!==null,launching:s===e.id,onLaunch:C},e.id))})]}),b.length>0&&(0,J.jsxs)(`section`,{"aria-labelledby":`editors-heading`,children:[(0,J.jsx)(`h3`,{id:`editors-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Code editors`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:b.map(e=>(0,J.jsx)(Q,{target:e,busy:s!==null,launching:s===e.id,preferred:e.id===y,onLaunch:C},e.id))})]}),!ee&&(0,J.jsx)(Ce,{className:`rounded-xl border border-dashed py-8 md:p-8`,children:(0,J.jsxs)(Se,{children:[(0,J.jsx)(U,{variant:`icon`,children:(0,J.jsx)(Ee,{})}),(0,J.jsx)(H,{className:`text-base`,children:`No compatible apps detected`}),(0,J.jsx)(W,{children:`Install a supported coding app or add its command to PATH, then recheck.`})]})})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border pt-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:T?`Checking recent sessions and apps…`:`Can’t find your app or session? Recheck detection.`}),(0,J.jsxs)(a,{size:`sm`,variant:`ghost`,onClick:()=>void w(),disabled:T||s!==null,children:[(0,J.jsx)(D,{className:T?`animate-spin`:``}),`Recheck`]})]})]})]})})]})}var Ne=`__ad-hoc__`,Pe=new URLSearchParams(window.location.search).get(`env`)===`vscode`,Fe=[{value:`in-place`,icon:_,title:`In-place`,body:`Work directly in the source repos. No branches or worktrees — fastest start.`},{value:`worktree`,icon:p,title:`Isolated worktrees`,body:`A feature branch and worktree per repo. Your source checkouts stay untouched.`}];function Ie({repo:e,value:t,onChange:n,enabled:r}){let i=F(e.path,r),a=(0,K.useMemo)(()=>[...new Set([...i.data?.local??[],...i.data?.remote??[]])],[i.data]),s=`branches-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}`;return(0,J.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-40 shrink-0 truncate text-xs`,children:e.name}),(0,J.jsx)(o,{list:s,value:t,onChange:e=>n(e.target.value),placeholder:`existing branch (must exist)`,className:`h-7 font-mono text-xs`}),(0,J.jsx)(`datalist`,{id:s,children:a.map(e=>(0,J.jsx)(`option`,{value:e},e))})]})}function Le({step:e}){return(0,J.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,J.jsx)(`span`,{className:i(`grid size-5 shrink-0 place-items-center rounded-full border`,e.status===`completed`&&`border-success bg-success/15 text-success-foreground`,e.status===`running`&&`border-primary text-primary`,e.status===`failed`&&`border-destructive bg-destructive/15 text-destructive-foreground`,e.status===`pending`&&`border-border text-muted-foreground`),children:e.status===`completed`?(0,J.jsx)(k,{className:`size-3`}):e.status===`running`?(0,J.jsx)(A,{className:`size-3`}):e.status===`failed`?(0,J.jsx)(v,{className:`size-3`}):null}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,J.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.message})]})]})}function Re(){let e=h(),[t]=g(),n=C(),r=ne(),l=ie(),p=ve(),_=pe(),v=he(),y=T(),{progress:x,start:ee,reset:w}=ke(),[E,se]=(0,K.useState)(t.get(`project`)??Ne),[D,ce]=(0,K.useState)(`in-place`),[O,ue]=(0,K.useState)(``),[k,de]=(0,K.useState)(``),[j,me]=(0,K.useState)(``),[M,N]=(0,K.useState)([]),[P,ye]=(0,K.useState)(!1),[F,I]=(0,K.useState)([]),[L,R]=(0,K.useState)([]),[z,be]=(0,K.useState)([]),[B,V]=(0,K.useState)(``),[H,U]=(0,K.useState)(``),[W,Se]=(0,K.useState)(!1),[Ce,Te]=(0,K.useState)(null),[G,Ee]=(0,K.useState)({}),[De,Oe]=(0,K.useState)(!1),[q,Y]=(0,K.useState)(null),Ae=(0,K.useRef)(!1);(0,K.useEffect)(()=>{!Ae.current&&l.data&&(Ae.current=!0,I(l.data.filter(e=>e.detected).map(e=>e.name)))},[l.data]);let X=(0,K.useMemo)(()=>(n.data??[]).find(e=>e.id===E)??null,[n.data,E]),Z=(0,K.useMemo)(()=>X?X.repos.map(e=>({name:_e(e.path),path:e.path,defaultBranch:e.defaultBranch})):(r.data??[]).filter(e=>M.includes(e.path)),[X,r.data,M]),Q=D===`in-place`,je=(Q?k.trim().length>0:O.trim().length>0)&&Z.length>0&&j.trim().length>0,Re=e=>{V(e),Te(null);let t=(p.data??[]).find(t=>t.id===e);U(t?.content??``)},ze=async()=>{if(!j.trim()){Y(`Describe what you are building first — the suggestion is based on it.`);return}Y(null),Se(!0);try{let e=await fe(`/api/workspace/suggest-workflow`,{method:`POST`,body:JSON.stringify({description:j,repos:Z})});V(e.suggestedWorkflowId),U(e.customInstructions),Te(e.difficulty)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{Se(!1)}},$=(0,K.useRef)(!1),Be=async()=>{if($.current||y.isPending||!je)return;$.current=!0,Y(null);let e={mode:D,projectId:X?.id,...Q?{name:k.trim()}:{branchName:O.trim()},description:j.trim(),repos:Z.map(e=>({...e,existingBranch:!Q&&G[e.path]?.trim()?G[e.path].trim():void 0})),assistants:F,enabledSkills:L.length>0?L:void 0,enabledAgents:z.length>0?z:void 0,teamworkInstructions:H.trim()||void 0};try{let{jobId:t}=await y.mutateAsync(e);ee(t)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{$.current=!1}};if(x.status!==`idle`){let t=x.steps.find(e=>e.status===`failed`);return(0,J.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:x.status===`running`?`Setting up your workspace…`:x.status===`completed`?`Workspace ready`:`Workspace creation failed`}),(0,J.jsx)(`ul`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`mt-6 divide-y divide-border rounded-xl border border-border bg-card px-4`,children:x.steps.map(e=>(0,J.jsx)(Le,{step:e},e.id))}),x.status===`failed`&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-destructive-foreground`,children:t?.message??x.error??`Something went wrong.`}),x.status===`completed`&&x.workspacePath&&(0,J.jsx)(`p`,{className:`mt-4 truncate font-mono text-xs text-muted-foreground`,children:x.workspacePath}),q&&(0,J.jsx)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:q}),(0,J.jsxs)(`div`,{"data-testid":`workspace-ready-actions`,className:`mt-6 flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[x.status===`completed`&&x.workspaceId&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(a,{className:`w-full min-w-0 whitespace-normal sm:w-auto`,onClick:()=>e(`/workspaces/${encodeURIComponent(x.workspaceId)}`),children:`Open workspace`}),x.workspacePath&&(0,J.jsx)(Me,{workspaceId:x.workspaceId,workspacePath:x.workspacePath,isVsCode:Pe,className:`w-full min-w-0 whitespace-normal sm:w-auto`})]}),x.status===`failed`&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(a,{variant:`default`,onClick:w,children:`Back to form (edit & retry)`}),(0,J.jsx)(a,{variant:`outline`,onClick:()=>window.location.reload(),children:`Start over (clear form)`})]}),x.status===`running`&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This can take a moment for large repositories.`})]})]})}return(0,J.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,J.jsxs)(`header`,{className:`mb-6`,children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Start work`}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Pick where the work happens and how isolated it should be.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`Project`}),(0,J.jsxs)(le,{value:E,onValueChange:e=>typeof e==`string`&&se(e),children:[(0,J.jsx)(oe,{className:`w-full`,"aria-label":`Project`,children:(0,J.jsx)(ge,{children:X?X.name:`Ad-hoc — pick repositories manually`})}),(0,J.jsxs)(b,{alignItemWithTrigger:!1,children:[(n.data??[]).map(e=>(0,J.jsx)(S,{value:e.id,children:e.name},e.id)),(0,J.jsx)(S,{value:Ne,children:`Ad-hoc — pick repositories manually`})]})]}),X?(0,J.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:X.repos.map(e=>(0,J.jsx)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.path},e.path))}):(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(u,{repos:r.data??[],selectedPaths:M,onToggle:e=>N(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),loading:r.isLoading}),(0,J.jsx)(f,{onCreated:e=>N(t=>[...t,e.path])})]}),(n.data??[]).length===0&&!n.isLoading&&(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Tip: `,(0,J.jsx)(m,{to:`/projects`,className:`text-primary hover:underline`,children:`register a project`}),` to skip repo picking next time.`]})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`How do you want to work?`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`Work mode`,className:`grid gap-3 sm:grid-cols-2`,onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(e.key)){e.preventDefault();let t=D===`in-place`?`worktree`:`in-place`;ce(t),document.getElementById(`mode-${t}`)?.focus()}},children:Fe.map(e=>(0,J.jsxs)(`button`,{id:`mode-${e.value}`,type:`button`,role:`radio`,"aria-checked":D===e.value,tabIndex:D===e.value?0:-1,onClick:()=>ce(e.value),className:i(`cursor-pointer rounded-xl border p-4 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring`,D===e.value?`border-primary bg-primary/5 ring-1 ring-primary`:`border-border bg-card hover:border-foreground/20`),children:[(0,J.jsx)(e.icon,{className:i(`size-4`,D===e.value?`text-primary`:`text-muted-foreground`)}),(0,J.jsx)(`p`,{className:`mt-2 text-sm font-semibold`,children:e.title}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.body})]},e.value))})]}),(0,J.jsx)(`section`,{children:Q?(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Workspace name`}),(0,J.jsx)(o,{value:k,onChange:e=>de(e.target.value),placeholder:`e.g. Fix invoice rounding`})]}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Feature branch`}),(0,J.jsx)(o,{value:O,onChange:e=>ue(e.target.value),placeholder:`e.g. feature/invoice-rounding`,className:`font-mono`})]}),Z.length>0&&(0,J.jsxs)(`details`,{className:`rounded-lg border border-border px-3 py-2`,onToggle:e=>Oe(e.target.open),children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Use an existing branch for specific repos (optional)`}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:Z.map(e=>(0,J.jsx)(Ie,{repo:e,enabled:De,value:G[e.path]??``,onChange:t=>Ee(n=>({...n,[e.path]:t}))},e.path))})]})]})}),(0,J.jsx)(`section`,{children:(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`What are you building?`}),(0,J.jsx)(we,{value:j,onChange:e=>me(e.target.value),placeholder:`A short description — your AI assistant reads this to plan the work.`,rows:3})]})}),(0,J.jsxs)(`section`,{className:`rounded-xl border border-border`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>ye(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-sm font-medium hover:bg-accent`,"aria-expanded":P,children:[`Advanced`,(0,J.jsx)(c,{className:i(`size-4 text-muted-foreground transition-transform`,P&&`rotate-180`)})]}),P&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`AI assistants`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(l.data??[]).map(e=>(0,J.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,!e.detected&&`opacity-50`),children:[(0,J.jsx)(d,{checked:F.includes(e.name),onCheckedChange:()=>I(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])}),e.displayName]},e.name))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium`,children:`Teamwork strategy`}),(0,J.jsxs)(a,{size:`xs`,variant:`outline`,onClick:ze,disabled:W,children:[W?(0,J.jsx)(A,{}):(0,J.jsx)(ae,{}),`Suggest with AI`]})]}),(0,J.jsxs)(le,{value:B,onValueChange:e=>typeof e==`string`&&Re(e),children:[(0,J.jsx)(oe,{className:`w-full`,"aria-label":`Teamwork strategy`,children:(0,J.jsx)(ge,{children:(p.data??[]).find(e=>e.id===B)?.name??`None`})}),(0,J.jsxs)(b,{alignItemWithTrigger:!1,children:[(0,J.jsx)(S,{value:``,children:`None`}),(p.data??[]).map(e=>(0,J.jsx)(S,{value:e.id,children:e.name},e.id))]})]}),Ce&&(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[`AI classified this task as `,(0,J.jsx)(`span`,{className:`font-medium`,children:Ce}),` difficulty.`]}),(0,J.jsx)(we,{value:H,onChange:e=>U(e.target.value),placeholder:`Cooperation instructions for the agent team (editable — prefilled by the strategy pick or AI suggestion).`,rows:4,className:`mt-2 font-mono text-xs`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,J.jsx)(te,{className:`size-4 text-primary`}),`Agent Skills (`,L.length,` selected)`]}),(_.data??[]).length>0&&(0,J.jsx)(a,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{let e=(_.data??[]).map(e=>e.id);R(L.length===e.length?[]:e)},className:`text-xs text-muted-foreground hover:text-foreground h-6 px-2`,children:L.length===(_.data??[]).length&&(_.data??[]).length>0?`Deselect All`:`Select All`})]}),(0,J.jsx)(`div`,{className:`max-h-48 overflow-y-auto rounded-lg border border-border bg-card/50 p-2 space-y-1.5`,children:_.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center justify-center p-4 gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{className:`size-3`}),`Loading skills...`]}):(_.data??[]).length===0?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground p-2 text-center`,children:`No skills available in catalog.`}):(_.data??[]).map(e=>{let t=L.includes(e.id);return(0,J.jsxs)(`label`,{className:i(`flex items-center justify-between gap-2 rounded-md p-2 text-xs cursor-pointer border transition-colors`,t?`border-primary/50 bg-primary/5 text-foreground`:`border-transparent hover:bg-muted/50 text-muted-foreground`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,J.jsx)(d,{checked:t,onCheckedChange:()=>R(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,J.jsx)(`span`,{className:`font-mono font-medium truncate`,children:e.title||e.name})]}),(0,J.jsx)(xe,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.category})]},e.id)})})]}),(v.data??[]).length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:(0,J.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,J.jsx)(s,{className:`size-4 text-purple-400`}),`Codex Native Agents (`,z.length,` selected)`]})}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(v.data??[]).map(e=>{let t=z.includes(e.id);return(0,J.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`text-muted-foreground hover:bg-muted/50`),children:[(0,J.jsx)(d,{checked:t,onCheckedChange:()=>be(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,J.jsx)(`span`,{className:`font-mono`,children:e.name})]},e.id)})})]})]})]}),q&&(0,J.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:q}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,J.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(re,{className:`size-3.5`}),Z.length,` repositor`,Z.length===1?`y`:`ies`,` selected`]}),(0,J.jsxs)(a,{onClick:Be,disabled:!je||y.isPending,children:[y.isPending?(0,J.jsx)(A,{}):null,Q?`Start working`:`Create workspace`]})]})]})]})}export{Re as StartWorkPage};
|
|
1
|
+
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{n as o}from"./CSPContext-BG7no5S_.js";import{t as s}from"./bot-C2HWrAft.js";import{t as c}from"./chevron-down-qTL8HPug.js";import{t as l}from"./code-xml-jFAa3-TT.js";import{n as u,r as d,t as f}from"./ScaffoldRepoInline-DWsd4vxF.js";import{t as p}from"./git-branch-Cfj9D8yW.js";import{a as m,d as h,f as g}from"./store-D7ixdVck.js";import{t as _}from"./zap-CWG_Lvki.js";import{Bt as v,Ct as y,D as b,Dt as x,E as S,Et as ee,G as C,Ht as te,J as ne,Kt as w,L as T,Lt as re,M as ie,Mt as ae,O as oe,Ot as E,P as se,Pt as D,Rt as ce,St as O,T as le,Tt as ue,Vt as k,a as A,bt as de,ct as fe,d as j,et as pe,f as me,it as M,j as he,jt as N,k as ge,l as P,n as _e,nt as ve,o as ye,q as F,rt as I,s as L,t as R,u as z,wt as be,yt as B,zt as V}from"./index-pxzwuRLq.js";import{t as xe}from"./badge-CAohJGj6.js";import{a as H,i as U,n as W,r as Se,t as Ce}from"./empty-BdlgbifD.js";import{t as we}from"./textarea-BNRuIXNs.js";import{n as Te,t as G}from"./vsc-DkRhgYbO.js";var Ee=r(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),De=r(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),Oe=r(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),K=t(e(),1),q={status:`idle`,steps:[]};function ke(){let[e,t]=(0,K.useState)(q),n=(0,K.useRef)(null),r=w(),i=(0,K.useCallback)(()=>{n.current?.close(),n.current=null},[]);return(0,K.useEffect)(()=>i,[i]),{progress:e,start:(0,K.useCallback)(e=>{i(),t({status:`running`,steps:[]});let a=new EventSource(`/api/workspace/create-stream/${encodeURIComponent(e)}`);n.current=a;let o=0;a.addEventListener(`progress`,n=>{o=0;try{let a=JSON.parse(n.data);t({status:a.status===`completed`||a.status===`failed`?a.status:`running`,steps:a.steps??[],error:a.error,workspacePath:a.workspacePath,workspaceId:a.feature?.id??e}),(a.status===`completed`||a.status===`failed`)&&(i(),r.invalidateQueries({queryKey:[`workspaces`]}),r.invalidateQueries({queryKey:[`workspaces-status`]}))}catch{}}),a.onerror=()=>{o+=1,!(a.readyState!==EventSource.CLOSED&&o<5)&&(t(e=>e.status===`running`?{...e,status:`failed`,error:e.error??`Lost connection to the creation stream.`}:e),i())}},[i,r]),reset:(0,K.useCallback)(()=>{i(),t(q)},[i])}}var J=n(),Y=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Ae={codex:E,claude:B,vscode:G,"vscode-insiders":Te,cursor:de,antigravity:De,powershell:N,cmd:N,terminal:N,intellij:O,webstorm:ue,pycharm:y,sublime:be,zed:x,windsurf:ee},X={codex:`bg-foreground text-background`,claude:`bg-[#D97757] text-white`,vscode:`bg-[#007ACC] text-white`,"vscode-insiders":`bg-[#24A148] text-white`,cursor:`bg-zinc-950 text-white dark:bg-white dark:text-zinc-950`,antigravity:`bg-violet-600 text-white`,powershell:`bg-sky-700 text-white`,cmd:`bg-zinc-800 text-amber-400`,terminal:`bg-zinc-800 text-emerald-400`,intellij:`bg-fuchsia-600 text-white`,webstorm:`bg-cyan-600 text-white`,pycharm:`bg-lime-600 text-zinc-950`,sublime:`bg-orange-500 text-white`,zed:`bg-red-600 text-white`,windsurf:`bg-teal-600 text-white`};function Z({icon:e}){let t=Ae[e]??l;return(0,J.jsx)(`span`,{className:i(`grid size-10 shrink-0 place-items-center rounded-xl shadow-sm`,X[e]),"aria-hidden":`true`,children:(0,J.jsx)(t,{className:`size-5`})})}function Q({target:e,busy:t,launching:n,preferred:r,onLaunch:a}){return(0,J.jsxs)(`button`,{type:`button`,disabled:!e.available||t,onClick:()=>a(e),"aria-label":`Open workspace in ${e.name}`,className:i(`flex min-h-20 w-full items-center gap-3 rounded-xl border p-3 text-left outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,`cursor-pointer border-border bg-card hover:border-primary/40 hover:bg-accent/60`),children:[(0,J.jsx)(Z,{icon:e.icon}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),n?(0,J.jsx)(A,{className:`size-4`}):r?(0,J.jsx)(xe,{size:`sm`,variant:`secondary`,children:`Preferred`}):null]}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})}function je({session:e,busy:t,launching:n,onResume:r}){let a=e.desktopHandoff.method===`direct`,o=a?`Codex Desktop`:`Claude Desktop`;return(0,J.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>r(e),"aria-label":a?`Resume ${e.title} in Codex Desktop`:`Move ${e.title} to Claude Desktop`,className:i(`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/25 bg-primary/5 p-3 text-left outline-none transition-colors`,`hover:border-primary/45 hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-65`),children:[(0,J.jsx)(Z,{icon:a?`codex`:`claude`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium text-foreground`,title:e.title,children:e.title}),n?(0,J.jsx)(A,{className:`size-4 shrink-0`}):a?(0,J.jsx)(ce,{className:`size-4 shrink-0 text-muted-foreground`}):(0,J.jsx)(V,{className:`size-4 shrink-0 text-muted-foreground`})]}),(0,J.jsxs)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:[a?`Open this existing task in ${o}`:`Resume in Claude Code, then type /desktop`,` · `,new Date(e.updatedAt).toLocaleString()]})]})]})}function Me({workspaceId:e,workspacePath:t,isVsCode:n=!1,className:r}){let[i,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(null),[d,f]=(0,K.useState)(null),p=(0,K.useRef)(!1),m=I(),h=M(e,i),g=se().data?.config,_=m.data?.filter(e=>e.available)??[],v=_.filter(e=>e.kind===`ai-app`),y=g?.defaultEditor?{code:`vscode`,"code-insiders":`vscode-insiders`,cursor:`cursor`,antigravity:`antigravity`,idea:`intellij`,webstorm:`webstorm`,charm:`pycharm`,subl:`sublime`,zed:`zed`,windsurf:`windsurf`}[g.defaultEditor]:void 0,b=_.filter(e=>e.kind===`editor`).toSorted((e,t)=>Number(t.id===y)-Number(e.id===y)),x=new Set(_.map(e=>e.id)),S=(h.data??[]).filter(e=>e.desktopHandoff&&x.has(e.desktopHandoff.targetId)),ee=n||_.length>0,C=async t=>{if(!p.current){p.current=!0,u(null),f(null),c(t.id);try{await fe(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await m.refetch()}finally{c(null),p.current=!1}}},te=async t=>{if(!(p.current||!t.desktopHandoff||!Y.test(t.id))){p.current=!0,u(null),f(null),c(`session:${t.id}`);try{if(t.desktopHandoff.method===`guided`){await R(`claude --resume ${t.id}`),f(`Claude resume command copied. With a Claude subscription login, run it in this workspace, then type /desktop in Claude to move the session into Claude Desktop.`);return}await fe(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.desktopHandoff.targetId,action:`resume`,sessionId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await Promise.all([m.refetch(),h.refetch()])}finally{c(null),p.current=!1}}},ne=()=>{window.parent.postMessage({type:`openWorkspaceFolder`,workspacePath:t},`*`),o(!1)},w=()=>Promise.all([m.refetch(),h.refetch()]),T=m.isFetching||h.isFetching;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(a,{variant:`outline`,className:r,onClick:()=>o(!0),children:[(0,J.jsx)(Oe,{}),`Open with…`]}),(0,J.jsx)(ye,{open:i,onOpenChange:e=>{o(e),e||(u(null),f(null))},children:(0,J.jsxs)(j,{className:`max-w-2xl`,"aria-busy":s!==null,children:[(0,J.jsxs)(P,{children:[(0,J.jsx)(me,{children:`Open workspace with…`}),(0,J.jsx)(L,{children:`Continue recent AI work or start in an installed coding app or editor. AI apps may use their own online services.`})]}),(0,J.jsxs)(z,{className:`space-y-5`,children:[l&&(0,J.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive-foreground`,children:l}),d&&(0,J.jsx)(`div`,{role:`status`,className:`rounded-lg border border-primary/25 bg-primary/5 px-3 py-2 text-sm text-foreground`,children:d}),h.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,J.jsx)(A,{className:`size-4`}),` Checking recent sessions…`]}):S.length>0?(0,J.jsxs)(`section`,{"aria-labelledby":`recent-sessions-heading`,children:[(0,J.jsx)(`h3`,{id:`recent-sessions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Continue recent work`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:S.map(e=>(0,J.jsx)(je,{session:e,busy:s!==null,launching:s===`session:${e.id}`,onResume:te},`${e.assistant}:${e.id}`))})]}):h.isError?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent sessions could not be checked. Starting new work is still available.`}):null,n&&(0,J.jsxs)(`section`,{"aria-labelledby":`current-editor-heading`,children:[(0,J.jsx)(`h3`,{id:`current-editor-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Current window`}),(0,J.jsxs)(`button`,{type:`button`,disabled:s!==null,onClick:ne,className:`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/30 bg-primary/5 p-3 text-left outline-none transition-colors hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-65`,children:[(0,J.jsx)(Z,{icon:`vscode`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:`Current VS Code window`}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:`Open through the installed NexusFlow extension.`})]})]})]}),m.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,J.jsx)(A,{}),` Checking apps on this computer…`]}):m.isError?(0,J.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive-foreground`,children:m.error instanceof Error?m.error.message:`Could not check available apps.`}):(0,J.jsxs)(J.Fragment,{children:[v.length>0&&(0,J.jsxs)(`section`,{"aria-labelledby":`ai-apps-heading`,children:[(0,J.jsx)(`h3`,{id:`ai-apps-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`AI coding apps`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:v.map(e=>(0,J.jsx)(Q,{target:e,busy:s!==null,launching:s===e.id,onLaunch:C},e.id))})]}),b.length>0&&(0,J.jsxs)(`section`,{"aria-labelledby":`editors-heading`,children:[(0,J.jsx)(`h3`,{id:`editors-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Code editors`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:b.map(e=>(0,J.jsx)(Q,{target:e,busy:s!==null,launching:s===e.id,preferred:e.id===y,onLaunch:C},e.id))})]}),!ee&&(0,J.jsx)(Ce,{className:`rounded-xl border border-dashed py-8 md:p-8`,children:(0,J.jsxs)(Se,{children:[(0,J.jsx)(U,{variant:`icon`,children:(0,J.jsx)(Ee,{})}),(0,J.jsx)(H,{className:`text-base`,children:`No compatible apps detected`}),(0,J.jsx)(W,{children:`Install a supported coding app or add its command to PATH, then recheck.`})]})})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border pt-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:T?`Checking recent sessions and apps…`:`Can’t find your app or session? Recheck detection.`}),(0,J.jsxs)(a,{size:`sm`,variant:`ghost`,onClick:()=>void w(),disabled:T||s!==null,children:[(0,J.jsx)(D,{className:T?`animate-spin`:``}),`Recheck`]})]})]})]})})]})}var Ne=`__ad-hoc__`,Pe=new URLSearchParams(window.location.search).get(`env`)===`vscode`,Fe=[{value:`in-place`,icon:_,title:`In-place`,body:`Work directly in the source repos. No branches or worktrees — fastest start.`},{value:`worktree`,icon:p,title:`Isolated worktrees`,body:`A feature branch and worktree per repo. Your source checkouts stay untouched.`}];function Ie({repo:e,value:t,onChange:n,enabled:r}){let i=F(e.path,r),a=(0,K.useMemo)(()=>[...new Set([...i.data?.local??[],...i.data?.remote??[]])],[i.data]),s=`branches-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}`;return(0,J.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-40 shrink-0 truncate text-xs`,children:e.name}),(0,J.jsx)(o,{list:s,value:t,onChange:e=>n(e.target.value),placeholder:`existing branch (must exist)`,className:`h-7 font-mono text-xs`}),(0,J.jsx)(`datalist`,{id:s,children:a.map(e=>(0,J.jsx)(`option`,{value:e},e))})]})}function Le({step:e}){return(0,J.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,J.jsx)(`span`,{className:i(`grid size-5 shrink-0 place-items-center rounded-full border`,e.status===`completed`&&`border-success bg-success/15 text-success-foreground`,e.status===`running`&&`border-primary text-primary`,e.status===`failed`&&`border-destructive bg-destructive/15 text-destructive-foreground`,e.status===`pending`&&`border-border text-muted-foreground`),children:e.status===`completed`?(0,J.jsx)(k,{className:`size-3`}):e.status===`running`?(0,J.jsx)(A,{className:`size-3`}):e.status===`failed`?(0,J.jsx)(v,{className:`size-3`}):null}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,J.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.message})]})]})}function Re(){let e=h(),[t]=g(),n=C(),r=ne(),l=ie(),p=ve(),_=pe(),v=he(),y=T(),{progress:x,start:ee,reset:w}=ke(),[E,se]=(0,K.useState)(t.get(`project`)??Ne),[D,ce]=(0,K.useState)(`in-place`),[O,ue]=(0,K.useState)(``),[k,de]=(0,K.useState)(``),[j,me]=(0,K.useState)(``),[M,N]=(0,K.useState)([]),[P,ye]=(0,K.useState)(!1),[F,I]=(0,K.useState)([]),[L,R]=(0,K.useState)([]),[z,be]=(0,K.useState)([]),[B,V]=(0,K.useState)(``),[H,U]=(0,K.useState)(``),[W,Se]=(0,K.useState)(!1),[Ce,Te]=(0,K.useState)(null),[G,Ee]=(0,K.useState)({}),[De,Oe]=(0,K.useState)(!1),[q,Y]=(0,K.useState)(null),Ae=(0,K.useRef)(!1);(0,K.useEffect)(()=>{!Ae.current&&l.data&&(Ae.current=!0,I(l.data.filter(e=>e.detected).map(e=>e.name)))},[l.data]);let X=(0,K.useMemo)(()=>(n.data??[]).find(e=>e.id===E)??null,[n.data,E]),Z=(0,K.useMemo)(()=>X?X.repos.map(e=>({name:_e(e.path),path:e.path,defaultBranch:e.defaultBranch})):(r.data??[]).filter(e=>M.includes(e.path)),[X,r.data,M]),Q=D===`in-place`,je=(Q?k.trim().length>0:O.trim().length>0)&&Z.length>0&&j.trim().length>0,Re=e=>{V(e),Te(null);let t=(p.data??[]).find(t=>t.id===e);U(t?.content??``)},ze=async()=>{if(!j.trim()){Y(`Describe what you are building first — the suggestion is based on it.`);return}Y(null),Se(!0);try{let e=await fe(`/api/workspace/suggest-workflow`,{method:`POST`,body:JSON.stringify({description:j,repos:Z})});V(e.suggestedWorkflowId),U(e.customInstructions),Te(e.difficulty)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{Se(!1)}},$=(0,K.useRef)(!1),Be=async()=>{if($.current||y.isPending||!je)return;$.current=!0,Y(null);let e={mode:D,projectId:X?.id,...Q?{name:k.trim()}:{branchName:O.trim()},description:j.trim(),repos:Z.map(e=>({...e,existingBranch:!Q&&G[e.path]?.trim()?G[e.path].trim():void 0})),assistants:F,enabledSkills:L.length>0?L:void 0,enabledAgents:z.length>0?z:void 0,teamworkInstructions:H.trim()||void 0};try{let{jobId:t}=await y.mutateAsync(e);ee(t)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{$.current=!1}};if(x.status!==`idle`){let t=x.steps.find(e=>e.status===`failed`);return(0,J.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:x.status===`running`?`Setting up your workspace…`:x.status===`completed`?`Workspace ready`:`Workspace creation failed`}),(0,J.jsx)(`ul`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`mt-6 divide-y divide-border rounded-xl border border-border bg-card px-4`,children:x.steps.map(e=>(0,J.jsx)(Le,{step:e},e.id))}),x.status===`failed`&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-destructive-foreground`,children:t?.message??x.error??`Something went wrong.`}),x.status===`completed`&&x.workspacePath&&(0,J.jsx)(`p`,{className:`mt-4 truncate font-mono text-xs text-muted-foreground`,children:x.workspacePath}),q&&(0,J.jsx)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:q}),(0,J.jsxs)(`div`,{"data-testid":`workspace-ready-actions`,className:`mt-6 flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[x.status===`completed`&&x.workspaceId&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(a,{className:`w-full min-w-0 whitespace-normal sm:w-auto`,onClick:()=>e(`/workspaces/${encodeURIComponent(x.workspaceId)}`),children:`Open workspace`}),x.workspacePath&&(0,J.jsx)(Me,{workspaceId:x.workspaceId,workspacePath:x.workspacePath,isVsCode:Pe,className:`w-full min-w-0 whitespace-normal sm:w-auto`})]}),x.status===`failed`&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(a,{variant:`default`,onClick:w,children:`Back to form (edit & retry)`}),(0,J.jsx)(a,{variant:`outline`,onClick:()=>window.location.reload(),children:`Start over (clear form)`})]}),x.status===`running`&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This can take a moment for large repositories.`}),(0,J.jsx)(a,{variant:`outline`,size:`sm`,onClick:w,children:`Cancel creation`})]})]})]})}return(0,J.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,J.jsxs)(`header`,{className:`mb-6`,children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Start work`}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Pick where the work happens and how isolated it should be.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`Project`}),(0,J.jsxs)(le,{value:E,onValueChange:e=>typeof e==`string`&&se(e),children:[(0,J.jsx)(oe,{className:`w-full`,"aria-label":`Project`,children:(0,J.jsx)(ge,{children:X?X.name:`Ad-hoc — pick repositories manually`})}),(0,J.jsxs)(b,{alignItemWithTrigger:!1,children:[(n.data??[]).map(e=>(0,J.jsx)(S,{value:e.id,children:e.name},e.id)),(0,J.jsx)(S,{value:Ne,children:`Ad-hoc — pick repositories manually`})]})]}),X?(0,J.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:X.repos.map(e=>(0,J.jsx)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.path},e.path))}):(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(u,{repos:r.data??[],selectedPaths:M,onToggle:e=>N(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),loading:r.isLoading}),(0,J.jsx)(f,{onCreated:e=>N(t=>[...t,e.path])})]}),(n.data??[]).length===0&&!n.isLoading&&(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Tip: `,(0,J.jsx)(m,{to:`/projects`,className:`text-primary hover:underline`,children:`register a project`}),` to skip repo picking next time.`]})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`How do you want to work?`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`Work mode`,className:`grid gap-3 sm:grid-cols-2`,onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(e.key)){e.preventDefault();let t=D===`in-place`?`worktree`:`in-place`;ce(t),document.getElementById(`mode-${t}`)?.focus()}},children:Fe.map(e=>(0,J.jsxs)(`button`,{id:`mode-${e.value}`,type:`button`,role:`radio`,"aria-checked":D===e.value,tabIndex:D===e.value?0:-1,onClick:()=>ce(e.value),className:i(`cursor-pointer rounded-xl border p-4 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring`,D===e.value?`border-primary bg-primary/5 ring-1 ring-primary`:`border-border bg-card hover:border-foreground/20`),children:[(0,J.jsx)(e.icon,{className:i(`size-4`,D===e.value?`text-primary`:`text-muted-foreground`)}),(0,J.jsx)(`p`,{className:`mt-2 text-sm font-semibold`,children:e.title}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.body})]},e.value))})]}),(0,J.jsx)(`section`,{children:Q?(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Workspace name`}),(0,J.jsx)(o,{value:k,onChange:e=>de(e.target.value),placeholder:`e.g. Fix invoice rounding`})]}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Feature branch`}),(0,J.jsx)(o,{value:O,onChange:e=>ue(e.target.value),placeholder:`e.g. feature/invoice-rounding`,className:`font-mono`})]}),Z.length>0&&(0,J.jsxs)(`details`,{className:`rounded-lg border border-border px-3 py-2`,onToggle:e=>Oe(e.target.open),children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Use an existing branch for specific repos (optional)`}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:Z.map(e=>(0,J.jsx)(Ie,{repo:e,enabled:De,value:G[e.path]??``,onChange:t=>Ee(n=>({...n,[e.path]:t}))},e.path))})]})]})}),(0,J.jsx)(`section`,{children:(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`What are you building?`}),(0,J.jsx)(we,{value:j,onChange:e=>me(e.target.value),placeholder:`A short description — your AI assistant reads this to plan the work.`,rows:3})]})}),(0,J.jsxs)(`section`,{className:`rounded-xl border border-border`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>ye(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-sm font-medium hover:bg-accent`,"aria-expanded":P,children:[`Advanced`,(0,J.jsx)(c,{className:i(`size-4 text-muted-foreground transition-transform`,P&&`rotate-180`)})]}),P&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`AI assistants`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(l.data??[]).map(e=>(0,J.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,!e.detected&&`opacity-50`),children:[(0,J.jsx)(d,{checked:F.includes(e.name),onCheckedChange:()=>I(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])}),e.displayName]},e.name))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium`,children:`Teamwork strategy`}),(0,J.jsxs)(a,{size:`xs`,variant:`outline`,onClick:ze,disabled:W,children:[W?(0,J.jsx)(A,{}):(0,J.jsx)(ae,{}),`Suggest with AI`]})]}),(0,J.jsxs)(le,{value:B,onValueChange:e=>typeof e==`string`&&Re(e),children:[(0,J.jsx)(oe,{className:`w-full`,"aria-label":`Teamwork strategy`,children:(0,J.jsx)(ge,{children:(p.data??[]).find(e=>e.id===B)?.name??`None`})}),(0,J.jsxs)(b,{alignItemWithTrigger:!1,children:[(0,J.jsx)(S,{value:``,children:`None`}),(p.data??[]).map(e=>(0,J.jsx)(S,{value:e.id,children:e.name},e.id))]})]}),Ce&&(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[`AI classified this task as `,(0,J.jsx)(`span`,{className:`font-medium`,children:Ce}),` difficulty.`]}),(0,J.jsx)(we,{value:H,onChange:e=>U(e.target.value),placeholder:`Cooperation instructions for the agent team (editable — prefilled by the strategy pick or AI suggestion).`,rows:4,className:`mt-2 font-mono text-xs`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,J.jsx)(te,{className:`size-4 text-primary`}),`Agent Skills (`,L.length,` selected)`]}),(_.data??[]).length>0&&(0,J.jsx)(a,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{let e=(_.data??[]).map(e=>e.id);R(L.length===e.length?[]:e)},className:`text-xs text-muted-foreground hover:text-foreground h-6 px-2`,children:L.length===(_.data??[]).length&&(_.data??[]).length>0?`Deselect All`:`Select All`})]}),(0,J.jsx)(`div`,{className:`max-h-48 overflow-y-auto rounded-lg border border-border bg-card/50 p-2 space-y-1.5`,children:_.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center justify-center p-4 gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{className:`size-3`}),`Loading skills...`]}):(_.data??[]).length===0?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground p-2 text-center`,children:`No skills available in catalog.`}):(_.data??[]).map(e=>{let t=L.includes(e.id);return(0,J.jsxs)(`label`,{className:i(`flex items-center justify-between gap-2 rounded-md p-2 text-xs cursor-pointer border transition-colors`,t?`border-primary/50 bg-primary/5 text-foreground`:`border-transparent hover:bg-muted/50 text-muted-foreground`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,J.jsx)(d,{checked:t,onCheckedChange:()=>R(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,J.jsx)(`span`,{className:`font-mono font-medium truncate`,children:e.title||e.name})]}),(0,J.jsx)(xe,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.category})]},e.id)})})]}),(v.data??[]).length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:(0,J.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,J.jsx)(s,{className:`size-4 text-purple-400`}),`Codex Native Agents (`,z.length,` selected)`]})}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(v.data??[]).map(e=>{let t=z.includes(e.id);return(0,J.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`text-muted-foreground hover:bg-muted/50`),children:[(0,J.jsx)(d,{checked:t,onCheckedChange:()=>be(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,J.jsx)(`span`,{className:`font-mono`,children:e.name})]},e.id)})})]})]})]}),q&&(0,J.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:q}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,J.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(re,{className:`size-3.5`}),Z.length,` repositor`,Z.length===1?`y`:`ies`,` selected`]}),(0,J.jsxs)(a,{onClick:Be,disabled:!je||y.isPending,children:[y.isPending?(0,J.jsx)(A,{}):null,Q?`Start working`:`Create workspace`]})]})]})]})}export{Re as StartWorkPage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,g as t,h as n,m as r,t as i}from"./button-BDDZnIHx.js";import{n as a}from"./CSPContext-BG7no5S_.js";import{t as o}from"./circle-plus-lmU1yNJd.js";import{t as s}from"./cpu-Cdwd84Jz.js";import{t as c}from"./trash-2-CtR35_eF.js";import{D as l,E as u,O as d,T as f,a as p,k as m,p as h}from"./index-
|
|
1
|
+
import{_ as e,g as t,h as n,m as r,t as i}from"./button-BDDZnIHx.js";import{n as a}from"./CSPContext-BG7no5S_.js";import{t as o}from"./circle-plus-lmU1yNJd.js";import{t as s}from"./cpu-Cdwd84Jz.js";import{t as c}from"./trash-2-CtR35_eF.js";import{D as l,E as u,O as d,T as f,a as p,k as m,p as h}from"./index-pxzwuRLq.js";import{t as g}from"./badge-CAohJGj6.js";import{t as _}from"./card-BKXzd_5L.js";import{a as v,i as y,n as b,r as x,t as S}from"./empty-BdlgbifD.js";import{t as C}from"./label-CG5exjag.js";import{t as w}from"./textarea-BNRuIXNs.js";var T=n(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),E=n(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]);e();var D=t();function O(e){let{workflowTemplates:t,isEditingTemplate:n,setIsEditingTemplate:O,mgtTemplateName:k,setMgtTemplateName:A,mgtTemplateContent:j,setMgtTemplateContent:M,selectedMgtTemplateId:N,setSelectedMgtTemplateId:P,analysisResult:F,setAnalysisResult:I,showToast:L,handleAnalyzeTemplate:R,handleSaveTemplate:z,handleDeleteTemplate:B,aiAssistants:V,analyzingTemplate:H,mgtAnalysisComment:U,setMgtAnalysisComment:W,suggestedImprovement:G,setSuggestedImprovement:K,savingTemplate:q,deletingTemplate:J,selectedInspectAssistant:Y,setSelectedInspectAssistant:X}=e,Z=t.find(e=>e.id===N),Q=V.filter(e=>e.detected&&e.command),$=Q.find(e=>e.name===Y)?.displayName??`No Harness Found`;return(0,D.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in`,children:[(0,D.jsxs)(`header`,{className:`mb-6`,children:[(0,D.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Team Collaboration Strategies`}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Predefine and review custom teamwork guidelines injected into workspaces' AGENTS.md files.`})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 text-left lg:grid-cols-12`,children:[(0,D.jsx)(`div`,{className:`flex flex-col gap-4 lg:col-span-4`,children:(0,D.jsxs)(_,{className:`rounded-xl p-5 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Strategies`}),(0,D.jsxs)(i,{size:`sm`,onClick:()=>{O(!0),A(`New Strategy`),M(`# New Strategy
|
|
2
2
|
|
|
3
3
|
Write custom teamwork rules here for subagent orchestration...`),P(null),I(null)},children:[(0,D.jsx)(o,{size:12}),` Add New`]})]}),(0,D.jsx)(h,{className:`mt-4 max-h-[480px]`,children:(0,D.jsx)(`div`,{className:`flex flex-col gap-2 pr-1`,children:t.map(e=>{let t=N===e.id;return(0,D.jsxs)(`div`,{className:r(`flex cursor-pointer flex-col gap-1.5 rounded-lg border p-3 text-left transition-colors`,t?`border-primary bg-primary/5 ring-1 ring-primary/40`:`border-border bg-card hover:border-foreground/15 hover:bg-muted/40`),onClick:()=>{P(e.id),O(!1),A(e.name),M(e.content),I(null)},children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsx)(`span`,{className:r(`text-xs font-semibold`,t?`text-primary`:`text-foreground`),children:e.name}),(0,D.jsx)(g,{variant:e.custom?`info`:`secondary`,size:`sm`,className:`font-mono uppercase`,children:e.custom?`Custom`:`Built-in`})]}),(0,D.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]},e.id)})})})]})}),(0,D.jsx)(`div`,{className:`flex flex-col gap-6 lg:col-span-8`,children:N||n?(0,D.jsxs)(_,{className:`flex flex-col gap-5 rounded-xl p-6 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,D.jsx)(`div`,{className:`flex-1`,children:n?(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-sm`,children:`Strategy Name`}),(0,D.jsx)(a,{type:`text`,value:k,onChange:e=>A(e.target.value),placeholder:`e.g. Test-Driven Development`})]}):(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold text-foreground`,children:[k,Z?.custom&&(0,D.jsx)(g,{variant:`info`,className:`font-mono uppercase`,children:`Custom Template`})]}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:Z?.description||`Custom strategy template.`})]})}),(0,D.jsx)(`div`,{className:`flex gap-2`,children:n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{if(N){let e=t.find(e=>e.id===N);e&&(A(e.name),M(e.content)),O(!1)}else if(O(!1),t.length>0){let e=t[0];P(e.id),A(e.name),M(e.content)}},children:`Cancel`}),(0,D.jsx)(i,{size:`sm`,onClick:z,disabled:q,children:q?`Saving...`:`Save Strategy`})]}):(0,D.jsxs)(D.Fragment,{children:[Z?.custom&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>O(!0),children:`Edit`}),(0,D.jsxs)(i,{variant:`destructive`,size:`sm`,onClick:()=>B(N),disabled:J,children:[(0,D.jsx)(c,{size:12}),` Delete`]})]}),!Z?.custom&&(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{O(!0),A(`${k} Copy`),M(j),P(null),I(null)},children:`Duplicate & Customize`})]})})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-sm`,children:`Guidelines Markdown`}),(0,D.jsx)(w,{className:`min-h-[250px] font-mono text-xs leading-relaxed`,value:j,onChange:e=>M(e.target.value),disabled:!n,placeholder:`Write cooperation guidelines in Markdown...`})]}),!n&&N&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border pt-5`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col`,children:[(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold text-foreground`,children:[(0,D.jsx)(s,{size:14,className:`text-muted-foreground`}),` AI Strategy Analysis`]}),(0,D.jsx)(`span`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Select an AI assistant harness installed on your system to inspect these guidelines.`})]}),(0,D.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-3 sm:w-auto`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Harness:`}),(0,D.jsxs)(f,{value:Y,disabled:Q.length===0,onValueChange:e=>typeof e==`string`&&X(e),children:[(0,D.jsx)(d,{size:`sm`,className:`w-44`,"aria-label":`Harness`,children:(0,D.jsx)(m,{children:$})}),(0,D.jsx)(l,{alignItemWithTrigger:!1,children:Q.length>0?Q.map(e=>(0,D.jsx)(u,{value:e.name,children:e.displayName},e.name)):(0,D.jsx)(u,{value:``,children:`No Harness Found`})})]})]}),(0,D.jsx)(i,{size:`sm`,onClick:()=>R(N,j,Y),disabled:H||Q.length===0,children:H?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(p,{className:`size-3`}),` Inspecting...`]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(s,{size:12}),` Inspect Strategy`]})})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-left text-xs uppercase tracking-wider text-muted-foreground`,children:`Evaluation Focus / Instructions (Optional)`}),(0,D.jsx)(w,{className:`min-h-[60px] text-xs leading-relaxed`,value:U,onChange:e=>W(e.target.value),placeholder:`e.g. Focus on checking if timeouts are handled well, check subagent roles coordination...`,disabled:H})]})]}),F&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsx)(h,{className:`max-h-[300px] rounded-xl border border-border bg-muted/40 p-5`,children:(0,D.jsx)(`div`,{className:`select-text whitespace-pre-wrap text-left text-xs leading-relaxed text-foreground`,children:F})}),G&&(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(i,{size:`sm`,onClick:()=>{M(G),O(!0),K(null),I(null),L(`Suggested improvements applied! Click Save to persist changes.`,`success`)},children:[(0,D.jsx)(T,{size:14}),` Apply Suggested Improvements`]})})]})]})]}):(0,D.jsx)(`div`,{className:`flex min-h-[400px] flex-col items-center justify-center`,children:(0,D.jsx)(S,{className:`w-full max-w-md border border-dashed border-border`,children:(0,D.jsxs)(x,{children:[(0,D.jsx)(y,{variant:`icon`,children:(0,D.jsx)(E,{})}),(0,D.jsx)(v,{children:`No strategy template selected`}),(0,D.jsx)(b,{children:`Select a template from the list to view, edit, or analyze it, or add a new custom teamwork workflow template.`})]})})})})]})]})}export{O as StrategiesPage};
|