@lovelybunch/api 1.0.71-alpha.8 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/jobs/job-runner.js +6 -1
- package/dist/lib/mcp-client.d.ts +39 -0
- package/dist/lib/mcp-client.js +131 -0
- package/dist/routes/api/v1/ai/route.js +2 -2
- package/dist/routes/api/v1/ai/tools.js +2 -2
- package/dist/routes/api/v1/mcp/index.js +36 -0
- package/dist/server-with-static.js +7 -0
- package/dist/server.js +7 -0
- package/package.json +4 -4
- package/static/assets/{AgentDetailPage-DgEbsro7.js → AgentDetailPage-CZ2tz-Ol.js} +1 -1
- package/static/assets/{AgentEditPage-C-oRXb2i.js → AgentEditPage-BiAoWU1z.js} +1 -1
- package/static/assets/{AgentsPage-LAiPsGo6.js → AgentsPage-D_HMA-40.js} +1 -1
- package/static/assets/{AgentsSettingsPage-Dg6xOvLr.js → AgentsSettingsPage-C5ZsOVSL.js} +1 -1
- package/static/assets/{ApiKeysSettingsPage-CCK0qACG.js → ApiKeysSettingsPage-C7Xlzj-X.js} +1 -1
- package/static/assets/{ArchitectureEditPage-BPO6OFWv.js → ArchitectureEditPage-B9nVQn0B.js} +1 -1
- package/static/assets/{ArchitecturePage-8fad_lNX.js → ArchitecturePage-CChIC6Qa.js} +1 -1
- package/static/assets/{AuthSettingsPage-DdfuUhwy.js → AuthSettingsPage-CaeV2cQ4.js} +1 -1
- package/static/assets/{CallbackPage-B66-RhgE.js → CallbackPage-DmeStBSx.js} +1 -1
- package/static/assets/{CodePage-BXPnfaYj.js → CodePage-BtKkipWC.js} +1 -1
- package/static/assets/{CollapsibleSection-Bo6dPNB0.js → CollapsibleSection-Cb80fCCb.js} +1 -1
- package/static/assets/{DashboardPage-g9RbjrxM.js → DashboardPage-DdApq_B-.js} +1 -1
- package/static/assets/{GitPage-CRhOabK5.js → GitPage-D2aJfzTq.js} +1 -1
- package/static/assets/{GitSettingsPage-4ThmHYiO.js → GitSettingsPage-Bz17VWrK.js} +1 -1
- package/static/assets/{IdentityPage-D2dQOIVu.js → IdentityPage-O7o2b4JB.js} +1 -1
- package/static/assets/{ImplementationStepsEditor-DqjmTpCD.js → ImplementationStepsEditor-BkJjQBc-.js} +1 -1
- package/static/assets/{IntegrationsSettingsPage-DL0EQ1Dp.js → IntegrationsSettingsPage-brFTXUBL.js} +1 -1
- package/static/assets/KnowledgeDetailPage-e5OpRrZ2.js +1 -0
- package/static/assets/KnowledgeEditPage-DgyPoIJv.js +1 -0
- package/static/assets/{KnowledgePage-CZBbkkxc.js → KnowledgePage-Ck_FeruK.js} +1 -1
- package/static/assets/{LoginPage-B3yLDlzb.js → LoginPage-IqcnIlMj.js} +1 -1
- package/static/assets/McpSettingsPage-KJBLTelP.js +1 -0
- package/static/assets/{NewAgentPage-DWkEh2H0.js → NewAgentPage-DLIvDpeZ.js} +1 -1
- package/static/assets/NewKnowledgePage-xBm9PTKB.js +9 -0
- package/static/assets/{NewProposalPage-B-6r2u9V.js → NewProposalPage-BlocVyGv.js} +1 -1
- package/static/assets/{ProjectEditPage-CXQL9wWm.js → ProjectEditPage-BlA-908F.js} +1 -1
- package/static/assets/{ProjectPage-N1-VPCXb.js → ProjectPage-Dj-tc-ZE.js} +1 -1
- package/static/assets/{PromptsSettingsPage-CkfWwaVo.js → PromptsSettingsPage-BvU01T7L.js} +1 -1
- package/static/assets/{ProposalDetailPage-CVjCtz3l.js → ProposalDetailPage-_8Wn6NJt.js} +1 -1
- package/static/assets/{ProposalEditPage-BlLNHhID.js → ProposalEditPage-BbbWkAuu.js} +1 -1
- package/static/assets/{ProposalsPage-Cg_8UnUz.js → ProposalsPage-erDBdH7Z.js} +1 -1
- package/static/assets/ResourcesPage-B1uF-EA-.js +71 -0
- package/static/assets/{RulesSettingsPage-DejeW-zE.js → RulesSettingsPage-DurFFm98.js} +1 -1
- package/static/assets/{SchedulePage-DRdcV50U.js → SchedulePage-BAnM4Lu5.js} +1 -1
- package/static/assets/SourceInput-7lTShZ6_.js +1 -0
- package/static/assets/{TagInput-Qey-JNSc.js → TagInput-2_jYxO52.js} +1 -1
- package/static/assets/TerminalPage-CRVEtFXr.js +1 -0
- package/static/assets/{TerminalSessionPage-Gy2cvUkm.js → TerminalSessionPage-BjvQegW1.js} +3 -3
- package/static/assets/{UserPreferencesPage-BuI5MILN.js → UserPreferencesPage-C5ueVUwG.js} +1 -1
- package/static/assets/{UserSettingsPage-qtJLo7KK.js → UserSettingsPage-DhOu8xZ3.js} +1 -1
- package/static/assets/{UtilitiesPage-BFQjoH8u.js → UtilitiesPage-olcchfEX.js} +1 -1
- package/static/assets/{alert-B1XiCMQp.js → alert-bP1PxakB.js} +1 -1
- package/static/assets/{arrow-down-CeHH_n_1.js → arrow-down-BoBPr1Sn.js} +1 -1
- package/static/assets/{arrow-left-1kNbh1Lu.js → arrow-left-orDiJ2Pw.js} +1 -1
- package/static/assets/{arrow-up-BYvPnrJd.js → arrow-up-CCloQpeV.js} +1 -1
- package/static/assets/{badge-NXKbF0v1.js → badge-D7styiB7.js} +1 -1
- package/static/assets/{browser-modal-rJ-NhTpW.js → browser-modal-n0MeSpgA.js} +1 -1
- package/static/assets/{calendar-v-JFQxNh.js → calendar-w3geg78-.js} +1 -1
- package/static/assets/{card-CSNr-FQA.js → card-pzUJtmwJ.js} +1 -1
- package/static/assets/{chevron-left-Br4J9Cp9.js → chevron-left-B6nXpDLi.js} +1 -1
- package/static/assets/{circle-alert-Dupw7IFA.js → circle-alert-BcFpY-ZU.js} +1 -1
- package/static/assets/{circle-check-B9hjnh3h.js → circle-check-HRharHjy.js} +1 -1
- package/static/assets/{circle-check-big-oAo0Oeyn.js → circle-check-big-B2CFEks4.js} +1 -1
- package/static/assets/{circle-play-CVSiuxiN.js → circle-play-CfrNAC9J.js} +1 -1
- package/static/assets/{circle-x-t7MHMAR2.js → circle-x-CNn7_0Ew.js} +1 -1
- package/static/assets/{clipboard-DHZxrsFW.js → clipboard-LaXihY2m.js} +1 -1
- package/static/assets/{clock-LA-30ZGm.js → clock-By2Dd4u0.js} +1 -1
- package/static/assets/{download-CnYQegjL.js → download--HiFU7TR.js} +1 -1
- package/static/assets/droid-C6RWH9f4.js +4 -0
- package/static/assets/{eye-CeI1df80.js → eye-DorygWtP.js} +1 -1
- package/static/assets/{folder-git-2-DEoH-p1C.js → folder-git-2-B8bjLoxc.js} +1 -1
- package/static/assets/{index-D9b0oysW.css → index-B5SwW-PH.css} +1 -1
- package/static/assets/{index-D_Lz5G-Q.js → index-BfJaT17z.js} +8 -8
- package/static/assets/{label-JyYTDtEw.js → label-CTlQtJaU.js} +1 -1
- package/static/assets/{markdown-editor-Chiudu3u.js → markdown-editor-BOcltq2r.js} +1 -1
- package/static/assets/{pause-C3Ag1l-W.js → pause-D33aM-oa.js} +1 -1
- package/static/assets/{play-BCmsp0g8.js → play-B6IdXHPj.js} +1 -1
- package/static/assets/{plus-CMaJeyI7.js → plus-DhYjijTS.js} +1 -1
- package/static/assets/{radio-group-BaKpW9AK.js → radio-group-B-Rc5x_L.js} +1 -1
- package/static/assets/{refresh-cw-2s-Cw28o.js → refresh-cw-BuuX9h4Z.js} +1 -1
- package/static/assets/{search-C_8YfOPe.js → search-BiMN-o92.js} +1 -1
- package/static/assets/{switch-C8QENxXl.js → switch-vSV_roZ2.js} +1 -1
- package/static/assets/{tabs-B2NsP4LT.js → tabs-ChuwGq16.js} +1 -1
- package/static/assets/{tag-BMxDJZSb.js → tag-DERlGH35.js} +1 -1
- package/static/assets/terminal-preview-BFedy4-J.js +11 -0
- package/static/assets/terminal-xj47PT8r.css +1 -0
- package/static/assets/{use-terminal-Se41LFUi.js → use-terminal-qzkum-B5.js} +1 -1
- package/static/assets/{zap-CCyjZlP1.js → zap-DwFz_ltU.js} +1 -1
- package/static/index.html +2 -2
- package/static/assets/KnowledgeDetailPage-Chu61B6A.js +0 -1
- package/static/assets/KnowledgeEditPage-n_nRhHz5.js +0 -1
- package/static/assets/McpSettingsPage-CwJgm_Ig.js +0 -1
- package/static/assets/NewKnowledgePage-qiZHOBk_.js +0 -9
- package/static/assets/ResourcesPage-6X2GbhJW.js +0 -71
- package/static/assets/TerminalPage-oL2epDcB.js +0 -1
- package/static/assets/droid-CmYuCN_q.js +0 -4
- package/static/assets/terminal-preview-BcVtz3Tb.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,b8 as E,aq as K,ak as T,j as a,al as N,b9 as U,ao as x,ap as w,ba as V,an as g,bb as z,at as H,as as $,f as I,bc as W}from"./index-
|
|
1
|
+
import{r as n,b8 as E,aq as K,ak as T,j as a,al as N,b9 as U,ao as x,ap as w,ba as V,an as g,bb as z,at as H,as as $,f as I,bc as W}from"./index-BfJaT17z.js";var C="Radio",[X,k]=N(C),[Y,J]=X(C),_=n.forwardRef((r,t)=>{const{__scopeRadio:e,name:c,checked:o=!1,required:s,disabled:i,value:p="on",onCheck:f,form:R,...v}=r,[l,m]=n.useState(null),d=w(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:d,onClick:g(r.onClick,y=>{o||f?.(),b&&(u.current=y.isPropagationStopped(),u.current||y.stopPropagation())})}),b&&a.jsx(P,{control:l,bubbles:!u.current,name:c,value:p,checked:o,required:s,disabled:i,form:R,style:{transform:"translateX(-100%)"}})]})});_.displayName=C;var j="RadioIndicator",G=n.forwardRef((r,t)=>{const{__scopeRadio:e,forceMount:c,...o}=r,s=J(j,e);return a.jsx(z,{present:c||s.checked,children:a.jsx(x.span,{"data-state":S(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});G.displayName=j;var Q="RadioBubbleInput",P=n.forwardRef(({__scopeRadio:r,control:t,checked:e,bubbles:c=!0,...o},s)=>{const i=n.useRef(null),p=w(i,s),f=H(e),R=$(t);return n.useEffect(()=>{const v=i.current;if(!v)return;const l=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(l,"checked").set;if(f!==e&&d){const u=new Event("click",{bubbles:c});d.call(v,e),v.dispatchEvent(u)}},[f,e,c]),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,ce]=N(h,[E,k]),A=E(),D=k(),[oe,re]=ee(h),M=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,name:c,defaultValue:o,value:s,required:i=!1,disabled:p=!1,orientation:f,dir:R,loop:v=!0,onValueChange:l,...m}=r,d=A(e),u=K(R),[b,y]=T({prop:s,defaultProp:o??null,onChange:l,caller:h});return a.jsx(oe,{scope:e,name:c,required:i,disabled:p,value:b,onValueChange:y,children:a.jsx(U,{asChild:!0,...d,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:c,...o}=r,s=re(O,e),i=s.disabled||c,p=A(e),f=D(e),R=n.useRef(null),v=w(t,R),l=s.value===o.value,m=n.useRef(!1);return n.useEffect(()=>{const d=b=>{Z.includes(b.key)&&(m.current=!0)},u=()=>m.current=!1;return document.addEventListener("keydown",d),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",d),document.removeEventListener("keyup",u)}},[]),a.jsx(V,{asChild:!0,...p,focusable:!i,active:l,children:a.jsx(_,{disabled:i,required:s.required,checked:l,...f,...o,name:s.name,ref:v,onCheck:()=>s.onValueChange(o.value),onKeyDown:g(d=>{d.key==="Enter"&&d.preventDefault()}),onFocus:g(o.onFocus,()=>{m.current&&R.current?.click()})})})});q.displayName=O;var ae="RadioGroupIndicator",F=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,...c}=r,o=D(e);return a.jsx(G,{...o,...c,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,f as i}from"./index-
|
|
1
|
+
import{r as c,j as e,f as i}from"./index-BfJaT17z.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,aq as F,ak as $,j as c,al as k,be as D,ao as g,b8 as y,b9 as V,ba as G,an as m,bb as L,f as T}from"./index-
|
|
1
|
+
import{r as l,aq as F,ak as $,j as c,al as k,be as D,ao as g,b8 as y,b9 as V,ba as G,an as m,bb as L,f as T}from"./index-BfJaT17z.js";var p="Tabs",[K,Q]=k(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:D(),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(V,{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};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c as p,r as e,ab as j,j as u}from"./index-BfJaT17z.js";import{x as C,a as F}from"./xterm-DTxiCjtJ.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 B=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],A=p("chevrons-down",B);/**
|
|
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 M=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],L=p("chevrons-up",M);function $({sessionId:l,className:v,heightPx:f=160,maxScrollback:h=200}){const m=e.useRef(null),y=e.useRef(null),w=e.useRef(null),x=e.useRef(null),[R,k]=e.useState(!0),s=e.useRef([]),c=e.useRef(null);return e.useEffect(()=>{const a=m.current;if(!a||!l)return;const t=new C.Terminal({disableStdin:!0,cursorBlink:!1,convertEol:!0,scrollback:Math.max(50,Math.min(h,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"}}),d=new F.FitAddon;t.loadAddon(d),t.open(a),a.style.height=`${f}px`,y.current=t,w.current=d;const i=()=>{try{const n=a.getBoundingClientRect();n.width>8&&n.height>8&&d.fit()}catch{}};i();const g=new ResizeObserver(()=>i());g.observe(a);const b=()=>{document.visibilityState==="visible"&&setTimeout(i,50)};document.addEventListener("visibilitychange",b);const o=new WebSocket(`${j}/ws/terminal-preview/${l}`);x.current=o,o.onopen=()=>k(!1);const S=()=>{c.current=null;const n=s.current;if(n.length){s.current=[];try{t.write(n.join(""))}catch{}}},E=()=>{c.current===null&&(c.current=requestAnimationFrame(S))};return o.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}if(r?.type==="snapshot"){if(t.reset(),s.current=[],r.data)try{t.write(r.data)}catch{}i()}else r?.type==="data"&&r.data&&(s.current.push(String(r.data)),E())},o.onclose=()=>{},o.onerror=()=>{},()=>{g.disconnect(),document.removeEventListener("visibilitychange",b);try{o.close()}catch{}c.current!==null&&cancelAnimationFrame(c.current),c.current=null,s.current=[],t.dispose()}},[l,f,h]),u.jsxs("div",{className:`relative w-full ${v||""}`.trim(),children:[R&&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:m,className:"border border-muted rounded overflow-hidden"})]})}export{L as C,$ as T,A as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--terminal-font-family: "IBM Plex Mono", "Source Code Pro", "Fira Code", "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--terminal-font-size: 14px;--terminal-preview-font-size: 12px;--terminal-line-height: 1.35;--terminal-letter-spacing: .5px;--terminal-preview-line-height: 1.25;--terminal-preview-letter-spacing: .3px}.terminal-container{font-family:var(--terminal-font-family)}.xterm .xterm-screen,.terminal-preview .xterm .xterm-screen{font-family:var(--terminal-font-family)!important}.xterm .xterm-viewport::-webkit-scrollbar{width:10px}.xterm .xterm-viewport::-webkit-scrollbar-track{background:#ffffff0d;border-radius:5px}.xterm .xterm-viewport::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:5px}.xterm .xterm-viewport::-webkit-scrollbar-thumb:hover{background:#ffffff40}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,ag as b,A as f}from"./index-
|
|
1
|
+
import{r as i,ag as b,A as f}from"./index-BfJaT17z.js";function j(){const[y,u]=i.useState([]),[g,c]=i.useState(!1),[m,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:g,error:m,createSession:d,destroySession:S,resizeSession:$,refreshSessions:k,fetchPreview:E}}export{j as u};
|
package/static/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
|
|
10
10
|
<title>Coconut - Agentic Development Environment</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-BfJaT17z.js"></script>
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B5SwW-PH.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body class="font-inter">
|
|
15
15
|
<div id="root"></div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E,u as A,H as T,r,A as u,j as e,n as f,B as i,L as d,az as F,J as L,M as $,N as P,T as S,O as z,P as B,Q as K,R as U,U as H,V as M,W as R,ah as _,ai as q,aA as I,Y as V}from"./index-D_Lz5G-Q.js";import{C as c,a as o,b as W,c as J}from"./card-CSNr-FQA.js";import{B as O}from"./badge-NXKbF0v1.js";import{c as Q}from"./clipboard-B9ndUJKl.js";import{A as g}from"./arrow-left-1kNbh1Lu.js";import{C as Y}from"./calendar-v-JFQxNh.js";import{T as G}from"./tag-BMxDJZSb.js";function le(){const p=E(),j=A(),{toast:n}=T(),l=p.filename,[s,w]=r.useState(null),[N,v]=r.useState(!0),[m,x]=r.useState(!1),[k,h]=r.useState(!1);r.useEffect(()=>{l&&C()},[l]);const C=async()=>{try{const a=await(await fetch(`${u}/api/v1/context/knowledge/${l}`)).json();a.success?w(a.document):n({title:"Error",description:"Failed to load knowledge document",variant:"destructive"})}catch(t){console.error("Error fetching document:",t),n({title:"Error",description:"Failed to load knowledge document",variant:"destructive"})}finally{v(!1)}},y=async()=>{if(!s)return;const t=`.nut/context/knowledge/${s.filename}`;try{await Q(t),h(!0),setTimeout(()=>h(!1),2e3),n({title:"Copied!",description:`Path copied to clipboard: ${t}`})}catch(a){console.error("Failed to copy path:",a),n({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},D=()=>{if(!s)return;const t=new CustomEvent("discuss-in-chat",{detail:{type:"knowledge",id:`knowledge-${s.filename.replace(".md","")}`,filename:s.filename,name:s.filename,path:`.nut/context/knowledge/${s.filename}`}});window.dispatchEvent(t)},b=async()=>{if(s){x(!0);try{const a=await(await fetch(`${u}/api/v1/context/knowledge/${l}`,{method:"DELETE"})).json();a.success?(n({title:"Success",description:"Knowledge document deleted successfully"}),j("/context/knowledge")):n({title:"Error",description:a.error||"Failed to delete knowledge document",variant:"destructive"})}catch(t){console.error("Error deleting document:",t),n({title:"Error",description:"Failed to delete knowledge document",variant:"destructive"})}finally{x(!1)}}};return N?e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(o,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(f,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading knowledge document..."})]})})})}):s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.title}),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:"/context/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(g,{className:"h-4 w-4"})})}),e.jsxs(i,{variant:"outline",size:"sm",onClick:D,children:[e.jsx(F,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsx(i,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(d,{to:`/context/knowledge/${l}/edit`,children:[e.jsx(L,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs($,{children:[e.jsx(P,{asChild:!0,children:e.jsxs(i,{variant:"destructive",size:"sm",children:[e.jsx(S,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Delete"})]})}),e.jsxs(z,{children:[e.jsxs(B,{children:[e.jsx(K,{children:"Delete Knowledge Document"}),e.jsxs(U,{children:["Are you sure you want to delete “",s.title,"”? This action cannot be undone."]})]}),e.jsxs(H,{children:[e.jsx(M,{children:"Cancel"}),e.jsx(R,{onClick:b,disabled:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:m?e.jsx(f,{className:"w-4 h-4 animate-spin"}):"Delete"})]})]})]})]})]}),e.jsx("div",{className:"text-left",children:e.jsxs("button",{type:"button",onClick:y,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono text-left",children:[e.jsxs("span",{className:"break-all",children:[".nut/context/knowledge/",s.filename]}),k?e.jsx(_,{className:"h-3.5 w-3.5 flex-shrink-0 text-green-600"}):e.jsx(q,{className:"h-3.5 w-3.5 flex-shrink-0"})]})})]}),e.jsxs("div",{className:"flex flex-col gap-2 text-sm text-muted-foreground sm:flex-row sm:flex-wrap sm:items-center sm:gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Y,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Updated ",s.metadata.updated]})]}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{className:"flex items-start gap-1.5 sm:items-center",children:[e.jsx(G,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5 sm:mt-0"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.metadata.tags.map((t,a)=>e.jsx(O,{variant:"outline",className:"text-xs",children:t},a))})]})]}),s.metadata.sources&&s.metadata.sources.length>0&&e.jsxs(c,{children:[e.jsx(W,{children:e.jsxs(J,{className:"flex items-center gap-2",children:[e.jsx(I,{className:"w-4 h-4"}),"Sources"]})}),e.jsx(o,{children:e.jsx("ul",{className:"space-y-2",children:s.metadata.sources.map((t,a)=>e.jsx("li",{children:t.startsWith("http")?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:t}):e.jsx("span",{children:t})},a))})})]}),e.jsx(c,{children:e.jsx(o,{className:"pt-6",children:e.jsx(V,{children:s.content})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold",children:"Knowledge Document Not 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:"/context/knowledge",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(g,{className:"h-4 w-4"})})})})]}),e.jsx(c,{children:e.jsx(o,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Knowledge Document Not Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"The requested knowledge document could not be found."})]})})})]})}export{le as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as B,u as M,H as z,r as n,A as C,j as e,n as S,B as x,L as D,a2 as K,X as R,I as U}from"./index-D_Lz5G-Q.js";import{C as d,a as l,b as h,c as g}from"./card-CSNr-FQA.js";import{L as p}from"./label-JyYTDtEw.js";import{M as H}from"./markdown-editor-Chiudu3u.js";import{T as y}from"./TagInput-Qey-JNSc.js";import{A as _}from"./arrow-left-1kNbh1Lu.js";import"./badge-NXKbF0v1.js";function W(){const T=B(),i=M(),{toast:a}=z(),r=T.filename,[m,L]=n.useState(null),[A,b]=n.useState(!0),[u,f]=n.useState(!1),[o,j]=n.useState(""),[c,v]=n.useState(""),[w,N]=n.useState([]),[k,E]=n.useState([]);n.useEffect(()=>{r&&F()},[r]);const F=async()=>{try{const t=await(await fetch(`${C}/api/v1/context/knowledge/${r}`)).json();t.success?(L(t.document),j(t.document.title),v(t.document.content),N(t.document.metadata.tags||[]),E(t.document.metadata.sources||[])):(a({title:"Error",description:"Failed to load knowledge document",variant:"destructive"}),i("/context/knowledge"))}catch(s){console.error("Error fetching document:",s),a({title:"Error",description:"Failed to load knowledge document",variant:"destructive"}),i("/context/knowledge")}finally{b(!1)}},P=async()=>{if(m){if(!o.trim()){a({title:"Error",description:"Please provide a title for the knowledge document",variant:"destructive"});return}if(!c.trim()){a({title:"Error",description:"Please provide content for the knowledge document",variant:"destructive"});return}f(!0);try{const t=await(await fetch(`${C}/api/v1/context/knowledge/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.trim(),content:c.trim(),metadata:{tags:w,sources:k}})})).json();if(t.success){a({title:"Success",description:"Knowledge document updated successfully"});const I=t.document.filename.replace(".md","");i(`/context/knowledge/${I}`,{replace:!0})}else a({title:"Error",description:t.error||"Failed to update knowledge document",variant:"destructive"})}catch(s){console.error("Error updating document:",s),a({title:"Error",description:"Failed to update knowledge document",variant:"destructive"})}finally{f(!1)}}},$=()=>{i(`/context/knowledge/${r}`)};return A?e.jsx("div",{className:"space-y-6",children:e.jsx(d,{children:e.jsx(l,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(S,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading knowledge document..."})]})})})}):m?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Knowledge Document"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:m.filename})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(x,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(D,{to:"/context/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(_,{className:"h-4 w-4"})})}),e.jsxs(x,{onClick:P,disabled:u||!o.trim()||!c.trim(),size:"sm",children:[u?e.jsx(S,{className:"w-4 h-4 animate-spin sm:mr-2"}):e.jsx(K,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:u?"Saving...":"Save"})]}),e.jsxs(x,{onClick:$,variant:"outline",size:"sm",children:[e.jsx(R,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Cancel"})]})]})]}),e.jsxs(d,{children:[e.jsx(h,{children:e.jsx(g,{children:"Basic Information"})}),e.jsx(l,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(p,{htmlFor:"title",children:"Title *"}),e.jsx(U,{id:"title",value:o,onChange:s=>j(s.target.value),placeholder:"Enter document title...",className:"text-lg"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing the title will rename the file"})]})})]}),e.jsxs(d,{children:[e.jsx(h,{children:e.jsx(g,{children:"Metadata"})}),e.jsxs(l,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Tags"}),e.jsx(y,{tags:w,onChange:N,placeholder:"Add a tag"})]}),e.jsxs("div",{children:[e.jsx(p,{children:"Sources"}),e.jsx(y,{tags:k,onChange:E,placeholder:"Add a source (URL or name)"})]})]})]}),e.jsxs(d,{children:[e.jsx(h,{children:e.jsx(g,{children:"Content *"})}),e.jsx(l,{children:e.jsx(H,{value:c,onChange:s=>v(s||""),placeholder:"Enter your knowledge content in Markdown..."})})]})]}):null}export{W as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,S as ne,Y as E,r as f,b5 as B,t as C,a1 as te,b3 as ie,B as j,I as p,a0 as M,J as ae,T as oe,g as ce,ad as le}from"./index-D_Lz5G-Q.js";import{C as P,b as F,c as O,d as R,a as $}from"./card-CSNr-FQA.js";import{L as m}from"./label-JyYTDtEw.js";import{B as J}from"./badge-NXKbF0v1.js";import{S as I}from"./switch-C8QENxXl.js";import{A as q,a as z}from"./alert-B1XiCMQp.js";import{R as de,L as me}from"./browser-modal-rJ-NhTpW.js";import{R as he}from"./registry-ANRa5WBi.js";import{C as L}from"./circle-alert-Dupw7IFA.js";import{P as Y}from"./plus-CMaJeyI7.js";import{C as xe}from"./circle-check-big-oAo0Oeyn.js";import"./search-C_8YfOPe.js";function U(r){if(r){if(Array.isArray(r)){const t=r.map(o=>{if(typeof o=="string")return o.trim();if(typeof o=="number")return`${o}`}).filter(o=>typeof o=="string"&&o.length>0);return t.length>0?t:void 0}if(typeof r=="string"){const t=r.split(",").map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?t:void 0}}}function K(r,t){const o=r.name||t.name,h=t.description||r.description||"",i={registryId:r.id,registryEndpoint:r.endpoint,registrySource:he,author:r.author||t.author};(t.version||r.version)&&(i.version=t.version||r.version);const d=U(t.tags)||U(r.tags);d&&(i.tags=d),t.capabilities&&Array.isArray(t.capabilities)&&(i.capabilities=t.capabilities),t.requirements&&typeof t.requirements=="object"&&(i.requirements=t.requirements),t.links&&typeof t.links=="object"&&(i.links=t.links),t.metadata&&typeof t.metadata=="object"&&(i.mcpMetadata=t.metadata);for(const[a,v]of Object.entries(i))v==null&&delete i[a];return{name:o,command:t.configuration.command,args:t.configuration.args,env:t.configuration.env,enabled:!0,description:h,metadata:Object.keys(i).length>0?i:void 0}}async function ve(r){const t=r.startsWith("http")?r:`https://registry.coconut.dev${r}`,o=await fetch(t,{headers:{Accept:"application/json","User-Agent":"coconut-frontend"}});if(!o.ok)throw new Error(`Failed to fetch MCP server detail: ${o.status}`);return o.json()}function pe({open:r,onOpenChange:t,onImport:o}){return e.jsx(de,{open:r,onOpenChange:t,categoryId:"mcp-servers",title:"Coconut Registry – MCP Servers",confirmLabel:"Add Server",getDetail:h=>ve(h.endpoint),renderPreview:(h,i)=>{if(!i)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an MCP server to preview"});const d=K(h,i),a=d.metadata??{},v=typeof a.version=="string"?a.version:void 0,N=Array.isArray(h.tags)?h.tags:[],S=Array.isArray(a.capabilities)?a.capabilities.filter(g=>typeof g=="string"):[];return e.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border",children:e.jsx(ne,{className:"h-full",children:e.jsx("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:h.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.description})]}),v&&e.jsxs(J,{variant:"outline",children:["v",v]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Registry ID: ",e.jsx("span",{className:"font-mono",children:h.id})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:N.map(g=>e.jsx(J,{variant:"secondary",children:g},g))}),e.jsxs("div",{className:"space-y-2 rounded-md border p-3 bg-muted/50",children:[e.jsx("div",{className:"text-sm font-medium",children:"Configuration"}),e.jsxs("div",{className:"space-y-1 text-sm font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Command:"})," ",e.jsx("span",{className:"text-foreground",children:d.command})]}),d.args&&d.args.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Args:"})," ",e.jsx("span",{className:"text-foreground",children:d.args.join(" ")})]}),d.env&&Object.keys(d.env).length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Env:"})," ",e.jsx("span",{className:"text-foreground",children:JSON.stringify(d.env)})]})]})]}),S.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Capabilities"}),e.jsx("ul",{className:"list-disc pl-5 text-sm text-muted-foreground space-y-1",children:S.map(g=>e.jsx("li",{children:g},g))})]}),i.documentation&&e.jsxs("div",{className:"space-y-3",children:[i.documentation.overview&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Overview"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.overview})]}),i.documentation.installation&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Installation"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.installation})]}),i.documentation.usage&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Usage"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.usage})]}),i.documentation.examples&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Examples"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.examples})]})]})]})})})})},onConfirm:async(h,i)=>{const d=K(h,i);await o({summary:h,detail:i,payload:d})}})}function ke(){const[r,t]=f.useState({}),[o,h]=f.useState(!0),[i,d]=f.useState(!1),[a,v]=f.useState({name:"",command:"",args:"",env:"",description:"",enabled:!0}),[N,S]=f.useState(!1),[g,A]=f.useState(null),[c,b]=f.useState({name:"",command:"",args:"",env:"",description:"",enabled:!0}),[G,T]=f.useState(!1);f.useEffect(()=>{_()},[]);const _=async()=>{try{h(!0);const s=await B("/api/v1/mcp/raw-config");t(s||{})}catch(s){console.error("Failed to load MCP config:",s),C({title:"Error",description:"Failed to load MCP configuration",variant:"destructive"})}finally{h(!1)}},w=async s=>{try{d(!0),await B("/api/v1/mcp/raw-config",{method:"PUT",body:JSON.stringify(s)}),t(s),C({title:"Success",description:"MCP configuration saved successfully"})}catch(n){console.error("Failed to save MCP config:",n),C({title:"Error",description:"Failed to save MCP configuration",variant:"destructive"})}finally{d(!1)}},H=()=>{if(!a.name||!a.command){C({title:"Error",description:"Server name and command are required",variant:"destructive"});return}const s={name:a.name,command:a.command,enabled:a.enabled,description:a.description||void 0};if(a.args.trim()&&(s.args=a.args.split(" ").filter(x=>x.trim())),a.env.trim())try{s.env=JSON.parse(a.env)}catch{C({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const n={...r,mcpServers:{...r.mcpServers,[a.name]:s}};w(n),v({name:"",command:"",args:"",env:"",description:"",enabled:!0}),S(!1)},V=(s,n)=>{const x={...r,mcpServers:{...r.mcpServers,[s]:{...r.mcpServers[s],enabled:n}}};w(x)},W=s=>{const{[s]:n,...x}=r.mcpServers||{},y={...r,mcpServers:x};w(y)},Q=s=>{const n=r.mcpServers?.[s];n&&(b({name:n.name||s,command:n.command,args:n.args?.join(" ")||"",env:n.env?JSON.stringify(n.env,null,2):"",description:n.description||"",enabled:n.enabled!==!1}),A(s))},X=s=>{if(!c.command){C({title:"Error",description:"Command is required",variant:"destructive"});return}const n={name:c.name,command:c.command,enabled:c.enabled,description:c.description||void 0};if(c.args.trim()&&(n.args=c.args.split(" ").filter(l=>l.trim())),c.env.trim())try{n.env=JSON.parse(c.env)}catch{C({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const{[s]:x,...y}=r.mcpServers||{},u={...r,mcpServers:{...y,[s]:n}};w(u),A(null)},Z=()=>{A(null),b({name:"",command:"",args:"",env:"",description:"",enabled:!0})},k=s=>{const n={...r,globalSettings:{...r.globalSettings,...s}};w(n)},ee=async s=>{const{payload:n}=s;let x=n.name.toLowerCase().replace(/\s+/g,"-");const y=r.mcpServers||{};let u=x,l=1;for(;y[u];)u=`${x}-${l}`,l++;const se={name:u,command:n.command,args:n.args,env:n.env,enabled:n.enabled!==!1,description:n.description},re={...r,mcpServers:{...r.mcpServers,[u]:se}};await w(re),C({title:"Success",description:`MCP server "${u}" added from registry`})};if(o)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading configuration..."})]})});const D=r.mcpServers||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Model Context Protocol servers and settings."})]}),e.jsx(te,{}),Object.keys(D).length===0&&!N&&e.jsxs(q,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(z,{children:"No MCP servers configured yet. Add your first server to get started."})]}),e.jsxs(P,{children:[e.jsx(F,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-5 w-5"}),"MCP Servers"]}),e.jsx(R,{className:"hidden sm:block",children:"Configure and manage Model Context Protocol servers for enhanced AI capabilities."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{size:"sm",variant:"outline",onClick:()=>T(!0),children:[e.jsx(me,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsxs(j,{size:"sm",onClick:()=>S(!N),variant:N?"outline":"default",children:[e.jsx(Y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:N?"Cancel":"Add Server"})]})]})]})}),e.jsxs($,{children:[N&&e.jsxs("div",{className:"space-y-4 p-3 sm:p-4 border rounded-lg mb-4",children:[e.jsx("h4",{className:"font-medium",children:"Add MCP Server"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverName",children:"Server Name"}),e.jsx(p,{id:"serverName",value:a.name,onChange:s=>v({...a,name:s.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverCommand",children:"Command"}),e.jsx(p,{id:"serverCommand",value:a.command,onChange:s=>v({...a,command:s.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverArgs",children:"Arguments (space-separated)"}),e.jsx(p,{id:"serverArgs",value:a.args,onChange:s=>v({...a,args:s.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverEnv",children:"Environment Variables (JSON format)"}),e.jsx(M,{id:"serverEnv",value:a.env,onChange:s=>v({...a,env:s.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverDescription",children:"Description (optional)"}),e.jsx(p,{id:"serverDescription",value:a.description,onChange:s=>v({...a,description:s.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:"serverEnabled",checked:a.enabled,onCheckedChange:s=>v({...a,enabled:s})}),e.jsx(m,{htmlFor:"serverEnabled",children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs(j,{onClick:H,disabled:i,children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),"Add Server"]}),e.jsx(j,{variant:"outline",onClick:()=>S(!1),children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-4",children:Object.entries(D).map(([s,n])=>{const x=n.enabled!==!1,y=n.name||s,u=g===s;return e.jsx("div",{className:"border rounded-lg",children:u?e.jsxs("div",{className:"space-y-4 p-3 sm:p-4",children:[e.jsx("h4",{className:"font-medium",children:"Edit MCP Server"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-name-${s}`,children:"Server Name"}),e.jsx(p,{id:`edit-name-${s}`,value:c.name,onChange:l=>b({...c,name:l.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-command-${s}`,children:"Command"}),e.jsx(p,{id:`edit-command-${s}`,value:c.command,onChange:l=>b({...c,command:l.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-args-${s}`,children:"Arguments (space-separated)"}),e.jsx(p,{id:`edit-args-${s}`,value:c.args,onChange:l=>b({...c,args:l.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-env-${s}`,children:"Environment Variables (JSON format)"}),e.jsx(M,{id:`edit-env-${s}`,value:c.env,onChange:l=>b({...c,env:l.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-description-${s}`,children:"Description (optional)"}),e.jsx(p,{id:`edit-description-${s}`,value:c.description,onChange:l=>b({...c,description:l.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:`edit-enabled-${s}`,checked:c.enabled,onCheckedChange:l=>b({...c,enabled:l})}),e.jsx(m,{htmlFor:`edit-enabled-${s}`,children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(j,{onClick:()=>X(s),disabled:i,children:"Save Changes"}),e.jsx(j,{variant:"outline",onClick:Z,children:"Cancel"})]})]}):e.jsx("div",{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[x?e.jsx(xe,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"}):e.jsx(L,{className:"h-4 w-4 text-gray-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:y}),e.jsx(J,{variant:x?"default":"secondary",className:"text-xs",children:x?"Enabled":"Disabled"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:n.description||n.command}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:[e.jsx("span",{className:"font-medium",children:"Command:"})," ",n.command," ",n.args?.join(" ")]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 shrink-0",children:[e.jsx(I,{checked:x,onCheckedChange:l=>V(s,l),disabled:i}),e.jsx(j,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Q(s),children:e.jsx(ae,{className:"h-4 w-4"})}),e.jsx(j,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>W(s),disabled:i,children:e.jsx(oe,{className:"h-4 w-4"})})]})]})})},s)})})]})]}),e.jsxs(P,{children:[e.jsxs(F,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"Configuration File"]}),e.jsxs(R,{children:["The MCP configuration is stored in ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:".nut/mcp/config.json"})]})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"configJson",children:"Current Configuration (JSON)"}),e.jsx(M,{id:"configJson",value:JSON.stringify(r,null,2),readOnly:!0,rows:12,className:"font-mono text-sm",placeholder:"Loading configuration..."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This is a read-only view of the current configuration. Use the forms above to make changes."})]}),e.jsxs(q,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(z,{children:"Configuration changes are automatically saved to the MCP config file. This file can also be edited manually if you prefer working with JSON directly."})]})]})]}),e.jsxs(P,{children:[e.jsxs(F,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5"}),"Global Settings"]}),e.jsx(R,{children:"Configure global MCP behavior and connection settings."})]}),e.jsx($,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"timeout",children:"Connection Timeout (ms)"}),e.jsx(p,{id:"timeout",type:"number",value:r.globalSettings?.timeout||3e4,onChange:s=>k({timeout:parseInt(s.target.value)}),placeholder:"30000"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"retryAttempts",children:"Retry Attempts"}),e.jsx(p,{id:"retryAttempts",type:"number",value:r.globalSettings?.retryAttempts||3,onChange:s=>k({retryAttempts:parseInt(s.target.value)}),placeholder:"3"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"logLevel",children:"Log Level"}),e.jsxs("select",{id:"logLevel",className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",value:r.globalSettings?.logLevel||"info",onChange:s=>k({logLevel:s.target.value}),children:[e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warning"}),e.jsx("option",{value:"error",children:"Error"})]})]})]})})]}),e.jsx("div",{className:"flex justify-end space-x-2",children:e.jsx(j,{variant:"outline",onClick:_,disabled:o,children:"Reload Configuration"})}),e.jsx(pe,{open:G,onOpenChange:T,onImport:ee})]})}export{ke as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{u as S,H as E,r as a,j as e,B as p,n as L,a2 as T,L as b,I as A,A as I}from"./index-D_Lz5G-Q.js";import{C as i,b as c,c as l,a as d}from"./card-CSNr-FQA.js";import{L as m}from"./label-JyYTDtEw.js";import{M as B}from"./markdown-editor-Chiudu3u.js";import{T as g}from"./TagInput-Qey-JNSc.js";import{A as P}from"./arrow-left-1kNbh1Lu.js";import"./badge-NXKbF0v1.js";function O(){const f=S(),{toast:s}=E(),[u,x]=a.useState(!1),[r,v]=a.useState(""),[n,w]=a.useState(""),[h,C]=a.useState([]),[j,k]=a.useState([]),N=async()=>{if(!r.trim()){s({title:"Error",description:"Please provide a title for the knowledge document",variant:"destructive"});return}if(!n.trim()){s({title:"Error",description:"Please provide content for the knowledge document",variant:"destructive"});return}x(!0);try{const o=await(await fetch(`${I}/api/v1/context/knowledge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:r.trim(),content:n.trim(),metadata:{tags:h,sources:j}})})).json();if(o.success){s({title:"Success",description:"Knowledge document created successfully"});const y=o.document.filename.replace(".md","");f(`/context/knowledge/${y}`)}else s({title:"Error",description:o.error||"Failed to create knowledge document",variant:"destructive"})}catch(t){console.error("Error creating document:",t),s({title:"Error",description:"Failed to create knowledge document",variant:"destructive"})}finally{x(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-3xl font-bold",children:"Create Knowledge Document"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(p,{onClick:N,disabled:u||!r.trim()||!n.trim(),size:"sm",children:[u?e.jsx(L,{className:"w-4 h-4 animate-spin"}):e.jsx(T,{className:"w-4 h-4"}),"Create Document"]}),e.jsx(p,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(b,{to:"/context/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(P,{className:"h-4 w-4"})})})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Basic Information"})}),e.jsx(d,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(m,{htmlFor:"title",children:"Title *"}),e.jsx(A,{id:"title",value:r,onChange:t=>v(t.target.value),placeholder:"Enter document title...",className:"text-lg"})]})})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Metadata"})}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{children:"Tags"}),e.jsx(g,{tags:h,onChange:C,placeholder:"Add a tag"})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Sources"}),e.jsx(g,{tags:j,onChange:k,placeholder:"Add a source (URL or name)"})]})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Content *"})}),e.jsx(d,{children:e.jsx(B,{value:n,onChange:t=>w(t||""),placeholder:`Enter your knowledge content in Markdown...
|
|
2
|
-
|
|
3
|
-
You can use:
|
|
4
|
-
- **Bold text**
|
|
5
|
-
- *Italic text*
|
|
6
|
-
- # Headers
|
|
7
|
-
- - Lists
|
|
8
|
-
- [Links](https://example.com)
|
|
9
|
-
- Code blocks and more!`})})]})]})}export{O as default};
|