@lovelybunch/api 1.0.77-alpha.0 → 1.0.77-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/oauth.d.ts +33 -0
- package/dist/config/oauth.js +43 -0
- package/dist/lib/auth/auth-manager.d.ts +21 -1
- package/dist/lib/auth/auth-manager.js +57 -3
- package/dist/lib/auth/clerk-verifier.d.ts +22 -0
- package/dist/lib/auth/clerk-verifier.js +39 -0
- package/dist/middleware/auth.js +40 -3
- package/dist/routes/api/v1/auth/route.js +94 -0
- package/dist/routes/api/v1/auth-settings/route.js +83 -2
- package/dist/routes/api/v1/jobs/[id]/route.d.ts +20 -20
- package/dist/routes/api/v1/jobs/route.d.ts +20 -20
- package/dist/routes/api/v1/slack/route.d.ts +6 -6
- package/dist/server-with-static.js +13 -0
- package/dist/server.js +11 -0
- package/package.json +5 -4
- package/static/assets/{ActivityPage-rASRHKYj.js → ActivityPage-BrpfoR1x.js} +1 -1
- package/static/assets/{AgentsContextEditPage-CMWD-7mS.js → AgentsContextEditPage-DD96j1Gu.js} +1 -1
- package/static/assets/AgentsContextPage-DbGPK_nF.js +1 -0
- package/static/assets/{ApiKeysSettingsPage-DxtuyXwn.js → ApiKeysSettingsPage-DCRw8BVU.js} +2 -2
- package/static/assets/AuthSettingsPage-BZcuolzF.js +11 -0
- package/static/assets/{CallbackPage-CjlTVuif.js → CallbackPage-j_Z5gQid.js} +1 -1
- package/static/assets/CoconutCallbackPage-ZEdMiq56.js +1 -0
- package/static/assets/CodePage-LOMEoK8O.js +2 -0
- package/static/assets/{CollapsibleSection-LrQJlSxD.js → CollapsibleSection-iVC3bo9u.js} +1 -1
- package/static/assets/{DashboardPage-DnyFyDO0.js → DashboardPage-CAxisL8l.js} +1 -1
- package/static/assets/{GitPage-o37iQMYQ.js → GitPage-BzVIV2mo.js} +2 -2
- package/static/assets/{GitSettingsPage-O0fe5kxm.js → GitSettingsPage-CKWWrG0f.js} +2 -2
- package/static/assets/{IdentityPage-KWjruliO.js → IdentityPage-IVZ-nvh_.js} +2 -2
- package/static/assets/{ImplementationStepsEditor-h_Mxu1tF.js → ImplementationStepsEditor-IzyUL2cs.js} +1 -1
- package/static/assets/IntegrationsSettingsPage-DvzES04i.js +1 -0
- package/static/assets/JobDetailPage-DVKKQ1j7.js +1 -0
- package/static/assets/KnowledgeDetailPage-jdJGqZT9.js +1 -0
- package/static/assets/{KnowledgeEditPage-DrdvEGuR.js → KnowledgeEditPage-C60yLCQf.js} +1 -1
- package/static/assets/{KnowledgePage-CK5rtZcv.js → KnowledgePage-B3G3eWhs.js} +2 -2
- package/static/assets/LoginPage-DXRpkMQE.js +1 -0
- package/static/assets/{MailInboxPage-CewILL7o.js → MailInboxPage-D4F-yUb2.js} +1 -1
- package/static/assets/MailProcessingModal-C5TbdlsX.js +1 -0
- package/static/assets/{MailReadPage--LnQ743i.js → MailReadPage-Bn6Zw8xJ.js} +1 -1
- package/static/assets/{MailSentPage-BqO4iBq6.js → MailSentPage-Bk3jJOzz.js} +1 -1
- package/static/assets/McpSettingsPage-D2UXUhK2.js +1 -0
- package/static/assets/{MemoryEditPage-BLfdKEDu.js → MemoryEditPage-fFwS44vf.js} +1 -1
- package/static/assets/MemoryPage-BTOJoF-z.js +1 -0
- package/static/assets/{NewKnowledgePage-SrBhXpH6.js → NewKnowledgePage-X86yjTVl.js} +1 -1
- package/static/assets/{NewSkillPage-vt-0rIkv.js → NewSkillPage-e8dGvY9r.js} +1 -1
- package/static/assets/{NewTaskPage-CBUpwIFP.js → NewTaskPage-DhUlLdQA.js} +2 -2
- package/static/assets/{NotFoundPage-CWF5qOC0.js → NotFoundPage-BjIfj-6G.js} +1 -1
- package/static/assets/{NotificationsSettingsPage-3ZvMrqiq.js → NotificationsSettingsPage-YWyp3_fq.js} +1 -1
- package/static/assets/PromptsSettingsPage-DS-7Hcyy.js +1 -0
- package/static/assets/{ResourceDetailPage-CE4iDbv7.js → ResourceDetailPage-5lxrzduZ.js} +1 -1
- package/static/assets/{ResourcesPage-4_5NA4RF.js → ResourcesPage-5e8iv04j.js} +1 -1
- package/static/assets/{RoleEditPage-4sSELIRX.js → RoleEditPage-CZl5kzLm.js} +1 -1
- package/static/assets/RolePage-DH1XSfmN.js +1 -0
- package/static/assets/{RulesSettingsPage-DnyGaden.js → RulesSettingsPage-CfHyX5-L.js} +4 -4
- package/static/assets/{RunDetailPage-D2ajvKfh.js → RunDetailPage-CKvjq6lg.js} +1 -1
- package/static/assets/SchedulePage-DK3H_i1s.js +4 -0
- package/static/assets/SkillDetailPage-K_CkFQv-.js +1 -0
- package/static/assets/{SkillEditPage-DeI8uu3S.js → SkillEditPage-2X3bZgJ0.js} +1 -1
- package/static/assets/{SkillsPage-Bb_dEdun.js → SkillsPage-Ba-7nPAX.js} +2 -2
- package/static/assets/{SkillsSettingsPage-CMWf2O9y.js → SkillsSettingsPage-w64_WHIP.js} +1 -1
- package/static/assets/{SourceInput-CtyUOXOG.js → SourceInput-I-hamu6Q.js} +1 -1
- package/static/assets/{TagInput-C0NyMxlY.js → TagInput-DEIDoXAF.js} +1 -1
- package/static/assets/{TaskDetailPage-6DDI0juh.js → TaskDetailPage-CIzKy_lB.js} +2 -2
- package/static/assets/{TaskEditPage-Btc1NXtR.js → TaskEditPage-DE5iZOlS.js} +1 -1
- package/static/assets/{TasksPage-C9TYvqRz.js → TasksPage-XJv3kCi4.js} +1 -1
- package/static/assets/{TeamEditPage-CLvNy6Ss.js → TeamEditPage-BJYjNG9s.js} +1 -1
- package/static/assets/TeamPage-8HQl8tJg.js +1 -0
- package/static/assets/{TerminalPage-DNDHEYJZ.js → TerminalPage-1wX_kSZq.js} +1 -1
- package/static/assets/{TerminalSessionPage-nNCw_oDE.js → TerminalSessionPage-C9DF64yx.js} +2 -2
- package/static/assets/{UserPreferencesPage-jc1SA79x.js → UserPreferencesPage-soBs08Yv.js} +1 -1
- package/static/assets/{UserSettingsPage-pr6n15Pz.js → UserSettingsPage-oGRL6qzb.js} +1 -1
- package/static/assets/UtilitiesPage-CtZZsdkO.js +1 -0
- package/static/assets/{alert-BtkLXQ3p.js → alert-yfoaxi15.js} +1 -1
- package/static/assets/{arrow-down-DnNLmXEs.js → arrow-down-CmC8SDMn.js} +1 -1
- package/static/assets/{arrow-left-B9NBHEkS.js → arrow-left-C3PN_VXn.js} +1 -1
- package/static/assets/{arrow-up-eMUJY7J9.js → arrow-up-C2_FqbAf.js} +1 -1
- package/static/assets/{arrow-up-down-DIuMvAne.js → arrow-up-down-BxszeBWu.js} +1 -1
- package/static/assets/{badge-BbfU_aPt.js → badge-CfOS4AEh.js} +1 -1
- package/static/assets/{browser-modal-J9l3o5os.js → browser-modal-CohGkjjX.js} +2 -2
- package/static/assets/{card-CL5bB4cs.js → card-DBbETqHr.js} +1 -1
- package/static/assets/{chevron-left-B-7K6MNx.js → chevron-left-CARf1vQR.js} +1 -1
- package/static/assets/{chevron-up-BwTmMEW2.js → chevron-up-DPqLVVFe.js} +1 -1
- package/static/assets/{chevrons-up-jI6nxhrz.js → chevrons-up-BJsTBH4G.js} +1 -1
- package/static/assets/{circle-alert-vJFSz39V.js → circle-alert-DvY6UCZI.js} +1 -1
- package/static/assets/{circle-check-D2LVHMl-.js → circle-check-D4I1hq5t.js} +1 -1
- package/static/assets/{circle-check-big-BwQ_q1N7.js → circle-check-big-DXkEigqp.js} +1 -1
- package/static/assets/{circle-play-CLKDBkrK.js → circle-play-Z-LH2XZF.js} +1 -1
- package/static/assets/{circle-x-CuUVLiI-.js → circle-x-Dh-KgkYg.js} +1 -1
- package/static/assets/{clipboard-BHOFelnW.js → clipboard-CME-lfxG.js} +1 -1
- package/static/assets/{clock-D-X3KCw6.js → clock-CzUgbpxH.js} +1 -1
- package/static/assets/{code-DqYaanki.js → code-Bf5KtxD0.js} +1 -1
- package/static/assets/{download-DeEju9jg.js → download-RyS06A9x.js} +1 -1
- package/static/assets/{external-link-CrRz0sU-.js → external-link-BUmaJn8N.js} +1 -1
- package/static/assets/{eye-Cx9ZGkg5.js → eye-B6H1Wnna.js} +1 -1
- package/static/assets/{folder-git-2-Cizv1NA6.js → folder-git-2-GfrcYXqB.js} +1 -1
- package/static/assets/{globe-lpD9Jv31.js → globe-DGJd-BEz.js} +1 -1
- package/static/assets/{index-CkT4WgqR.js → index--3ISLTsV.js} +1 -1
- package/static/assets/{index-BvZJRqTz.js → index--Syi3rI6.js} +1 -1
- package/static/assets/{index-Dc9Njo8L.js → index-2KcfNqV-.js} +1 -1
- package/static/assets/{index-DK1gGyTZ.js → index-3bHY1RZf.js} +1 -1
- package/static/assets/{index-BL-5Bhtg.js → index-7i8CPi9F.js} +1 -1
- package/static/assets/{index-Hy3cH93B.js → index-B2zWPdyi.js} +1 -1
- package/static/assets/{index-BCYTbJRb.js → index-BCEWTKM2.js} +1 -1
- package/static/assets/{index-CMaK0hpv.js → index-BMfWq2j7.js} +1 -1
- package/static/assets/{index-Djzp98Vj.js → index-BMooEqjV.js} +1 -1
- package/static/assets/{index-ihWq-CVE.js → index-BMtEpMwG.js} +1 -1
- package/static/assets/{index-DgAcL75U.js → index-D7MExzMq.js} +1 -1
- package/static/assets/{index-BPdWQ0rI.js → index-D7veMECT.js} +1 -1
- package/static/assets/{index-ByTA2ZiD.js → index-DQyKDJLd.js} +105 -105
- package/static/assets/{index-Dnj5cWsp.js → index-DztTpy2B.js} +1 -1
- package/static/assets/{index-D12O6wM3.js → index-Oe08b-EX.js} +1 -1
- package/static/assets/{index-DIt703WU.js → index-ctTeh4My.js} +1 -1
- package/static/assets/{index-BVrOTqTm.js → index-kIIlr6Bh.js} +1 -1
- package/static/assets/{index-CuLP7P_G.js → index-sRKyM1Il.js} +1 -1
- package/static/assets/{index-BknCCMZK.js → index-vmtCSD0U.js} +1 -1
- package/static/assets/{info-DxhTCbw1.js → info-CHiTEVvq.js} +1 -1
- package/static/assets/{label-Dp0-28_O.js → label-DZN-TTmJ.js} +1 -1
- package/static/assets/{markdown-editor-DUmrf1eN.js → markdown-editor-CjtUzCZF.js} +38 -38
- package/static/assets/{message-square-BPOApeM3.js → message-square-D8KMCL9-.js} +1 -1
- package/static/assets/{paperclip-Bfjc1WLZ.js → paperclip-CsjIUex0.js} +1 -1
- package/static/assets/{pause-Bfz-QQZp.js → pause-DyIY-Fg6.js} +1 -1
- package/static/assets/{play-fOwEoIcu.js → play-BsqG0Xxh.js} +1 -1
- package/static/assets/{radio-group-B8RB7N01.js → radio-group-Cd6D1zWl.js} +1 -1
- package/static/assets/{refresh-cw-Cj_5MZiJ.js → refresh-cw-DvA7rcDs.js} +1 -1
- package/static/assets/{search-BgbqRUnf.js → search-BtvwgzIM.js} +1 -1
- package/static/assets/{select-CfwLZl55.js → select-BTiepyTe.js} +1 -1
- package/static/assets/{server-u9FLHclt.js → server-DjyRLssO.js} +1 -1
- package/static/assets/{switch-CX_Inx_p.js → switch-QFsCjFLp.js} +1 -1
- package/static/assets/{tabs-Bj0YyeRI.js → tabs-BQcOvpJ3.js} +1 -1
- package/static/assets/{tag-rYG4CdRx.js → tag-ChBxeRYs.js} +1 -1
- package/static/assets/{terminal-preview-BNm5-Umi.js → terminal-preview-Ch9841_B.js} +1 -1
- package/static/assets/{triangle-alert-C0ovMJwZ.js → triangle-alert-Dj9MnxX5.js} +1 -1
- package/static/assets/{use-terminal-D1UnvAVs.js → use-terminal-CJ3EJhYK.js} +1 -1
- package/static/assets/{video-CuyRES-H.js → video-DHNX2nx5.js} +1 -1
- package/static/index.html +1 -1
- package/dist/routes/api/v1/context/architecture/route.d.ts +0 -3
- package/dist/routes/api/v1/context/architecture/route.js +0 -245
- package/dist/routes/api/v1/context/project/route.d.ts +0 -3
- package/dist/routes/api/v1/context/project/route.js +0 -200
- package/static/assets/AgentsContextPage-VfMmxxr6.js +0 -1
- package/static/assets/AuthSettingsPage-CWTpS6BA.js +0 -11
- package/static/assets/CodePage-DwjtGxQi.js +0 -2
- package/static/assets/IntegrationsSettingsPage-DeFQd6af.js +0 -1
- package/static/assets/JobDetailPage-HOLpF7Sx.js +0 -1
- package/static/assets/KnowledgeDetailPage-C5egPQ54.js +0 -1
- package/static/assets/LoginPage-DajEouCN.js +0 -1
- package/static/assets/MailProcessingModal-B1ZLXyYl.js +0 -1
- package/static/assets/McpSettingsPage-BZ6GJOtk.js +0 -1
- package/static/assets/MemoryPage-BV0RlvUS.js +0 -1
- package/static/assets/PromptsSettingsPage-pHKoiUPI.js +0 -1
- package/static/assets/RolePage-Ds17xn4X.js +0 -1
- package/static/assets/SchedulePage-oEGct1B1.js +0 -4
- package/static/assets/SkillDetailPage-mSypV_JK.js +0 -1
- package/static/assets/TeamPage-DSWax4fa.js +0 -1
- package/static/assets/UtilitiesPage-CjLb989o.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,
|
|
1
|
+
import{r as n,bi as E,ap as K,aj as T,j as a,ak as N,bk as U,an as x,ao as w,bj as V,am as g,b8 as z,as as H,ar as $,e as j,bG as W}from"./index-DQyKDJLd.js";var C="Radio",[X,k]=N(C),[Y,J]=X(C),I=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=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:c,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:d,value:p,checked:o,required:s,disabled:i,form:R,style:{transform:"translateX(-100%)"}})]})});I.displayName=C;var G="RadioIndicator",_=n.forwardRef((r,t)=>{const{__scopeRadio:e,forceMount:d,...o}=r,s=J(G,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})})});_.displayName=G;var Q="RadioBubbleInput",P=n.forwardRef(({__scopeRadio:r,control:t,checked:e,bubbles:d=!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,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,k]),A=E(),D=k(),[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",F=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,disabled:d,...o}=r,s=re(O,e),i=s.disabled||d,p=A(e),f=D(e),R=n.useRef(null),v=w(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(I,{disabled:i,required:s.required,checked:l,...f,...o,name:s.name,ref:v,onCheck:()=>s.onValueChange(o.value),onKeyDown:g(c=>{c.key==="Enter"&&c.preventDefault()}),onFocus:g(o.onFocus,()=>{m.current&&R.current?.click()})})})});F.displayName=O;var ae="RadioGroupIndicator",L=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,...d}=r,o=D(e);return a.jsx(_,{...o,...d,ref:t})});L.displayName=ae;var q=M,B=F,te=L;const se=n.forwardRef(({className:r,...t},e)=>a.jsx(q,{className:j("grid gap-2",r),...t,ref:e}));se.displayName=q.displayName;const ne=n.forwardRef(({className:r,...t},e)=>a.jsx(B,{ref:e,className:j("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 o,j as e,e as r,n as d,
|
|
1
|
+
import{r as o,j as e,e as r,n as d,ah as y}from"./index-DQyKDJLd.js";import{R as N,V as g,T as n,I as j,P as b,C as i,a as S,b as c,d as v,c as R,e as m,f as p,L as f,S as x}from"./index-sRKyM1Il.js";import{C}from"./chevron-up-DPqLVVFe.js";const k=N,E=g,I=o.forwardRef(({className:t,children:s,...a},l)=>e.jsxs(n,{ref:l,className:r("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(j,{asChild:!0,children:e.jsx(d,{className:"h-4 w-4 opacity-50"})})]}));I.displayName=n.displayName;const u=o.forwardRef(({className:t,...s},a)=>e.jsx(m,{ref:a,className:r("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(C,{className:"h-4 w-4"})}));u.displayName=m.displayName;const h=o.forwardRef(({className:t,...s},a)=>e.jsx(p,{ref:a,className:r("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(d,{className:"h-4 w-4"})}));h.displayName=p.displayName;const B=o.forwardRef(({className:t,children:s,position:a="popper",...l},w)=>e.jsx(b,{children:e.jsxs(i,{ref:w,className:r("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...l,children:[e.jsx(u,{}),e.jsx(S,{className:r("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(h,{})]})}));B.displayName=i.displayName;const T=o.forwardRef(({className:t,...s},a)=>e.jsx(f,{ref:a,className:r("px-2 py-1.5 text-sm font-semibold",t),...s}));T.displayName=f.displayName;const V=o.forwardRef(({className:t,children:s,...a},l)=>e.jsxs(c,{ref:l,className:r("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(v,{children:e.jsx(y,{className:"h-4 w-4"})})}),e.jsx(R,{children:s})]}));V.displayName=c.displayName;const z=o.forwardRef(({className:t,...s},a)=>e.jsx(x,{ref:a,className:r("-mx-1 my-1 h-px bg-muted",t),...s}));z.displayName=x.displayName;export{k as S,I as a,E as b,B as c,V as d};
|
|
@@ -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-DQyKDJLd.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,
|
|
1
|
+
import{r as l,ap as F,aj as k,j as c,ak as $,b6 as D,an as g,bi as y,bk as V,bj as G,am as m,b8 as L,e as T}from"./index-DQyKDJLd.js";var p="Tabs",[K,Q]=$(p,[y]),h=y(),[B,x]=K(p),N=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,onValueChange:i,defaultValue:d,orientation:n="horizontal",dir:u,activationMode:f="automatic",...v}=e,r=F(u),[s,b]=k({prop:o,onChange:i,defaultProp:d??"",caller:p});return c.jsx(B,{scope:t,baseId:D(),value:s,onValueChange:b,orientation:n,dir:r,activationMode:f,children:c.jsx(g.div,{dir:r,"data-orientation":n,...v,ref:a})})});N.displayName=p;var C="TabsList",j=l.forwardRef((e,a)=>{const{__scopeTabs:t,loop:o=!0,...i}=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,...i,ref:a})})});j.displayName=C;var I="TabsTrigger",R=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,disabled:i=!1,...d}=e,n=x(I,t),u=h(t),f=A(n.baseId,o),v=E(n.baseId,o),r=o===n.value;return c.jsx(G,{asChild:!0,...u,focusable:!i,active:r,children:c.jsx(g.button,{type:"button",role:"tab","aria-selected":r,"aria-controls":v,"data-state":r?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:f,...d,ref:a,onMouseDown:m(e.onMouseDown,s=>{!i&&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";!r&&!i&&s&&n.onValueChange(o)})})})});R.displayName=I;var w="TabsContent",_=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,forceMount:i,children:d,...n}=e,u=x(w,t),f=A(u.baseId,o),v=E(u.baseId,o),r=o===u.value,s=l.useRef(r);return l.useEffect(()=>{const b=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(b)},[]),c.jsx(L,{present:i||r,children:({present:b})=>c.jsx(g.div,{"data-state":r?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!b,id:v,tabIndex:0,...n,ref:a,style:{...e.style,animationDuration:s.current?"0s":void 0},children:b&&d})})});_.displayName=w;function A(e,a){return`${e}-trigger-${a}`}function E(e,a){return`${e}-content-${a}`}var q=N,S=j,M=R,P=_;const U=q,z=l.forwardRef(({className:e,...a},t)=>c.jsx(S,{ref:t,className:T("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));z.displayName=S.displayName;const H=l.forwardRef(({className:e,...a},t)=>c.jsx(M,{ref:t,className:T("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));H.displayName=M.displayName;const O=l.forwardRef(({className:e,...a},t)=>c.jsx(P,{ref:t,className:T("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));O.displayName=P.displayName;export{U as T,z as a,H as b,O as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,
|
|
1
|
+
import{r as t,a7 as M,j as m}from"./index-DQyKDJLd.js";import{x as T,a as k}from"./xterm-DTxiCjtJ.js";function B(n){if(!n||typeof n!="object")return!1;const i=n,u=i.type==="snapshot"||i.type==="data",l=i.data===void 0||typeof i.data=="string";return u&&l}function N({sessionId:n,className:i,heightPx:u=160,maxScrollback:l=200}){const b=t.useRef(null),v=t.useRef(null),w=t.useRef(null),x=t.useRef(null),[R,S]=t.useState(!0),c=t.useRef([]),a=t.useRef(null);return t.useEffect(()=>{const o=b.current;if(!o||!n)return;const e=new T.Terminal({disableStdin:!0,cursorBlink:!1,convertEol:!0,scrollback:Math.max(50,Math.min(l,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"}}),h=new k.FitAddon;e.loadAddon(h),e.open(o),o.style.height=`${u}px`,v.current=e,w.current=h;const f=()=>{try{const r=o.getBoundingClientRect();r.width>8&&r.height>8&&e.element&&h.fit()}catch{}},j=setTimeout(()=>f(),100),p=new ResizeObserver(()=>f());p.observe(o);const y=()=>{document.visibilityState==="visible"&&setTimeout(f,50)};document.addEventListener("visibilitychange",y);const d=new WebSocket(`${M}/ws/terminal-preview/${n}`);x.current=d,d.onopen=()=>S(!1);const E=()=>{a.current=null;const r=c.current;if(r.length){c.current=[];try{e.write(r.join(""))}catch{}}},F=()=>{a.current===null&&(a.current=requestAnimationFrame(E))};return d.onmessage=r=>{let g;try{g=JSON.parse(r.data)}catch{return}if(!B(g))return;const s=g;if(s?.type==="snapshot"){if(e.reset(),c.current=[],s.data)try{e.write(s.data)}catch{}f()}else s?.type==="data"&&s.data&&(c.current.push(String(s.data)),F())},()=>{clearTimeout(j),p.disconnect(),document.removeEventListener("visibilitychange",y);try{d.close()}catch{}a.current!==null&&cancelAnimationFrame(a.current),a.current=null,c.current=[],e.dispose()}},[n,u,l]),m.jsxs("div",{className:`relative w-full ${i||""}`.trim(),children:[R&&m.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/60 z-10",children:m.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading preview…"})}),m.jsx("div",{ref:b,className:"border border-muted rounded overflow-hidden"})]})}export{N as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,
|
|
1
|
+
import{r as i,ag as v,A as f}from"./index-DQyKDJLd.js";function j(){const[y,p]=i.useState([]),[m,c]=i.useState(!1),[d,o]=i.useState(null),{refresh:w}=v(),S=i.useCallback(async(s,n)=>{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({startupCommand:n})});if(!e.ok){const t=await e.json();throw new Error(t.error||"Failed to create terminal session")}const r=await e.json();return await w(),r.sessionId}catch(e){const r=e instanceof Error?e.message:"Unknown error";return o(r),null}finally{c(!1)}},[w]),g=i.useCallback(async s=>{try{c(!0),o(null);let n;if(s.startsWith("session-")){const r=s.split("-");n=`${r[0]}-${r[1]}`}else{const r=s.split("-");n=`${r[0]}-${r[1]}`}const e=await fetch(`${f}/api/v1/terminal/${n}/destroy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s})});if(!e.ok){const r=await e.json();throw new Error(r.error||"Failed to destroy terminal session")}return p(r=>r.filter(t=>t.id!==s)),await w(),!0}catch(n){const e=n instanceof Error?n.message:"Unknown error";return o(e),!1}finally{c(!1)}},[w]),$=i.useCallback(async(s,n,e)=>{try{o(null);let r;if(s.startsWith("session-")){const a=s.split("-");r=`${a[0]}-${a[1]}`}else{const a=s.split("-");r=`${a[0]}-${a[1]}`}const t=await fetch(`${f}/api/v1/terminal/${r}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,cols:n,rows:e})});if(!t.ok){const a=await t.json();throw new Error(a.error||"Failed to resize terminal session")}return!0}catch(r){const t=r instanceof Error?r.message:"Unknown error";return o(t),!1}},[]),k=i.useCallback(async(s,n,e)=>{try{c(!0),o(null);const r=new URLSearchParams;s&&r.set("taskId",s),n&&(r.set("withPreview","true"),e&&Number.isFinite(e)&&r.set("lines",String(e)));const t=`${f}/api/v1/terminal/sessions${r.toString()?`?${r.toString()}`:""}`,a=await fetch(t);if(!a.ok){const l=await a.json();throw new Error(l.error||"Failed to fetch terminal sessions")}const u=await a.json();p(u.sessions)}catch(r){const t=r instanceof Error?r.message:"Unknown error";o(t)}finally{c(!1)}},[]),E=i.useCallback(async(s,n=8)=>{try{o(null);const e=new URLSearchParams;e.set("sessionId",s),e.set("withPreview","true"),e.set("lines",String(n)),e.set("colorize","true");const r=`${f}/api/v1/terminal/sessions?${e.toString()}`,t=await fetch(r);if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to fetch preview")}const a=await t.json(),u=Array.isArray(a?.sessions)&&a.sessions[0]?.preview?a.sessions[0].preview:[];return p(l=>l.map(h=>h.id===s?{...h,preview:u}:h)),u}catch(e){const r=e instanceof Error?e.message:"Unknown error";return o(r),[]}},[]);return{sessions:y,loading:m,error:d,createSession:S,destroySession:g,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-DQyKDJLd.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-DVMcu9sQ.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body class="font-inter">
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { Hono } from 'hono';
|
|
2
|
-
import { promises as fs } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import matter from 'gray-matter';
|
|
5
|
-
import { findGaitDirectory } from '../../../../../lib/gait-path.js';
|
|
6
|
-
import { getLogger, ContextKinds } from '@lovelybunch/core/logging';
|
|
7
|
-
import { requireAuth } from '../../../../../middleware/auth.js';
|
|
8
|
-
// Helper function to generate a simple summary from content
|
|
9
|
-
function generateSummary(content, maxLines = 3, maxChars = 200) {
|
|
10
|
-
// Remove markdown formatting for cleaner summary
|
|
11
|
-
const cleanContent = content
|
|
12
|
-
.replace(/^#+\s+/gm, '') // Remove headings
|
|
13
|
-
.replace(/[*_`]/g, '') // Remove bold, italic, code
|
|
14
|
-
.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') // Convert links to text
|
|
15
|
-
.trim();
|
|
16
|
-
// Get first few lines
|
|
17
|
-
const lines = cleanContent.split('\n').filter(line => line.trim().length > 0);
|
|
18
|
-
const summary = lines.slice(0, maxLines).join(' ');
|
|
19
|
-
// Truncate if too long
|
|
20
|
-
return summary.length > maxChars
|
|
21
|
-
? summary.substring(0, maxChars) + '...'
|
|
22
|
-
: summary;
|
|
23
|
-
}
|
|
24
|
-
const app = new Hono();
|
|
25
|
-
async function getArchitecturePath() {
|
|
26
|
-
const gaitDir = await findGaitDirectory();
|
|
27
|
-
if (!gaitDir)
|
|
28
|
-
return null;
|
|
29
|
-
return path.join(gaitDir, 'context');
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* GET /api/v1/context/architecture
|
|
33
|
-
* Load architecture document
|
|
34
|
-
*/
|
|
35
|
-
app.get('/', async (c) => {
|
|
36
|
-
try {
|
|
37
|
-
const architecturePath = await getArchitecturePath();
|
|
38
|
-
if (!architecturePath) {
|
|
39
|
-
return c.json({
|
|
40
|
-
success: false,
|
|
41
|
-
error: 'GAIT directory not found'
|
|
42
|
-
}, 404);
|
|
43
|
-
}
|
|
44
|
-
// Ensure directory exists
|
|
45
|
-
await fs.mkdir(architecturePath, { recursive: true });
|
|
46
|
-
// Look for architecture.md file
|
|
47
|
-
const filePath = path.join(architecturePath, 'architecture.md');
|
|
48
|
-
try {
|
|
49
|
-
const fileContent = await fs.readFile(filePath, 'utf-8');
|
|
50
|
-
const { data, content } = matter(fileContent);
|
|
51
|
-
// Extract title from first heading or use default
|
|
52
|
-
const title = content.match(/^#\s+(.+)$/m)?.[1] || 'Architecture Overview';
|
|
53
|
-
const document = {
|
|
54
|
-
filename: 'architecture.md',
|
|
55
|
-
metadata: {
|
|
56
|
-
...data,
|
|
57
|
-
updated: data.updated || new Date().toISOString().split('T')[0],
|
|
58
|
-
type: 'architecture',
|
|
59
|
-
category: 'design',
|
|
60
|
-
tags: data.tags || []
|
|
61
|
-
},
|
|
62
|
-
content,
|
|
63
|
-
title
|
|
64
|
-
};
|
|
65
|
-
return c.json({
|
|
66
|
-
success: true,
|
|
67
|
-
document
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
catch (fileError) {
|
|
71
|
-
// If file doesn't exist, return default content
|
|
72
|
-
const defaultContent = `# Architecture Overview
|
|
73
|
-
|
|
74
|
-
This document describes the overall architecture and design patterns used in this project.
|
|
75
|
-
|
|
76
|
-
## System Architecture
|
|
77
|
-
|
|
78
|
-
Describe the high-level system architecture, including major components and their relationships.
|
|
79
|
-
|
|
80
|
-
## Design Patterns
|
|
81
|
-
|
|
82
|
-
Document the key design patterns and architectural principles followed in this project.
|
|
83
|
-
|
|
84
|
-
### Frontend Architecture
|
|
85
|
-
|
|
86
|
-
- Component structure
|
|
87
|
-
- State management
|
|
88
|
-
- Routing approach
|
|
89
|
-
- UI/UX patterns
|
|
90
|
-
|
|
91
|
-
### Backend Architecture
|
|
92
|
-
|
|
93
|
-
- API design
|
|
94
|
-
- Data layer
|
|
95
|
-
- Service architecture
|
|
96
|
-
- Authentication & authorization
|
|
97
|
-
|
|
98
|
-
## Data Flow
|
|
99
|
-
|
|
100
|
-
Explain how data flows through the system, including:
|
|
101
|
-
|
|
102
|
-
- Request/response cycles
|
|
103
|
-
- Data transformations
|
|
104
|
-
- Caching strategies
|
|
105
|
-
- Error handling
|
|
106
|
-
|
|
107
|
-
## Technology Decisions
|
|
108
|
-
|
|
109
|
-
Document key technology choices and the reasoning behind them:
|
|
110
|
-
|
|
111
|
-
- Framework selections
|
|
112
|
-
- Database choices
|
|
113
|
-
- Third-party integrations
|
|
114
|
-
- Development tools
|
|
115
|
-
|
|
116
|
-
## Deployment Architecture
|
|
117
|
-
|
|
118
|
-
Describe the deployment strategy and infrastructure:
|
|
119
|
-
|
|
120
|
-
- Environment setup
|
|
121
|
-
- CI/CD pipeline
|
|
122
|
-
- Monitoring and logging
|
|
123
|
-
- Scaling considerations
|
|
124
|
-
|
|
125
|
-
## Security Considerations
|
|
126
|
-
|
|
127
|
-
Outline security measures and best practices:
|
|
128
|
-
|
|
129
|
-
- Authentication mechanisms
|
|
130
|
-
- Data protection
|
|
131
|
-
- API security
|
|
132
|
-
- Infrastructure security
|
|
133
|
-
|
|
134
|
-
## Performance Considerations
|
|
135
|
-
|
|
136
|
-
Document performance optimization strategies:
|
|
137
|
-
|
|
138
|
-
- Caching layers
|
|
139
|
-
- Database optimization
|
|
140
|
-
- Frontend performance
|
|
141
|
-
- Monitoring and metrics
|
|
142
|
-
`;
|
|
143
|
-
const document = {
|
|
144
|
-
filename: 'architecture.md',
|
|
145
|
-
metadata: {
|
|
146
|
-
version: '1.0',
|
|
147
|
-
updated: new Date().toISOString().split('T')[0],
|
|
148
|
-
type: 'architecture',
|
|
149
|
-
category: 'design',
|
|
150
|
-
tags: []
|
|
151
|
-
},
|
|
152
|
-
content: defaultContent,
|
|
153
|
-
title: 'Architecture Overview'
|
|
154
|
-
};
|
|
155
|
-
return c.json({
|
|
156
|
-
success: true,
|
|
157
|
-
document
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
catch (error) {
|
|
162
|
-
console.error('Error loading architecture document:', error);
|
|
163
|
-
return c.json({
|
|
164
|
-
success: false,
|
|
165
|
-
error: 'Failed to load architecture document'
|
|
166
|
-
}, 500);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
/**
|
|
170
|
-
* PUT /api/v1/context/architecture
|
|
171
|
-
* Update architecture document
|
|
172
|
-
*/
|
|
173
|
-
app.put('/', async (c) => {
|
|
174
|
-
try {
|
|
175
|
-
const body = await c.req.json();
|
|
176
|
-
if (!body.content) {
|
|
177
|
-
return c.json({ success: false, error: 'Content is required' }, 400);
|
|
178
|
-
}
|
|
179
|
-
const architecturePath = await getArchitecturePath();
|
|
180
|
-
if (!architecturePath) {
|
|
181
|
-
return c.json({ success: false, error: 'GAIT directory not found' }, 404);
|
|
182
|
-
}
|
|
183
|
-
await fs.mkdir(architecturePath, { recursive: true });
|
|
184
|
-
const filePath = path.join(architecturePath, 'architecture.md');
|
|
185
|
-
// Read current content if it exists
|
|
186
|
-
let currentData = {};
|
|
187
|
-
try {
|
|
188
|
-
const currentContent = await fs.readFile(filePath, 'utf-8');
|
|
189
|
-
const { data } = matter(currentContent);
|
|
190
|
-
currentData = data;
|
|
191
|
-
}
|
|
192
|
-
catch {
|
|
193
|
-
// File doesn't exist, use defaults
|
|
194
|
-
}
|
|
195
|
-
// Prepare updated metadata
|
|
196
|
-
const updatedMetadata = {
|
|
197
|
-
...currentData,
|
|
198
|
-
...body.metadata,
|
|
199
|
-
updated: new Date().toISOString().split('T')[0],
|
|
200
|
-
type: 'architecture',
|
|
201
|
-
category: 'design',
|
|
202
|
-
version: currentData.version || '1.0'
|
|
203
|
-
};
|
|
204
|
-
// Create the markdown content with frontmatter
|
|
205
|
-
const fileContent = matter.stringify(body.content, updatedMetadata);
|
|
206
|
-
await fs.writeFile(filePath, fileContent, 'utf-8');
|
|
207
|
-
// Extract updated title
|
|
208
|
-
const title = body.title ||
|
|
209
|
-
body.content.match(/^#\s+(.+)$/m)?.[1] ||
|
|
210
|
-
'Architecture Overview';
|
|
211
|
-
// Log architecture update event
|
|
212
|
-
try {
|
|
213
|
-
const session = await requireAuth(c);
|
|
214
|
-
const actor = session ? `human:${session.email}` : "human:unknown";
|
|
215
|
-
const logger = getLogger();
|
|
216
|
-
logger.log({
|
|
217
|
-
kind: ContextKinds.ARCHITECTURE_UPDATE,
|
|
218
|
-
actor,
|
|
219
|
-
subject: `context:architecture.md`,
|
|
220
|
-
tags: ["context", "architecture"],
|
|
221
|
-
payload: {
|
|
222
|
-
title,
|
|
223
|
-
summary: generateSummary(body.content),
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
catch (logError) {
|
|
228
|
-
console.error('Error logging architecture update:', logError);
|
|
229
|
-
}
|
|
230
|
-
return c.json({
|
|
231
|
-
success: true,
|
|
232
|
-
document: {
|
|
233
|
-
filename: 'architecture.md',
|
|
234
|
-
title,
|
|
235
|
-
metadata: updatedMetadata,
|
|
236
|
-
content: body.content
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
console.error('Error updating architecture document:', error);
|
|
242
|
-
return c.json({ success: false, error: 'Failed to update architecture document' }, 500);
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
export default app;
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { Hono } from 'hono';
|
|
2
|
-
import { promises as fs } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import matter from 'gray-matter';
|
|
5
|
-
import { findGaitDirectory } from '../../../../../lib/gait-path.js';
|
|
6
|
-
import { getLogger, ContextKinds } from '@lovelybunch/core/logging';
|
|
7
|
-
import { requireAuth } from '../../../../../middleware/auth.js';
|
|
8
|
-
// Helper function to generate a simple summary from content
|
|
9
|
-
function generateSummary(content, maxLines = 3, maxChars = 200) {
|
|
10
|
-
// Remove markdown formatting for cleaner summary
|
|
11
|
-
const cleanContent = content
|
|
12
|
-
.replace(/^#+\s+/gm, '') // Remove headings
|
|
13
|
-
.replace(/[*_`]/g, '') // Remove bold, italic, code
|
|
14
|
-
.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') // Convert links to text
|
|
15
|
-
.trim();
|
|
16
|
-
// Get first few lines
|
|
17
|
-
const lines = cleanContent.split('\n').filter(line => line.trim().length > 0);
|
|
18
|
-
const summary = lines.slice(0, maxLines).join(' ');
|
|
19
|
-
// Truncate if too long
|
|
20
|
-
return summary.length > maxChars
|
|
21
|
-
? summary.substring(0, maxChars) + '...'
|
|
22
|
-
: summary;
|
|
23
|
-
}
|
|
24
|
-
const app = new Hono();
|
|
25
|
-
async function getProjectPath() {
|
|
26
|
-
const gaitDir = await findGaitDirectory();
|
|
27
|
-
if (!gaitDir)
|
|
28
|
-
return null;
|
|
29
|
-
return path.join(gaitDir, 'context');
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* GET /api/v1/context/project
|
|
33
|
-
* Load project overview document
|
|
34
|
-
*/
|
|
35
|
-
app.get('/', async (c) => {
|
|
36
|
-
try {
|
|
37
|
-
const projectPath = await getProjectPath();
|
|
38
|
-
if (!projectPath) {
|
|
39
|
-
return c.json({
|
|
40
|
-
success: false,
|
|
41
|
-
error: 'GAIT directory not found'
|
|
42
|
-
}, 404);
|
|
43
|
-
}
|
|
44
|
-
// Ensure directory exists
|
|
45
|
-
await fs.mkdir(projectPath, { recursive: true });
|
|
46
|
-
// Look for project.md file
|
|
47
|
-
const filePath = path.join(projectPath, 'project.md');
|
|
48
|
-
try {
|
|
49
|
-
const fileContent = await fs.readFile(filePath, 'utf-8');
|
|
50
|
-
const { data, content } = matter(fileContent);
|
|
51
|
-
// Extract title from first heading or use default
|
|
52
|
-
const title = content.match(/^#\s+(.+)$/m)?.[1] || 'Project Overview';
|
|
53
|
-
const document = {
|
|
54
|
-
filename: 'project.md',
|
|
55
|
-
metadata: {
|
|
56
|
-
...data,
|
|
57
|
-
updated: data.updated || new Date().toISOString().split('T')[0],
|
|
58
|
-
type: 'project',
|
|
59
|
-
category: 'overview',
|
|
60
|
-
tags: data.tags || []
|
|
61
|
-
},
|
|
62
|
-
content,
|
|
63
|
-
title
|
|
64
|
-
};
|
|
65
|
-
return c.json({
|
|
66
|
-
success: true,
|
|
67
|
-
document
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
catch (fileError) {
|
|
71
|
-
// If file doesn't exist, return default content
|
|
72
|
-
const defaultContent = `# Project Overview
|
|
73
|
-
|
|
74
|
-
This document provides an overview of the project, including its purpose, goals, and key information.
|
|
75
|
-
|
|
76
|
-
## Purpose
|
|
77
|
-
|
|
78
|
-
Describe the main purpose and objectives of this project.
|
|
79
|
-
|
|
80
|
-
## Key Features
|
|
81
|
-
|
|
82
|
-
- Feature 1
|
|
83
|
-
- Feature 2
|
|
84
|
-
- Feature 3
|
|
85
|
-
|
|
86
|
-
## Technology Stack
|
|
87
|
-
|
|
88
|
-
List the main technologies, frameworks, and tools used in this project.
|
|
89
|
-
|
|
90
|
-
## Getting Started
|
|
91
|
-
|
|
92
|
-
Provide instructions for setting up and running the project locally.
|
|
93
|
-
|
|
94
|
-
## Documentation
|
|
95
|
-
|
|
96
|
-
Links to additional documentation, guides, and resources.
|
|
97
|
-
`;
|
|
98
|
-
const document = {
|
|
99
|
-
filename: 'project.md',
|
|
100
|
-
metadata: {
|
|
101
|
-
version: '1.0',
|
|
102
|
-
updated: new Date().toISOString().split('T')[0],
|
|
103
|
-
type: 'project',
|
|
104
|
-
category: 'overview',
|
|
105
|
-
tags: []
|
|
106
|
-
},
|
|
107
|
-
content: defaultContent,
|
|
108
|
-
title: 'Project Overview'
|
|
109
|
-
};
|
|
110
|
-
return c.json({
|
|
111
|
-
success: true,
|
|
112
|
-
document
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
console.error('Error loading project document:', error);
|
|
118
|
-
return c.json({
|
|
119
|
-
success: false,
|
|
120
|
-
error: 'Failed to load project document'
|
|
121
|
-
}, 500);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
/**
|
|
125
|
-
* PUT /api/v1/context/project
|
|
126
|
-
* Update project overview document
|
|
127
|
-
*/
|
|
128
|
-
app.put('/', async (c) => {
|
|
129
|
-
try {
|
|
130
|
-
const body = await c.req.json();
|
|
131
|
-
if (!body.content) {
|
|
132
|
-
return c.json({ success: false, error: 'Content is required' }, 400);
|
|
133
|
-
}
|
|
134
|
-
const projectPath = await getProjectPath();
|
|
135
|
-
if (!projectPath) {
|
|
136
|
-
return c.json({ success: false, error: 'GAIT directory not found' }, 404);
|
|
137
|
-
}
|
|
138
|
-
await fs.mkdir(projectPath, { recursive: true });
|
|
139
|
-
const filePath = path.join(projectPath, 'project.md');
|
|
140
|
-
// Read current content if it exists
|
|
141
|
-
let currentData = {};
|
|
142
|
-
try {
|
|
143
|
-
const currentContent = await fs.readFile(filePath, 'utf-8');
|
|
144
|
-
const { data } = matter(currentContent);
|
|
145
|
-
currentData = data;
|
|
146
|
-
}
|
|
147
|
-
catch {
|
|
148
|
-
// File doesn't exist, use defaults
|
|
149
|
-
}
|
|
150
|
-
// Prepare updated metadata
|
|
151
|
-
const updatedMetadata = {
|
|
152
|
-
...currentData,
|
|
153
|
-
...body.metadata,
|
|
154
|
-
updated: new Date().toISOString().split('T')[0],
|
|
155
|
-
type: 'project',
|
|
156
|
-
category: 'overview',
|
|
157
|
-
version: currentData.version || '1.0'
|
|
158
|
-
};
|
|
159
|
-
// Create the markdown content with frontmatter
|
|
160
|
-
const fileContent = matter.stringify(body.content, updatedMetadata);
|
|
161
|
-
await fs.writeFile(filePath, fileContent, 'utf-8');
|
|
162
|
-
// Extract updated title
|
|
163
|
-
const title = body.title ||
|
|
164
|
-
body.content.match(/^#\s+(.+)$/m)?.[1] ||
|
|
165
|
-
'Project Overview';
|
|
166
|
-
// Log project update event
|
|
167
|
-
try {
|
|
168
|
-
const session = await requireAuth(c);
|
|
169
|
-
const actor = session ? `human:${session.email}` : "human:unknown";
|
|
170
|
-
const logger = getLogger();
|
|
171
|
-
logger.log({
|
|
172
|
-
kind: ContextKinds.PROJECT_UPDATE,
|
|
173
|
-
actor,
|
|
174
|
-
subject: `context:project.md`,
|
|
175
|
-
tags: ["context", "project"],
|
|
176
|
-
payload: {
|
|
177
|
-
title,
|
|
178
|
-
summary: generateSummary(body.content),
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
catch (logError) {
|
|
183
|
-
console.error('Error logging project update:', logError);
|
|
184
|
-
}
|
|
185
|
-
return c.json({
|
|
186
|
-
success: true,
|
|
187
|
-
document: {
|
|
188
|
-
filename: 'project.md',
|
|
189
|
-
title,
|
|
190
|
-
metadata: updatedMetadata,
|
|
191
|
-
content: body.content
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
catch (error) {
|
|
196
|
-
console.error('Error updating project document:', error);
|
|
197
|
-
return c.json({ success: false, error: 'Failed to update project document' }, 500);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
export default app;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as g,r as t,A as N,j as e,v,av as C,B as a,L as d,_ as l,M as w,au as y,aq as E}from"./index-ByTA2ZiD.js";import{C as i,a as c,b}from"./card-CL5bB4cs.js";import{c as A}from"./clipboard-B9ndUJKl.js";function D(){const{toast:r}=g(),[o,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${N}/api/v1/context/agents`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/agents.md";try{await A(s),r({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),r({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"agents-md",filename:"agents.md",name:"agents.md",path:".nut/context/agents.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading agents definition..."})]})})})}):!u||!o?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(c,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(C,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Agents Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Agents definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 mr-2"}),"Create Agents Definition"]})})]})})})}):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:"Agents"}),e.jsx("p",{className:"text-muted-foreground",children:"Agent definitions and configurations"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(d,{to:"/context/agents/edit",children:[e.jsx(l,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(b,{className:"pb-0"}),e.jsx(c,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(E,{children:o.content||"No content available"})})})]})]})}export{D as default};
|