@lovelybunch/api 1.0.75-alpha.5 → 1.0.75-alpha.7
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/routes/api/v1/ai/route.js +4 -3
- package/dist/routes/api/v1/events/status/route.d.ts +1 -1
- package/dist/routes/api/v1/jobs/[id]/run/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/[id]/runs/[runId]/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/status/route.d.ts +1 -1
- package/dist/routes/api/v1/proposals/[id]/route.d.ts +8 -8
- package/dist/routes/api/v1/skills/[id]/index.d.ts +1 -0
- package/dist/routes/api/v1/skills/[id]/index.js +1 -0
- package/dist/routes/api/v1/skills/[id]/route.d.ts +3 -0
- package/dist/routes/api/v1/skills/[id]/route.js +199 -0
- package/dist/routes/api/v1/skills/index.d.ts +1 -0
- package/dist/routes/api/v1/skills/index.js +1 -0
- package/dist/routes/api/v1/skills/route.d.ts +3 -0
- package/dist/routes/api/v1/skills/route.js +329 -0
- package/dist/server-with-static.js +6 -4
- package/dist/server.js +4 -4
- package/package.json +6 -4
- package/static/assets/{ActivityPage-6xf2Jxp0.js → ActivityPage-BsNcwPRH.js} +1 -1
- package/static/assets/{ApiKeysSettingsPage-DlWMBuQb.js → ApiKeysSettingsPage-Dk-JIhny.js} +1 -1
- package/static/assets/{ArchitectureEditPage-C6MWFHCp.js → ArchitectureEditPage-Cq3jRBeK.js} +1 -1
- package/static/assets/{ArchitecturePage-CxQtPG4d.js → ArchitecturePage-DG4RrZCK.js} +1 -1
- package/static/assets/{AuthSettingsPage-w0blkw8Q.js → AuthSettingsPage-C7a7q-Q2.js} +1 -1
- package/static/assets/{CallbackPage-ByjWTMuG.js → CallbackPage-4mY02Tgr.js} +1 -1
- package/static/assets/CodePage-DV9WWikT.js +2 -0
- package/static/assets/{CollapsibleSection-B1AU3exJ.js → CollapsibleSection-BfOUBfzq.js} +1 -1
- package/static/assets/{DashboardPage-CAToLPqr.js → DashboardPage-dRge5Q81.js} +1 -1
- package/static/assets/{GitPage-DGjEzIUs.js → GitPage-r3PCQC0B.js} +1 -1
- package/static/assets/{GitSettingsPage-X1GEO1Ti.js → GitSettingsPage-fszzi8GW.js} +1 -1
- package/static/assets/{IdentityPage-L0foq6qN.js → IdentityPage-BzVHjOMb.js} +1 -1
- package/static/assets/{ImplementationStepsEditor-Dn88eiVP.js → ImplementationStepsEditor-COEh2NTL.js} +1 -1
- package/static/assets/{IntegrationsSettingsPage-WX1lSaWr.js → IntegrationsSettingsPage-D8jiPBI8.js} +1 -1
- package/static/assets/{JobDetailPage-CvNs3cEP.js → JobDetailPage-BIa9-NLI.js} +1 -1
- package/static/assets/{KnowledgeDetailPage-DXjmZdQl.js → KnowledgeDetailPage-BQxD9Lz3.js} +1 -1
- package/static/assets/{KnowledgeEditPage-C70yoVFM.js → KnowledgeEditPage-kCUvyQ02.js} +1 -1
- package/static/assets/{KnowledgePage-EUJ9c9By.js → KnowledgePage-CzjHNc32.js} +1 -1
- package/static/assets/{LoginPage-Df_q-ACP.js → LoginPage-C5GfXwon.js} +1 -1
- package/static/assets/{McpSettingsPage-4b5M8tpH.js → McpSettingsPage-CrXjyI7N.js} +1 -1
- package/static/assets/{NewKnowledgePage-CqKz6_K-.js → NewKnowledgePage-DfSlEoq7.js} +1 -1
- package/static/assets/{NewProposalPage-DR9UZich.js → NewProposalPage-BEqehTAn.js} +1 -1
- package/static/assets/NewSkillPage-C4F8b-zZ.js +1 -0
- package/static/assets/{ProjectEditPage-5YxG7Xxd.js → ProjectEditPage-Dxj0T_OR.js} +1 -1
- package/static/assets/{ProjectPage-BBhGv2fS.js → ProjectPage-WQwLaUBo.js} +1 -1
- package/static/assets/{PromptsSettingsPage-DLrpZcDA.js → PromptsSettingsPage-Bs1yLOnd.js} +1 -1
- package/static/assets/{ProposalDetailPage-C4tagoNE.js → ProposalDetailPage-Ox4VO8dP.js} +1 -1
- package/static/assets/{ProposalEditPage-Bz-oEsLL.js → ProposalEditPage-RK0-VJcu.js} +1 -1
- package/static/assets/{ProposalsPage-BKRjNF4y.js → ProposalsPage-DYoO3Zmv.js} +1 -1
- package/static/assets/{ResourcesPage-BZrToY-V.js → ResourcesPage-DUSDibSA.js} +1 -1
- package/static/assets/{RoleEditPage-C2vWadxy.js → RoleEditPage-BNKO37rN.js} +1 -1
- package/static/assets/{RolePage-CE9y3rMd.js → RolePage-B4Crd8sw.js} +1 -1
- package/static/assets/{RulesSettingsPage-BidnZaAT.js → RulesSettingsPage-C9JZf3Q-.js} +1 -1
- package/static/assets/{SchedulePage-DU7ng6Gq.js → SchedulePage-BqPWdx_U.js} +1 -1
- package/static/assets/SkillDetailPage-CaVyuMJn.js +1 -0
- package/static/assets/SkillEditPage-BmzUm8ZL.js +1 -0
- package/static/assets/SkillsPage-qw5UquV7.js +8 -0
- package/static/assets/SkillsSettingsPage-DyomY5Jn.js +1 -0
- package/static/assets/{SourceInput-CCa7okhU.js → SourceInput-D-9ARKki.js} +1 -1
- package/static/assets/{TagInput-Chn207ze.js → TagInput-CaHIGpWw.js} +1 -1
- package/static/assets/{TerminalPage-CEYgdKT2.js → TerminalPage-Cidkdbnm.js} +1 -1
- package/static/assets/TerminalSessionPage-COs2_qA8.js +13 -0
- package/static/assets/{UserPreferencesPage-lPgr1ngr.js → UserPreferencesPage-D868VFVd.js} +1 -1
- package/static/assets/{UserSettingsPage-ctHFqz6e.js → UserSettingsPage-DEFpDWXY.js} +1 -1
- package/static/assets/{UtilitiesPage-BVxyh0Ce.js → UtilitiesPage-BBbNWbSM.js} +1 -1
- package/static/assets/{alert-D5jzRTa5.js → alert-YHLFG4kD.js} +1 -1
- package/static/assets/{arrow-down-4I_8gyhd.js → arrow-down-CVaEeC0E.js} +1 -1
- package/static/assets/{arrow-left-DZzHrGWA.js → arrow-left-BpPEBvVt.js} +1 -1
- package/static/assets/{arrow-up-B4VxSS3_.js → arrow-up-BDiN-tgD.js} +1 -1
- package/static/assets/{badge-DvLOhob-.js → badge-B59i_2WR.js} +1 -1
- package/static/assets/{browser-modal-DzaD2oDW.js → browser-modal-DZpkwK9n.js} +1 -1
- package/static/assets/{calendar-BNe2rz1T.js → calendar-Ck6-s6Vl.js} +1 -1
- package/static/assets/{card-BguljVtN.js → card-B1BNEOKA.js} +1 -1
- package/static/assets/{chevron-left-DZQ_tMvU.js → chevron-left-D13rHXtZ.js} +1 -1
- package/static/assets/{chevrons-up-BCenbxtV.js → chevrons-up-DrGM9h8F.js} +1 -1
- package/static/assets/{circle-alert-CZtpB74t.js → circle-alert-3FuqDs2g.js} +1 -1
- package/static/assets/{circle-check-hWIEYAMH.js → circle-check-Cq24IiHP.js} +1 -1
- package/static/assets/{circle-check-big-CTApxALS.js → circle-check-big-XKpfzr-Y.js} +1 -1
- package/static/assets/{circle-play-BF3gDlvZ.js → circle-play-CEPnc0z3.js} +1 -1
- package/static/assets/{circle-x-BtYTEkcT.js → circle-x-4bsQsvLG.js} +1 -1
- package/static/assets/{clipboard-B8Tnfm3W.js → clipboard-Xdr0FfgD.js} +1 -1
- package/static/assets/{clock-_sj3uVNp.js → clock-BkRDj1VL.js} +1 -1
- package/static/assets/{download-CPGv4d5Q.js → download-_PvO8olJ.js} +1 -1
- package/static/assets/{droid-BWtMgfPD.js → droid-DqWsM2dp.js} +5 -5
- package/static/assets/{external-link-CtxWkvSs.js → external-link-C34deyLk.js} +1 -1
- package/static/assets/{eye-_nXnan_b.js → eye-CApn6EOn.js} +1 -1
- package/static/assets/{folder-git-2-C_Zkp5wq.js → folder-git-2-B5Xz-Xdp.js} +1 -1
- package/static/assets/{index-BlLRLvWP.js → index-DLvo1sdI.js} +9 -9
- package/static/assets/{info-fJ-d5-p-.js → info-BzNlGG-G.js} +1 -1
- package/static/assets/{label-PINvlQb-.js → label-CdwSXdXm.js} +1 -1
- package/static/assets/{markdown-editor-B7Zxgu1u.js → markdown-editor-BfIQ27jO.js} +1 -1
- package/static/assets/{pause-C9zNWRax.js → pause-FjNAOibm.js} +1 -1
- package/static/assets/{play-BpXD0Ub0.js → play-ps1v3QHM.js} +1 -1
- package/static/assets/{plus-DBJTL6qk.js → plus-ChDS7MXp.js} +1 -1
- package/static/assets/{radio-group-DBaY5DVP.js → radio-group-xmkSGMqE.js} +1 -1
- package/static/assets/{refresh-cw-SQsUc3_C.js → refresh-cw-DZmqHMC0.js} +1 -1
- package/static/assets/{search-CBNlhD-8.js → search-1cnszOvc.js} +1 -1
- package/static/assets/{switch-C3ys7mIF.js → switch-DIjerrYl.js} +1 -1
- package/static/assets/{tabs-BpxOu6UL.js → tabs-DHfBLbor.js} +1 -1
- package/static/assets/{tag-Cu4oj34X.js → tag-CGdHqvLW.js} +1 -1
- package/static/assets/{terminal-preview-B5-BekLC.js → terminal-preview-DfhfOJmr.js} +1 -1
- package/static/assets/{use-terminal-CDMgbskg.js → use-terminal-BZlVNW2z.js} +1 -1
- package/static/assets/{zap-LrtVPxxV.js → zap-CN2EX1x-.js} +1 -1
- package/static/index.html +1 -1
- package/static/assets/AgentDetailPage-1hbFBTeB.js +0 -1
- package/static/assets/AgentEditPage-qMmg057j.js +0 -1
- package/static/assets/AgentsPage-DyyJrXqo.js +0 -3
- package/static/assets/AgentsSettingsPage-Bf61k6i0.js +0 -6
- package/static/assets/CodePage-aWl0jKwx.js +0 -2
- package/static/assets/NewAgentPage-BqvZZJmC.js +0 -1
- package/static/assets/TerminalSessionPage-C8YA0AmM.js +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,b9 as E,at as K,an as T,j as a,ao as N,ba as U,ar as x,as as g,bb as V,aq as w,bc as z,aw as H,av as $,e as I,bd as W}from"./index-
|
|
1
|
+
import{r as n,b9 as E,at as K,an as T,j as a,ao as N,ba as U,ar as x,as as g,bb as V,aq as w,bc as z,aw as H,av as $,e as I,bd as W}from"./index-DLvo1sdI.js";var C="Radio",[X,_]=N(C),[Y,J]=X(C),j=n.forwardRef((r,t)=>{const{__scopeRadio:e,name:d,checked:o=!1,required:s,disabled:i,value:p="on",onCheck:f,form:R,...v}=r,[l,m]=n.useState(null),c=g(t,y=>m(y)),u=n.useRef(!1),b=l?R||!!l.closest("form"):!0;return a.jsxs(Y,{scope:e,checked:o,disabled:i,children:[a.jsx(x.button,{type:"button",role:"radio","aria-checked":o,"data-state":S(o),"data-disabled":i?"":void 0,disabled:i,value:p,...v,ref:c,onClick:w(r.onClick,y=>{o||f?.(),b&&(u.current=y.isPropagationStopped(),u.current||y.stopPropagation())})}),b&&a.jsx(P,{control:l,bubbles:!u.current,name:d,value:p,checked:o,required:s,disabled:i,form:R,style:{transform:"translateX(-100%)"}})]})});j.displayName=C;var k="RadioIndicator",G=n.forwardRef((r,t)=>{const{__scopeRadio:e,forceMount:d,...o}=r,s=J(k,e);return a.jsx(z,{present:d||s.checked,children:a.jsx(x.span,{"data-state":S(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});G.displayName=k;var Q="RadioBubbleInput",P=n.forwardRef(({__scopeRadio:r,control:t,checked:e,bubbles:d=!0,...o},s)=>{const i=n.useRef(null),p=g(i,s),f=H(e),R=$(t);return n.useEffect(()=>{const v=i.current;if(!v)return;const l=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(l,"checked").set;if(f!==e&&c){const u=new Event("click",{bubbles:d});c.call(v,e),v.dispatchEvent(u)}},[f,e,d]),a.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:e,...o,tabIndex:-1,ref:p,style:{...o.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});P.displayName=Q;function S(r){return r?"checked":"unchecked"}var Z=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],h="RadioGroup",[ee,de]=N(h,[E,_]),A=E(),D=_(),[oe,re]=ee(h),M=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,name:d,defaultValue:o,value:s,required:i=!1,disabled:p=!1,orientation:f,dir:R,loop:v=!0,onValueChange:l,...m}=r,c=A(e),u=K(R),[b,y]=T({prop:s,defaultProp:o??null,onChange:l,caller:h});return a.jsx(oe,{scope:e,name:d,required:i,disabled:p,value:b,onValueChange:y,children:a.jsx(U,{asChild:!0,...c,orientation:f,dir:u,loop:v,children:a.jsx(x.div,{role:"radiogroup","aria-required":i,"aria-orientation":f,"data-disabled":p?"":void 0,dir:u,...m,ref:t})})})});M.displayName=h;var O="RadioGroupItem",q=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,disabled:d,...o}=r,s=re(O,e),i=s.disabled||d,p=A(e),f=D(e),R=n.useRef(null),v=g(t,R),l=s.value===o.value,m=n.useRef(!1);return n.useEffect(()=>{const c=b=>{Z.includes(b.key)&&(m.current=!0)},u=()=>m.current=!1;return document.addEventListener("keydown",c),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",u)}},[]),a.jsx(V,{asChild:!0,...p,focusable:!i,active:l,children:a.jsx(j,{disabled:i,required:s.required,checked:l,...f,...o,name:s.name,ref:v,onCheck:()=>s.onValueChange(o.value),onKeyDown:w(c=>{c.key==="Enter"&&c.preventDefault()}),onFocus:w(o.onFocus,()=>{m.current&&R.current?.click()})})})});q.displayName=O;var ae="RadioGroupIndicator",F=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,...d}=r,o=D(e);return a.jsx(G,{...o,...d,ref:t})});F.displayName=ae;var L=M,B=q,te=F;const se=n.forwardRef(({className:r,...t},e)=>a.jsx(L,{className:I("grid gap-2",r),...t,ref:e}));se.displayName=L.displayName;const ne=n.forwardRef(({className:r,...t},e)=>a.jsx(B,{ref:e,className:I("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),...t,children:a.jsx(te,{className:"flex items-center justify-center",children:a.jsx(W,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ne.displayName=B.displayName;export{se as R,ne as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,e as i}from"./index-
|
|
1
|
+
import{r as c,j as e,e as i}from"./index-DLvo1sdI.js";const d=c.forwardRef(({className:s,onCheckedChange:r,onChange:t,...o},n)=>{const l=a=>{t?.(a),r?.(a.target.checked)};return e.jsxs("label",{className:i("relative inline-flex cursor-pointer",s),children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",onChange:l,ref:n,...o}),e.jsx("div",{className:"block bg-gray-300 w-9 h-5 rounded-full transition-colors duration-200 ease-in-out peer-checked:bg-blue-600"}),e.jsx("div",{className:"absolute left-0 top-0 bg-white w-4 h-4 rounded-full mt-0.5 ml-0.5 transition-transform duration-200 ease-in-out transform peer-checked:translate-x-4 shadow"})]})});d.displayName="Switch";export{d as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,at as F,an as $,j as c,ao as D,b8 as V,ar as g,b9 as y,ba as k,bb as G,aq as m,bc as L,e as T}from"./index-
|
|
1
|
+
import{r as l,at as F,an as $,j as c,ao as D,b8 as V,ar as g,b9 as y,ba as k,bb as G,aq as m,bc as L,e as T}from"./index-DLvo1sdI.js";var p="Tabs",[K,Q]=D(p,[y]),h=y(),[q,x]=K(p),N=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,onValueChange:r,defaultValue:d,orientation:n="horizontal",dir:u,activationMode:f="automatic",...v}=e,i=F(u),[s,b]=$({prop:o,onChange:r,defaultProp:d??"",caller:p});return c.jsx(q,{scope:t,baseId:V(),value:s,onValueChange:b,orientation:n,dir:i,activationMode:f,children:c.jsx(g.div,{dir:i,"data-orientation":n,...v,ref:a})})});N.displayName=p;var C="TabsList",I=l.forwardRef((e,a)=>{const{__scopeTabs:t,loop:o=!0,...r}=e,d=x(C,t),n=h(t);return c.jsx(k,{asChild:!0,...n,orientation:d.orientation,dir:d.dir,loop:o,children:c.jsx(g.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:a})})});I.displayName=C;var R="TabsTrigger",j=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,disabled:r=!1,...d}=e,n=x(R,t),u=h(t),f=A(n.baseId,o),v=E(n.baseId,o),i=o===n.value;return c.jsx(G,{asChild:!0,...u,focusable:!r,active:i,children:c.jsx(g.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":v,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:f,...d,ref:a,onMouseDown:m(e.onMouseDown,s=>{!r&&s.button===0&&s.ctrlKey===!1?n.onValueChange(o):s.preventDefault()}),onKeyDown:m(e.onKeyDown,s=>{[" ","Enter"].includes(s.key)&&n.onValueChange(o)}),onFocus:m(e.onFocus,()=>{const s=n.activationMode!=="manual";!i&&!r&&s&&n.onValueChange(o)})})})});j.displayName=R;var w="TabsContent",_=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,forceMount:r,children:d,...n}=e,u=x(w,t),f=A(u.baseId,o),v=E(u.baseId,o),i=o===u.value,s=l.useRef(i);return l.useEffect(()=>{const b=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(b)},[]),c.jsx(L,{present:r||i,children:({present:b})=>c.jsx(g.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!b,id:v,tabIndex:0,...n,ref:a,style:{...e.style,animationDuration:s.current?"0s":void 0},children:b&&d})})});_.displayName=w;function A(e,a){return`${e}-trigger-${a}`}function E(e,a){return`${e}-content-${a}`}var B=N,S=I,M=j,P=_;const U=B,z=l.forwardRef(({className:e,...a},t)=>c.jsx(S,{ref:t,className:T("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));z.displayName=S.displayName;const H=l.forwardRef(({className:e,...a},t)=>c.jsx(M,{ref:t,className:T("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));H.displayName=M.displayName;const O=l.forwardRef(({className:e,...a},t)=>c.jsx(P,{ref:t,className:T("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));O.displayName=P.displayName;export{U as T,z as a,H as b,O as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,af as j,j as u}from"./index-
|
|
1
|
+
import{r as t,af as j,j as u}from"./index-DLvo1sdI.js";import{x as k,a as B}from"./xterm-DTxiCjtJ.js";function A({sessionId:l,className:p,heightPx:d=160,maxScrollback:m=200}){const h=t.useRef(null),v=t.useRef(null),w=t.useRef(null),y=t.useRef(null),[x,R]=t.useState(!0),o=t.useRef([]),i=t.useRef(null);return t.useEffect(()=>{const a=h.current;if(!a||!l)return;const e=new k.Terminal({disableStdin:!0,cursorBlink:!1,convertEol:!0,scrollback:Math.max(50,Math.min(m,1e3)),fontSize:12,fontFamily:"'IBM Plex Mono', 'Source Code Pro', 'Fira Code', ui-monospace, Menlo, Monaco, monospace",lineHeight:1.25,letterSpacing:.3,theme:{background:"#1a1b26",foreground:"#c0caf5",cursor:"#c0caf5",selectionBackground:"#33467c",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}}),f=new B.FitAddon;e.loadAddon(f),e.open(a),a.style.height=`${d}px`,v.current=e,w.current=f;const s=()=>{try{const n=a.getBoundingClientRect();n.width>8&&n.height>8&&e.element&&f.fit()}catch{}},S=setTimeout(()=>s(),100),g=new ResizeObserver(()=>s());g.observe(a);const b=()=>{document.visibilityState==="visible"&&setTimeout(s,50)};document.addEventListener("visibilitychange",b);const c=new WebSocket(`${j}/ws/terminal-preview/${l}`);y.current=c,c.onopen=()=>R(!1);const E=()=>{i.current=null;const n=o.current;if(n.length){o.current=[];try{e.write(n.join(""))}catch{}}},F=()=>{i.current===null&&(i.current=requestAnimationFrame(E))};return c.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}if(r?.type==="snapshot"){if(e.reset(),o.current=[],r.data)try{e.write(r.data)}catch{}s()}else r?.type==="data"&&r.data&&(o.current.push(String(r.data)),F())},c.onclose=()=>{},c.onerror=()=>{},()=>{clearTimeout(S),g.disconnect(),document.removeEventListener("visibilitychange",b);try{c.close()}catch{}i.current!==null&&cancelAnimationFrame(i.current),i.current=null,o.current=[],e.dispose()}},[l,d,m]),u.jsxs("div",{className:`relative w-full ${p||""}`.trim(),children:[x&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/60 z-10",children:u.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading preview…"})}),u.jsx("div",{ref:h,className:"border border-muted rounded overflow-hidden"})]})}export{A as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,ak as b,A as f}from"./index-
|
|
1
|
+
import{r as i,ak as b,A as f}from"./index-DLvo1sdI.js";function j(){const[y,u]=i.useState([]),[m,c]=i.useState(!1),[g,o]=i.useState(null),{refresh:p}=b(),d=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=await fetch(`${f}/api/v1/terminal/${s}/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableLogging:n||!1,startupCommand:r})});if(!e.ok){const a=await e.json();throw new Error(a.error||"Failed to create terminal session")}const t=await e.json();return await p(),t.sessionId}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),null}finally{c(!1)}},[p]),S=i.useCallback(async s=>{try{c(!0),o(null);let n;if(s.startsWith("session-")){const e=s.split("-");n=`${e[0]}-${e[1]}`}else{const e=s.split("-");n=`${e[0]}-${e[1]}`}const r=await fetch(`${f}/api/v1/terminal/${n}/destroy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s})});if(!r.ok){const e=await r.json();throw new Error(e.error||"Failed to destroy terminal session")}return u(e=>e.filter(t=>t.id!==s)),await p(),!0}catch(n){const r=n instanceof Error?n.message:"Unknown error";return o(r),!1}finally{c(!1)}},[p]),$=i.useCallback(async(s,n,r)=>{try{o(null);let e;if(s.startsWith("session-")){const a=s.split("-");e=`${a[0]}-${a[1]}`}else{const a=s.split("-");e=`${a[0]}-${a[1]}`}const t=await fetch(`${f}/api/v1/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,cols:n,rows:r})});if(!t.ok){const a=await t.json();throw new Error(a.error||"Failed to resize terminal session")}return!0}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),!1}},[]),k=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=new URLSearchParams;s&&e.set("proposalId",s),n&&(e.set("withPreview","true"),r&&Number.isFinite(r)&&e.set("lines",String(r)));const t=`${f}/api/v1/terminal/sessions${e.toString()?`?${e.toString()}`:""}`,a=await fetch(t);if(!a.ok){const l=await a.json();throw new Error(l.error||"Failed to fetch terminal sessions")}const w=await a.json();u(w.sessions)}catch(e){const t=e instanceof Error?e.message:"Unknown error";o(t)}finally{c(!1)}},[]),E=i.useCallback(async(s,n=8)=>{try{o(null);const r=new URLSearchParams;r.set("sessionId",s),r.set("withPreview","true"),r.set("lines",String(n)),r.set("colorize","true");const e=`${f}/api/v1/terminal/sessions?${r.toString()}`,t=await fetch(e);if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to fetch preview")}const a=await t.json(),w=Array.isArray(a?.sessions)&&a.sessions[0]?.preview?a.sessions[0].preview:[];return u(l=>l.map(h=>h.id===s?{...h,preview:w}:h)),w}catch(r){const e=r instanceof Error?r.message:"Unknown error";return o(e),[]}},[]);return{sessions:y,loading:m,error:g,createSession:d,destroySession:S,resizeSession:$,refreshSessions:k,fetchPreview:E}}export{j as u};
|
package/static/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
|
|
10
10
|
<title>Coconut - Agentic Development Environment</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-DLvo1sdI.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-DVTgTsDa.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body class="font-inter">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as A,u as E,r as h,j as e,B as i,L as d,Q as k,V as B,p as S,A as N}from"./index-BlLRLvWP.js";import{C as l,b as o,a as m,c as f,d as z}from"./card-BguljVtN.js";import{B as v}from"./badge-DvLOhob-.js";import{A as u}from"./arrow-left-DZzHrGWA.js";const D=t=>t?Array.isArray(t)?t.filter(r=>typeof r=="string").map(r=>r.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(r=>r.trim()).filter(Boolean):[]:[],c={blue:{bg:"#dbeafe",border:"#2563eb",text:"#1e40af"},green:{bg:"#dcfce7",border:"#16a34a",text:"#166534"},red:{bg:"#fee2e2",border:"#dc2626",text:"#991b1b"},emerald:{bg:"#d1fae5",border:"#10b981",text:"#047857"},purple:{bg:"#f3e8ff",border:"#9333ea",text:"#6b21a8"},orange:{bg:"#fed7aa",border:"#ea580c",text:"#9a3412"},yellow:{bg:"#fef9c3",border:"#eab308",text:"#854d0e"},teal:{bg:"#ccfbf1",border:"#14b8a6",text:"#0f766e"},indigo:{bg:"#e0e7ff",border:"#6366f1",text:"#4338ca"},pink:{bg:"#fce7f3",border:"#ec4899",text:"#9f1239"},cyan:{bg:"#cffafe",border:"#06b6d4",text:"#155e75"},slate:{bg:"#f1f5f9",border:"#475569",text:"#334155"},gray:{bg:"#f3f4f6",border:"#6b7280",text:"#374151"}};function F(){const t=A(),r=E(),[s,y]=h.useState(null),[w,j]=h.useState(!0),[p,x]=h.useState(null);h.useEffect(()=>{async function a(){try{j(!0);const g=await(await fetch(`${N}/api/v1/agents/${t.id}`)).json();g.success?y(g.document):x(g.error||"Failed to fetch agent")}catch(n){x(n instanceof Error?n.message:"Unknown error")}finally{j(!1)}}t.id&&a()},[t.id]);const C=async()=>{if(!(!s||!confirm("Are you sure you want to delete this agent?")))try{const n=await(await fetch(`${N}/api/v1/agents/${s.filename.replace(".md","")}`,{method:"DELETE"})).json();n.success?r("/agents"):x(n.error?.message||"Failed to delete agent")}catch(a){x(a instanceof Error?a.message:"Unknown error")}};if(w)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-64 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-32 animate-pulse mt-2"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(i,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(d,{to:"/agents",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(u,{className:"h-4 w-4"})})})})]}),e.jsx(l,{children:e.jsxs(o,{children:[e.jsx("div",{className:"h-6 bg-muted rounded w-48 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-64 animate-pulse"})]})})]});if(p||!s)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agent Not Found"}),e.jsx("p",{className:"text-muted-foreground",children:"The requested agent could not be found"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(i,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(d,{to:"/agents",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(u,{className:"h-4 w-4"})})})})]}),e.jsx(l,{children:e.jsx(m,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-destructive",children:p||"Agent not found"})})})})]});const b=D(s.metadata.tools);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:s.metadata.name}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(i,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(d,{to:"/agents",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(u,{className:"h-4 w-4"})})}),e.jsx(i,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(d,{to:`/agents/${s.filename.replace(".md","")}/edit`,children:[e.jsx(k,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(i,{variant:"destructive",size:"sm",onClick:C,children:[e.jsx(B,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Delete"})]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(l,{children:[e.jsx(o,{children:e.jsx(f,{children:"Description"})}),e.jsx(m,{children:e.jsx("p",{children:s.metadata.description})})]}),s.content&&e.jsxs(l,{children:[e.jsxs(o,{children:[e.jsx(f,{children:"Instructions"}),e.jsx(z,{children:"System prompt and behavior instructions for this agent"})]}),e.jsx(m,{children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-muted p-4 rounded-md",children:s.content})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(l,{children:[e.jsx(o,{children:e.jsx(f,{children:"Actions"})}),e.jsx(m,{className:"space-y-2",children:e.jsx(i,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(d,{to:`/terminal/ag-${s.filename.replace(".md","")}`,children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),"Start Agent"]})})})]}),e.jsxs(l,{children:[e.jsx(o,{children:e.jsx(f,{children:"Information"})}),e.jsxs(m,{className:"space-y-2",children:[s.metadata.color&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"Color"}),e.jsx(v,{variant:"outline",className:"capitalize border-2",style:{backgroundColor:c[s.metadata.color]?.bg||c.blue.bg,color:c[s.metadata.color]?.text||c.blue.text,borderColor:c[s.metadata.color]?.border||c.blue.border},children:s.metadata.color})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Tools"}),b.length>0?e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:b.map(a=>e.jsx(v,{variant:"secondary",children:a},a))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No specific tools configured - inherits all tools"})]})]})]})]})]})]})}export{F as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as X,u as Y,a as Z,r as n,j as e,B as m,L as v,p as O,I as D,w as ee,ag as te,A as y}from"./index-BlLRLvWP.js";import{C as N,a as C,b as se,c as ae}from"./card-BguljVtN.js";import{L as l}from"./label-PINvlQb-.js";import{B as re}from"./badge-DvLOhob-.js";import{c as ne}from"./clipboard-B9ndUJKl.js";import{A as z}from"./arrow-left-DZzHrGWA.js";import{C as oe,a as ie}from"./clipboard-B8Tnfm3W.js";function xe(){const{id:i}=X(),U=Y(),{toast:w}=Z(),[q,S]=n.useState(!0),[o,A]=n.useState(!1),[d,c]=n.useState(null),[R,_]=n.useState(""),[u,E]=n.useState(""),[g,F]=n.useState(""),[f,P]=n.useState("blue"),[x,k]=n.useState([]),[h,$]=n.useState(""),[L,p]=n.useState([]),[H,M]=n.useState(!0),[J,T]=n.useState(!1),G=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],K={blue:{bg:"#3b82f6",border:"#1e40af",text:"#ffffff"},green:{bg:"#22c55e",border:"#15803d",text:"#ffffff"},red:{bg:"#ef4444",border:"#b91c1c",text:"#ffffff"},emerald:{bg:"#10b981",border:"#047857",text:"#ffffff"},purple:{bg:"#a855f7",border:"#7e22ce",text:"#ffffff"},orange:{bg:"#f97316",border:"#c2410c",text:"#ffffff"},yellow:{bg:"#eab308",border:"#a16207",text:"#ffffff"},teal:{bg:"#14b8a6",border:"#0f766e",text:"#ffffff"},indigo:{bg:"#6366f1",border:"#4338ca",text:"#ffffff"},pink:{bg:"#ec4899",border:"#be185d",text:"#ffffff"},cyan:{bg:"#06b6d4",border:"#0e7490",text:"#ffffff"},slate:{bg:"#64748b",border:"#475569",text:"#ffffff"},gray:{bg:"#6b7280",border:"#4b5563",text:"#ffffff"}},Q=t=>{if(!t)return[];if(Array.isArray(t)){const a=t.filter(s=>typeof s=="string").map(s=>s.trim()).filter(Boolean);return Array.from(new Set(a))}return typeof t=="string"?Array.from(new Set(t.split(",").map(a=>a.trim()).filter(Boolean))):[]};n.useEffect(()=>{async function t(){try{S(!0);const s=await(await fetch(`${y}/api/v1/agents/${i}`)).json();if(!s.success)throw new Error(s.error||"Failed to load agent");const r=s.document;_(r.filename),E(r.metadata.name||""),F(r.metadata.description||""),P(r.metadata.color||"blue"),$(r.content||""),k(Q(r.metadata.tools))}catch(a){const s=a instanceof Error?a.message:"Failed to load agent";c(s)}finally{S(!1)}}i&&t()},[i]),n.useEffect(()=>{let t=!0;return(async()=>{M(!0);try{const s=await fetch(`${y}/api/v1/mcp`);if(!s.ok)throw new Error("Failed to fetch MCP servers");const r=await s.json();if(!r?.success||!Array.isArray(r.servers)){t&&p([]);return}const B=r.mcpServers&&typeof r.mcpServers=="object"?r.mcpServers:{},b=r.servers.map(I=>{const j=B[I]??{};return{name:I,enabled:j?.enabled!==!1,description:typeof j?.description=="string"?j.description:void 0}});t&&p(b)}catch(s){console.error("Failed to load MCP servers",s),t&&p([])}finally{t&&M(!1)}})(),()=>{t=!1}},[]);const V=async()=>{const t=".nut/config.json";try{await ne(t),T(!0),w({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>T(!1),2e3)}catch(a){console.error("Failed to copy config path:",a),w({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},W=async t=>{if(t.preventDefault(),!u.trim()||!g.trim()||!h.trim()){c("Name, description, and agent instructions are required");return}try{A(!0),c(null);const a={name:u.trim(),description:g.trim(),content:h.trim(),metadata:{color:f,tools:x.length?x:void 0}},r=await(await fetch(`${y}/api/v1/agents/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.error||"Failed to update agent");const b=r.document.filename.replace(/\.md$/,"");U(`/agents/${b}`)}catch(a){const s=a instanceof Error?a.message:"Failed to update agent";c(s)}finally{A(!1)}};return q?e.jsx("div",{className:"space-y-6",children:e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:"Loading agent..."})})}):d?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Agent"}),e.jsx("p",{className:"text-muted-foreground",children:"Unable to load agent"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/agents/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(z,{className:"h-4 w-4"})})})})]}),e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:e.jsx("div",{className:"text-destructive",children:d})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Agent"}),e.jsxs("p",{className:"text-muted-foreground",children:["File: ",R]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/agents/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(z,{className:"h-4 w-4"})})})})]}),e.jsxs(N,{children:[e.jsx(se,{children:e.jsxs(ae,{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-5 w-5"}),"Agent Configuration"]})}),e.jsx(C,{children:e.jsxs("form",{onSubmit:W,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"name",children:"Name *"}),e.jsx(D,{id:"name",value:u,onChange:t=>E(t.target.value),disabled:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"description",children:"Description *"}),e.jsx(D,{id:"description",value:g,onChange:t=>F(t.target.value),disabled:o})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:G.map(t=>{const a=K[t];return e.jsx("button",{type:"button",onClick:()=>P(t),disabled:o,className:`w-10 h-10 rounded-md border-2 transition-all ${f===t?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:a.bg,borderColor:f===t?a.border:"hsl(var(--border))",...f===t&&{"--tw-ring-color":a.border}},title:t,children:e.jsx("span",{className:"sr-only",children:t})},t)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"content",children:"Agent Instructions *"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["System prompt or instructions for this agent's behavior."," ","Insert ",e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:".nut/config.json"})," ",e.jsx("button",{type:"button",onClick:V,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:J?e.jsx(oe,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(ie,{className:"h-3.5 w-3.5 ml-0.5"})})," ","if you want the agent to be able to access its name, role, or email address."]}),e.jsx(ee,{id:"content",value:h,onChange:t=>$(t.target.value),rows:8,disabled:o,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Tools (Optional)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this agent should be able to use. Leave empty to inherit all available servers."}),e.jsx("div",{className:"space-y-2",children:H?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers…"}):L.length===0?e.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):L.map(t=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[e.jsx(te,{checked:x.includes(t.name),onCheckedChange:a=>{k(s=>a===!0?s.includes(t.name)?s:[...s,t.name]:s.filter(r=>r!==t.name))},disabled:o||!t.enabled}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-medium",children:[t.name,!t.enabled&&e.jsx(re,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.enabled?t.description||"Enabled MCP server":"Enable this server in Settings to allow agents to use it"})]})]},t.name))})]}),d&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:d}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(m,{type:"button",variant:"outline",asChild:!0,disabled:o,children:e.jsx(v,{to:`/agents/${i}`,children:"Cancel"})}),e.jsx(m,{type:"submit",disabled:o,children:o?"Saving...":"Save Changes"})]})]})})]})]})}export{xe as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e,S as I,a2 as L,r as x,a as O,A as R,H as M,B as b,L as v,p as E,al as $,am as _}from"./index-BlLRLvWP.js";import{C as N,a as w,b as D,c as H}from"./card-BguljVtN.js";import{B as y}from"./badge-DvLOhob-.js";import{c as U}from"./clipboard-B9ndUJKl.js";import{R as Y,L as F}from"./browser-modal-DzaD2oDW.js";import{R as G,f as J}from"./registry-ANRa5WBi.js";import{P as T}from"./plus-DBJTL6qk.js";import{T as K}from"./tag-Cu4oj34X.js";import"./search-CBNlhD-8.js";const V=["color","tools","createdAt","updatedAt","version","focusAreas","contextPreferences","tags"];function P(s){if(s){if(Array.isArray(s)){const r=s.map(o=>{if(typeof o=="string")return o.trim();if(typeof o=="number")return`${o}`}).filter(o=>typeof o=="string"&&o.length>0);return r.length>0?r:void 0}if(typeof s=="string"){const r=s.split(",").map(o=>o.trim()).filter(o=>o.length>0);return r.length>0?r:void 0}}}function q(s,r){const o=[];if(s.content&&typeof s.content=="object")for(const n of Object.values(s.content))typeof n=="string"&&n.trim().length>0&&o.push(n.trim());const i=[];return i.push(`# ${r}`),s.description?.trim()&&i.push(s.description.trim()),[...i,...o].join(`
|
|
2
|
-
|
|
3
|
-
`).trim()}function z(s,r){const o=s.name||r.name,i=r.description||s.description||"",a={registryId:s.id,registryEndpoint:s.endpoint,registrySource:G,author:s.author};for(const n of V){const d=r[n];if(d!==void 0)if(n==="tools"||n==="focusAreas"||n==="contextPreferences"||n==="tags"){const f=P(d);f&&(a[n]=f)}else a[n]=d}!a.version&&s.version&&(a.version=s.version),a.color||(a.color="blue"),!a.tags&&s.tags&&(a.tags=P(s.tags));for(const[n,d]of Object.entries(a))d==null&&delete a[n];return{name:o,description:i,content:q(r,o),metadata:Object.keys(a).length>0?a:void 0}}function B({open:s,onOpenChange:r,onImport:o}){return e.jsx(Y,{open:s,onOpenChange:r,categoryId:"agents",title:"Coconut Registry – Agents",confirmLabel:"Import Agent",getDetail:i=>J(i.endpoint),renderPreview:(i,a)=>{if(!a)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an agent to preview"});const n=z(i,a),d=n.metadata??{},f=typeof d.version=="string"?d.version:void 0,u=Array.isArray(i.tags)?i.tags:[],j=Array.isArray(d.tools)?d.tools.filter(c=>typeof c=="string"):[],p=Array.isArray(d.focusAreas)?d.focusAreas.filter(c=>typeof c=="string"):[];return e.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border",children:e.jsx(I,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:i.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),f&&e.jsxs(y,{variant:"outline",children:["v",f]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Registry ID: ",e.jsx("span",{className:"font-mono",children:i.id})]}),u.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(c=>e.jsx(y,{variant:"secondary",children:c},c))}),j.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:"Tools:"}),j.map(c=>e.jsx(y,{variant:"outline",children:c},c))]}),p.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-medium",children:"Focus Areas"}),e.jsx("ul",{className:"list-disc pl-5 text-sm text-muted-foreground",children:p.map(c=>e.jsx("li",{children:c},c))})]})]}),e.jsx(L,{className:"[&_.prose]:max-w-none",children:n.content})]})})})},onConfirm:async(i,a)=>{const n=z(i,a);await o({summary:i,detail:a,payload:n})}})}const Q=s=>s?Array.isArray(s)?s.filter(r=>typeof r=="string").map(r=>r.trim()).filter(Boolean):typeof s=="string"?s.split(",").map(r=>r.trim()).filter(Boolean):[]:[],g={blue:{bg:"#dbeafe",border:"#2563eb",text:"#1e40af"},green:{bg:"#dcfce7",border:"#16a34a",text:"#166534"},red:{bg:"#fee2e2",border:"#dc2626",text:"#991b1b"},emerald:{bg:"#d1fae5",border:"#10b981",text:"#047857"},purple:{bg:"#f3e8ff",border:"#9333ea",text:"#6b21a8"},orange:{bg:"#fed7aa",border:"#ea580c",text:"#9a3412"},yellow:{bg:"#fef9c3",border:"#eab308",text:"#854d0e"},teal:{bg:"#ccfbf1",border:"#14b8a6",text:"#0f766e"},indigo:{bg:"#e0e7ff",border:"#6366f1",text:"#4338ca"},pink:{bg:"#fce7f3",border:"#ec4899",text:"#9f1239"},cyan:{bg:"#cffafe",border:"#06b6d4",text:"#155e75"},slate:{bg:"#f1f5f9",border:"#475569",text:"#334155"},gray:{bg:"#f3f4f6",border:"#6b7280",text:"#374151"}};function ie(){const[s,r]=x.useState([]),[o,i]=x.useState(!0),[a,n]=x.useState({}),[d,f]=x.useState(!1),[u,j]=x.useState(!1),{toast:p}=O(),c=x.useCallback(async()=>{i(!0);try{const t=await fetch(`${R}/api/v1/agents`);if(!t.ok)throw new Error("Failed to load agents");const m=await t.json();r(Array.isArray(m.documents)?m.documents:[])}catch(t){console.error("Failed to load agents:",t),r([])}finally{i(!1)}},[]);x.useEffect(()=>{c()},[c]);const A=async t=>{const m=`.nut/agents/${t}`;try{await U(m),n(l=>({...l,[t]:!0})),setTimeout(()=>{n(l=>({...l,[t]:!1}))},2e3),p({title:"Path copied!",description:`Copied ${m} to clipboard`})}catch(l){console.error("Failed to copy path:",l),p({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},C=x.useCallback(async({payload:t})=>{let m=!1;j(!0);try{const l=await fetch(`${R}/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,description:t.description,content:t.content,metadata:t.metadata})});let h=null;try{h=await l.json()}catch(k){console.error("Failed to parse registry import response:",k)}if(!(l.ok&&h?.success)){const S=(typeof h?.error=="string"?h.error:h?.error?.message)||l.statusText||"Failed to import agent from registry";throw p({title:"Failed to import agent",description:S,variant:"destructive"}),m=!0,new Error(S)}p({title:"Agent imported",description:`${t.name} is now available in Coconut`}),await c()}catch(l){if(!m){const h=l instanceof Error&&l.message?l.message:"Failed to import agent from registry";p({title:"Failed to import agent",description:h,variant:"destructive"})}throw l}finally{j(!1)}},[c,p]);return o?e.jsx("div",{className:"space-y-6",children:e.jsx(N,{children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(M,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading skills..."})]})})})}):s.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Skills"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage skills for your agents"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>f(!0),disabled:u,children:[e.jsx(F,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsx(b,{size:"sm",asChild:!0,children:e.jsxs(v,{to:"/agents/new",children:[e.jsx(T,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Create New"})]})})]})]}),e.jsx(N,{children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(E,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Skills Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Specialized skills help you automate your development and business workflows."})]})})})]}),e.jsx(B,{open:d,onOpenChange:f,onImport:C})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Skills"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage skills for your agents"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>f(!0),disabled:u,children:[e.jsx(F,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsx(b,{size:"sm",asChild:!0,children:e.jsxs(v,{to:"/agents/new",children:[e.jsx(T,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Create New"})]})})]})]}),e.jsx("div",{className:"grid gap-4",children:s.map(t=>{const m=Q(t.metadata.tools);return e.jsx(v,{to:`/agents/${t.filename.replace(".md","")}`,className:"block",children:e.jsxs(N,{className:"group hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:[e.jsx(D,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"text-lg",children:t.title}),e.jsx(b,{variant:"ghost",size:"sm",onClick:l=>{l.preventDefault(),A(t.filename)},className:"h-6 w-6 p-0 hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy file path to clipboard",children:a[t.filename]?e.jsx($,{className:"w-3 h-3 text-green-600"}):e.jsx(_,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"text-xs text-muted-foreground font-mono bg-muted/50 px-2 py-1 rounded inline-block cursor-pointer hover:bg-muted/70 transition-colors",onClick:l=>{l.preventDefault(),A(t.filename)},title:"Click to copy file path to clipboard",children:[".nut/agents/",t.filename]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(K,{className:"w-3 h-3"}),t.metadata.color||"blue"]}),m.length>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(E,{className:"w-3 h-3"}),m.join(", ")]})]})]}),t.metadata.color&&e.jsx(y,{variant:"outline",className:"capitalize border-2",style:{backgroundColor:g[t.metadata.color]?.bg||g.blue.bg,color:g[t.metadata.color]?.text||g.blue.text,borderColor:g[t.metadata.color]?.border||g.blue.border},children:t.metadata.color})]})}),e.jsx(w,{children:e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:t.metadata.description})})})})]})},t.filename)})})]}),e.jsx(B,{open:d,onOpenChange:f,onImport:C})]})}export{ie as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{c as b,j as e,a6 as w,B as t,s as C,V as A,I as r,h as l,i as c,k as d,l as o,m as i}from"./index-BlLRLvWP.js";import{C as x,b as m,c as u,d as h,a as j}from"./card-BguljVtN.js";import{L as a}from"./label-PINvlQb-.js";import{B as n}from"./badge-DvLOhob-.js";import{P as S}from"./plus-DBJTL6qk.js";import{P as p}from"./pause-C9zNWRax.js";import{P as R}from"./play-BpXD0Ub0.js";import{Z as k}from"./zap-LrtVPxxV.js";/**
|
|
2
|
-
* @license lucide-react v0.542.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const T=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],P=b("chart-column",T);function V(){const g=[{id:"1",name:"Code Review Agent",description:"Automatically reviews pull requests and provides feedback",type:"Code Review",status:"active",model:"claude-3.5-sonnet",lastRun:"5 minutes ago",runsToday:23,successRate:"94%"},{id:"2",name:"Documentation Agent",description:"Generates and updates code documentation automatically",type:"Documentation",status:"paused",model:"gpt-4",lastRun:"2 hours ago",runsToday:8,successRate:"98%"},{id:"3",name:"Bug Hunter Agent",description:"Scans code for potential bugs and security vulnerabilities",type:"Quality Assurance",status:"active",model:"gemini-pro",lastRun:"15 minutes ago",runsToday:12,successRate:"87%"},{id:"4",name:"Performance Monitor",description:"Monitors application performance and suggests optimizations",type:"Performance",status:"inactive",model:"claude-3-haiku",lastRun:"1 day ago",runsToday:0,successRate:"91%"}],v=["Code Review","Documentation","Quality Assurance","Performance","Security","Refactoring","Testing","Architecture"],f=["claude-3.5-sonnet","claude-3-haiku","gpt-4","gpt-3.5-turbo","gemini-pro","gemini-flash"],y=s=>{switch(s){case"active":return e.jsx(k,{className:"h-4 w-4 text-green-500"});case"paused":return e.jsx(p,{className:"h-4 w-4 text-yellow-500"});case"inactive":return e.jsx("div",{className:"h-4 w-4 rounded-full bg-gray-300"});default:return e.jsx("div",{className:"h-4 w-4 rounded-full bg-gray-300"})}},N=s=>{switch(s){case"active":return e.jsx(n,{className:"bg-green-100 text-green-800",children:"Active"});case"paused":return e.jsx(n,{className:"bg-yellow-100 text-yellow-800",children:"Paused"});case"inactive":return e.jsx(n,{variant:"secondary",children:"Inactive"});default:return e.jsx(n,{variant:"secondary",children:"Unknown"})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Agents Management"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure and manage AI agents that automate various development tasks."})]}),e.jsx(w,{}),e.jsxs(x,{children:[e.jsx(m,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{children:"Active Agents"}),e.jsx(h,{children:"Monitor and control your AI agents across different workflows."})]}),e.jsxs(t,{size:"sm",children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),"Create Agent"]})]})}),e.jsx(j,{children:e.jsx("div",{className:"space-y-4",children:g.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[y(s.status),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h4",{className:"font-medium",children:s.name}),N(s.status),e.jsx(n,{variant:"outline",children:s.type}),e.jsx(n,{variant:"outline",children:s.model})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.description}),e.jsxs("div",{className:"flex items-center space-x-4 mt-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last run: ",s.lastRun]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Runs today: ",s.runsToday]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Success rate: ",s.successRate]})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(P,{className:"h-4 w-4"})}),s.status==="active"?e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(p,{className:"h-4 w-4"})}):e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(C,{className:"h-4 w-4"})}),e.jsx(t,{variant:"outline",size:"sm",children:e.jsx(A,{className:"h-4 w-4"})})]})]},s.id))})})]}),e.jsxs(x,{children:[e.jsxs(m,{children:[e.jsx(u,{children:"Create New Skill"}),e.jsx(h,{children:"Configure a new skill for your agents."})]}),e.jsxs(j,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"agentName",children:"Agent Name"}),e.jsx(r,{id:"agentName",placeholder:"Enter agent name"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"agentType",children:"Agent Type"}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(d,{placeholder:"Select agent type"})}),e.jsx(o,{children:v.map(s=>e.jsx(i,{value:s.toLowerCase(),children:s},s))})]})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"agentDescription",children:"Description"}),e.jsx(r,{id:"agentDescription",placeholder:"What does this agent do?"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"aiModel",children:"AI Model"}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(d,{placeholder:"Select AI model"})}),e.jsx(o,{children:f.map(s=>e.jsx(i,{value:s,children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"systemPrompt",children:"System Prompt"}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(d,{placeholder:"Select system prompt"})}),e.jsxs(o,{children:[e.jsx(i,{value:"code-review",children:"Code Review Assistant"}),e.jsx(i,{value:"documentation",children:"Documentation Generator"}),e.jsx(i,{value:"bug-analysis",children:"Bug Analysis Expert"}),e.jsx(i,{value:"architecture",children:"Architecture Advisor"})]})]})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"triggers",children:"Triggers"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:["Pull Request","Commit","File Change","Schedule","Manual"].map(s=>e.jsxs("label",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",className:"rounded"}),e.jsx("span",{className:"text-sm",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"configuration",children:"Agent Configuration (JSON)"}),e.jsx("textarea",{id:"configuration",className:"w-full min-h-[120px] p-3 border rounded-md font-mono text-sm",placeholder:'{"maxTokens": 4000, "temperature": 0.3, "timeout": 30}'})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(t,{variant:"outline",children:"Test Configuration"}),e.jsx(t,{variant:"outline",children:"Save as Draft"}),e.jsx(t,{children:"Create & Activate"})]})]})]}),e.jsxs(x,{children:[e.jsxs(m,{children:[e.jsx(u,{children:"Global Agent Settings"}),e.jsx(h,{children:"Configure global settings that apply to all agents."})]}),e.jsxs(j,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"maxConcurrent",children:"Max Concurrent Agents"}),e.jsx(r,{id:"maxConcurrent",type:"number",placeholder:"5"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"defaultTimeout",children:"Default Timeout (seconds)"}),e.jsx(r,{id:"defaultTimeout",type:"number",placeholder:"30"})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"retryPolicy",children:"Retry Policy"}),e.jsxs(l,{children:[e.jsx(c,{children:e.jsx(d,{placeholder:"Select retry policy"})}),e.jsxs(o,{children:[e.jsx(i,{value:"none",children:"No Retries"}),e.jsx(i,{value:"exponential",children:"Exponential Backoff"}),e.jsx(i,{value:"linear",children:"Linear Retry"}),e.jsx(i,{value:"custom",children:"Custom Policy"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"enableLogging",className:"rounded"}),e.jsx(a,{htmlFor:"enableLogging",children:"Enable detailed logging"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"enableMetrics",className:"rounded"}),e.jsx(a,{htmlFor:"enableMetrics",children:"Collect performance metrics"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"enableNotifications",className:"rounded"}),e.jsx(a,{htmlFor:"enableNotifications",children:"Send failure notifications"})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(t,{variant:"outline",children:"Reset to Defaults"}),e.jsx(t,{children:"Save Settings"})]})]})]})]})}export{V as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{u as ce,a as de,r as i,j as e,B as r,q as oe,T as me,O as xe,v as M,X as he,F as ue,Q as fe,D as ge,b as je,d as pe,f as ve,h as Ne,i as we,k as ye,l as Ce,m as b,p as be,a9 as B,aa as R,ab as O,ac as H,ad as L,ai as G,ah as Se,w as Ae,A as T}from"./index-BlLRLvWP.js";import{C as p,b as ke,a as _,c as De}from"./card-BguljVtN.js";import{B as U}from"./badge-DvLOhob-.js";import{u as Me}from"./use-terminal-CDMgbskg.js";import{T as Te}from"./terminal-preview-B5-BekLC.js";import{b as Ie,d as $e,c as Ee,a as Pe}from"./droid-BWtMgfPD.js";import{R as ze}from"./refresh-cw-SQsUc3_C.js";import{C as Fe,a as Be}from"./chevrons-up-BCenbxtV.js";import{P as Re}from"./play-BpXD0Ub0.js";import"./xterm-DTxiCjtJ.js";const Oe=c=>c?Array.isArray(c)?c.filter(x=>typeof x=="string").map(x=>x.trim()).filter(Boolean):typeof c=="string"?c.split(",").map(x=>x.trim()).filter(Boolean):[]:[];function Je(){const c=ce(),{sessions:x,loading:S,error:I,refreshSessions:y,createSession:V,destroySession:q}=Me(),{toast:v}=de(),[$,W]=i.useState([]),[Q,X]=i.useState(!0),[g,A]=i.useState(()=>({})),[k,N]=i.useState(!1),[j,J]=i.useState("claude"),[E,K]=i.useState(""),[D,P]=i.useState(!1),[h,Y]=i.useState([]),[f,w]=i.useState([]),[Z,ee]=i.useState({}),[u,se]=i.useState([]),[o,C]=i.useState([]),te=s=>{const t=Date.now(),a=new Date(s).getTime(),n=Math.max(0,Math.floor((t-a)/1e3));if(n<60)return`${n}s ago`;const d=Math.floor(n/60);if(d<60)return`${d}m ago`;const l=Math.floor(d/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`};i.useEffect(()=>{(async()=>{try{const t=await fetch(`${T}/api/v1/proposals`);if(t.ok){const a=await t.json(),n=a.data||a;W(Array.isArray(n)?n:[])}}catch(t){console.error("Error loading proposals:",t)}finally{X(!1)}})()},[]),i.useEffect(()=>{y()},[y]),i.useEffect(()=>{if(!k)return;(async()=>{try{const t=await fetch(`${T}/api/v1/mcp`);if(t.ok){const a=await t.json();a?.success&&Array.isArray(a.servers)&&(Y(a.servers),w(n=>n.filter(d=>a.servers.includes(d))),a.mcpServers&&typeof a.mcpServers=="object"&&ee(a.mcpServers))}}catch(t){console.error("Failed to load MCP servers",t)}try{const t=await fetch(`${T}/api/v1/agents`);if(t.ok){const a=await t.json(),d=(Array.isArray(a?.documents)?a.documents:[]).map(l=>({id:l.filename,name:l?.metadata?.name||l.title||l.filename,tools:Oe(l?.metadata?.tools)}));se(d),C(l=>l.filter(F=>d.some(re=>re.id===F)))}}catch(t){console.error("Failed to load agents",t)}})()},[k]),i.useEffect(()=>{o.length!==0&&w(s=>{const t=new Set(s),a=h.length>0?new Set(h):void 0;return o.forEach(n=>{const d=u.find(l=>l.id===n);d&&d.tools.forEach(l=>{(!a||a.has(l))&&t.add(l)})}),Array.from(t)})},[o,u,h]);const m=i.useMemo(()=>x.filter(s=>s.proposalId?.startsWith("cp-")||s.proposalId?.startsWith("ag-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[x]);i.useEffect(()=>{A(s=>{const t={...s};return m.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[m]);const z=i.useMemo(()=>$.filter(s=>s.status==="draft"||s.status==="ready").sort((s,t)=>new Date(t.metadata.createdAt).getTime()-new Date(s.metadata.createdAt).getTime()).slice(0,3),[$]),ae=()=>{const s=m.every(a=>g[a.id]),t={};m.forEach(a=>{t[a.id]=!s}),A(t)},ie=m.length>0&&m.every(s=>g[s.id]),ne=async s=>{await q(s)?(v({title:"Session closed",description:s}),setTimeout(()=>y(),100)):v({title:"Failed to close session",description:s,variant:"destructive"})},le=async()=>{P(!0);try{const s=`cp-${Date.now()}`,t={proposalId:s,contextType:"change-proposal",cliAgent:j,mcpServersMap:Z,selectedMcpServers:f,agents:u,selectedAgentIds:o,automationEnabled:!1,customInstruction:E.trim(),includeDefaultInstructions:!1};let a="";j==="claude"?a=Ie(t):j==="gemini"?a=$e(t):j==="codex"?a=Ee(t):j==="droid"&&(a=Pe(t)),await V(s,!1,a)?(v({title:"Coding session started",description:`Session ${s} created`}),N(!1),c(`/terminal/${s}`)):v({title:"Failed to start session",description:"Could not create terminal session",variant:"destructive"})}catch(s){console.error("Error starting coding session:",s),v({title:"Error",description:"Failed to start coding session",variant:"destructive"})}finally{P(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Code"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Terminal sessions and coding agents"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>y(),disabled:S,children:[e.jsx(ze,{className:`h-4 w-4 sm:mr-2 ${S?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),m.length>0&&e.jsx(r,{variant:"outline",size:"sm",onClick:ae,children:ie?e.jsxs(e.Fragment,{children:[e.jsx(Fe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Hide All"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Show All"})]})}),e.jsxs(r,{size:"sm",onClick:()=>N(!0),children:[e.jsx(Re,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Interactive Session"})]})]})]}),I&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:I})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),S?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,t)=>e.jsx(p,{className:"p-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),e.jsxs("div",{children:[e.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),e.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},t))}):m.length===0?e.jsx(p,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(oe,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No active sessions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Get started by launching an"," ",e.jsx("button",{onClick:()=>N(!0),className:"text-primary hover:underline font-medium",children:"Interactive Session"})," ","or working on a"," ",e.jsx("button",{onClick:()=>c("/proposals"),className:"text-primary hover:underline font-medium",children:"Change Proposal"})]})]})]})}):e.jsx("div",{className:"space-y-2",children:m.slice(0,10).map(s=>e.jsxs(p,{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(me,{className:"h-4 w-4 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:s.proposalId}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",s.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",te(s.lastActivity)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:`flex items-center gap-1 ${s.connected?"text-green-600":"text-gray-400"}`,title:s.connected?"Connected":"Disconnected",children:e.jsx("div",{className:`w-2 h-2 rounded-full ${s.connected?"bg-green-500":"bg-gray-400"}`})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>{A(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":g[s.id]?"Hide preview":"Show preview",title:g[s.id]?"Hide preview":"Show preview",children:g[s.id]?e.jsx(xe,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>c(`/terminal/${s.proposalId}`),children:"Open"}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>ne(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(he,{className:"h-4 w-4"})})]})]}),g[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>c(`/terminal/${s.proposalId}`),title:"Click to open full terminal session",children:e.jsx(Te,{sessionId:s.id,heightPx:160,maxScrollback:200})})]},s.id))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"New Tasks"}),Q?e.jsx("div",{className:"space-y-3",children:[...Array(3)].map((s,t)=>e.jsx(p,{children:e.jsx(ke,{className:"py-3",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-2/3 animate-pulse"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"})]}),e.jsx("div",{className:"h-5 bg-muted rounded w-16 animate-pulse"})]})})},t))}):z.length===0?e.jsx(p,{children:e.jsx(_,{className:"flex items-center justify-center py-6",children:e.jsx("div",{className:"text-center text-sm text-gray-500",children:"No draft or approved proposals found"})})}):e.jsx("div",{className:"space-y-2",children:z.map(s=>e.jsx(p,{className:"hover:shadow-md transition-all cursor-pointer hover:border-primary/50",onClick:()=>c(`/terminal/${s.id}`),children:e.jsx(_,{className:"py-4",children:e.jsx("div",{className:"flex justify-between items-start gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(De,{className:"text-base leading-tight",children:s.title||s.intent}),e.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[s.priority&&e.jsx(U,{variant:s.priority==="high"||s.priority==="critical"?"destructive":s.priority==="medium"?"secondary":"outline",className:"text-xs",children:s.priority}),e.jsx(U,{variant:"default",className:"text-xs",children:s.status})]})]}),s.content&&e.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[s.content.split(`
|
|
2
|
-
`).slice(0,2).join(" ").substring(0,150),s.content.length>150?"...":""]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.id," • by ",s.author.name," • ",new Date(s.metadata.createdAt).toLocaleDateString()]}),e.jsxs("div",{className:"flex gap-2",onClick:t=>t.stopPropagation(),children:[e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/proposals/${s.id}`),className:"h-7 px-2 text-xs",children:[e.jsx(ue,{className:"h-3 w-3 mr-1"})," View"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/proposals/${s.id}/edit`),className:"h-7 px-2 text-xs",children:[e.jsx(fe,{className:"h-3 w-3 mr-1"})," Edit"]})]})]})]})})})},s.id))})]}),e.jsx(ge,{open:k,onOpenChange:N,children:e.jsxs(je,{className:"max-w-lg",children:[e.jsxs(pe,{children:[e.jsx(ve,{children:"Start Coding Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Start an interactive coding session"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Coding Agent"}),e.jsxs(Ne,{value:j,onValueChange:s=>J(s),children:[e.jsx(we,{className:"w-full",children:e.jsx(ye,{placeholder:"Select coding agent"})}),e.jsxs(Ce,{children:[e.jsx(b,{value:"claude",children:"Claude Code"}),e.jsx(b,{value:"gemini",children:"Google Gemini"}),e.jsx(b,{value:"codex",children:"OpenAI Codex"}),e.jsx(b,{value:"droid",children:"Factory Droid"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(be,{className:"h-4 w-4"}),"Custom Agents"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[o.length," of ",u.length," selected"]})]}),e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[o.length===0?"Select agents...":o.length===u.length?"All agents selected":`${o.length} agent${o.length!==1?"s":""} selected`,e.jsx(M,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(O,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(H,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Agents"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),C(u.map(t=>t.id))},children:"All"}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),C([])},children:"None"})]})]}),e.jsx(L,{}),u.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No agents found"}):u.map(s=>e.jsx(G,{checked:o.includes(s.id),onCheckedChange:t=>{C(a=>t?a.includes(s.id)?a:[...a,s.id]:a.filter(n=>n!==s.id))},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:s.name}),s.tools.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",s.tools.join(", ")]}),s.tools.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},s.id))]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Se,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[f.length," of ",h.length," selected"]})]}),e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[f.length===0?"Select MCP servers...":f.length===h.length?"All servers selected":`${f.length} server${f.length!==1?"s":""} selected`,e.jsx(M,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(O,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(H,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Servers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),w(h)},children:"All"}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),w([])},children:"None"})]})]}),e.jsx(L,{}),h.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):h.map(s=>e.jsx(G,{checked:f.includes(s),onCheckedChange:t=>{w(a=>t?a.includes(s)?a:[...a,s]:a.filter(n=>n!==s))},children:s},s))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Additional Instructions (optional)"}),e.jsx(Ae,{value:E,onChange:s=>K(s.target.value),placeholder:"Add any custom instructions for the coding agent...",rows:4,className:"resize-none"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(r,{variant:"outline",onClick:()=>N(!1),disabled:D,children:"Cancel"}),e.jsx(r,{onClick:le,disabled:D,children:D?"Starting...":"Start Session"})]})]})]})})]})}export{Je as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as z,a as H,r as a,j as e,B as p,L as k,p as J,I as P,w as W,ag as Y,A}from"./index-BlLRLvWP.js";import{C as G,b as K,c as Q,a as V}from"./card-BguljVtN.js";import{L as l}from"./label-PINvlQb-.js";import{B as X}from"./badge-DvLOhob-.js";import{c as Z}from"./clipboard-B9ndUJKl.js";import{A as O}from"./arrow-left-DZzHrGWA.js";import{C as ee,a as se}from"./clipboard-B8Tnfm3W.js";function de(){const M=z(),{toast:b}=H(),[o,j]=a.useState(!1),[v,d]=a.useState(null),[m,E]=a.useState(""),[u,L]=a.useState(""),[c,T]=a.useState("blue"),[x,C]=a.useState([]),[g,F]=a.useState(""),[y,h]=a.useState([]),[B,N]=a.useState(!0),[I,w]=a.useState(!1),D=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],$={blue:{bg:"#3b82f6",border:"#1e40af",text:"#ffffff"},green:{bg:"#22c55e",border:"#15803d",text:"#ffffff"},red:{bg:"#ef4444",border:"#b91c1c",text:"#ffffff"},emerald:{bg:"#10b981",border:"#047857",text:"#ffffff"},purple:{bg:"#a855f7",border:"#7e22ce",text:"#ffffff"},orange:{bg:"#f97316",border:"#c2410c",text:"#ffffff"},yellow:{bg:"#eab308",border:"#a16207",text:"#ffffff"},teal:{bg:"#14b8a6",border:"#0f766e",text:"#ffffff"},indigo:{bg:"#6366f1",border:"#4338ca",text:"#ffffff"},pink:{bg:"#ec4899",border:"#be185d",text:"#ffffff"},cyan:{bg:"#06b6d4",border:"#0e7490",text:"#ffffff"},slate:{bg:"#64748b",border:"#475569",text:"#ffffff"},gray:{bg:"#6b7280",border:"#4b5563",text:"#ffffff"}};a.useEffect(()=>{let s=!0;return(async()=>{N(!0);try{const n=await fetch(`${A}/api/v1/mcp`);if(!n.ok)throw new Error("Failed to fetch MCP servers");const r=await n.json();if(!r?.success||!Array.isArray(r.servers)){s&&h([]);return}const U=r.mcpServers&&typeof r.mcpServers=="object"?r.mcpServers:{},S=r.servers.map(f=>{const i=U[f]??{};return{name:f,enabled:i?.enabled!==!1,description:typeof i?.description=="string"?i.description:void 0}});s&&(h(S),C(f=>f.filter(i=>S.some(_=>_.name===i))))}catch(n){console.error("Failed to load MCP servers",n),s&&h([])}finally{s&&N(!1)}})(),()=>{s=!1}},[]);const q=async()=>{const s=".nut/config.json";try{await Z(s),w(!0),b({title:"Copied!",description:`${s} copied to clipboard`}),setTimeout(()=>w(!1),2e3)}catch(t){console.error("Failed to copy config path:",t),b({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},R=async s=>{if(s.preventDefault(),!m.trim()||!u.trim()||!g.trim()){d("Name, description, and agent instructions are required");return}try{j(!0),d(null);const t={name:m.trim(),description:u.trim(),content:g.trim(),metadata:{color:c,tools:x.length>0?x:void 0}},r=await(await fetch(`${A}/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json();r.success?M("/agents"):d(r.error?.message||"Failed to create agent")}catch(t){d(t instanceof Error?t.message:"Unknown error")}finally{j(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Create New Skill"}),e.jsx("p",{className:"text-muted-foreground",children:"Define an AI agent for automated development workflows"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(p,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(k,{to:"/agents",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(O,{className:"h-4 w-4"})})})})]}),e.jsxs(G,{children:[e.jsx(K,{children:e.jsxs(Q,{className:"flex items-center gap-2",children:[e.jsx(J,{className:"h-5 w-5"}),"Skill Configuration"]})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:R,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"name",children:"Name *"}),e.jsx(P,{id:"name",placeholder:"e.g., design expert",value:m,onChange:s=>E(s.target.value),disabled:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"description",children:"Description *"}),e.jsx(P,{id:"description",placeholder:"When should this skill be used?",value:u,onChange:s=>L(s.target.value),disabled:o})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(s=>{const t=$[s];return e.jsx("button",{type:"button",onClick:()=>T(s),disabled:o,className:`w-10 h-10 rounded-md border-2 transition-all ${c===s?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:t.bg,borderColor:c===s?t.border:"hsl(var(--border))",...c===s&&{"--tw-ring-color":t.border}},title:s,children:e.jsx("span",{className:"sr-only",children:s})},s)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"content",children:"Agent Instructions *"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["System prompt or instructions for this skill."," ","Insert ",e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:".nut/config.json"})," ",e.jsx("button",{type:"button",onClick:q,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:I?e.jsx(ee,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(se,{className:"h-3.5 w-3.5 ml-0.5"})})," ","if you want the agent to be able to access its name, role, or email address."]}),e.jsx(W,{id:"content",placeholder:"You are a design expert that focuses on...",value:g,onChange:s=>F(s.target.value),rows:8,disabled:o,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Tools (Optional)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers does this skill require."}),e.jsx("div",{className:"space-y-2",children:B?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers…"}):y.length===0?e.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):y.map(s=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[e.jsx(Y,{checked:x.includes(s.name),onCheckedChange:t=>{C(n=>t===!0?n.includes(s.name)?n:[...n,s.name]:n.filter(r=>r!==s.name))},disabled:o||!s.enabled}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s.name,!s.enabled&&e.jsx(X,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.enabled?s.description||"Enabled MCP server":"Enable this server in Settings to allow agents to use it"})]})]},s.name))})]}),v&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:v}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(p,{type:"button",variant:"outline",asChild:!0,disabled:o,children:e.jsx(k,{to:"/agents",children:"Cancel"})}),e.jsx(p,{type:"submit",disabled:o,children:o?"Creating...":"Create Agent"})]})]})})]})]})}export{de as default};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{c as Ze,j as e,B as N,a9 as Me,aa as We,ab as Re,ac as Be,ad as Oe,ae as et,x as de,r as a,af as tt,P as rt,z as st,u as at,N as nt,a as it,q as ve,T as we,ag as Fe,h as Ne,i as ke,k as Se,l as Ce,m as H,X as De,p as Ae,s as ct,ah as Je,G as ot,D as lt,b as dt,d as mt,f as ut,v as Ue,ai as Ge,A as me}from"./index-BlLRLvWP.js";import{C as ht,a as xt}from"./card-BguljVtN.js";import{B as qe}from"./badge-DvLOhob-.js";import{R as gt,a as Te}from"./radio-group-DBaY5DVP.js";import{C as ft}from"./CollapsibleSection-B1AU3exJ.js";import{L as ge}from"./label-PINvlQb-.js";import{u as pt}from"./use-terminal-CDMgbskg.js";import{x as bt,a as yt}from"./xterm-DTxiCjtJ.js";import{A as jt}from"./arrow-down-4I_8gyhd.js";/* empty css */import{b as Ve,a as vt,c as wt,d as Nt}from"./droid-BWtMgfPD.js";import{R as kt}from"./refresh-cw-SQsUc3_C.js";import{P as Ee}from"./play-BpXD0Ub0.js";import{P as Pe}from"./plus-DBJTL6qk.js";import{E as St}from"./eye-_nXnan_b.js";import{Z as Ct}from"./zap-LrtVPxxV.js";/**
|
|
2
|
-
* @license lucide-react v0.542.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const At=[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],Tt=Ze("book-marked",At);/**
|
|
7
|
-
* @license lucide-react v0.542.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Et=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Pt=Ze("message-square",Et);var Le={exports:{}},He;function Lt(){return He||(He=1,(function(r,T){(function(W,C){r.exports=C()})(self,(()=>(()=>{var W={6:(d,o)=>{function g(m){try{const n=new URL(m),l=n.password&&n.username?`${n.protocol}//${n.username}:${n.password}@${n.host}`:n.username?`${n.protocol}//${n.username}@${n.host}`:`${n.protocol}//${n.host}`;return m.toLocaleLowerCase().startsWith(l.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(m,n,l,h={}){this._terminal=m,this._regex=n,this._handler=l,this._options=h}provideLinks(m,n){const l=I.computeLink(m,this._regex,this._terminal,this._handler);n(this._addCallbacks(l))}_addCallbacks(m){return m.map((n=>(n.leave=this._options.leave,n.hover=(l,h)=>{if(this._options.hover){const{range:x}=n;this._options.hover(l,h,x)}},n)))}};class I{static computeLink(n,l,h,x){const _=new RegExp(l.source,(l.flags||"")+"g"),[k,f]=I._getWindowedLineStrings(n-1,h),y=k.join("");let u;const E=[];for(;u=_.exec(y);){const p=u[0];if(!g(p))continue;const[R,j]=I._mapStrIdx(h,f,0,u.index),[Q,ee]=I._mapStrIdx(h,R,j,p.length);if(R===-1||j===-1||Q===-1||ee===-1)continue;const te={start:{x:j+1,y:R+1},end:{x:ee,y:Q+1}};E.push({range:te,text:p,activate:x})}return E}static _getWindowedLineStrings(n,l){let h,x=n,_=n,k=0,f="";const y=[];if(h=l.buffer.active.getLine(n)){const u=h.translateToString(!0);if(h.isWrapped&&u[0]!==" "){for(k=0;(h=l.buffer.active.getLine(--x))&&k<2048&&(f=h.translateToString(!0),k+=f.length,y.push(f),h.isWrapped&&f.indexOf(" ")===-1););y.reverse()}for(y.push(u),k=0;(h=l.buffer.active.getLine(++_))&&h.isWrapped&&k<2048&&(f=h.translateToString(!0),k+=f.length,y.push(f),f.indexOf(" ")===-1););}return[y,x]}static _mapStrIdx(n,l,h,x){const _=n.buffer.active,k=_.getNullCell();let f=h;for(;x;){const y=_.getLine(l);if(!y)return[-1,-1];for(let u=f;u<y.length;++u){y.getCell(u,k);const E=k.getChars();if(k.getWidth()&&(x-=E.length||1,u===y.length-1&&E==="")){const p=_.getLine(l+1);p&&p.isWrapped&&(p.getCell(0,k),k.getWidth()===2&&(x+=1))}if(x<0)return[l,u]}l++,f=0}return[l,f]}}o.LinkComputer=I}},C={};function A(d){var o=C[d];if(o!==void 0)return o.exports;var g=C[d]={exports:{}};return W[d](g,g.exports,A),g.exports}var M={};return(()=>{var d=M;Object.defineProperty(d,"__esModule",{value:!0}),d.WebLinksAddon=void 0;const o=A(6),g=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function I(m,n){const l=window.open();if(l){try{l.opener=null}catch{}l.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}d.WebLinksAddon=class{constructor(m=I,n={}){this._handler=m,this._options=n}activate(m){this._terminal=m;const n=this._options,l=n.urlRegex||g;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,l,this._handler,n))}dispose(){this._linkProvider?.dispose()}}})(),M})()))})(Le)),Le.exports}var Mt=Lt();const Wt=[{label:"Save to knowledge base",command:"Save this to the knowledge base (.nut/context/knowledge/) using the following schema as reference .nut/.schema/knowledge.schema.md",description:"Save content to knowledge base with schema reference"},{label:"Update project document",command:"Update the project document (.nut/context/project.md) using the following schema as reference .nut/.schema/project.schema.md",description:"Update project.md using schema reference"},{label:"Update architecture document",command:"Update the architecture document (.nut/context/architecture.md) using the following schema as reference .nut/.schema/architecture.schema.md",description:"Update architecture.md using schema reference"}];function Rt({onJumpToBottom:r,onSnippet:T,onSendKey:W}){return e.jsxs("div",{className:"w-full border-t border-gray-700/50 bg-[#252525] px-4 py-2.5 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r&&e.jsxs(N,{variant:"outline",size:"sm",onClick:r,className:"h-8 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] text-gray-200 hover:text-white transition-colors",title:"Jump to bottom and set focus",children:[e.jsx(jt,{className:"h-3.5 w-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Jump to Bottom"})]}),T&&e.jsxs(Me,{children:[e.jsx(We,{asChild:!0,children:e.jsxs(N,{variant:"outline",size:"sm",className:"h-8 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] text-gray-200 hover:text-white transition-colors",children:[e.jsx(Tt,{className:"h-3.5 w-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Snippets"})]})}),e.jsxs(Re,{align:"start",className:"w-72",children:[e.jsx(Be,{children:"Command Snippets"}),e.jsx(Oe,{}),Wt.map((C,A)=>e.jsxs(et,{onClick:()=>T(C.command),className:"cursor-pointer flex flex-col items-start py-2",children:[e.jsx("span",{className:"font-medium",children:C.label}),e.jsx("span",{className:"text-xs text-muted-foreground font-mono mt-0.5",children:C.command})]},A))]})]})]}),W&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>W(""),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-red-900/40 hover:border-red-700 text-gray-200 hover:text-red-300 transition-colors",title:"Send Ctrl+C (interrupt)",children:[e.jsx(de,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"⌃"}),e.jsx(de,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"C"})]}),e.jsxs("button",{onClick:()=>W(""),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white transition-colors",title:"Send Ctrl+Z (suspend)",children:[e.jsx(de,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"⌃"}),e.jsx(de,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"Z"})]}),e.jsx("button",{onClick:()=>W("\x1B"),className:"h-8 px-2 flex items-center gap-1 rounded-md bg-[#2d2d2d] border border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white transition-colors",title:"Send Escape key",children:e.jsx(de,{className:"bg-gray-700/50 border-gray-600 text-gray-300",children:"Esc"})})]})]})}function Bt({sessionId:r,onResize:T,onDestroy:W,pendingCommand:C,onCommandExecuted:A,showToolbar:M=!0,onSnippet:d}){const o=a.useRef(null),g=a.useRef(null),I=a.useRef(null),m=a.useRef(null),[n,l]=a.useState(!1),[h,x]=a.useState(null),[_,k]=a.useState(!0),f=a.useRef(0),y=5,u=a.useRef(null),E=a.useRef(null),p=a.useRef(C??null),R=a.useRef(!1),j=a.useRef(null),Q=a.useRef(A),ee=a.useRef(W),te=a.useRef(T);a.useEffect(()=>{Q.current=A},[A]),a.useEffect(()=>{ee.current=W},[W]),a.useEffect(()=>{te.current=T},[T]);const Y=a.useCallback(v=>{!p.current||R.current||(j.current!==null&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>{if(!p.current||R.current){j.current=null;return}m.current?.readyState===WebSocket.OPEN&&(m.current.send(JSON.stringify({type:"input",data:p.current+"\r"})),R.current=!0,Q.current?.()),j.current=null},v))},[]);a.useEffect(()=>{if(p.current=C??null,R.current=!1,!p.current){j.current!==null&&(window.clearTimeout(j.current),j.current=null);return}const v=m.current?.readyState===WebSocket.OPEN;return Y(v?200:800),()=>{j.current!==null&&(window.clearTimeout(j.current),j.current=null)}},[C,r,Y]),a.useEffect(()=>{l(!1),k(!0),x(null)},[r]),a.useEffect(()=>{if(!o.current||!r)return;const v=L=>{const b=L.getBoundingClientRect();return b.width>0&&b.height>0},P=new bt.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"'IBM Plex Mono', 'Source Code Pro', 'Fira Code', ui-monospace, Menlo, Monaco, monospace",lineHeight:1.35,letterSpacing:.5,convertEol:!0,theme:{background:"#1a1b26",foreground:"#c0caf5",cursor:"#c0caf5",cursorAccent:"#1a1b26",selectionBackground:"#33467c",selectionForeground:"#c0caf5",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"}}),z=new yt.FitAddon,pe=new Mt.WebLinksAddon;P.loadAddon(z),P.loadAddon(pe),P.open(o.current),g.current=P,I.current=z;let S=null,O=null;const q=()=>{if(!P||!P.element||!P.element.parentElement)return;const L=P.cols??0,b=P.rows??0;if(L>0&&b>0){m.current?.readyState===WebSocket.OPEN&&m.current.send(JSON.stringify({type:"resize",cols:L,rows:b}));const $=te.current;$&&$(L,b)}},ne=()=>{const L=o.current;if(L&&v(L)&&!(!P||!P.element||!P.element.parentElement))try{const b=L.getBoundingClientRect();if(b.width<10||b.height<10)return;z.fit(),q()}catch(b){console.warn("xterm fit() failed, will retry if needed:",b)}},w=()=>{S&&cancelAnimationFrame(S),S=requestAnimationFrame(()=>{ne()})},K=()=>{if(!r)return;u.current&&(window.clearTimeout(u.current),u.current=null);const L=`${tt}/ws/terminal/${r}`,b=new WebSocket(L);return m.current=b,b.onopen=()=>{l(!0),x(null),f.current=0,console.log("Terminal WebSocket connected"),E.current&&window.clearInterval(E.current),E.current=window.setInterval(()=>{b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"keepalive"}))},120*1e3),w(),setTimeout(()=>{k(!1),w(),setTimeout(()=>w(),50),setTimeout(()=>w(),150)},400),Y(1200)},b.onmessage=$=>{try{const B=JSON.parse($.data);switch(B.type){case"snapshot":if(typeof B.data=="string"&&B.data.length&&g.current){const F=g.current;F.write(B.data,()=>{F.scrollToBottom()})}break;case"data":if(g.current){const F=g.current,V=F.buffer.active.viewportY+F.rows>=F.buffer.active.baseY+F.buffer.active.cursorY;F.write(B.data,()=>{V&&F.scrollToBottom()})}break;case"exit":g.current&&g.current.write(`\r
|
|
12
|
-
\x1B[31mProcess exited with code ${B.exitCode}\x1B[0m\r
|
|
13
|
-
`),ee.current?.();break}}catch(B){console.error("Error parsing WebSocket message:",B)}},b.onclose=$=>{if(l(!1),console.log("Terminal WebSocket disconnected",$.code,$.reason),E.current&&(window.clearInterval(E.current),E.current=null),$.code!==1e3&&f.current<y&&r){f.current++;const B=Math.min(1e3*Math.pow(2,f.current-1),1e4);console.log(`Attempting to reconnect (${f.current}/${y}) in ${B}ms`),u.current=window.setTimeout(()=>{K()},B)}else f.current>=y&&x("Connection lost. Please refresh the page to reconnect.")},b.onerror=$=>{console.error("Terminal WebSocket error:",$),f.current===0&&x("WebSocket connection failed")},b};K(),P.onData(L=>{m.current?.readyState===WebSocket.OPEN&&m.current.send(JSON.stringify({type:"input",data:L}))});const J=()=>{w()},ie=new ResizeObserver(J);o.current&&ie.observe(o.current),window.addEventListener("resize",J),window.addEventListener("orientationchange",J);const U=()=>{document.visibilityState==="visible"&&(O&&clearTimeout(O),O=window.setTimeout(()=>{w()},50))};document.addEventListener("visibilitychange",U);let ce=0;const oe=20,he=()=>{const L=o.current;if(L){if(v(L)){ne();return}ce+=1,ce<oe?S=requestAnimationFrame(he):O=window.setTimeout(()=>{ne()},100)}};return S=requestAnimationFrame(he),()=>{ie.disconnect(),window.removeEventListener("resize",J),window.removeEventListener("orientationchange",J),document.removeEventListener("visibilitychange",U),S&&cancelAnimationFrame(S),O&&clearTimeout(O),u.current&&(window.clearTimeout(u.current),u.current=null),E.current&&(window.clearInterval(E.current),E.current=null),m.current?.readyState===WebSocket.OPEN&&m.current.close(),j.current!==null&&(window.clearTimeout(j.current),j.current=null),P.dispose()}},[r,Y]);const ue=a.useCallback(()=>{g.current&&(g.current.scrollToBottom(),g.current.focus())},[]),fe=a.useCallback(v=>{m.current?.readyState===WebSocket.OPEN&&(m.current.send(JSON.stringify({type:"input",data:v})),g.current&&g.current.focus())},[]),re=a.useCallback(v=>{m.current?.readyState===WebSocket.OPEN&&(m.current.send(JSON.stringify({type:"input",data:v})),g.current&&g.current.focus())},[]);return h?e.jsx("div",{className:"flex items-center justify-center h-full bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-red-600 font-medium",children:"Terminal Connection Error"}),e.jsx("div",{className:"text-red-500 text-sm mt-1",children:h})]})}):e.jsxs("div",{className:"relative h-full flex flex-col bg-[#1a1b26] overflow-hidden",children:[!n&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1a1b26] bg-opacity-95 z-10 backdrop-blur-sm",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),e.jsx("div",{className:"text-gray-300 mt-2",children:"Connecting to terminal..."})]})}),n&&_&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1a1b26] bg-opacity-50 z-10 transition-opacity duration-300 backdrop-blur-sm",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-pulse rounded-full h-6 w-6 bg-blue-500 mx-auto"}),e.jsx("div",{className:"text-gray-300 text-sm mt-2",children:"Loading terminal..."})]})}),e.jsx("div",{ref:o,className:"flex-1 w-full overflow-hidden",style:{minHeight:"400px"}}),M&&e.jsx(Rt,{onJumpToBottom:ue,onSnippet:d||fe,onSendKey:re})]})}const Ot=r=>r?Array.isArray(r)?r.filter(T=>typeof T=="string").map(T=>T.trim()).filter(Boolean):typeof r=="string"?r.split(",").map(T=>T.trim()).filter(Boolean):[]:[];function er(){const{proposalId:r}=rt(),T=st(),W=at(),[C]=nt(),{toast:A}=it(),M=r?.startsWith("session-"),d=a.useMemo(()=>!!r&&r.startsWith("cp-"),[r]),o=a.useMemo(()=>!!r&&r.startsWith("ag-"),[r]),g=C.get("reviewOnly")==="true",I=C.get("startOnly")==="true",m=d&&!I,n=!g,l=a.useMemo(()=>o&&r?r.replace("ag-","")+".md":null,[o,r]),{sessions:h,loading:x,error:_,createSession:k,destroySession:f,refreshSessions:y}=pt(),[u,E]=a.useState([]),[p,R]=a.useState(null),[j,Q]=a.useState(!1),[ee,te]=a.useState(null),[Y,ue]=a.useState("claude"),[fe,re]=a.useState(!1),[v,P]=a.useState("claude"),[z,pe]=a.useState([]),[S,O]=a.useState([]),[q,ne]=a.useState([]),[w,K]=a.useState([]),[J,ie]=a.useState(!0),[U,ce]=a.useState(""),[oe,he]=a.useState(!1),[L,b]=a.useState({}),[$,B]=a.useState(null),F=a.useRef([]),[V,$e]=a.useState("current"),[xe,Ye]=a.useState("main"),X=a.useMemo(()=>r?`terminal.cp.config.${r}`:null,[r]);a.useEffect(()=>{if(!(!d&&!o||!X))try{const t=localStorage.getItem(X);if(t){const s=JSON.parse(t);s.cliAgent&&P(s.cliAgent),Array.isArray(s.selectedMcpServers)&&O(s.selectedMcpServers),Array.isArray(s.selectedAgentIds)&&K(s.selectedAgentIds),typeof s.automationEnabled=="boolean"&&ie(s.automationEnabled),typeof s.customInstruction=="string"&&ce(s.customInstruction),typeof s.createWorktree=="boolean"&&he(s.createWorktree),s.branchMode&&$e(s.branchMode)}}catch{console.error("Failed to load config",X)}},[d,o,X]);const be=a.useCallback(()=>{if(!X)return;const t={cliAgent:v,selectedMcpServers:S,selectedAgentIds:w,automationEnabled:J,customInstruction:U,createWorktree:oe,branchMode:V};try{localStorage.setItem(X,JSON.stringify(t))}catch{console.error("Failed to persist config",X)}},[X,v,S,w,J,U,oe,V]);a.useEffect(()=>{be()},[U,be]);const se=t=>`feat/cp-${t.startsWith("cp-")?t.slice(3):t}`,Ke=async t=>{try{const s=se(t),c=await(await fetch(`${me}/api/v1/git/branches`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,from:xe})})).json();if(!c.success){const D=c.error?.message||"Unknown error";return A({title:"Branch creation failed",description:D,variant:"destructive"}),!1}return A({title:"Branch created",description:`Created branch: ${s}`}),!0}catch{return A({title:"Branch creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}},Ie=async t=>{try{const s=se(t),c=await(await fetch(`${me}/api/v1/git/worktrees`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:s,from:xe})})).json();if(!c.success){const D=c.error?.message||"Unknown error";return A({title:"Worktree creation failed",description:D,variant:"destructive"}),!1}return A({title:"Worktree created",description:`Created branch: ${s}`}),!0}catch{return A({title:"Worktree creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}};a.useEffect(()=>{(d||o)&&r&&(async()=>{try{const s=await fetch(`${me}/api/v1/git/status`);if(s.ok){const c=await s.json();c?.success&&c.data?.branch&&Ye(c.data.branch)}const i=await fetch(`${me}/api/v1/mcp`);if(i.ok){const c=await i.json();c?.success&&Array.isArray(c.servers)&&(pe(c.servers),O(D=>D.filter(G=>c.servers.includes(G))),c.mcpServers&&typeof c.mcpServers=="object"&&b(c.mcpServers))}}catch(s){console.error("Failed to load MCP servers",s)}try{const s=await fetch(`${me}/api/v1/agents`);if(s.ok){const i=await s.json(),D=(Array.isArray(i?.documents)?i.documents:[]).map(G=>({id:G.filename,name:G?.metadata?.name||G.title||G.filename,tools:Ot(G?.metadata?.tools)}));ne(D),K(G=>{const le=G.filter(Z=>D.some(je=>je.id===Z));if(o&&l&&le.length===0){const Z=D.find(je=>je.id===l);if(Z)return[Z.id]}return le})}}catch(s){console.error("Failed to load agents",s)}})()},[d,o,r,l]),a.useEffect(()=>{const t=F.current,s=w.filter(i=>!t.includes(i));s.length>0&&O(i=>{const c=new Set(i),D=z.length>0?new Set(z):void 0;return s.forEach(G=>{const le=q.find(Z=>Z.id===G);le&&le.tools.forEach(Z=>{(!D||D.has(Z))&&c.add(Z)})}),Array.from(c)}),F.current=w},[w,q,z]),a.useEffect(()=>{r&&y(r)},[r,y]),a.useEffect(()=>{if(!r)return;const s=h.filter(i=>i.proposalId===r).map(i=>i.id);E(s),!p&&s.length>0&&R(s[0]),p&&!s.includes(p)&&R(s.length>0?s[0]:null)},[h,r,p]);const ae=async t=>{if(!r)return;const s=t||void 0,i=await k(r,j,s);i&&(R(i),!s&&t&&te(t),setTimeout(()=>y(r),100))},_e=(t,s)=>{const c={proposalId:r,contextType:s??(d?"change-proposal":o?"agent":"general"),selectedMcpServers:S,selectedAgentIds:w,automationEnabled:J,customInstruction:U};switch(t){case"claude":return Ve(c);case"gemini":return Nt(c);case"codex":return wt(c);case"droid":return vt(c);default:return Ve(c)}},ye=async()=>{d&&r&&(V==="new-branch"?await Ke(r)||console.warn("Branch creation failed, continuing with terminal creation"):V==="new-worktree"&&(await Ie(r)||console.warn("Worktree creation failed, continuing with terminal creation"))),d&&oe&&V==="current"&&r&&(await Ie(r)||console.warn("Worktree creation failed, continuing with terminal creation"));const s=_e(d||o?v:Y);await ae(s)},Xe=async()=>{const s=_e(v,"prepare-proposal");await ae(s)},ze=async t=>{if(await f(t)&&p===t){const i=u.filter(c=>c!==t);R(i.length>0?i[0]:null)}},Qe=t=>{ze(t)};return r?e.jsxs("div",{className:"flex flex-col h-full",children:[M&&u.length===0&&r&&e.jsx($t,{proposalId:r,onStart:ae,locationSearch:T.search}),e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-lg",children:d||o?e.jsx(ve,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):e.jsx(we,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:M?"Terminal":"Agent Session"}),!M&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r}),M&&e.jsxs("span",{className:"text-sm text-gray-500 font-mono",children:["(",r,")"]})]})]})}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsxs("div",{className:"hidden sm:flex items-center space-x-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 rounded-lg border",children:[e.jsx(Fe,{id:"enable-logging",checked:j,onCheckedChange:t=>Q(t===!0)}),e.jsx("label",{htmlFor:"enable-logging",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Log sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>r&&y(r),disabled:x,className:"bg-white dark:bg-gray-800",children:[e.jsx(kt,{className:`h-4 w-4 sm:mr-2 ${x?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),!M&&!d&&!o&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ne,{value:Y,onValueChange:ue,children:[e.jsx(ke,{className:"w-24",children:e.jsx(Se,{})}),e.jsxs(Ce,{children:[e.jsx(H,{value:"claude",children:"Claude Code"}),e.jsx(H,{value:"gemini",children:"Google Gemini"}),e.jsx(H,{value:"codex",children:"OpenAI Codex"})]})]}),e.jsxs(N,{onClick:ye,disabled:x,size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ee,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Start Agent"})]})]}),!d&&!o&&(!M||u.length===0)&&e.jsxs(N,{onClick:()=>ae(),disabled:x,size:"sm",children:[e.jsx(Pe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"New Terminal"})]})]})]})]}),_&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-1.5 bg-red-100 dark:bg-red-900/40 rounded-lg flex-shrink-0",children:e.jsx(De,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),e.jsx("div",{className:"text-red-800 dark:text-red-200 text-sm font-medium",children:_})]})}),u.length>0&&e.jsx("div",{className:"flex items-center gap-1 border-b dark:border-gray-700",children:u.map(t=>{const s=h.find(c=>c.id===t),i=p===t;return e.jsxs("div",{className:`flex items-center gap-2 px-4 py-3 border-b-1 cursor-pointer rounded-t-lg transition-all duration-200 ${i?"border-gray-400 bg-white dark:bg-gray-800 dark:border-gray-500 shadow-sm":"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800 hover:border-gray-300"}`,onClick:()=>R(t),children:[e.jsx("div",{className:`p-1.5 rounded-md ${i?"bg-gray-200 dark:bg-gray-700":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(we,{className:`h-3.5 w-3.5 ${i?"text-gray-700 dark:text-gray-300":"text-gray-600 dark:text-gray-400"}`})}),e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["Terminal ",t.split("-").slice(-1)[0].substring(0,6)]}),e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s?.connected?"bg-green-500":"bg-gray-400"}`}),e.jsx(N,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-red-100 dark:hover:bg-red-900/30 rounded-md opacity-60 hover:opacity-100 transition-opacity",onClick:c=>{c.stopPropagation(),ze(t)},children:e.jsx(De,{className:"h-3 w-3"})})]},t)})}),e.jsx("div",{className:"flex-1 min-h-0",children:u.length===0?e.jsx(ht,{className:"h-full",children:e.jsx(xt,{className:"flex items-center justify-center h-full p-8",children:e.jsxs("div",{className:"text-center w-full max-w-[33vw] min-w-[400px]",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full w-fit mx-auto mb-2",children:d||o?e.jsx(Ae,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"}):e.jsx(we,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"Prepare Agent"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6 leading-relaxed",children:M?"Create a new terminal session":e.jsxs(e.Fragment,{children:["Configure the agent to start working on ",r,"."]})}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[!M&&!d&&!o&&e.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[e.jsxs("div",{className:"w-full space-y-3",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Choose your AI agent"}),e.jsxs(Ne,{value:Y,onValueChange:ue,children:[e.jsx(ke,{className:"w-full h-11 bg-white dark:bg-gray-800",children:e.jsx(Se,{})}),e.jsxs(Ce,{children:[e.jsx(H,{value:"claude",children:"Claude Code (default)"}),e.jsx(H,{value:"gemini",children:"Google Gemini"}),e.jsx(H,{value:"codex",children:"OpenAI Codex"})]})]})]}),e.jsxs(N,{onClick:ye,disabled:x,className:"bg-green-600 hover:bg-green-700 w-full h-11 text-base font-medium",size:"lg",children:[e.jsx(Ee,{className:"h-5 w-5 mr-2"}),"Start Agent"]}),e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"}),e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 font-medium",children:"or"}),e.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"})]}),e.jsxs(N,{onClick:()=>ae(),disabled:x,variant:"outline",className:"w-full h-11 bg-white dark:bg-gray-800",size:"lg",children:[e.jsx(Pe,{className:"h-5 w-5 mr-2"}),"New Terminal"]})]}),!M&&(d||o)&&e.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[m&&e.jsxs(N,{onClick:Xe,disabled:x,className:"w-full bg-blue-600 hover:bg-blue-700 h-11 text-base font-medium",size:"lg",children:[e.jsx(St,{className:"h-5 w-5 mr-2"}),"Review & Prepare"]}),e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsxs(N,{variant:"outline",onClick:()=>re(!0),className:"flex-1 h-11 bg-white dark:bg-gray-800",size:"lg",children:[e.jsx(ct,{className:"h-5 w-5 mr-2"}),"Configure"]}),n&&e.jsxs(N,{onClick:ye,disabled:x,className:"flex-1 bg-green-600 hover:bg-green-700 h-11 text-base font-medium",size:"lg",children:[e.jsx(Ee,{className:"h-5 w-5 mr-2"}),"Start Agent"]})]}),e.jsxs("div",{className:"w-full space-y-3",children:[e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-500 dark:text-gray-400",children:"Agent Configuration"}),e.jsxs("div",{className:"text-left text-sm text-gray-700 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Agent:"}),e.jsx("span",{className:"font-mono text-sm",children:v==="claude"?"Claude Code":v.charAt(0).toUpperCase()+v.slice(1)})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ve,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Skills:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:w.length?w.map(t=>{const s=q.find(i=>i.id===t);return e.jsx(qe,{variant:"secondary",className:"font-mono text-xs",children:s?.name||t},t)}):e.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Je,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"MCP Servers:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:S.length?S.map(t=>e.jsx(qe,{variant:"secondary",className:"font-mono text-xs",children:t},t)):e.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ct,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Full Environment Access:"}),e.jsx("span",{className:"font-mono text-sm",children:J?"Enabled":"Disabled"})]}),d&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ot,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Branch:"}),e.jsx("span",{className:"font-mono text-sm",children:V==="current"?`Current (${xe})`:V==="new-branch"?`New branch (${se(r||"")})`:`New worktree (${se(r||"")})`})]})]}),e.jsxs("div",{className:"text-left",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2 text-gray-700 dark:text-gray-300",children:[e.jsx(Pt,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),"Additional Instructions"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[U.length,"/500"]})]}),e.jsx("textarea",{className:"w-full min-h-[80px] rounded-md border p-3 text-sm bg-gray-50 dark:bg-gray-900/50 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 resize-none",placeholder:"Add specific instructions to guide the agent...",value:U,onChange:t=>ce(t.target.value),rows:3}),U.length>500&&e.jsx("div",{className:"text-xs text-red-600 mt-1",children:"Custom instruction is too long (max 500 characters)"})]})]})]}),M&&u.length===0&&e.jsx("div",{className:"p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:e.jsxs(N,{onClick:()=>ae(),disabled:x,className:"w-full h-11 text-base font-medium",size:"lg",children:[e.jsx(Pe,{className:"h-5 w-5 mr-2"}),"New Terminal"]})})]})]})})}):p?e.jsx("div",{className:"h-full overflow-hidden rounded-b-lg",children:e.jsx(Bt,{sessionId:p,onDestroy:()=>Qe(p),pendingCommand:ee,onCommandExecuted:()=>te(null),showToolbar:!0})}):null}),e.jsx(lt,{open:fe,onOpenChange:re,children:e.jsxs(dt,{className:"max-w-3xl max-h-[85vh] overflow-y-auto",children:[e.jsxs(mt,{children:[e.jsx(ut,{children:"Configure Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Customize the agent's capabilities and configure it's environment."})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Ae,{className:"h-4 w-4"}),"Agent"]}),e.jsxs(Ne,{value:v,onValueChange:t=>P(t),children:[e.jsx(ke,{className:"w-full",children:e.jsx(Se,{placeholder:"Select agent"})}),e.jsxs(Ce,{children:[e.jsx(H,{value:"claude",children:"Claude Code"}),e.jsx(H,{value:"gemini",children:"Google Gemini"}),e.jsx(H,{value:"codex",children:"OpenAI Codex"}),e.jsx(H,{value:"droid",children:"Factory Droid"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4"}),"Skills"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[w.length," of ",q.length," selected"]})]}),e.jsxs(Me,{children:[e.jsx(We,{asChild:!0,children:e.jsxs(N,{variant:"outline",className:"w-full justify-between",children:[w.length===0?"Select skills...":w.length===q.length?"All skills selected":`${w.length} agent${w.length!==1?"s":""} selected`,e.jsx(Ue,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(Re,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(Be,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Skills"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(N,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),K(q.map(s=>s.id))},children:"All"}),e.jsx(N,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),K([])},children:"None"})]})]}),e.jsx(Oe,{}),q.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No agents found"}):q.map(t=>e.jsx(Ge,{checked:w.includes(t.id),onCheckedChange:s=>{K(i=>s?i.includes(t.id)?i:[...i,t.id]:i.filter(c=>c!==t.id))},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:t.name}),t.tools.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",t.tools.join(", ")]}),t.tools.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},t.id))]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[S.length," of ",z.length," selected"]})]}),e.jsxs(Me,{children:[e.jsx(We,{asChild:!0,children:e.jsxs(N,{variant:"outline",className:"w-full justify-between",children:[S.length===0?"Select MCP servers...":S.length===z.length?"All servers selected":`${S.length} server${S.length!==1?"s":""} selected`,e.jsx(Ue,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(Re,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(Be,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Servers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(N,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),O(z)},children:"All"}),e.jsx(N,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:t=>{t.preventDefault(),O([])},children:"None"})]})]}),e.jsx(Oe,{}),z.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):z.map(t=>e.jsx(Ge,{checked:S.includes(t),onCheckedChange:s=>{O(i=>s?i.includes(t)?i:[...i,t]:i.filter(c=>c!==t))},children:t},t))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-md bg-amber-50/50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800",children:[e.jsx(Fe,{id:"automation",checked:J,onCheckedChange:t=>ie(t===!0),className:"data-[state=checked]:bg-red-600 data-[state=checked]:border-red-600 data-[state=checked]:text-white border-red-400",disabled:v==="droid"}),e.jsx("label",{htmlFor:"automation",className:"text-sm font-medium text-red-600 dark:text-red-400 cursor-pointer",children:"Full environment access (recommended in secure environments only)"})]}),v==="droid"&&e.jsxs("p",{className:"text-xs text-muted-foreground px-1",children:[e.jsx("span",{className:"font-medium",children:"Droid:"})," Automation level is set in the REPL. Press ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-[10px] font-mono",children:"shift+tab"})," to cycle through Off → Low → Medium → High."]})]}),d&&e.jsx(ft,{title:"Advanced Settings",description:"Configure branch and worktree options",defaultOpen:!1,children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(ge,{className:"text-sm font-medium mb-3 block",children:"Branch Management"}),e.jsxs(gt,{value:V,onValueChange:t=>$e(t),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Te,{value:"current",id:"branch-current"}),e.jsxs(ge,{htmlFor:"branch-current",className:"cursor-pointer font-normal",children:["Stay on current branch (",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:xe}),")"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Te,{value:"new-branch",id:"branch-new"}),e.jsxs(ge,{htmlFor:"branch-new",className:"cursor-pointer font-normal",children:["Create new branch: ",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:se(r||"")})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Te,{value:"new-worktree",id:"branch-worktree"}),e.jsxs(ge,{htmlFor:"branch-worktree",className:"cursor-pointer font-normal",children:["Create new worktree: ",e.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:se(r||"")})]})]})]})]})})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"outline",onClick:()=>re(!1),children:"Close"}),e.jsx(N,{onClick:()=>{if(U.length>500){B("Please shorten the custom instruction to 500 characters.");return}B(null),be(),re(!1)},children:"Save"})]}),$&&e.jsx("div",{className:"text-xs text-red-600 text-right",children:$})]})]})})]}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-red-600 font-medium",children:"Invalid Proposal ID"}),e.jsx(N,{onClick:()=>W("/proposals"),className:"mt-4",children:"Back to Proposals"})]})})}function $t({proposalId:r,onStart:T,locationSearch:W}){return a.useEffect(()=>{if(!r)return;const C=new URLSearchParams(W);if(!C.has("autostart"))return;const A=`terminal.autostart.${r}`;if(sessionStorage.getItem(A)==="done")return;sessionStorage.setItem(A,"done");const d=C.get("run")||void 0;T(d||void 0)},[r]),null}export{er as default};
|