@lovelybunch/api 1.0.76 → 1.0.77-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/terminal/terminal-manager.js +2 -1
- package/dist/routes/api/v1/events/status/route.d.ts +1 -1
- package/dist/routes/api/v1/jobs/[id]/route.d.ts +16 -16
- package/dist/routes/api/v1/jobs/[id]/run/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/[id]/runs/[runId]/route.d.ts +2 -2
- package/dist/routes/api/v1/jobs/route.d.ts +16 -16
- package/dist/routes/api/v1/jobs/status/route.d.ts +1 -1
- package/dist/routes/api/v1/mail/route.d.ts +3 -3
- package/dist/routes/api/v1/slack/route.d.ts +6 -6
- package/dist/routes/api/v1/tasks/[id]/route.d.ts +4 -4
- package/dist/routes/api/v1/tasks/[id]/steps/[stepId]/route.d.ts +2 -2
- package/dist/routes/api/v1/tasks/route.d.ts +1 -1
- package/dist/server-with-static.js +23 -17
- package/dist/server.js +1 -0
- package/package.json +24 -23
- package/static/assets/{ActivityPage-sJEQn6DK.js → ActivityPage-rASRHKYj.js} +1 -1
- package/static/assets/{AgentsContextEditPage-DU3qIXk9.js → AgentsContextEditPage-CMWD-7mS.js} +1 -1
- package/static/assets/{AgentsContextPage-tJ-LhFYb.js → AgentsContextPage-VfMmxxr6.js} +1 -1
- package/static/assets/{ApiKeysSettingsPage-Bg84BQHV.js → ApiKeysSettingsPage-DxtuyXwn.js} +1 -1
- package/static/assets/{AuthSettingsPage-Bwr7uP3z.js → AuthSettingsPage-CWTpS6BA.js} +2 -2
- package/static/assets/{CallbackPage-BFn0Np2S.js → CallbackPage-CjlTVuif.js} +1 -1
- package/static/assets/{CodePage-kp4s3wCJ.js → CodePage-DwjtGxQi.js} +1 -1
- package/static/assets/{CollapsibleSection-CNs1mvsZ.js → CollapsibleSection-LrQJlSxD.js} +1 -1
- package/static/assets/{DashboardPage-DMJSzzgD.js → DashboardPage-DnyFyDO0.js} +2 -2
- package/static/assets/{GitPage-uqene8zj.js → GitPage-o37iQMYQ.js} +1 -1
- package/static/assets/{GitSettingsPage-CLswbZsT.js → GitSettingsPage-O0fe5kxm.js} +1 -1
- package/static/assets/{IdentityPage-BDTPXEo7.js → IdentityPage-KWjruliO.js} +1 -1
- package/static/assets/{ImplementationStepsEditor-D4cvhPhz.js → ImplementationStepsEditor-h_Mxu1tF.js} +1 -1
- package/static/assets/{IntegrationsSettingsPage-o7NXZGt9.js → IntegrationsSettingsPage-DeFQd6af.js} +1 -1
- package/static/assets/{JobDetailPage-DuEiPz6X.js → JobDetailPage-HOLpF7Sx.js} +1 -1
- package/static/assets/{KnowledgeDetailPage-DFVud_VC.js → KnowledgeDetailPage-C5egPQ54.js} +1 -1
- package/static/assets/KnowledgeEditPage-DrdvEGuR.js +1 -0
- package/static/assets/{KnowledgePage-B2zI3xwW.js → KnowledgePage-CK5rtZcv.js} +1 -1
- package/static/assets/{LoginPage-CUJRxwXy.js → LoginPage-DajEouCN.js} +1 -1
- package/static/assets/MailInboxPage-CewILL7o.js +1 -0
- package/static/assets/{MailProcessingModal-BJIdHOqK.js → MailProcessingModal-B1ZLXyYl.js} +1 -1
- package/static/assets/MailReadPage--LnQ743i.js +1 -0
- package/static/assets/MailSentPage-BqO4iBq6.js +1 -0
- package/static/assets/{McpSettingsPage-BZcCGkGM.js → McpSettingsPage-BZ6GJOtk.js} +1 -1
- package/static/assets/{MemoryEditPage-DXSQoCT4.js → MemoryEditPage-BLfdKEDu.js} +1 -1
- package/static/assets/{MemoryPage-oBnyuvSf.js → MemoryPage-BV0RlvUS.js} +1 -1
- package/static/assets/{NewKnowledgePage-deMsezK8.js → NewKnowledgePage-SrBhXpH6.js} +1 -1
- package/static/assets/{NewSkillPage-DRYWdrlV.js → NewSkillPage-vt-0rIkv.js} +1 -1
- package/static/assets/{NewTaskPage-B6xdic5_.js → NewTaskPage-CBUpwIFP.js} +1 -1
- package/static/assets/{NotFoundPage-Bxu9uKFO.js → NotFoundPage-CWF5qOC0.js} +1 -1
- package/static/assets/{NotificationsSettingsPage-CLgtsCVM.js → NotificationsSettingsPage-3ZvMrqiq.js} +1 -1
- package/static/assets/{PromptsSettingsPage-BWaELCjG.js → PromptsSettingsPage-pHKoiUPI.js} +1 -1
- package/static/assets/{ResourceDetailPage-CMPDRdVM.js → ResourceDetailPage-CE4iDbv7.js} +1 -1
- package/static/assets/{ResourcesPage-DspYILfG.js → ResourcesPage-4_5NA4RF.js} +1 -1
- package/static/assets/{RoleEditPage-DXtzicVZ.js → RoleEditPage-4sSELIRX.js} +1 -1
- package/static/assets/{RolePage-DafGURGp.js → RolePage-Ds17xn4X.js} +1 -1
- package/static/assets/{RulesSettingsPage-E8V9cexV.js → RulesSettingsPage-DnyGaden.js} +1 -1
- package/static/assets/{RunDetailPage-DsxkqFst.js → RunDetailPage-D2ajvKfh.js} +1 -1
- package/static/assets/SchedulePage-oEGct1B1.js +4 -0
- package/static/assets/{SkillDetailPage-CWkqSfuT.js → SkillDetailPage-mSypV_JK.js} +1 -1
- package/static/assets/{SkillEditPage-DwyebzFV.js → SkillEditPage-DeI8uu3S.js} +1 -1
- package/static/assets/{SkillsPage-CauK65X_.js → SkillsPage-Bb_dEdun.js} +1 -1
- package/static/assets/{SkillsSettingsPage-DXMRv3jR.js → SkillsSettingsPage-CMWf2O9y.js} +1 -1
- package/static/assets/SourceInput-CtyUOXOG.js +1 -0
- package/static/assets/{TagInput-Ct-WRvTs.js → TagInput-C0NyMxlY.js} +1 -1
- package/static/assets/{TaskDetailPage-CApk2iBh.js → TaskDetailPage-6DDI0juh.js} +1 -1
- package/static/assets/{TaskEditPage-NgOVShfK.js → TaskEditPage-Btc1NXtR.js} +1 -1
- package/static/assets/{TasksPage-BoPrP_Rl.js → TasksPage-C9TYvqRz.js} +1 -1
- package/static/assets/{TeamEditPage-ChY6mYm8.js → TeamEditPage-CLvNy6Ss.js} +1 -1
- package/static/assets/{TeamPage-DH-dJhFG.js → TeamPage-DSWax4fa.js} +1 -1
- package/static/assets/{TerminalPage-CRhcscF2.js → TerminalPage-DNDHEYJZ.js} +1 -1
- package/static/assets/{TerminalSessionPage-CSCQg2sn.js → TerminalSessionPage-nNCw_oDE.js} +1 -1
- package/static/assets/{UserPreferencesPage-DxCSWJnS.js → UserPreferencesPage-jc1SA79x.js} +1 -1
- package/static/assets/{UserSettingsPage-DKkOLNPV.js → UserSettingsPage-pr6n15Pz.js} +1 -1
- package/static/assets/{UtilitiesPage-CBNSvixW.js → UtilitiesPage-CjLb989o.js} +1 -1
- package/static/assets/{alert-Dw_RSroN.js → alert-BtkLXQ3p.js} +1 -1
- package/static/assets/{arrow-down-UClxXzT-.js → arrow-down-DnNLmXEs.js} +1 -1
- package/static/assets/{arrow-left-DWmf9YJp.js → arrow-left-B9NBHEkS.js} +1 -1
- package/static/assets/{arrow-up-down-Btc3okb3.js → arrow-up-down-DIuMvAne.js} +1 -1
- package/static/assets/{arrow-up-fLCh7Hvh.js → arrow-up-eMUJY7J9.js} +1 -1
- package/static/assets/{badge-vIqE5SOP.js → badge-BbfU_aPt.js} +1 -1
- package/static/assets/{browser-modal-DgMJTsMd.js → browser-modal-J9l3o5os.js} +1 -1
- package/static/assets/{card-DPLdBoa5.js → card-CL5bB4cs.js} +1 -1
- package/static/assets/{chevron-left-CiNaLX-v.js → chevron-left-B-7K6MNx.js} +1 -1
- package/static/assets/{chevron-up-DFd-7wxW.js → chevron-up-BwTmMEW2.js} +1 -1
- package/static/assets/{chevrons-up-BfU70OcQ.js → chevrons-up-jI6nxhrz.js} +1 -1
- package/static/assets/{circle-alert-Mv00T-P2.js → circle-alert-vJFSz39V.js} +1 -1
- package/static/assets/{circle-check-xMiP6SLO.js → circle-check-D2LVHMl-.js} +1 -1
- package/static/assets/{circle-check-big-BEY1IoIP.js → circle-check-big-BwQ_q1N7.js} +1 -1
- package/static/assets/{circle-play-iZZwaGbV.js → circle-play-CLKDBkrK.js} +1 -1
- package/static/assets/{circle-x-z3iynaE7.js → circle-x-CuUVLiI-.js} +1 -1
- package/static/assets/{clipboard-C8wZRPDH.js → clipboard-BHOFelnW.js} +1 -1
- package/static/assets/{clock-C_9shc08.js → clock-D-X3KCw6.js} +1 -1
- package/static/assets/{code-DH-sRhus.js → code-DqYaanki.js} +1 -1
- package/static/assets/{download-CE8b59ER.js → download-DeEju9jg.js} +1 -1
- package/static/assets/{external-link-DPyKt8NE.js → external-link-CrRz0sU-.js} +1 -1
- package/static/assets/{eye-BpGD-yoS.js → eye-Cx9ZGkg5.js} +1 -1
- package/static/assets/{folder-git-2-BIw4zbmy.js → folder-git-2-Cizv1NA6.js} +1 -1
- package/static/assets/{globe-CUo7eHKN.js → globe-lpD9Jv31.js} +1 -1
- package/static/assets/{index-jaRIZ6SY.js → index-BCYTbJRb.js} +1 -1
- package/static/assets/{index-CTouvf2d.js → index-BL-5Bhtg.js} +1 -1
- package/static/assets/{index-BaR4iUzg.js → index-BPdWQ0rI.js} +1 -1
- package/static/assets/{index-B07hel4U.js → index-BVrOTqTm.js} +1 -1
- package/static/assets/{index-iB8oed57.js → index-BknCCMZK.js} +1 -1
- package/static/assets/{index-CpJ0uBf3.js → index-BvZJRqTz.js} +1 -1
- package/static/assets/{index-UXL5-kaP.js → index-ByTA2ZiD.js} +6 -6
- package/static/assets/{index-ClO9-JVh.js → index-CMaK0hpv.js} +1 -1
- package/static/assets/{index-Bkt1rQVV.js → index-CkT4WgqR.js} +1 -1
- package/static/assets/{index-DnZKG-_7.js → index-CuLP7P_G.js} +1 -1
- package/static/assets/{index-CsBxEWw5.js → index-D12O6wM3.js} +1 -1
- package/static/assets/{index-DZAYfTI2.js → index-DIt703WU.js} +1 -1
- package/static/assets/{index-CGbmjmEy.js → index-DK1gGyTZ.js} +1 -1
- package/static/assets/index-DVMcu9sQ.css +1 -0
- package/static/assets/{index-Bfb3OTwj.js → index-Dc9Njo8L.js} +1 -1
- package/static/assets/{index-BCwmQxLC.js → index-DgAcL75U.js} +1 -1
- package/static/assets/{index-C65b3D5_.js → index-Djzp98Vj.js} +1 -1
- package/static/assets/{index-BOKaM9K-.js → index-Dnj5cWsp.js} +1 -1
- package/static/assets/{index-Dkr9CBL7.js → index-Hy3cH93B.js} +1 -1
- package/static/assets/{index-Cdwx6Zps.js → index-ihWq-CVE.js} +1 -1
- package/static/assets/{info-D-UNBNx2.js → info-DxhTCbw1.js} +1 -1
- package/static/assets/{label-8VKluf9w.js → label-Dp0-28_O.js} +1 -1
- package/static/assets/{markdown-editor-DBdRsbP2.js → markdown-editor-DUmrf1eN.js} +3 -3
- package/static/assets/{message-square-CO8kDUed.js → message-square-BPOApeM3.js} +1 -1
- package/static/assets/{paperclip-DlLXZbru.js → paperclip-Bfjc1WLZ.js} +1 -1
- package/static/assets/{pause-zSiaxJBu.js → pause-Bfz-QQZp.js} +1 -1
- package/static/assets/{pipeline-builders-Bkf0wt_O.js → pipeline-builders-DrEjlsbH.js} +1 -1
- package/static/assets/{play-DVBhRokt.js → play-fOwEoIcu.js} +1 -1
- package/static/assets/{radio-group-CThYUcA4.js → radio-group-B8RB7N01.js} +1 -1
- package/static/assets/{refresh-cw-tXYl1ePu.js → refresh-cw-Cj_5MZiJ.js} +1 -1
- package/static/assets/{search-BxF7Wwex.js → search-BgbqRUnf.js} +1 -1
- package/static/assets/{select-CyHFRA1Y.js → select-CfwLZl55.js} +1 -1
- package/static/assets/{server-lRxThHjr.js → server-u9FLHclt.js} +1 -1
- package/static/assets/{switch-BUpDbrux.js → switch-CX_Inx_p.js} +1 -1
- package/static/assets/{tabs-DkvCmQEX.js → tabs-Bj0YyeRI.js} +1 -1
- package/static/assets/{tag-CkcZNLnh.js → tag-rYG4CdRx.js} +1 -1
- package/static/assets/terminal-preview-BNm5-Umi.js +1 -0
- package/static/assets/{triangle-alert-CmjG_mbF.js → triangle-alert-C0ovMJwZ.js} +1 -1
- package/static/assets/{use-terminal-D3iV7-iC.js → use-terminal-D1UnvAVs.js} +1 -1
- package/static/assets/{video-CY_dOujm.js → video-CuyRES-H.js} +1 -1
- package/static/index.html +2 -2
- package/static/assets/KnowledgeEditPage-XG6HKK7E.js +0 -1
- package/static/assets/MailInboxPage-BlCG-tba.js +0 -1
- package/static/assets/MailReadPage-MoNo_gmW.js +0 -1
- package/static/assets/MailSentPage-QzpuIJmT.js +0 -1
- package/static/assets/SchedulePage-B2YvNDHr.js +0 -4
- package/static/assets/SourceInput-C0iKqbQ1.js +0 -1
- package/static/assets/index-BcCuKdbf.css +0 -1
- package/static/assets/terminal-preview-CLWDhoOZ.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as z,r as t,bD as y,j as e,B as a,P as R,bE as X,H as J,D as j,b as g,d as v,f,g as A,I as F,Y as N,ae as W,w as i}from"./index-
|
|
1
|
+
import{t as z,r as t,bD as y,j as e,B as a,P as R,bE as X,H as J,D as j,b as g,d as v,f,g as A,I as F,Y as N,ae as W,w as i}from"./index-ByTA2ZiD.js";import{C as G,b as Q,c as V,d as Z,a as _}from"./card-CL5bB4cs.js";import{L as w}from"./label-Dp0-28_O.js";import{B as ee}from"./badge-BbfU_aPt.js";import{A as I,a as C}from"./alert-BtkLXQ3p.js";import{I as L}from"./info-DxhTCbw1.js";import{C as se}from"./circle-alert-vJFSz39V.js";function oe(){const{authEnabled:n}=z(),[P,k]=t.useState([]),[b,K]=t.useState(!0),[O,l]=t.useState(!1),[M,d]=t.useState(!1),[x,D]=t.useState(""),[h,E]=t.useState("never"),[c,S]=t.useState(null),[m,o]=t.useState(null);t.useEffect(()=>{p()},[]);const p=async()=>{K(!0);try{const s=await y("/api/v1/api-keys");s.success&&k(s.data?.apiKeys||[])}catch(s){console.error("Failed to load API keys:",s),k([])}finally{K(!1)}},U=async()=>{if(!x.trim()){i({title:"Error",description:"Please provide a name for the API key",variant:"destructive"});return}try{const s={name:x,scopes:["*"]};h!=="never"&&(s.expiresIn=h);const r=await y("/api/v1/api-keys",{method:"POST",body:JSON.stringify(s)});r.success&&(S(r.data),l(!1),d(!0),D(""),E("never"),await p(),i({title:"API Key Created",description:"Make sure to copy your API key now. You won't be able to see it again!"}))}catch(s){console.error("Failed to create API key:",s),i({title:"Error",description:"Failed to create API key",variant:"destructive"})}},B=async s=>{try{(await y(`/api/v1/api-keys/${s}`,{method:"DELETE"})).success&&(await p(),o(null),i({title:"API Key Deleted",description:"The API key has been permanently deleted"}))}catch(r){console.error("Failed to delete API key:",r),i({title:"Error",description:"Failed to delete API key",variant:"destructive"})}},H=async s=>{try{await navigator.clipboard.writeText(s),i({title:"Copied",description:"API key copied to clipboard"})}catch{i({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},u=s=>new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Y=s=>s?new Date(s)<new Date:!1,$=typeof window<"u"?window.location.origin:"http://localhost:3000",q=c?`curl -H "X-API-Key: ${c.key}" \\
|
|
2
2
|
+ ${$}/api/v1/tasks`:"",T=n?null:e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["Authentication is currently disabled. API keys will only be required once you enable authentication in the ",e.jsx("a",{href:"/settings/authentication",className:"underline",children:"Authentication settings"}),"."]})]});return!n&&b?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access"})]}),T]}):b?e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"API Keys"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage API keys for programmatic access to your Coconut instance"})]}),T,n&&e.jsxs(I,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsxs(C,{children:["API keys provide programmatic access to your Coconut instance. Use them in CI/CD pipelines or automation scripts by including the key in the ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"X-API-Key"})," header."]})]}),e.jsxs(G,{children:[e.jsx(Q,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(V,{children:"Active API Keys"}),e.jsx(Z,{children:"API keys you've created for programmatic access"})]}),e.jsxs(a,{onClick:()=>l(!0),disabled:!n,children:[e.jsx(R,{className:"mr-2 h-4 w-4"}),"Create API Key"]})]})}),e.jsx(_,{children:P.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(X,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),e.jsx("p",{children:"No API keys yet"}),e.jsx("p",{className:"text-sm",children:"Create an API key to get started with programmatic access"})]}):e.jsx("div",{className:"space-y-4",children:P.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"font-medium",children:s.name}),Y(s.expiresAt)&&e.jsx(ee,{variant:"destructive",children:"Expired"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:s.keyPreview}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Created: ",u(s.createdAt)]}),s.expiresAt&&e.jsxs("span",{children:["Expires: ",u(s.expiresAt)]}),s.lastUsedAt&&e.jsxs("span",{children:["Last used: ",u(s.lastUsedAt)]})]})]}),e.jsx(a,{variant:"ghost",size:"icon",onClick:()=>o(s.id),children:e.jsx(J,{className:"h-4 w-4 text-destructive"})})]},s.id))})})]}),e.jsx(j,{open:O,onOpenChange:l,children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Create API Key"}),e.jsx(A,{children:"Create a new API key for programmatic access. The key will only be shown once."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyName",children:"Name"}),e.jsx(F,{id:"keyName",placeholder:"CI/CD Pipeline",value:x,onChange:s=>D(s.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A descriptive name to identify this API key"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"keyExpiry",children:"Expiration"}),e.jsxs("select",{id:"keyExpiry",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:h,onChange:s=>E(s.target.value),children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"30d",children:"30 days"}),e.jsx("option",{value:"90d",children:"90 days"}),e.jsx("option",{value:"1y",children:"1 year"})]})]})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(a,{onClick:U,disabled:!n,children:"Create API Key"})]})]})}),e.jsx(j,{open:M,onOpenChange:d,children:e.jsxs(g,{className:"sm:max-w-[600px]",children:[e.jsxs(v,{children:[e.jsx(f,{children:"API Key Created"}),e.jsx(A,{children:"Make sure to copy your API key now. You won't be able to see it again!"})]}),e.jsxs(I,{variant:"destructive",className:"my-4",children:[e.jsx(se,{className:"h-4 w-4"}),e.jsx(C,{children:"This is the only time you will see this key. Store it securely."})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{children:"API Key"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{readOnly:!0,value:c.key,className:"font-mono text-sm"}),e.jsx(a,{variant:"outline",size:"icon",onClick:()=>H(c.key),children:e.jsx(W,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"mb-2",children:"Usage example:"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md whitespace-pre-wrap break-words",children:e.jsx("code",{className:"font-mono text-xs",children:q})})]})]}),e.jsx(N,{children:e.jsx(a,{onClick:()=>{d(!1),S(null)},children:"I've Saved My Key"})})]})}),e.jsx(j,{open:!!m,onOpenChange:s=>!s&&o(null),children:e.jsxs(g,{children:[e.jsxs(v,{children:[e.jsx(f,{children:"Delete API Key"}),e.jsx(A,{children:"Are you sure you want to delete this API key? This action cannot be undone and any scripts using this key will stop working."})]}),e.jsxs(N,{children:[e.jsx(a,{variant:"outline",onClick:()=>o(null),children:"Cancel"}),e.jsx(a,{variant:"destructive",onClick:()=>m&&B(m),children:"Delete API Key"})]})]})})]})}export{oe as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Y,t as le,r as n,bD as
|
|
1
|
+
import{c as Y,t as le,r as n,bD as l,j as e,bx as O,i as ce,D as I,W as M,B as c,b as V,d as $,f as H,g as J,I as j,Y as z,z as oe,E as de,H as he,J as ue,N as xe,O as me,Q as ge,R as je,U as pe,V as ve,w as r}from"./index-ByTA2ZiD.js";import{C as p,b as v,c as w,d as f,a as y}from"./card-CL5bB4cs.js";import{L as o}from"./label-Dp0-28_O.js";import{S as _,a as W,b as q,c as B,d as a}from"./select-CfwLZl55.js";import{S as E}from"./switch-CX_Inx_p.js";import{B as U}from"./badge-BbfU_aPt.js";import{C as we}from"./circle-alert-vJFSz39V.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{c as Y,t as le,r as n,bD as c,j as e,bx as O,i as ce,D as I,W as M,B as l
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Ne=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Se=Y("user-plus",Ne);function Re(){const{user:N,authEnabled:K,checkAuthStatus:Q}=le(),[i,d]=n.useState(null),[G,F]=n.useState(!0),[S,D]=n.useState(!1),[X,C]=n.useState(!1),[b,P]=n.useState(""),[A,R]=n.useState(""),[T,L]=n.useState("viewer"),[E,u]=n.useState(null),[x,m]=n.useState(""),Z=!K||N?.role==="admin";n.useEffect(()=>{h()},[]);const h=async()=>{try{F(!0);const s=await c("/api/v1/auth-settings");s.success?d(s.data):d(null)}catch(s){console.error("Failed to load auth settings:",s),d(null)}finally{F(!1)}},ee=async()=>{if(!i)return;const s=!i.enabled;try{const t=await c("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({enabled:s})});if(t.success)d({...i,enabled:s}),await Q(),r({title:"Success",description:`Authentication ${s?"enabled":"disabled"}`});else throw new Error(t.error||"Failed to toggle auth")}catch(t){r({title:"Error",description:t.message||"Failed to toggle authentication",variant:"destructive"})}},se=async()=>{if(!i)return;const s=!i.allowRegistration;try{const t=await c("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({allowRegistration:s})});if(t.success)d({...i,allowRegistration:s}),r({title:"Success",description:`Self-registration ${s?"enabled":"disabled"}`});else throw new Error(t.error||"Failed to update setting")}catch(t){r({title:"Error",description:t.message||"Failed to update setting",variant:"destructive"})}},te=async()=>{if(!b||!A){r({title:"Error",description:"Please provide email and name",variant:"destructive"});return}try{const s=await c("/api/v1/auth-settings/users",{method:"POST",body:JSON.stringify({email:b,name:A,role:T})});if(s.success)await h(),C(!1),P(""),R(""),L("viewer"),r({title:"Success",description:"User added to whitelist"});else throw new Error(s.error||"Failed to add user")}catch(s){r({title:"Error",description:s.message||"Failed to add user",variant:"destructive"})}},ie=async s=>{try{const t=await c(`/api/v1/auth-settings/users/${s}`,{method:"DELETE"});if(t.success)await h(),r({title:"Success",description:"User removed from whitelist"});else throw new Error(t.error||"Failed to remove user")}catch(t){r({title:"Error",description:t.message||"Failed to remove user",variant:"destructive"})}},re=async(s,t)=>{try{const g=await c(`/api/v1/auth-settings/users/${s}`,{method:"PUT",body:JSON.stringify({role:t})});if(g.success)await h(),r({title:"Success",description:"User role updated"});else throw new Error(g.error||"Failed to update role")}catch(g){r({title:"Error",description:g.message||"Failed to update role",variant:"destructive"})}},ae=async()=>{if(!(!E||!x)){if(x.length<8){r({title:"Error",description:"Password must be at least 8 characters",variant:"destructive"});return}try{const s=await c(`/api/v1/auth-settings/users/${E}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:x})});if(s.success)u(null),m(""),r({title:"Success",description:"Password reset successfully"});else throw new Error(s.error||"Failed to reset password")}catch(s){r({title:"Error",description:s.message||"Failed to reset password",variant:"destructive"})}}},ne=async()=>{if(i)try{D(!0);const s=await c("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({session:i.session})});if(s.success)r({title:"Success",description:"Session settings updated"});else throw new Error(s.error||"Failed to update settings")}catch(s){r({title:"Error",description:s.message||"Failed to update settings",variant:"destructive"})}finally{D(!1)}};return G?e.jsx("div",{children:"Loading..."}):i?Z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage authentication settings and user access."})]}),e.jsx(O,{}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),e.jsx(w,{children:"Authentication Status"})]}),e.jsx(f,{children:"Control whether authentication is required to access Coconut."})]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"auth-enabled",children:"Require Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"When enabled, users must log in to access Coconut"})]}),e.jsx(U,{id:"auth-enabled",checked:i.enabled,onCheckedChange:ee})]}),i.enabled&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"allow-registration",children:"Allow Self-Registration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Whitelisted users can create their own accounts"})]}),e.jsx(U,{id:"allow-registration",checked:i.allowRegistration,onCheckedChange:se})]})]})]}),e.jsxs(p,{children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(w,{children:"Whitelisted Users"}),e.jsx(f,{children:"Manage users who can access this Coconut instance."})]}),e.jsxs(I,{open:X,onOpenChange:C,children:[e.jsx(M,{asChild:!0,children:e.jsxs(l,{size:"sm",children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Add User"]})}),e.jsxs(V,{children:[e.jsxs($,{children:[e.jsx(H,{children:"Add User to Whitelist"}),e.jsx(J,{children:"Add a user's email to allow them to register and access Coconut."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-email",children:"Email"}),e.jsx(j,{id:"new-email",type:"email",value:b,onChange:s=>P(s.target.value),placeholder:"user@example.com"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-name",children:"Name"}),e.jsx(j,{id:"new-name",value:A,onChange:s=>R(s.target.value),placeholder:"User Name"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-role",children:"Role"}),e.jsxs(_,{value:T,onValueChange:s=>L(s),children:[e.jsx(W,{children:e.jsx(q,{})}),e.jsxs(B,{children:[e.jsx(a,{value:"viewer",children:"Viewer"}),e.jsx(a,{value:"engineer",children:"Engineer"}),e.jsx(a,{value:"designer",children:"Designer"}),e.jsx(a,{value:"product_manager",children:"Product Manager"}),e.jsx(a,{value:"manager",children:"Manager"}),e.jsx(a,{value:"admin",children:"Admin"})]})]})]})]}),e.jsxs(z,{children:[e.jsx(l,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),e.jsx(l,{onClick:te,children:"Add User"})]})]})]})]})}),e.jsx(y,{children:e.jsx("div",{className:"space-y-4",children:i.providers.local.users.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium",children:s.name}),s.registered?e.jsx(k,{variant:"default",className:"text-xs",children:"Registered"}):e.jsx(k,{variant:"secondary",className:"text-xs",children:"Pending"}),s.id===N?.id&&e.jsx(k,{variant:"outline",className:"text-xs",children:"You"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.email}),s.lastLoginAt&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last login: ",new Date(s.lastLoginAt).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{value:s.role,onValueChange:t=>re(s.id,t),children:[e.jsx(W,{className:"w-40",children:e.jsx(q,{})}),e.jsxs(B,{children:[e.jsx(a,{value:"viewer",children:"Viewer"}),e.jsx(a,{value:"engineer",children:"Engineer"}),e.jsx(a,{value:"designer",children:"Designer"}),e.jsx(a,{value:"product_manager",children:"Product Manager"}),e.jsx(a,{value:"manager",children:"Manager"}),e.jsx(a,{value:"admin",children:"Admin"})]})]}),e.jsxs(I,{open:E===s.id,onOpenChange:t=>{t||(u(null),m(""))},children:[e.jsx(M,{asChild:!0,children:e.jsx(l,{size:"sm",variant:"outline",onClick:()=>u(s.id),children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(V,{children:[e.jsxs($,{children:[e.jsx(H,{children:"Reset Password"}),e.jsxs(J,{children:["Set a new password for ",s.name]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{children:[e.jsx(o,{htmlFor:"reset-password",children:"New Password"}),e.jsx(j,{id:"reset-password",type:"password",value:x,onChange:t=>m(t.target.value),placeholder:"At least 8 characters",minLength:8})]})}),e.jsxs(z,{children:[e.jsx(l,{variant:"outline",onClick:()=>{u(null),m("")},children:"Cancel"}),e.jsx(l,{onClick:ae,children:"Reset Password"})]})]})]}),s.id!==N?.id&&e.jsxs(oe,{children:[e.jsx(de,{asChild:!0,children:e.jsx(l,{size:"sm",variant:"destructive",children:e.jsx(he,{className:"h-4 w-4"})})}),e.jsxs(ue,{children:[e.jsxs(xe,{children:[e.jsx(me,{children:"Remove User"}),e.jsxs(ge,{children:["Are you sure you want to remove ",s.name," from the whitelist? They will no longer be able to access Coconut."]})]}),e.jsxs(je,{children:[e.jsx(pe,{children:"Cancel"}),e.jsx(ve,{onClick:()=>ie(s.id),children:"Remove"})]})]})]})]})]},s.id))})})]}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsx(w,{children:"Session Settings"}),e.jsx(f,{children:"Configure session behavior and security."})]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"session-expiry",children:"Session Expiry"}),e.jsx(j,{id:"session-expiry",value:i.session.expiresIn,onChange:s=>d({...i,session:{...i.session,expiresIn:s.target.value}}),placeholder:"7d"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Format: 30s, 15m, 24h, 7d"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"secure-cookies",children:"Secure Cookies (HTTPS only)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable in production with HTTPS"})]}),e.jsx(U,{id:"secure-cookies",checked:i.session.secure||!1,onCheckedChange:s=>d({...i,session:{...i.session,secure:s}})})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(l,{variant:"outline",onClick:h,disabled:S,children:"Cancel"}),e.jsx(l,{onClick:ne,disabled:S,children:S?"Saving...":"Save Session Settings"})]})]}):e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have permission to manage authentication settings."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Secure your Coconut instance with authentication."})]}),e.jsx(O,{}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{className:"h-5 w-5 text-muted-foreground"}),e.jsx(w,{children:"Authentication Not Configured"})]}),e.jsx(f,{children:"Authentication has not been initialized. Use the CLI to set up authentication."})]}),e.jsxs(y,{children:[e.jsx("div",{className:"bg-muted p-4 rounded-md",children:e.jsxs("code",{className:"text-sm",children:["$ nut auth init",e.jsx("br",{}),"$ nut auth toggle"]})}),e.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"This will create an admin user and enable authentication for your Coconut instance."})]})]})]})}export{Re as default};
|
|
11
|
+
*/const Ne=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Se=Y("user-plus",Ne);function Re(){const{user:N,authEnabled:K,checkAuthStatus:Q}=le(),[i,d]=n.useState(null),[G,k]=n.useState(!0),[F,D]=n.useState(!1),[X,S]=n.useState(!1),[C,P]=n.useState(""),[b,R]=n.useState(""),[T,L]=n.useState("viewer"),[A,h]=n.useState(null),[u,x]=n.useState(""),Z=!K||N?.role==="admin";n.useEffect(()=>{m()},[]);const m=async()=>{try{k(!0);const s=await l("/api/v1/auth-settings");s.success?d(s.data):d(null)}catch(s){console.error("Failed to load auth settings:",s),d(null)}finally{k(!1)}},ee=async()=>{if(!i)return;const s=!i.enabled;try{const t=await l("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({enabled:s})});if(t.success)d({...i,enabled:s}),await Q(),r({title:"Success",description:`Authentication ${s?"enabled":"disabled"}`});else throw new Error(t.error||"Failed to toggle auth")}catch(t){r({title:"Error",description:t.message||"Failed to toggle authentication",variant:"destructive"})}},se=async()=>{if(!i)return;const s=!i.allowRegistration;try{const t=await l("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({allowRegistration:s})});if(t.success)d({...i,allowRegistration:s}),r({title:"Success",description:`Self-registration ${s?"enabled":"disabled"}`});else throw new Error(t.error||"Failed to update setting")}catch(t){r({title:"Error",description:t.message||"Failed to update setting",variant:"destructive"})}},te=async()=>{if(!C||!b){r({title:"Error",description:"Please provide email and name",variant:"destructive"});return}try{const s=await l("/api/v1/auth-settings/users",{method:"POST",body:JSON.stringify({email:C,name:b,role:T})});if(s.success)await m(),S(!1),P(""),R(""),L("viewer"),r({title:"Success",description:"User added to whitelist"});else throw new Error(s.error||"Failed to add user")}catch(s){r({title:"Error",description:s.message||"Failed to add user",variant:"destructive"})}},ie=async s=>{try{const t=await l(`/api/v1/auth-settings/users/${s}`,{method:"DELETE"});if(t.success)await m(),r({title:"Success",description:"User removed from whitelist"});else throw new Error(t.error||"Failed to remove user")}catch(t){r({title:"Error",description:t.message||"Failed to remove user",variant:"destructive"})}},re=async(s,t)=>{try{const g=await l(`/api/v1/auth-settings/users/${s}`,{method:"PUT",body:JSON.stringify({role:t})});if(g.success)await m(),r({title:"Success",description:"User role updated"});else throw new Error(g.error||"Failed to update role")}catch(g){r({title:"Error",description:g.message||"Failed to update role",variant:"destructive"})}},ae=async()=>{if(!(!A||!u)){if(u.length<8){r({title:"Error",description:"Password must be at least 8 characters",variant:"destructive"});return}try{const s=await l(`/api/v1/auth-settings/users/${A}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:u})});if(s.success)h(null),x(""),r({title:"Success",description:"Password reset successfully"});else throw new Error(s.error||"Failed to reset password")}catch(s){r({title:"Error",description:s.message||"Failed to reset password",variant:"destructive"})}}},ne=async()=>{if(i)try{D(!0);const s=await l("/api/v1/auth-settings",{method:"PUT",body:JSON.stringify({session:i.session})});if(s.success)r({title:"Success",description:"Session settings updated"});else throw new Error(s.error||"Failed to update settings")}catch(s){r({title:"Error",description:s.message||"Failed to update settings",variant:"destructive"})}finally{D(!1)}};return G?e.jsx("div",{children:"Loading..."}):i?Z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage authentication settings and user access."})]}),e.jsx(O,{}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),e.jsx(w,{children:"Authentication Status"})]}),e.jsx(f,{children:"Control whether authentication is required to access Coconut."})]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"auth-enabled",children:"Require Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"When enabled, users must log in to access Coconut"})]}),e.jsx(E,{id:"auth-enabled",checked:i.enabled,onCheckedChange:ee})]}),i.enabled&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"allow-registration",children:"Allow Self-Registration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Whitelisted users can create their own accounts"})]}),e.jsx(E,{id:"allow-registration",checked:i.allowRegistration,onCheckedChange:se})]})]})]}),e.jsxs(p,{children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(w,{children:"Whitelisted Users"}),e.jsx(f,{children:"Manage users who can access this Coconut instance."})]}),e.jsxs(I,{open:X,onOpenChange:S,children:[e.jsx(M,{asChild:!0,children:e.jsxs(c,{size:"sm",children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Add User"]})}),e.jsxs(V,{children:[e.jsxs($,{children:[e.jsx(H,{children:"Add User to Whitelist"}),e.jsx(J,{children:"Add a user's email to allow them to register and access Coconut."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-email",children:"Email"}),e.jsx(j,{id:"new-email",type:"email",value:C,onChange:s=>P(s.target.value),placeholder:"user@example.com"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-name",children:"Name"}),e.jsx(j,{id:"new-name",value:b,onChange:s=>R(s.target.value),placeholder:"User Name"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"new-role",children:"Role"}),e.jsxs(_,{value:T,onValueChange:s=>L(s),children:[e.jsx(W,{children:e.jsx(q,{})}),e.jsxs(B,{children:[e.jsx(a,{value:"viewer",children:"Viewer"}),e.jsx(a,{value:"engineer",children:"Engineer"}),e.jsx(a,{value:"designer",children:"Designer"}),e.jsx(a,{value:"product_manager",children:"Product Manager"}),e.jsx(a,{value:"manager",children:"Manager"}),e.jsx(a,{value:"admin",children:"Admin"})]})]})]})]}),e.jsxs(z,{children:[e.jsx(c,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),e.jsx(c,{onClick:te,children:"Add User"})]})]})]})]})}),e.jsx(y,{children:e.jsx("div",{className:"space-y-4",children:i.providers.local.users.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium",children:s.name}),s.registered?e.jsx(U,{variant:"default",className:"text-xs",children:"Registered"}):e.jsx(U,{variant:"secondary",className:"text-xs",children:"Pending"}),s.id===N?.id&&e.jsx(U,{variant:"outline",className:"text-xs",children:"You"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.email}),s.lastLoginAt&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last login: ",new Date(s.lastLoginAt).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{value:s.role,onValueChange:t=>re(s.id,t),children:[e.jsx(W,{className:"w-40",children:e.jsx(q,{})}),e.jsxs(B,{children:[e.jsx(a,{value:"viewer",children:"Viewer"}),e.jsx(a,{value:"engineer",children:"Engineer"}),e.jsx(a,{value:"designer",children:"Designer"}),e.jsx(a,{value:"product_manager",children:"Product Manager"}),e.jsx(a,{value:"manager",children:"Manager"}),e.jsx(a,{value:"admin",children:"Admin"})]})]}),e.jsxs(I,{open:A===s.id,onOpenChange:t=>{t||(h(null),x(""))},children:[e.jsx(M,{asChild:!0,children:e.jsx(c,{size:"sm",variant:"outline",onClick:()=>h(s.id),children:e.jsx(ye,{className:"h-4 w-4"})})}),e.jsxs(V,{children:[e.jsxs($,{children:[e.jsx(H,{children:"Reset Password"}),e.jsxs(J,{children:["Set a new password for ",s.name]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{children:[e.jsx(o,{htmlFor:"reset-password",children:"New Password"}),e.jsx(j,{id:"reset-password",type:"password",value:u,onChange:t=>x(t.target.value),placeholder:"At least 8 characters",minLength:8})]})}),e.jsxs(z,{children:[e.jsx(c,{variant:"outline",onClick:()=>{h(null),x("")},children:"Cancel"}),e.jsx(c,{onClick:ae,children:"Reset Password"})]})]})]}),s.id!==N?.id&&e.jsxs(oe,{children:[e.jsx(de,{asChild:!0,children:e.jsx(c,{size:"sm",variant:"destructive",children:e.jsx(he,{className:"h-4 w-4"})})}),e.jsxs(ue,{children:[e.jsxs(xe,{children:[e.jsx(me,{children:"Remove User"}),e.jsxs(ge,{children:["Are you sure you want to remove ",s.name," from the whitelist? They will no longer be able to access Coconut."]})]}),e.jsxs(je,{children:[e.jsx(pe,{children:"Cancel"}),e.jsx(ve,{onClick:()=>ie(s.id),children:"Remove"})]})]})]})]})]},s.id))})})]}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsx(w,{children:"Session Settings"}),e.jsx(f,{children:"Configure session behavior and security."})]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"session-expiry",children:"Session Expiry"}),e.jsx(j,{id:"session-expiry",value:i.session.expiresIn,onChange:s=>d({...i,session:{...i.session,expiresIn:s.target.value}}),placeholder:"7d"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Format: 30s, 15m, 24h, 7d"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"secure-cookies",children:"Secure Cookies (HTTPS only)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable in production with HTTPS"})]}),e.jsx(E,{id:"secure-cookies",checked:i.session.secure||!1,onCheckedChange:s=>d({...i,session:{...i.session,secure:s}})})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(c,{onClick:ne,disabled:F,children:F?"Saving...":"Save Session Settings"})})]}):e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have permission to manage authentication settings."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Secure your Coconut instance with authentication."})]}),e.jsx(O,{}),e.jsxs(p,{children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{className:"h-5 w-5 text-muted-foreground"}),e.jsx(w,{children:"Authentication Not Configured"})]}),e.jsx(f,{children:"Authentication has not been initialized. Use the CLI to set up authentication."})]}),e.jsxs(y,{children:[e.jsx("div",{className:"bg-muted p-4 rounded-md",children:e.jsxs("code",{className:"text-sm",children:["$ nut auth init",e.jsx("br",{}),"$ nut auth toggle"]})}),e.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"This will create an admin user and enable authentication for your Coconut instance."})]})]})]})}export{Re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,j as e,v as x,A as f}from"./index-
|
|
1
|
+
import{r as m,j as e,v as x,A as f}from"./index-ByTA2ZiD.js";import{C as w}from"./circle-check-D2LVHMl-.js";import{C as b}from"./circle-x-CuUVLiI-.js";const r="coconut/github-auth-state";function j(s){try{window.opener&&window.opener.postMessage({type:"github-auth",...s},window.location.origin)}catch{}}const y=()=>{const[s,d]=m.useState("pending"),[h,p]=m.useState("Authorizing GitHub…");return m.useEffect(()=>{const a=new URLSearchParams(window.location.search),u=a.get("error"),l=a.get("token"),n=a.get("expires_at")||a.get("expiresAt"),c=a.get("state"),o=t=>{j(t),d(t.success?"success":"error"),p(t.message),setTimeout(()=>{try{window.close()}catch{}},1200)};if(u){localStorage.removeItem(r),o({success:!1,message:decodeURIComponent(u)});return}if(!l||!n||!c){localStorage.removeItem(r),o({success:!1,message:"Missing authorization parameters. Please try again."});return}const g=localStorage.getItem(r);if(!g||g!==c){localStorage.removeItem(r),o({success:!1,message:"Authorization state mismatch. Please start again."});return}(async()=>{try{const t=await fetch(`${f}/api/v1/git/providers/github/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:l,expiresAt:n,state:c})}),i=await t.json();if(!t.ok||!i.success)throw new Error(i?.error?.message||"Failed to store GitHub token");localStorage.removeItem(r),o({success:!0,message:"GitHub connected successfully!",expiresAt:i.data?.expiresAt||n})}catch(t){localStorage.removeItem(r),o({success:!1,message:t?.message||"Failed to store GitHub token. Please try again."})}})()},[]),e.jsx("div",{className:"flex h-screen items-center justify-center bg-background px-6",children:e.jsxs("div",{className:"max-w-sm rounded-lg border bg-card p-6 text-center shadow-sm",children:[e.jsxs("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:[s==="pending"&&e.jsx(x,{className:"h-6 w-6 animate-spin text-muted-foreground"}),s==="success"&&e.jsx(w,{className:"h-6 w-6 text-green-600"}),s==="error"&&e.jsx(b,{className:"h-6 w-6 text-red-600"})]}),e.jsx("h1",{className:"text-lg font-semibold",children:"GitHub Authorization"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:h}),s!=="pending"&&e.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"You can close this window and return to Coconut."})]})})};export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as ce,a as de,r as i,j as e,B as r,T as oe,n as M,X as me,F as xe,_ as he,D as ue,b as fe,d as pe,f as je,k as ge,a4 as B,a5 as R,a6 as H,a7 as L,a8 as O,a9 as _,o as ve,A as T}from"./index-UXL5-kaP.js";import{C as g,b as Ne,a as G,c as ye}from"./card-DPLdBoa5.js";import{B as U}from"./badge-vIqE5SOP.js";import{u as we}from"./use-terminal-D3iV7-iC.js";import{T as Se}from"./terminal-preview-CLWDhoOZ.js";import{S as Ce,a as be,b as ke,c as Ae,d as w}from"./select-CyHFRA1Y.js";import{b as De,e as Me,d as Te,c as Ie,a as $e}from"./pipeline-builders-Bkf0wt_O.js";import{R as Ee}from"./refresh-cw-tXYl1ePu.js";import{C as Pe,a as ze}from"./chevrons-up-BfU70OcQ.js";import{P as Fe}from"./play-DVBhRokt.js";import{C as Be}from"./code-DH-sRhus.js";import{C as Re}from"./chevron-up-DFd-7wxW.js";import{S as He}from"./server-lRxThHjr.js";import"./xterm-DTxiCjtJ.js";import"./index-DnZKG-_7.js";const Le=c=>c?Array.isArray(c)?c.filter(x=>typeof x=="string").map(x=>x.trim()).filter(Boolean):typeof c=="string"?c.split(",").map(x=>x.trim()).filter(Boolean):[]:[];function ts(){const c=ce(),{sessions:x,loading:b,error:I,refreshSessions:S,createSession:V,destroySession:K}=we(),{toast:v}=de(),[$,W]=i.useState([]),[q,X]=i.useState(!0),[j,k]=i.useState(()=>({})),[A,N]=i.useState(!1),[f,J]=i.useState("claude"),[E,Q]=i.useState(""),[D,P]=i.useState(!1),[h,Y]=i.useState([]),[p,y]=i.useState([]),[Z,ee]=i.useState({}),[u,se]=i.useState([]),[o,C]=i.useState([]),te=s=>{const t=Date.now(),a=new Date(s).getTime(),n=Math.max(0,Math.floor((t-a)/1e3));if(n<60)return`${n}s ago`;const d=Math.floor(n/60);if(d<60)return`${d}m ago`;const l=Math.floor(d/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`};i.useEffect(()=>{(async()=>{try{const t=await fetch(`${T}/api/v1/tasks`);if(t.ok){const a=await t.json(),n=a.data||a;W(Array.isArray(n)?n:[])}}catch(t){console.error("Error loading tasks:",t)}finally{X(!1)}})()},[]),i.useEffect(()=>{S()},[S]),i.useEffect(()=>{if(!A)return;(async()=>{try{const t=await fetch(`${T}/api/v1/mcp`);if(t.ok){const a=await t.json();a?.success&&Array.isArray(a.servers)&&(Y(a.servers),y(n=>n.filter(d=>a.servers.includes(d))),a.mcpServers&&typeof a.mcpServers=="object"&&ee(a.mcpServers))}}catch(t){console.error("Failed to load MCP servers",t)}try{const t=await fetch(`${T}/api/v1/skills`);if(t.ok){const a=await t.json(),d=(Array.isArray(a?.documents)?a.documents:[]).map(l=>({id:l.id,name:l?.metadata?.name||l.id,mcpServers:Le(l?.metadata?.metadata?.mcpServers)}));se(d),C(l=>l.filter(F=>d.some(le=>le.id===F)))}}catch(t){console.error("Failed to load skills",t)}})()},[A]),i.useEffect(()=>{o.length!==0&&y(s=>{const t=new Set(s),a=h.length>0?new Set(h):void 0;return o.forEach(n=>{const d=u.find(l=>l.id===n);d&&d.mcpServers.forEach(l=>{(!a||a.has(l))&&t.add(l)})}),Array.from(t)})},[o,u,h]);const m=i.useMemo(()=>x.filter(s=>s.taskId?.startsWith("cp-")||s.taskId?.startsWith("ag-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[x]);i.useEffect(()=>{k(s=>{const t={...s};return m.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[m]);const z=i.useMemo(()=>$.filter(s=>s.status==="draft"||s.status==="ready").sort((s,t)=>new Date(t.metadata.createdAt).getTime()-new Date(s.metadata.createdAt).getTime()).slice(0,3),[$]),ae=()=>{const s=m.every(a=>j[a.id]),t={};m.forEach(a=>{t[a.id]=!s}),k(t)},ie=m.length>0&&m.every(s=>j[s.id]),ne=async s=>{await K(s)?(v({title:"Session closed",description:s}),setTimeout(()=>S(),100)):v({title:"Failed to close session",description:s,variant:"destructive"})},re=async()=>{P(!0);try{const s=`session-${Date.now()}`,t={taskId:s,contextType:"change-task",cliAgent:f,mcpServersMap:Z,selectedMcpServers:p,skills:u,selectedSkillIds:o,automationEnabled:!1,customInstruction:E.trim(),includeDefaultInstructions:!1};let a="";f==="claude"?a=De(t):f==="gemini"?a=Me(t):f==="codex"?a=Te(t):f==="droid"?a=Ie(t):f==="kiro"&&(a=$e(t)),await V(s,a)?(v({title:"Coding session started",description:`Session ${s} created`}),N(!1),c(`/terminal/${s}`)):v({title:"Failed to start session",description:"Could not create terminal session",variant:"destructive"})}catch(s){console.error("Error starting coding session:",s),v({title:"Error",description:"Failed to start coding session",variant:"destructive"})}finally{P(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Manage agents and their active sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>S(),disabled:b,children:[e.jsx(Ee,{className:`h-4 w-4 sm:mr-2 ${b?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),m.length>0&&e.jsx(r,{variant:"outline",size:"sm",onClick:ae,children:ie?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Hide All"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Show All"})]})}),e.jsxs(r,{size:"sm",onClick:()=>N(!0),children:[e.jsx(Fe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Interactive Session"})]})]})]}),I&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:I})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),b?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,t)=>e.jsx(g,{className:"p-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),e.jsxs("div",{children:[e.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),e.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},t))}):m.length===0?e.jsx(g,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(Be,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No active sessions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Get started by launching an"," ",e.jsx("button",{onClick:()=>N(!0),className:"text-primary hover:underline font-medium",children:"Interactive Session"})," ","or working on a"," ",e.jsx("button",{onClick:()=>c("/tasks"),className:"text-primary hover:underline font-medium",children:"New Task"})]})]})]})}):e.jsx("div",{className:"space-y-2",children:m.slice(0,10).map(s=>e.jsxs(g,{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(oe,{className:"h-4 w-4 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:s.taskId}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",s.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",te(s.lastActivity)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:`flex items-center gap-1 ${s.connected?"text-green-600":"text-gray-400"}`,title:s.connected?"Connected":"Disconnected",children:e.jsx("div",{className:`w-2 h-2 rounded-full ${s.connected?"bg-green-500":"bg-gray-400"}`})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>{k(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":j[s.id]?"Hide preview":"Show preview",title:j[s.id]?"Hide preview":"Show preview",children:j[s.id]?e.jsx(Re,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>c(`/terminal/${s.taskId}`),children:"Open"}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>ne(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(me,{className:"h-4 w-4"})})]})]}),j[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>c(`/terminal/${s.taskId}`),title:"Click to open full terminal session",children:e.jsx(Se,{sessionId:s.id,heightPx:160,maxScrollback:200})})]},s.id))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"New Tasks"}),q?e.jsx("div",{className:"space-y-3",children:[...Array(3)].map((s,t)=>e.jsx(g,{children:e.jsx(Ne,{className:"py-3",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-2/3 animate-pulse"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"})]}),e.jsx("div",{className:"h-5 bg-muted rounded w-16 animate-pulse"})]})})},t))}):z.length===0?e.jsx(g,{children:e.jsx(G,{className:"flex items-center justify-center py-6",children:e.jsx("div",{className:"text-center text-sm text-gray-500",children:"No draft or approved tasks found"})})}):e.jsx("div",{className:"space-y-2",children:z.map(s=>e.jsx(g,{className:"hover:shadow-md transition-all cursor-pointer hover:border-primary/50",onClick:()=>c(`/terminal/${s.id}`),children:e.jsx(G,{className:"py-4",children:e.jsx("div",{className:"flex justify-between items-start gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(ye,{className:"text-base leading-tight",children:s.title||s.intent}),e.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[s.priority&&e.jsx(U,{variant:s.priority==="high"||s.priority==="critical"?"destructive":s.priority==="medium"?"secondary":"outline",className:"text-xs",children:s.priority}),e.jsx(U,{variant:"default",className:"text-xs",children:s.status})]})]}),s.content&&e.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[s.content.split(`
|
|
1
|
+
import{u as ce,a as de,r as i,j as e,B as r,T as oe,n as M,X as me,F as xe,_ as he,D as ue,b as fe,d as pe,f as je,k as ge,a4 as B,a5 as R,a6 as H,a7 as L,a8 as O,a9 as _,o as ve,A as T}from"./index-ByTA2ZiD.js";import{C as g,b as Ne,a as G,c as ye}from"./card-CL5bB4cs.js";import{B as U}from"./badge-BbfU_aPt.js";import{u as we}from"./use-terminal-D1UnvAVs.js";import{T as Se}from"./terminal-preview-BNm5-Umi.js";import{S as Ce,a as be,b as ke,c as Ae,d as w}from"./select-CfwLZl55.js";import{b as De,e as Me,d as Te,c as Ie,a as $e}from"./pipeline-builders-DrEjlsbH.js";import{R as Ee}from"./refresh-cw-Cj_5MZiJ.js";import{C as Pe,a as ze}from"./chevrons-up-jI6nxhrz.js";import{P as Fe}from"./play-fOwEoIcu.js";import{C as Be}from"./code-DqYaanki.js";import{C as Re}from"./chevron-up-BwTmMEW2.js";import{S as He}from"./server-u9FLHclt.js";import"./xterm-DTxiCjtJ.js";import"./index-CuLP7P_G.js";const Le=c=>c?Array.isArray(c)?c.filter(x=>typeof x=="string").map(x=>x.trim()).filter(Boolean):typeof c=="string"?c.split(",").map(x=>x.trim()).filter(Boolean):[]:[];function ts(){const c=ce(),{sessions:x,loading:b,error:I,refreshSessions:S,createSession:V,destroySession:K}=we(),{toast:v}=de(),[$,W]=i.useState([]),[q,X]=i.useState(!0),[j,k]=i.useState(()=>({})),[A,N]=i.useState(!1),[f,J]=i.useState("claude"),[E,Q]=i.useState(""),[D,P]=i.useState(!1),[h,Y]=i.useState([]),[p,y]=i.useState([]),[Z,ee]=i.useState({}),[u,se]=i.useState([]),[o,C]=i.useState([]),te=s=>{const t=Date.now(),a=new Date(s).getTime(),n=Math.max(0,Math.floor((t-a)/1e3));if(n<60)return`${n}s ago`;const d=Math.floor(n/60);if(d<60)return`${d}m ago`;const l=Math.floor(d/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`};i.useEffect(()=>{(async()=>{try{const t=await fetch(`${T}/api/v1/tasks`);if(t.ok){const a=await t.json(),n=a.data||a;W(Array.isArray(n)?n:[])}}catch(t){console.error("Error loading tasks:",t)}finally{X(!1)}})()},[]),i.useEffect(()=>{S()},[S]),i.useEffect(()=>{if(!A)return;(async()=>{try{const t=await fetch(`${T}/api/v1/mcp`);if(t.ok){const a=await t.json();a?.success&&Array.isArray(a.servers)&&(Y(a.servers),y(n=>n.filter(d=>a.servers.includes(d))),a.mcpServers&&typeof a.mcpServers=="object"&&ee(a.mcpServers))}}catch(t){console.error("Failed to load MCP servers",t)}try{const t=await fetch(`${T}/api/v1/skills`);if(t.ok){const a=await t.json(),d=(Array.isArray(a?.documents)?a.documents:[]).map(l=>({id:l.id,name:l?.metadata?.name||l.id,mcpServers:Le(l?.metadata?.metadata?.mcpServers)}));se(d),C(l=>l.filter(F=>d.some(le=>le.id===F)))}}catch(t){console.error("Failed to load skills",t)}})()},[A]),i.useEffect(()=>{o.length!==0&&y(s=>{const t=new Set(s),a=h.length>0?new Set(h):void 0;return o.forEach(n=>{const d=u.find(l=>l.id===n);d&&d.mcpServers.forEach(l=>{(!a||a.has(l))&&t.add(l)})}),Array.from(t)})},[o,u,h]);const m=i.useMemo(()=>x.filter(s=>s.taskId?.startsWith("cp-")||s.taskId?.startsWith("ag-")).sort((s,t)=>new Date(t.lastActivity).getTime()-new Date(s.lastActivity).getTime()),[x]);i.useEffect(()=>{k(s=>{const t={...s};return m.forEach(a=>{a.id in t||(t[a.id]=!0)}),t})},[m]);const z=i.useMemo(()=>$.filter(s=>s.status==="draft"||s.status==="ready").sort((s,t)=>new Date(t.metadata.createdAt).getTime()-new Date(s.metadata.createdAt).getTime()).slice(0,3),[$]),ae=()=>{const s=m.every(a=>j[a.id]),t={};m.forEach(a=>{t[a.id]=!s}),k(t)},ie=m.length>0&&m.every(s=>j[s.id]),ne=async s=>{await K(s)?(v({title:"Session closed",description:s}),setTimeout(()=>S(),100)):v({title:"Failed to close session",description:s,variant:"destructive"})},re=async()=>{P(!0);try{const s=`session-${Date.now()}`,t={taskId:s,contextType:"change-task",cliAgent:f,mcpServersMap:Z,selectedMcpServers:p,skills:u,selectedSkillIds:o,automationEnabled:!1,customInstruction:E.trim(),includeDefaultInstructions:!1};let a="";f==="claude"?a=De(t):f==="gemini"?a=Me(t):f==="codex"?a=Te(t):f==="droid"?a=Ie(t):f==="kiro"&&(a=$e(t)),await V(s,a)?(v({title:"Coding session started",description:`Session ${s} created`}),N(!1),c(`/terminal/${s}`)):v({title:"Failed to start session",description:"Could not create terminal session",variant:"destructive"})}catch(s){console.error("Error starting coding session:",s),v({title:"Error",description:"Failed to start coding session",variant:"destructive"})}finally{P(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),e.jsx("p",{className:"text-muted-foreground hidden sm:block",children:"Manage agents and their active sessions"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>S(),disabled:b,children:[e.jsx(Ee,{className:`h-4 w-4 sm:mr-2 ${b?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]}),m.length>0&&e.jsx(r,{variant:"outline",size:"sm",onClick:ae,children:ie?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Hide All"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Show All"})]})}),e.jsxs(r,{size:"sm",onClick:()=>N(!0),children:[e.jsx(Fe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Interactive Session"})]})]})]}),I&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("div",{className:"text-red-600",children:I})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),b?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,t)=>e.jsx(g,{className:"p-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),e.jsxs("div",{children:[e.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),e.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},t))}):m.length===0?e.jsx(g,{className:"p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[e.jsx(Be,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No active sessions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Get started by launching an"," ",e.jsx("button",{onClick:()=>N(!0),className:"text-primary hover:underline font-medium",children:"Interactive Session"})," ","or working on a"," ",e.jsx("button",{onClick:()=>c("/tasks"),className:"text-primary hover:underline font-medium",children:"New Task"})]})]})]})}):e.jsx("div",{className:"space-y-2",children:m.slice(0,10).map(s=>e.jsxs(g,{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(oe,{className:"h-4 w-4 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:s.taskId}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",s.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",te(s.lastActivity)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:`flex items-center gap-1 ${s.connected?"text-green-600":"text-gray-400"}`,title:s.connected?"Connected":"Disconnected",children:e.jsx("div",{className:`w-2 h-2 rounded-full ${s.connected?"bg-green-500":"bg-gray-400"}`})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>{k(t=>({...t,[s.id]:!t[s.id]}))},"aria-label":j[s.id]?"Hide preview":"Show preview",title:j[s.id]?"Hide preview":"Show preview",children:j[s.id]?e.jsx(Re,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>c(`/terminal/${s.taskId}`),children:"Open"}),e.jsx(r,{size:"icon",variant:"destructive",onClick:()=>ne(s.id),title:"Close session","aria-label":"Close session",children:e.jsx(me,{className:"h-4 w-4"})})]})]}),j[s.id]&&e.jsx("div",{className:"mt-2 w-full p-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>c(`/terminal/${s.taskId}`),title:"Click to open full terminal session",children:e.jsx(Se,{sessionId:s.id,heightPx:160,maxScrollback:200})})]},s.id))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"New Tasks"}),q?e.jsx("div",{className:"space-y-3",children:[...Array(3)].map((s,t)=>e.jsx(g,{children:e.jsx(Ne,{className:"py-3",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-2/3 animate-pulse"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"})]}),e.jsx("div",{className:"h-5 bg-muted rounded w-16 animate-pulse"})]})})},t))}):z.length===0?e.jsx(g,{children:e.jsx(G,{className:"flex items-center justify-center py-6",children:e.jsx("div",{className:"text-center text-sm text-gray-500",children:"No draft or approved tasks found"})})}):e.jsx("div",{className:"space-y-2",children:z.map(s=>e.jsx(g,{className:"hover:shadow-md transition-all cursor-pointer hover:border-primary/50",onClick:()=>c(`/terminal/${s.id}`),children:e.jsx(G,{className:"py-4",children:e.jsx("div",{className:"flex justify-between items-start gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(ye,{className:"text-base leading-tight",children:s.title||s.intent}),e.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[s.priority&&e.jsx(U,{variant:s.priority==="high"||s.priority==="critical"?"destructive":s.priority==="medium"?"secondary":"outline",className:"text-xs",children:s.priority}),e.jsx(U,{variant:"default",className:"text-xs",children:s.status})]})]}),s.content&&e.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[s.content.split(`
|
|
2
2
|
`).slice(0,2).join(" ").substring(0,150),s.content.length>150?"...":""]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.id," • by ",s.author.name," • ",new Date(s.metadata.createdAt).toLocaleDateString()]}),e.jsxs("div",{className:"flex gap-2",onClick:t=>t.stopPropagation(),children:[e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/tasks/${s.id}`),className:"h-7 px-2 text-xs",children:[e.jsx(xe,{className:"h-3 w-3 mr-1"})," View"]}),e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>c(`/tasks/${s.id}/edit`),className:"h-7 px-2 text-xs",children:[e.jsx(he,{className:"h-3 w-3 mr-1"})," Edit"]})]})]})]})})})},s.id))})]}),e.jsx(ue,{open:A,onOpenChange:N,children:e.jsxs(fe,{className:"max-w-lg",children:[e.jsxs(pe,{children:[e.jsx(je,{children:"Start Agent"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Start an interactive session"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Agent"}),e.jsxs(Ce,{value:f,onValueChange:s=>J(s),children:[e.jsx(be,{className:"w-full",children:e.jsx(ke,{placeholder:"Select coding agent"})}),e.jsxs(Ae,{children:[e.jsx(w,{value:"claude",children:"Claude Code"}),e.jsx(w,{value:"gemini",children:"Google Gemini"}),e.jsx(w,{value:"codex",children:"OpenAI Codex"}),e.jsx(w,{value:"droid",children:"Factory Droid"}),e.jsx(w,{value:"kiro",children:"Kiro"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ge,{className:"h-4 w-4"}),"Skills"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[o.length," of ",u.length," selected"]})]}),e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[o.length===0?"Select skills...":o.length===u.length?"All skills selected":`${o.length} skill${o.length!==1?"s":""} selected`,e.jsx(M,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(H,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(L,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Skills"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),C(u.map(t=>t.id))},children:"All"}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),C([])},children:"None"})]})]}),e.jsx(O,{}),u.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No skills found"}):u.map(s=>e.jsx(_,{checked:o.includes(s.id),onCheckedChange:t=>{C(a=>t?a.includes(s.id)?a:[...a,s.id]:a.filter(n=>n!==s.id))},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:s.name}),s.mcpServers.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",s.mcpServers.join(", ")]}),s.mcpServers.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},s.id))]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4"}),"MCP Servers"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[p.length," of ",h.length," selected"]})]}),e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"outline",className:"w-full justify-between",children:[p.length===0?"Select MCP servers...":p.length===h.length?"All servers selected":`${p.length} server${p.length!==1?"s":""} selected`,e.jsx(M,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(H,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(L,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Servers"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),y(h)},children:"All"}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),y([])},children:"None"})]})]}),e.jsx(O,{}),h.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):h.map(s=>e.jsx(_,{checked:p.includes(s),onCheckedChange:t=>{y(a=>t?a.includes(s)?a:[...a,s]:a.filter(n=>n!==s))},children:s},s))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Additional Instructions (optional)"}),e.jsx(ve,{value:E,onChange:s=>Q(s.target.value),placeholder:"Add any custom instructions for the coding agent...",rows:4,className:"resize-none"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(r,{variant:"outline",onClick:()=>N(!1),disabled:D,children:"Cancel"}),e.jsx(r,{onClick:re,disabled:D,children:D?"Starting...":"Start Session"})]})]})]})})]})}export{ts as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e,e as a,n as m}from"./index-
|
|
1
|
+
import{r as x,j as e,e as a,n as m}from"./index-ByTA2ZiD.js";function u({title:n,description:t,icon:r,defaultOpen:o=!1,children:i,className:l}){const[s,d]=x.useState(o);return e.jsxs("div",{className:a("rounded-lg border bg-card text-card-foreground",l),children:[e.jsxs("button",{type:"button",onClick:()=>d(c=>!c),className:"flex w-full items-center justify-between gap-4 px-4 py-3 text-left","aria-expanded":s,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r,e.jsxs("div",{children:[e.jsx("p",{className:"font-medium leading-tight",children:n}),t&&e.jsx("p",{className:"text-sm text-muted-foreground leading-snug",children:t})]})]}),e.jsx(m,{className:a("h-4 w-4 shrink-0 transition-transform duration-200",s?"rotate-180":"rotate-0")})]}),s&&e.jsx("div",{className:"border-t px-4 py-4",children:i})]})}export{u as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as b,u as Re,a as Le,r as l,j as e,D as De,b as Ie,d as te,e as f,f as ae,g as ne,S as re,B as d,C as le,I as B,h as G,i as Pe,G as _e,F as qe,k as ue,Z as We,l as ze,m as Fe,T as ce,n as Ve,o as Be,L as v,P as Ee,M as Ke,K as A,p as g,q as $e,A as Ge}from"./index-
|
|
1
|
+
import{c as b,u as Re,a as Le,r as l,j as e,D as De,b as Ie,d as te,e as f,f as ae,g as ne,S as re,B as d,C as le,I as B,h as G,i as Pe,G as _e,F as qe,k as ue,Z as We,l as ze,m as Fe,T as ce,n as Ve,o as Be,L as v,P as Ee,M as Ke,K as A,p as g,q as $e,A as Ge}from"./index-ByTA2ZiD.js";import{C as h,a as u,b as R,c as L,d as ie}from"./card-CL5bB4cs.js";import{B as He}from"./badge-BbfU_aPt.js";import{g as Oe}from"./status-utils-PwF3DXLL.js";import{L as Ye}from"./label-Dp0-28_O.js";import{S as oe,a as de,b as me,c as xe,d as E}from"./select-CfwLZl55.js";import{u as Qe}from"./use-terminal-D1UnvAVs.js";import{T as Ue}from"./terminal-preview-BNm5-Umi.js";import{C as Ze}from"./circle-check-D2LVHMl-.js";import{C as Je}from"./chevron-left-B-7K6MNx.js";import{S as Xe}from"./search-BgbqRUnf.js";import{G as es}from"./globe-lpD9Jv31.js";import{C as ss}from"./code-DqYaanki.js";import{F as ts}from"./folder-git-2-Cizv1NA6.js";import{E as as}from"./external-link-CrRz0sU-.js";import{P as ns}from"./play-fOwEoIcu.js";import{C as rs}from"./clock-D-X3KCw6.js";import{C as ls}from"./circle-check-big-BwQ_q1N7.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";import"./xterm-DTxiCjtJ.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -38,4 +38,4 @@ import{c as b,u as Re,a as Le,r as l,j as e,D as De,b as Ie,d as te,e as f,f as
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const vs=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],Ns=b("wand-sparkles",vs),bs={Rocket:js,FolderGit2:ts,FileBarChart:xs,FilePlus2:W,Calendar:Fe,Sparkles:G,Settings:ze,Zap:We,Code:ss,Bot:ue,FileText:qe,GitBranch:_e,ChartLine:is,Shield:Pe,Database:ds,TestTube:ys,Palette:ps,Globe:es},ws={blue:{bg:"bg-gradient-to-br from-blue-500/30 to-blue-600/15",icon:"text-blue-400",border:"border-blue-500/40 hover:border-blue-500/60"},purple:{bg:"bg-gradient-to-br from-purple-500/30 to-purple-600/15",icon:"text-purple-400",border:"border-purple-500/40 hover:border-purple-500/60"},green:{bg:"bg-gradient-to-br from-emerald-500/30 to-emerald-600/15",icon:"text-emerald-400",border:"border-emerald-500/40 hover:border-emerald-500/60"},orange:{bg:"bg-gradient-to-br from-orange-500/30 to-orange-600/15",icon:"text-orange-400",border:"border-orange-500/40 hover:border-orange-500/60"},pink:{bg:"bg-gradient-to-br from-pink-500/30 to-pink-600/15",icon:"text-pink-400",border:"border-pink-500/40 hover:border-pink-500/60"}},he={setup:"Setup",analysis:"Analysis",automation:"Automation",coding:"Coding"};function K(i){return bs[i]||G}function $(i){return ws[i||"blue"]}function ks(i,N){let m=i.replace(/\{\{#if (\w+)\}\}(.*?)\{\{\/if\}\}/g,(S,j,M)=>N[j]?.trim()?M.replace(/\{\{(\w+)\}\}/g,(w,t)=>N[t]||""):"");return m=m.replace(/\{\{(\w+)\}\}/g,(S,j)=>N[j]||""),m}function Cs({open:i,onOpenChange:N,workflows:m}){const S=Re(),{loading:j,createSession:M,destroySession:D}=Qe(),{toast:w}=Le(),[t,n]=l.useState(null),[x,y]=l.useState(0),[o,I]=l.useState(""),[r,k]=l.useState("all"),[p,T]=l.useState({}),[H,O]=l.useState(!1),[P,Y]=l.useState(null),[pe,Q]=l.useState(null),[z,fe]=l.useState(!1),U=l.useMemo(()=>{const s=new Set(m.map(a=>a.category));return Array.from(s)},[m]),C=l.useMemo(()=>m.filter(s=>{const a=o===""||s.title.toLowerCase().includes(o.toLowerCase())||s.description.toLowerCase().includes(o.toLowerCase()),c=r==="all"||s.category===r;return a&&c}),[m,o,r]),Z=l.useMemo(()=>o||r!=="all"?[]:m.filter(s=>s.featured),[m,o,r]),J=l.useMemo(()=>o||r!=="all"?C:C.filter(s=>!s.featured),[C,o,r]),X=s=>{n(s),y(0);const a={};s.params?.forEach(c=>{c.defaultValue&&(a[c.id]=c.defaultValue)}),T(a)},je=()=>{x>0?y(x-1):(n(null),T({}))},ge=()=>{t&&x<t.steps.length-1&&y(x+1)},_=()=>{n(null),y(0),I(""),k("all"),T({}),Y(null),Q(null),N(!1)},q=(s,a)=>{T(c=>({...c,[s]:a}))},F=l.useMemo(()=>t?.params?t.params.filter(s=>s.required).every(s=>p[s.id]?.trim()):!0,[t,p]),V=l.useMemo(()=>t?.command?ks(t.command,p):"",[t,p]),ye=async()=>{if(!V)return;const s=`wizard-${Date.now()}`;O(!0);try{const a=await M(s,V);a?(w({title:"Session started",description:s}),Y(a),Q(s)):w({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{O(!1)}},ve=s=>{const a=K(s.icon),c=$(s.color);return e.jsx(h,{className:f("cursor-pointer transition-all duration-200 hover:scale-[1.02]",c.bg,c.border),onClick:()=>X(s),children:e.jsxs(u,{className:"p-4 flex flex-col items-center text-center h-full",children:[e.jsx("div",{className:f("w-12 h-12 rounded-xl flex items-center justify-center mb-3","bg-background/50 backdrop-blur-sm"),children:e.jsx(a,{className:f("h-6 w-6",c.icon)})}),e.jsx("h3",{className:"text-sm font-semibold line-clamp-2",children:s.title})]})},s.id)},Ne=s=>{const a=K(s.icon),c=$(s.color);return e.jsx(h,{className:"cursor-pointer hover:bg-accent hover:border-accent-foreground/20 transition-colors",onClick:()=>X(s),children:e.jsx(u,{className:"p-4",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:f("flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center",c.bg),children:e.jsx(a,{className:f("h-5 w-5",c.icon)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold truncate",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description})]}),e.jsx(le,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"})]})})},s.id)},be=()=>e.jsxs("div",{className:"flex h-[600px]",children:[e.jsxs("div",{className:"w-56 border-r pr-4 flex flex-col space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Xe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(B,{placeholder:"Search workflows...",value:o,onChange:s=>I(s.target.value),className:"pl-9"})]}),e.jsxs(oe,{value:r,onValueChange:k,children:[e.jsx(de,{children:e.jsx(me,{placeholder:"All categories"})}),e.jsxs(xe,{children:[e.jsx(E,{value:"all",children:"All categories"}),U.map(s=>e.jsx(E,{value:s,children:he[s]||s},s))]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2 px-1",children:"Categories"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("button",{onClick:()=>k("all"),className:f("w-full text-left px-3 py-2 text-sm rounded-md transition-colors",r==="all"?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:"All Workflows"}),U.map(s=>e.jsx("button",{onClick:()=>k(s),className:f("w-full text-left px-3 py-2 text-sm rounded-md transition-colors",r===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:he[s]||s},s))]})]})]}),e.jsxs("div",{className:"flex-1 pl-4",children:[e.jsxs(te,{className:"mb-4",children:[e.jsx(ae,{className:"text-2xl",children:"Getting Started"}),e.jsx(ne,{children:"Choose a workflow to get started with Coconut. We'll guide you through each step."})]}),e.jsx(re,{className:"h-[500px] pr-4",children:e.jsxs("div",{className:"space-y-6",children:[Z.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-muted-foreground mb-3 flex items-center",children:[e.jsx(G,{className:"h-4 w-4 mr-2"}),"Featured"]}),e.jsx("div",{className:"grid grid-cols-3 gap-3 p-1",children:Z.map(ve)})]}),(J.length>0||o||r!=="all")&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:o||r!=="all"?`Results (${C.length})`:"All Workflows"}),e.jsx("div",{className:"space-y-2",children:C.length>0?(o||r!=="all"?C:J).map(Ne):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{children:"No workflows found matching your search."})})})]})]})})]})]}),we=s=>e.jsx("div",{className:"space-y-4",children:s.content&&e.jsxs("div",{className:"space-y-4",children:[s.content.text&&e.jsx(h,{children:e.jsx(u,{className:"p-4",children:e.jsx("p",{className:"text-sm leading-relaxed",children:s.content.text})})}),s.content.image&&e.jsx(h,{children:e.jsx(u,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("img",{src:s.content.image.src,alt:s.content.image.alt,className:"w-full rounded-md border"}),s.content.image.caption&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:s.content.image.caption})]})})}),s.content.video&&e.jsx(h,{children:e.jsx(u,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"relative rounded-md overflow-hidden border bg-muted",children:e.jsx("video",{src:s.content.video.src,poster:s.content.video.poster,controls:!0,className:"w-full",children:"Your browser does not support the video tag."})}),s.content.video.caption&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:s.content.video.caption})]})})})]})}),ke=()=>t?.params?e.jsx("div",{className:"space-y-4",children:t.params.map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ye,{htmlFor:s.id,children:[s.label,s.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),s.type==="text"&&e.jsx(B,{id:s.id,placeholder:s.placeholder,value:p[s.id]||"",onChange:a=>q(s.id,a.target.value)}),s.type==="textarea"&&e.jsx(Be,{id:s.id,placeholder:s.placeholder,value:p[s.id]||"",onChange:a=>q(s.id,a.target.value),rows:4}),s.type==="number"&&e.jsx(B,{id:s.id,type:"number",placeholder:s.placeholder,value:p[s.id]||"",onChange:a=>q(s.id,a.target.value)}),s.type==="select"&&s.options&&e.jsxs(oe,{value:p[s.id]||"",onValueChange:a=>q(s.id,a),children:[e.jsx(de,{children:e.jsx(me,{placeholder:s.placeholder||"Select..."})}),e.jsx(xe,{children:s.options.map(a=>e.jsx(E,{value:a.value,children:a.label},a.value))})]})]},s.id))}):null,Ce=()=>t?.command?P?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ce,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h4",{className:"text-sm font-semibold",children:"Terminal Output"})]}),e.jsx(Ue,{sessionId:P,heightPx:220,maxScrollback:500})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(d,{onClick:()=>{_(),S(`/terminal/${pe}`)},variant:"secondary",className:"flex-1",children:[e.jsx(as,{className:"h-4 w-4 mr-2"}),"Open in Terminal"]}),e.jsx(d,{onClick:async()=>{P&&await D(P),_()},className:"flex-1 bg-green-600 hover:bg-green-700",children:"Done"})]})]}):e.jsxs("div",{className:"space-y-6",children:[t.params&&t.params.length>0&&e.jsx(h,{children:e.jsxs(u,{className:"p-4",children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"Configuration"}),e.jsx("div",{className:"space-y-2",children:t.params.map(s=>e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[s.label,":"]}),e.jsx("span",{className:"font-medium truncate ml-2 max-w-[200px]",children:p[s.id]||e.jsx("span",{className:"text-muted-foreground italic",children:"Not set"})})]},s.id))})]})}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs(d,{onClick:ye,disabled:j||H||!F,className:"flex-1",children:[e.jsx(ns,{className:"h-4 w-4 mr-2"}),H?"Starting...":"Run"]})}),!F&&e.jsx("p",{className:"text-sm text-destructive text-center",children:"Please fill in all required fields before running."}),e.jsx(h,{children:e.jsxs(u,{className:"p-4",children:[e.jsxs("button",{type:"button",onClick:()=>fe(!z),className:"flex items-center justify-between w-full text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h4",{className:"text-sm font-semibold",children:"Command"})]}),e.jsx(Ve,{className:f("h-4 w-4 text-muted-foreground transition-transform",z&&"rotate-180")})]}),z&&e.jsx("div",{className:"bg-muted rounded-md p-3 overflow-x-auto mt-3",children:e.jsx("code",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:V})})]})})]}):null,Se=()=>{if(!t)return null;const s=t.steps[x],a=s.type||"info",c=x===t.steps.length-1,Me=K(t.icon),ee=$(t.color),Te=()=>{switch(a){case"params":return ke();case"confirm":return Ce();case"info":default:return we(s)}},Ae=c&&!t.command&&a==="info";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(te,{children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx("div",{className:f("flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center",ee.bg),children:e.jsx(Me,{className:f("h-5 w-5",ee.icon)})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(ae,{className:"text-xl",children:t.title}),e.jsxs(ne,{children:["Step ",x+1," of ",t.steps.length]})]})]}),e.jsx("div",{className:"flex items-center space-x-2 pt-2",children:t.steps.map((As,se)=>e.jsx("div",{className:f("h-1.5 flex-1 rounded-full transition-colors",se<=x?"bg-primary":"bg-muted")},se))})]}),e.jsx(re,{className:"h-[450px] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]}),Te(),Ae&&e.jsx(h,{className:"bg-primary/5 border-primary/20",children:e.jsxs(u,{className:"p-4 flex items-center space-x-3",children:[e.jsx(Ze,{className:"h-5 w-5 text-primary flex-shrink-0"}),e.jsx("p",{className:"text-sm font-medium",children:`You've completed this workflow! Click "Finish" to close this wizard.`})]})})]})}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsx(d,{variant:"ghost",onClick:_,children:"Cancel"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(d,{variant:"outline",onClick:je,children:[e.jsx(Je,{className:"mr-2 h-4 w-4"}),x===0?"Back to Workflows":"Previous"]}),a!=="confirm"&&(c?e.jsx(d,{onClick:_,children:"Finish"}):e.jsxs(d,{onClick:ge,disabled:a==="params"&&!F,children:["Next",e.jsx(le,{className:"ml-2 h-4 w-4"})]}))]})]})]})};return e.jsx(De,{open:i,onOpenChange:N,children:e.jsx(Ie,{className:"max-w-4xl max-h-[90vh]",children:t?Se():be()})})}const Ss=[{id:"new-project",title:"Start Building a New Website",description:"Scaffold a ready-to-go Vite + React + TypeScript project with Tailwind CSS",icon:"Rocket",category:"setup",featured:!0,color:"blue",command:"npx -y http://registry.coconut.dev/registry/blueprints/coconut-vite-starter-1.0.1.tgz",steps:[{type:"info",title:"Start Building a New Website",description:"Get up and running with a modern web stack in seconds",content:{text:"This wizard scaffolds a ready-to-go Vite + React + TypeScript project with Tailwind CSS and React Router. Perfect for quick experiments, agent-driven prototypes, or Coconut sandboxes. You'll have a fully configured development environment with hot reloading, routing, and styling out of the box."}},{type:"confirm",title:"Create Your Project",description:"Run the scaffolding command to set up your new website"}]},{id:"company-sentiment-analysis",title:"Daily Company Sentiment Analysis",description:"Monitor a company's online presence with automated daily sentiment analysis",icon:"ChartLine",category:"automation",featured:!0,color:"orange",command:'npx -y http://registry.coconut.dev/utils/coconut-research-sentiment-analysis-1.0.2.tgz --company "{{company}}" --url "{{url}}"{{#if socialPlatforms}} --social-platforms "{{socialPlatforms}}"{{/if}}{{#if keywords}} --keywords "{{keywords}}"{{/if}}',params:[{id:"company",label:"Company Name",type:"text",placeholder:"e.g., Acme Corp",required:!0},{id:"url",label:"Company Website URL",type:"text",placeholder:"e.g., https://acme.com",required:!0},{id:"socialPlatforms",label:"Social Platforms (optional)",type:"text",placeholder:"e.g., twitter,linkedin,reddit",required:!1},{id:"keywords",label:"Keywords to Track (optional)",type:"text",placeholder:"e.g., product launch,customer feedback",required:!1}],steps:[{type:"info",title:"Daily Company Sentiment Analysis",description:"Learn how automated sentiment monitoring works",content:{text:"This wizard creates a scheduled job that monitors a company's online presence daily (Monday–Friday). It uses web scraping to gather sentiment data and generates comprehensive reports including overall sentiment score, key themes, notable mentions, and trend analysis over time."}},{type:"params",title:"Configure Analysis",description:"Enter the company details and optional filters"},{type:"confirm",title:"Review and Create Job",description:"Confirm your settings and create the sentiment analysis job"}]}],Ms={workflows:Ss},Ts=Ms.workflows;function Zs(){const[i,N]=l.useState({total:0,inReview:0,approved:0}),[m,S]=l.useState([]),[j,M]=l.useState(!0),[D,w]=l.useState(!1);return l.useEffect(()=>{const t=n=>{(n.metaKey||n.ctrlKey)&&n.key==="k"&&(n.preventDefault(),w(!0)),(n.metaKey||n.ctrlKey)&&n.key==="i"&&(n.preventDefault(),window.location.href="/tasks/new"),(n.metaKey||n.ctrlKey)&&n.key==="u"&&(n.preventDefault(),window.location.href="/knowledge"),(n.metaKey||n.ctrlKey)&&n.key==="e"&&(n.preventDefault(),window.location.href="/agents")};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[]),l.useEffect(()=>{(async()=>{try{const x=await(await fetch(`${Ge}/api/v1/tasks`)).json();if(x.success&&x.data){const y=x.data,o={total:y.length,inReview:y.filter(r=>r.status==="review").length,approved:y.filter(r=>r.status==="ready"||r.status==="done").length},I=y.sort((r,k)=>{const p=new Date(r.metadata?.updatedAt||r.metadata?.createdAt||0);return new Date(k.metadata?.updatedAt||k.metadata?.createdAt||0).getTime()-p.getTime()}).slice(0,5);N(o),S(I)}}catch(n){console.error("Failed to fetch task stats:",n)}finally{M(!1)}})()},[]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Home"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage change tasks and take quick actions"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(v,{to:"/tasks",children:e.jsxs(h,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(R,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(L,{className:"text-sm font-medium",children:"All Tasks"}),e.jsx(W,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:j?"...":i.total}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.total===0?"No tasks yet":`${i.total} task${i.total!==1?"s":""}`})]})]})}),e.jsx(v,{to:"/tasks?status=review",children:e.jsxs(h,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(R,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(L,{className:"text-sm font-medium",children:"In Review"}),e.jsx(rs,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:j?"...":i.inReview}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting approval"})]})]})}),e.jsx(v,{to:"/tasks?status=ready",children:e.jsxs(h,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(R,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(L,{className:"text-sm font-medium",children:"Ready / Done"}),e.jsx(ls,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:j?"...":i.approved}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Ready to implement"})]})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(h,{children:[e.jsxs(R,{children:[e.jsx(L,{children:"Recent Tasks"}),e.jsx(ie,{children:"Recently created or updated tasks"})]}),e.jsx(u,{children:j?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/2 mt-2"})]},t))}):m.length>0?e.jsxs("div",{className:"space-y-4 overflow-hidden",children:[m.map(t=>e.jsx(v,{to:`/tasks/${t.id}`,className:"block",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 p-3 rounded-lg border hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(He,{variant:Oe(t.status),children:t.status})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-sm font-medium line-clamp-2 sm:truncate",children:t.title||t.intent}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[t.author.name," • ",new Date(t.metadata?.updatedAt||t.metadata?.createdAt||"").toLocaleDateString()]})]})]})},t.id)),e.jsx("div",{className:"pt-2",children:e.jsx(d,{variant:"outline",size:"sm",asChild:!0,className:"w-full",children:e.jsx(v,{to:"/tasks",children:"View All Tasks"})})})]}):e.jsxs("div",{className:"text-center py-6",children:[e.jsx(W,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No tasks yet"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first task to get started."}),e.jsx(d,{asChild:!0,className:"mt-4",children:e.jsxs(v,{to:"/tasks/new",children:[e.jsx(Ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]})})]}),e.jsxs(h,{className:"flex flex-col",children:[e.jsxs(R,{children:[e.jsx(L,{children:"Quick Actions"}),e.jsx(ie,{children:"Common tasks and operations"})]}),e.jsx(u,{className:"flex flex-col flex-1",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{variant:"default",className:"w-full justify-between",onClick:()=>window.dispatchEvent(new CustomEvent("open-assistant-expanded")),children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(Ke,{className:"mr-2 h-4 w-4"}),"Chat with Assistant"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"L"})]})]}),e.jsxs(d,{variant:"outline",className:"w-full justify-between",onClick:()=>w(!0),children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(Ns,{className:"mr-2 h-4 w-4"}),"Launch Wizard"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"K"})]})]}),e.jsx(d,{asChild:!0,variant:"outline",className:"w-full justify-between",children:e.jsxs(v,{to:"/tasks/new",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(W,{className:"mr-2 h-4 w-4"}),"Create a Task"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"I"})]})]})}),e.jsx(d,{asChild:!0,variant:"outline",className:"w-full justify-between",children:e.jsxs(v,{to:"/knowledge",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx($e,{className:"mr-2 h-4 w-4"}),"View Knowledge"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"U"})]})]})}),e.jsx(d,{asChild:!0,variant:"outline",className:"w-full justify-between",children:e.jsxs(v,{to:"/agents",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(ue,{className:"mr-2 h-4 w-4"}),"Start an Agent"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"E"})]})]})})]})})]})]}),e.jsx(Cs,{open:D,onOpenChange:w,workflows:Ts})]})}export{Zs as default};
|
|
41
|
+
*/const vs=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],Ns=b("wand-sparkles",vs),bs={Rocket:js,FolderGit2:ts,FileBarChart:xs,FilePlus2:W,Calendar:Fe,Sparkles:G,Settings:ze,Zap:We,Code:ss,Bot:ue,FileText:qe,GitBranch:_e,ChartLine:is,Shield:Pe,Database:ds,TestTube:ys,Palette:ps,Globe:es},ws={blue:{bg:"bg-gradient-to-br from-blue-500/30 to-blue-600/15",icon:"text-blue-400",border:"border-blue-500/40 hover:border-blue-500/60"},purple:{bg:"bg-gradient-to-br from-purple-500/30 to-purple-600/15",icon:"text-purple-400",border:"border-purple-500/40 hover:border-purple-500/60"},green:{bg:"bg-gradient-to-br from-emerald-500/30 to-emerald-600/15",icon:"text-emerald-400",border:"border-emerald-500/40 hover:border-emerald-500/60"},orange:{bg:"bg-gradient-to-br from-orange-500/30 to-orange-600/15",icon:"text-orange-400",border:"border-orange-500/40 hover:border-orange-500/60"},pink:{bg:"bg-gradient-to-br from-pink-500/30 to-pink-600/15",icon:"text-pink-400",border:"border-pink-500/40 hover:border-pink-500/60"}},he={setup:"Setup",analysis:"Analysis",automation:"Automation",coding:"Coding"};function K(i){return bs[i]||G}function $(i){return ws[i||"blue"]}function ks(i,N){let m=i.replace(/\{\{#if (\w+)\}\}(.*?)\{\{\/if\}\}/g,(S,j,M)=>N[j]?.trim()?M.replace(/\{\{(\w+)\}\}/g,(w,t)=>N[t]||""):"");return m=m.replace(/\{\{(\w+)\}\}/g,(S,j)=>N[j]||""),m}function Cs({open:i,onOpenChange:N,workflows:m}){const S=Re(),{loading:j,createSession:M,destroySession:D}=Qe(),{toast:w}=Le(),[t,n]=l.useState(null),[x,y]=l.useState(0),[o,I]=l.useState(""),[r,k]=l.useState("all"),[p,T]=l.useState({}),[H,O]=l.useState(!1),[P,Y]=l.useState(null),[pe,Q]=l.useState(null),[z,fe]=l.useState(!1),U=l.useMemo(()=>{const s=new Set(m.map(a=>a.category));return Array.from(s)},[m]),C=l.useMemo(()=>m.filter(s=>{const a=o===""||s.title.toLowerCase().includes(o.toLowerCase())||s.description.toLowerCase().includes(o.toLowerCase()),c=r==="all"||s.category===r;return a&&c}),[m,o,r]),Z=l.useMemo(()=>o||r!=="all"?[]:m.filter(s=>s.featured),[m,o,r]),J=l.useMemo(()=>o||r!=="all"?C:C.filter(s=>!s.featured),[C,o,r]),X=s=>{n(s),y(0);const a={};s.params?.forEach(c=>{c.defaultValue&&(a[c.id]=c.defaultValue)}),T(a)},je=()=>{x>0?y(x-1):(n(null),T({}))},ge=()=>{t&&x<t.steps.length-1&&y(x+1)},_=()=>{n(null),y(0),I(""),k("all"),T({}),Y(null),Q(null),N(!1)},q=(s,a)=>{T(c=>({...c,[s]:a}))},F=l.useMemo(()=>t?.params?t.params.filter(s=>s.required).every(s=>p[s.id]?.trim()):!0,[t,p]),V=l.useMemo(()=>t?.command?ks(t.command,p):"",[t,p]),ye=async()=>{if(!V)return;const s=`wizard-${Date.now()}`;O(!0);try{const a=await M(s,V);a?(w({title:"Session started",description:s}),Y(a),Q(s)):w({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{O(!1)}},ve=s=>{const a=K(s.icon),c=$(s.color);return e.jsx(h,{className:f("cursor-pointer transition-all duration-200 hover:scale-[1.02]",c.bg,c.border),onClick:()=>X(s),children:e.jsxs(u,{className:"p-4 flex flex-col items-center text-center h-full",children:[e.jsx("div",{className:f("w-12 h-12 rounded-xl flex items-center justify-center mb-3","bg-background/50 backdrop-blur-sm"),children:e.jsx(a,{className:f("h-6 w-6",c.icon)})}),e.jsx("h3",{className:"text-sm font-semibold line-clamp-2",children:s.title})]})},s.id)},Ne=s=>{const a=K(s.icon),c=$(s.color);return e.jsx(h,{className:"cursor-pointer hover:bg-accent hover:border-accent-foreground/20 transition-colors",onClick:()=>X(s),children:e.jsx(u,{className:"p-4",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:f("flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center",c.bg),children:e.jsx(a,{className:f("h-5 w-5",c.icon)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold truncate",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description})]}),e.jsx(le,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"})]})})},s.id)},be=()=>e.jsxs("div",{className:"flex h-[600px]",children:[e.jsxs("div",{className:"w-56 border-r pr-4 flex flex-col space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Xe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(B,{placeholder:"Search workflows...",value:o,onChange:s=>I(s.target.value),className:"pl-9"})]}),e.jsxs(oe,{value:r,onValueChange:k,children:[e.jsx(de,{children:e.jsx(me,{placeholder:"All categories"})}),e.jsxs(xe,{children:[e.jsx(E,{value:"all",children:"All categories"}),U.map(s=>e.jsx(E,{value:s,children:he[s]||s},s))]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2 px-1",children:"Categories"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("button",{onClick:()=>k("all"),className:f("w-full text-left px-3 py-2 text-sm rounded-md transition-colors",r==="all"?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:"All Workflows"}),U.map(s=>e.jsx("button",{onClick:()=>k(s),className:f("w-full text-left px-3 py-2 text-sm rounded-md transition-colors",r===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:he[s]||s},s))]})]})]}),e.jsxs("div",{className:"flex-1 pl-4",children:[e.jsxs(te,{className:"mb-4",children:[e.jsx(ae,{className:"text-2xl",children:"Getting Started"}),e.jsx(ne,{children:"Choose a workflow to get started with Coconut. We'll guide you through each step."})]}),e.jsx(re,{className:"h-[500px] pr-4",children:e.jsxs("div",{className:"space-y-6",children:[Z.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-muted-foreground mb-3 flex items-center",children:[e.jsx(G,{className:"h-4 w-4 mr-2"}),"Featured"]}),e.jsx("div",{className:"grid grid-cols-3 gap-3 p-1",children:Z.map(ve)})]}),(J.length>0||o||r!=="all")&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:o||r!=="all"?`Results (${C.length})`:"All Workflows"}),e.jsx("div",{className:"space-y-2",children:C.length>0?(o||r!=="all"?C:J).map(Ne):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{children:"No workflows found matching your search."})})})]})]})})]})]}),we=s=>e.jsx("div",{className:"space-y-4",children:s.content&&e.jsxs("div",{className:"space-y-4",children:[s.content.text&&e.jsx(h,{children:e.jsx(u,{className:"p-4",children:e.jsx("p",{className:"text-sm leading-relaxed",children:s.content.text})})}),s.content.image&&e.jsx(h,{children:e.jsx(u,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("img",{src:s.content.image.src,alt:s.content.image.alt,className:"w-full rounded-md border"}),s.content.image.caption&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:s.content.image.caption})]})})}),s.content.video&&e.jsx(h,{children:e.jsx(u,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"relative rounded-md overflow-hidden border bg-muted",children:e.jsx("video",{src:s.content.video.src,poster:s.content.video.poster,controls:!0,className:"w-full",children:"Your browser does not support the video tag."})}),s.content.video.caption&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:s.content.video.caption})]})})})]})}),ke=()=>t?.params?e.jsx("div",{className:"space-y-4",children:t.params.map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ye,{htmlFor:s.id,children:[s.label,s.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),s.type==="text"&&e.jsx(B,{id:s.id,placeholder:s.placeholder,value:p[s.id]||"",onChange:a=>q(s.id,a.target.value)}),s.type==="textarea"&&e.jsx(Be,{id:s.id,placeholder:s.placeholder,value:p[s.id]||"",onChange:a=>q(s.id,a.target.value),rows:4}),s.type==="number"&&e.jsx(B,{id:s.id,type:"number",placeholder:s.placeholder,value:p[s.id]||"",onChange:a=>q(s.id,a.target.value)}),s.type==="select"&&s.options&&e.jsxs(oe,{value:p[s.id]||"",onValueChange:a=>q(s.id,a),children:[e.jsx(de,{children:e.jsx(me,{placeholder:s.placeholder||"Select..."})}),e.jsx(xe,{children:s.options.map(a=>e.jsx(E,{value:a.value,children:a.label},a.value))})]})]},s.id))}):null,Ce=()=>t?.command?P?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ce,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h4",{className:"text-sm font-semibold",children:"Terminal Output"})]}),e.jsx(Ue,{sessionId:P,heightPx:220,maxScrollback:500})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(d,{onClick:()=>{_(),S(`/terminal/${pe}`)},variant:"secondary",className:"flex-1",children:[e.jsx(as,{className:"h-4 w-4 mr-2"}),"Open in Terminal"]}),e.jsx(d,{onClick:async()=>{P&&await D(P),_()},className:"flex-1 bg-green-600 hover:bg-green-700",children:"Done"})]})]}):e.jsxs("div",{className:"space-y-6",children:[t.params&&t.params.length>0&&e.jsx(h,{children:e.jsxs(u,{className:"p-4",children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"Configuration"}),e.jsx("div",{className:"space-y-2",children:t.params.map(s=>e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[s.label,":"]}),e.jsx("span",{className:"font-medium truncate ml-2 max-w-[200px]",children:p[s.id]||e.jsx("span",{className:"text-muted-foreground italic",children:"Not set"})})]},s.id))})]})}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs(d,{onClick:ye,disabled:j||H||!F,className:"flex-1",children:[e.jsx(ns,{className:"h-4 w-4 mr-2"}),H?"Starting...":"Run"]})}),!F&&e.jsx("p",{className:"text-sm text-destructive text-center",children:"Please fill in all required fields before running."}),e.jsx(h,{children:e.jsxs(u,{className:"p-4",children:[e.jsxs("button",{type:"button",onClick:()=>fe(!z),className:"flex items-center justify-between w-full text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h4",{className:"text-sm font-semibold",children:"Command"})]}),e.jsx(Ve,{className:f("h-4 w-4 text-muted-foreground transition-transform",z&&"rotate-180")})]}),z&&e.jsx("div",{className:"bg-muted rounded-md p-3 overflow-x-auto mt-3",children:e.jsx("code",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:V})})]})})]}):null,Se=()=>{if(!t)return null;const s=t.steps[x],a=s.type||"info",c=x===t.steps.length-1,Me=K(t.icon),ee=$(t.color),Te=()=>{switch(a){case"params":return ke();case"confirm":return Ce();case"info":default:return we(s)}},Ae=c&&!t.command&&a==="info";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(te,{children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx("div",{className:f("flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center",ee.bg),children:e.jsx(Me,{className:f("h-5 w-5",ee.icon)})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(ae,{className:"text-xl",children:t.title}),e.jsxs(ne,{children:["Step ",x+1," of ",t.steps.length]})]})]}),e.jsx("div",{className:"flex items-center space-x-2 pt-2",children:t.steps.map((As,se)=>e.jsx("div",{className:f("h-1.5 flex-1 rounded-full transition-colors",se<=x?"bg-primary":"bg-muted")},se))})]}),e.jsx(re,{className:"h-[450px] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]}),Te(),Ae&&e.jsx(h,{className:"bg-primary/5 border-primary/20",children:e.jsxs(u,{className:"p-4 flex items-center space-x-3",children:[e.jsx(Ze,{className:"h-5 w-5 text-primary flex-shrink-0"}),e.jsx("p",{className:"text-sm font-medium",children:`You've completed this workflow! Click "Finish" to close this wizard.`})]})})]})}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsx(d,{variant:"ghost",onClick:_,children:"Cancel"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(d,{variant:"outline",onClick:je,children:[e.jsx(Je,{className:"mr-2 h-4 w-4"}),x===0?"Back to Workflows":"Previous"]}),a!=="confirm"&&(c?e.jsx(d,{onClick:_,children:"Finish"}):e.jsxs(d,{onClick:ge,disabled:a==="params"&&!F,children:["Next",e.jsx(le,{className:"ml-2 h-4 w-4"})]}))]})]})]})};return e.jsx(De,{open:i,onOpenChange:N,children:e.jsx(Ie,{className:"max-w-4xl max-h-[90vh]",children:t?Se():be()})})}const Ss=[{id:"new-project",title:"Start Building a New Website",description:"Scaffold a ready-to-go Vite + React + TypeScript project with Tailwind CSS",icon:"Rocket",category:"setup",featured:!0,color:"blue",command:"npx -y http://registry.coconut.dev/registry/blueprints/coconut-vite-starter-1.0.1.tgz",steps:[{type:"info",title:"Start Building a New Website",description:"Get up and running with a modern web stack in seconds",content:{text:"This wizard scaffolds a ready-to-go Vite + React + TypeScript project with Tailwind CSS and React Router. Perfect for quick experiments, agent-driven prototypes, or Coconut sandboxes. You'll have a fully configured development environment with hot reloading, routing, and styling out of the box."}},{type:"confirm",title:"Create Your Project",description:"Run the scaffolding command to set up your new website"}]},{id:"company-sentiment-analysis",title:"Daily Company Sentiment Analysis",description:"Monitor a company's online presence with automated daily sentiment analysis",icon:"ChartLine",category:"automation",featured:!0,color:"orange",command:'npx -y http://registry.coconut.dev/utils/coconut-research-sentiment-analysis-1.0.2.tgz --company "{{company}}" --url "{{url}}"{{#if socialPlatforms}} --social-platforms "{{socialPlatforms}}"{{/if}}{{#if keywords}} --keywords "{{keywords}}"{{/if}}',params:[{id:"company",label:"Company Name",type:"text",placeholder:"e.g., Acme Corp",required:!0},{id:"url",label:"Company Website URL",type:"text",placeholder:"e.g., https://acme.com",required:!0},{id:"socialPlatforms",label:"Social Platforms (optional)",type:"text",placeholder:"e.g., twitter,linkedin,reddit",required:!1},{id:"keywords",label:"Keywords to Track (optional)",type:"text",placeholder:"e.g., product launch,customer feedback",required:!1}],steps:[{type:"info",title:"Daily Company Sentiment Analysis",description:"Learn how automated sentiment monitoring works",content:{text:"This wizard creates a scheduled job that monitors a company's online presence daily (Monday–Friday). It uses web scraping to gather sentiment data and generates comprehensive reports including overall sentiment score, key themes, notable mentions, and trend analysis over time."}},{type:"params",title:"Configure Analysis",description:"Enter the company details and optional filters"},{type:"confirm",title:"Review and Create Job",description:"Confirm your settings and create the sentiment analysis job"}]}],Ms={workflows:Ss},Ts=Ms.workflows;function Zs(){const[i,N]=l.useState({total:0,inReview:0,approved:0}),[m,S]=l.useState([]),[j,M]=l.useState(!0),[D,w]=l.useState(!1);return l.useEffect(()=>{const t=n=>{(n.metaKey||n.ctrlKey)&&n.key==="k"&&(n.preventDefault(),w(!0)),(n.metaKey||n.ctrlKey)&&n.key==="i"&&(n.preventDefault(),window.location.href="/tasks/new"),(n.metaKey||n.ctrlKey)&&n.key==="u"&&(n.preventDefault(),window.location.href="/knowledge"),(n.metaKey||n.ctrlKey)&&n.key==="e"&&(n.preventDefault(),window.location.href="/agents")};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[]),l.useEffect(()=>{(async()=>{try{const x=await(await fetch(`${Ge}/api/v1/tasks`)).json();if(x.success&&x.data){const y=x.data,o={total:y.length,inReview:y.filter(r=>r.status==="review").length,approved:y.filter(r=>r.status==="ready"||r.status==="done").length},I=y.sort((r,k)=>{const p=new Date(r.metadata?.updatedAt||r.metadata?.createdAt||0);return new Date(k.metadata?.updatedAt||k.metadata?.createdAt||0).getTime()-p.getTime()}).slice(0,5);N(o),S(I)}}catch(n){console.error("Failed to fetch task stats:",n)}finally{M(!1)}})()},[]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Home"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage agent tasks and take quick actions"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(v,{to:"/tasks",children:e.jsxs(h,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(R,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(L,{className:"text-sm font-medium",children:"All Tasks"}),e.jsx(W,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:j?"...":i.total}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.total===0?"No tasks yet":`${i.total} task${i.total!==1?"s":""}`})]})]})}),e.jsx(v,{to:"/tasks?status=review",children:e.jsxs(h,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(R,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(L,{className:"text-sm font-medium",children:"In Review"}),e.jsx(rs,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:j?"...":i.inReview}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting approval"})]})]})}),e.jsx(v,{to:"/tasks?status=ready",children:e.jsxs(h,{className:"hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsxs(R,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(L,{className:"text-sm font-medium",children:"Ready / Done"}),e.jsx(ls,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:j?"...":i.approved}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Ready to implement"})]})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(h,{children:[e.jsxs(R,{children:[e.jsx(L,{children:"Recent Tasks"}),e.jsx(ie,{children:"Recently created or updated tasks"})]}),e.jsx(u,{children:j?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/2 mt-2"})]},t))}):m.length>0?e.jsxs("div",{className:"space-y-4 overflow-hidden",children:[m.map(t=>e.jsx(v,{to:`/tasks/${t.id}`,className:"block",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 p-3 rounded-lg border hover:bg-accent hover:border-accent-foreground/20 transition-colors cursor-pointer",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(He,{variant:Oe(t.status),children:t.status})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-sm font-medium line-clamp-2 sm:truncate",children:t.title||t.intent}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[t.author.name," • ",new Date(t.metadata?.updatedAt||t.metadata?.createdAt||"").toLocaleDateString()]})]})]})},t.id)),e.jsx("div",{className:"pt-2",children:e.jsx(d,{variant:"outline",size:"sm",asChild:!0,className:"w-full",children:e.jsx(v,{to:"/tasks",children:"View All Tasks"})})})]}):e.jsxs("div",{className:"text-center py-6",children:[e.jsx(W,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No tasks yet"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first task to get started."}),e.jsx(d,{asChild:!0,className:"mt-4",children:e.jsxs(v,{to:"/tasks/new",children:[e.jsx(Ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]})})]}),e.jsxs(h,{className:"flex flex-col",children:[e.jsxs(R,{children:[e.jsx(L,{children:"Quick Actions"}),e.jsx(ie,{children:"Common tasks and operations"})]}),e.jsx(u,{className:"flex flex-col flex-1",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{variant:"default",className:"w-full justify-between",onClick:()=>window.dispatchEvent(new CustomEvent("open-assistant-expanded")),children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(Ke,{className:"mr-2 h-4 w-4"}),"Chat with Assistant"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"L"})]})]}),e.jsxs(d,{variant:"outline",className:"w-full justify-between",onClick:()=>w(!0),children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(Ns,{className:"mr-2 h-4 w-4"}),"Launch Wizard"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"K"})]})]}),e.jsx(d,{asChild:!0,variant:"outline",className:"w-full justify-between",children:e.jsxs(v,{to:"/tasks/new",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(W,{className:"mr-2 h-4 w-4"}),"Create a Task"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"I"})]})]})}),e.jsx(d,{asChild:!0,variant:"outline",className:"w-full justify-between",children:e.jsxs(v,{to:"/knowledge",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx($e,{className:"mr-2 h-4 w-4"}),"View Knowledge"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"U"})]})]})}),e.jsx(d,{asChild:!0,variant:"outline",className:"w-full justify-between",children:e.jsxs(v,{to:"/agents",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(ue,{className:"mr-2 h-4 w-4"}),"Start an Agent"]}),e.jsxs(A,{children:[e.jsx(g,{children:"⌘"}),e.jsx(g,{children:"E"})]})]})})]})})]})]}),e.jsx(Cs,{open:D,onOpenChange:w,workflows:Ts})]})}export{Zs as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as le,A as l,bH as ws,r as n,a as vs,ac as ys,j as e,L as ee,l as Fe,B as o,G as D,aa as Ns,X as Cs,I as k,n as Me,H as Be,D as se,b as te,d as ae,f as re,g as ne,bE as ks,Y as Oe}from"./index-
|
|
1
|
+
import{c as le,A as l,bH as ws,r as n,a as vs,ac as ys,j as e,L as ee,l as Fe,B as o,G as D,aa as Ns,X as Cs,I as k,n as Me,H as Be,D as se,b as te,d as ae,f as re,g as ne,bE as ks,Y as Oe}from"./index-ByTA2ZiD.js";import{C as ie}from"./card-CL5bB4cs.js";import{L as Re}from"./label-Dp0-28_O.js";import{T as Ss,a as Ps,b as Ge,c as We}from"./tabs-Bj0YyeRI.js";import{C as Ts}from"./circle-check-D2LVHMl-.js";import{C as As}from"./circle-x-CuUVLiI-.js";import{A as Ds}from"./arrow-down-DnNLmXEs.js";import{A as Es}from"./arrow-up-eMUJY7J9.js";import{R as ze}from"./refresh-cw-Cj_5MZiJ.js";import{C as ce}from"./circle-alert-vJFSz39V.js";import{C as Ue}from"./chevron-up-BwTmMEW2.js";import{F as oe}from"./folder-git-2-Cizv1NA6.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as He,r,a as Te,A as u,j as e,bx as he,B as o,H as Fe,v as De,bE as ze,I as U,D as W,b as B,d as q,f as J,g as K,Y}from"./index-
|
|
1
|
+
import{c as He,r,a as Te,A as u,j as e,bx as he,B as o,H as Fe,v as De,bE as ze,I as U,D as W,b as B,d as q,f as J,g as K,Y}from"./index-ByTA2ZiD.js";import{C as xe,b as pe,c as ge,d as fe,a as be}from"./card-CL5bB4cs.js";import{L as f}from"./label-Dp0-28_O.js";import{R as Me,a as je}from"./radio-group-B8RB7N01.js";import{R as A}from"./refresh-cw-Cj_5MZiJ.js";import{E as ve}from"./external-link-CrRz0sU-.js";import{C as Oe}from"./circle-check-D2LVHMl-.js";import{C as Ie}from"./circle-x-CuUVLiI-.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ge,a as ve,r as u,j as e,v as se,B as x,a1 as fe,a0 as Ne,bv as Te,i as be,Z as Ce,bw as Se,I as c,o as O,aa as ae,P as E,bx as ne,H as we,A as ie}from"./index-
|
|
1
|
+
import{c as ge,a as ve,r as u,j as e,v as se,B as x,a1 as fe,a0 as Ne,bv as Te,i as be,Z as Ce,bw as Se,I as c,o as O,aa as ae,P as E,bx as ne,H as we,A as ie}from"./index-ByTA2ZiD.js";import{C as y,b as j,c as g,d as v,a as f,e as Ae}from"./card-CL5bB4cs.js";import{L as o}from"./label-Dp0-28_O.js";import{B as re}from"./badge-BbfU_aPt.js";import{S as ke,a as Ie,b as Oe,c as Fe,d as Pe}from"./select-CfwLZl55.js";import{A as Ee,a as Me}from"./alert-BtkLXQ3p.js";import{T as De,a as Le,b as C,c as S}from"./tabs-Bj0YyeRI.js";import{E as Ue}from"./eye-Cx9ZGkg5.js";import{C as _e,a as Re}from"./clipboard-BHOFelnW.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as u,j as e,e as p,B as c,H as x,I as j,P as v}from"./index-
|
|
1
|
+
import{c as u,j as e,e as p,B as c,H as x,I as j,P as v}from"./index-ByTA2ZiD.js";import{L as r}from"./label-Dp0-28_O.js";import{S,a as y,b,c as f,d as k}from"./select-CfwLZl55.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/static/assets/{IntegrationsSettingsPage-o7NXZGt9.js → IntegrationsSettingsPage-DeFQd6af.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,bD as A,w as i,j as e,bx as K,e as f,n as j,C as y,ad as v,I as N,B as r,H as b,a1 as k,h as $}from"./index-UXL5-kaP.js";import{C as _,b as F,c as E,d as M,a as G}from"./card-DPLdBoa5.js";import{L as m}from"./label-8VKluf9w.js";import{S as Q,a as W,b as X,c as Z,d as ee}from"./select-CyHFRA1Y.js";import{G as se}from"./globe-CUo7eHKN.js";import"./index-DnZKG-_7.js";import"./chevron-up-DFd-7wxW.js";const te=[{id:"openai/gpt-4o",label:"GPT-4o",provider:"openai",supportsMCP:!0,strengths:["balanced","reasoning","code","tools"],notes:"Great general model with tool/function calling support."},{id:"openai/gpt-4o-mini",label:"GPT-4o Mini",provider:"openai",supportsMCP:!0,strengths:["cost-effective","fast","tools"],notes:"Good for quick, inexpensive tasks with function calling."},{id:"openai/gpt-4.1",label:"GPT-4.1",provider:"openai",supportsMCP:!0,strengths:["coding","instruction following","long context"],notes:"Latest GPT-4 series with enhanced capabilities."},{id:"openai/o3-mini",label:"o3-mini",provider:"openai",supportsMCP:!0,strengths:["reasoning","math","coding"],notes:"Reasoning model optimized for efficiency."},{id:"anthropic/claude-sonnet-4.5",label:"Claude Sonnet 4.5",provider:"anthropic",supportsMCP:!0,strengths:["agents","coding","tools","fast","long context"],notes:"Most advanced Sonnet - 1.5-2x faster, optimized for agents and tool orchestration."},{id:"anthropic/claude-sonnet-4",label:"Claude Sonnet 4",provider:"anthropic",supportsMCP:!0,strengths:["reasoning","analysis","tools","coding"],notes:"Excellent tool use and reasoning capabilities."},{id:"anthropic/claude-3.5-sonnet",label:"Claude 3.5 Sonnet",provider:"anthropic",supportsMCP:!0,strengths:["reasoning","analysis","tools"],notes:"Reliable Claude model with strong tool support."},{id:"google/gemini-2.0-flash-001",label:"Gemini 2.0 Flash",provider:"google",supportsMCP:!0,strengths:["speed","multimodal","tools"],notes:"Fast Google model with function calling."},{id:"meta-llama/llama-3.1-405b-instruct",label:"Llama 3.1 405B",provider:"meta-llama",supportsMCP:!0,strengths:["reasoning","open weights","code"],notes:"High-capacity open model; function calling often available."},{id:"qwen/qwen-2.5-72b-instruct",label:"Qwen 2.5 72B",provider:"qwen",supportsMCP:!0,strengths:["cost-effective","code","tools"],notes:"Strong value open model with tool support."}],ae={models:te},re=ae;function z(){return re.models}function xe(){const[t,O]=d.useState({}),[n,R]=d.useState(!0),[D,L]=d.useState(!1),[x,U]=d.useState({}),[I,q]=d.useState({}),[H,Y]=d.useState(z()[0]?.id||"openai/gpt-4o"),[l,J]=d.useState({openrouter:!1,replicate:!1,anthropic:!1,openai:!1,gemini:!1,factorydroid:!1,callbackToken:!1});d.useEffect(()=>{P()},[]);const P=async()=>{try{R(!0);const s=await A("/api/v1/config?type=global");if(s.success&&s.data){const a=s.data.apiKeys||{},o={},c={};for(const C of["openrouter","replicate","anthropic","openai","gemini","factorydroid","callbackToken"]){const S=a[C];S&&typeof S=="string"&&S.trim()!==""?(o[C]=!0,c[C]="***"):(o[C]=!1,c[C]="")}O(c);const T=s.data.defaults&&s.data.defaults.model?String(s.data.defaults.model):void 0;Y(T||z()[0]?.id||"openai/gpt-4o")}}catch(s){console.error("Failed to load API keys:",s),i({title:"Error",description:"Failed to load API keys",variant:"destructive"})}finally{R(!1)}},p=(s,a)=>{O(o=>({...o,[s]:a}))},B=async s=>{try{q(T=>({...T,[s]:!0}));const a=t[s],o={provider:s};a&&a!=="***"&&(o.key=a);const c=await A("/api/v1/config/test",{method:"POST",body:JSON.stringify(o)});c.success&&c.message?i({title:"Test Result",description:c.message}):c.success?i({title:"Test Result",description:"Success"}):i({title:"Test Failed",description:c.message||"Unknown error",variant:"destructive"})}catch(a){i({title:"Test Failed",description:a instanceof Error?a.message:"Unknown error",variant:"destructive"})}finally{q(a=>({...a,[s]:!1}))}},h=s=>{J(a=>({...a,[s]:!a[s]}))},u=async s=>{try{const a={[s]:""};await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({apiKeys:a})}),i({title:"Success",description:`${s} API key cleared`}),await P()}catch(a){console.error("Failed to clear API key:",a),i({title:"Error",description:"Failed to clear API key",variant:"destructive"})}},g=async s=>{try{U(o=>({...o,[s]:!0}));const a={[s]:t[s]};await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({apiKeys:a})}),i({title:"Success",description:`${s} API key saved`}),await P()}catch(a){console.error("Failed to save API key:",a),i({title:"Error",description:"Failed to save API key",variant:"destructive"})}finally{U(a=>({...a,[s]:!1}))}},V=async()=>{try{L(!0),await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({defaults:{model:H}})}),i({title:"Success",description:"Default model saved successfully"})}catch(s){console.error("Failed to save default model:",s),i({title:"Error",description:"Failed to save default model",variant:"destructive"})}finally{L(!1)}},w={openrouter:"OPENROUTER_API_KEY",replicate:"REPLICATE_API_TOKEN",anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GEMINI_API_KEY",factorydroid:"FACTORY_API_KEY"};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"AI & LLM"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Coconut's connections to LLM providers."})]}),e.jsx(K,{}),e.jsxs(_,{children:[e.jsxs(F,{children:[e.jsx(E,{children:"API Keys & Authentication"}),e.jsx(M,{children:"Manage API keys and authentication tokens for integrated services."})]}),e.jsxs(G,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"AI Assistant API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keys used by the AI Assistant sidebar for chat and code suggestions."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("openrouter"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.openrouter&&t.openrouter!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.openrouter?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"OpenRouter"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.openrouter})]})]}),t.openrouter&&t.openrouter!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.openrouter&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"openrouterKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"openrouterKey",type:"password",placeholder:"sk-or-v1-...",className:"flex-1",value:t.openrouter||"",onChange:s=>p("openrouter",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("openrouter"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>B("openrouter"),disabled:!!I.openrouter,title:"Test API key",children:I.openrouter?"Testing...":"Test"}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("openrouter"),disabled:x.openrouter||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"OpenRouter"})]})]})]}),e.jsx(K,{className:"my-6"}),e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Resource Creation API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keys used for generating images and other resources."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("replicate"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.replicate&&t.replicate!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.replicate?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Replicate"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.replicate})]})]}),t.replicate&&t.replicate!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.replicate&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"replicateKey",children:"API Token"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"replicateKey",type:"password",placeholder:"r8_...",className:"flex-1",value:t.replicate||"",onChange:s=>p("replicate",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("replicate"),title:"Clear API token",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>B("replicate"),disabled:!!I.replicate,title:"Test API token",children:I.replicate?"Testing...":"Test"}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("replicate"),disabled:x.replicate||n,title:"Save API token",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token from"," ",e.jsx("a",{href:"https://replicate.com/account/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Replicate"})]})]})]}),e.jsx(K,{className:"my-6"}),e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Coding Agent API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These keys are automatically provided to coding agents when they start running."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("anthropic"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.anthropic&&t.anthropic!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.anthropic?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Anthropic Claude"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.anthropic})]})]}),t.anthropic&&t.anthropic!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.anthropic&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"anthropicKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"anthropicKey",type:"password",placeholder:"sk-ant-...",className:"flex-1",value:t.anthropic||"",onChange:s=>p("anthropic",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("anthropic"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("anthropic"),disabled:x.anthropic||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://console.anthropic.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Anthropic Console"})]})]})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("openai"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.openai&&t.openai!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.openai?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"OpenAI"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.openai})]})]}),t.openai&&t.openai!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.openai&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"openaiKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"openaiKey",type:"password",placeholder:"sk-...",className:"flex-1",value:t.openai||"",onChange:s=>p("openai",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("openai"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("openai"),disabled:x.openai||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"OpenAI Platform"})]})]})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("gemini"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.gemini&&t.gemini!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.gemini?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Google Gemini"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.gemini})]})]}),t.gemini&&t.gemini!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.gemini&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"geminiKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"geminiKey",type:"password",placeholder:"AIza...",className:"flex-1",value:t.gemini||"",onChange:s=>p("gemini",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("gemini"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("gemini"),disabled:x.gemini||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://makersuite.google.com/app/apikey",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Google AI Studio"})]})]})]}),e.jsxs("div",{className:"border rounded-lg mt-4",children:[e.jsxs("button",{onClick:()=>h("factorydroid"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.factorydroid&&t.factorydroid!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.factorydroid?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Factory Droid"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.factorydroid})]})]}),t.factorydroid&&t.factorydroid!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.factorydroid&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"factorydroidKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"factorydroidKey",type:"password",placeholder:"fd-...",className:"flex-1",value:t.factorydroid||"",onChange:s=>p("factorydroid",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("factorydroid"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("factorydroid"),disabled:x.factorydroid||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://factorydroid.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Factory Droid"})]})]})]})]})]}),e.jsxs(_,{children:[e.jsxs(F,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-5 w-5"}),e.jsx(E,{children:"Coconut Control Plane"})]}),e.jsxs(M,{children:["Connect to the"," ",e.jsx("a",{href:"https://app.coconut.dev",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Coconut Dashboard"})," ","to access third-party connectors (Google Drive, Slack, HubSpot, Stripe, and more)."]})]}),e.jsx(G,{className:"space-y-4",children:e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("callbackToken"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.callbackToken&&t.callbackToken!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.callbackToken?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Callback Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"COCONUT_CALLBACK_TOKEN"})]})]}),t.callbackToken&&t.callbackToken!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.callbackToken&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"callbackTokenKey",children:"Callback Token"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"callbackTokenKey",type:"password",placeholder:"cpt_...",className:"flex-1",value:t.callbackToken||"",onChange:s=>p("callbackToken",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("callbackToken"),title:"Clear callback token",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("callbackToken"),disabled:x.callbackToken||n,title:"Save callback token",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Find your callback token in the"," ",e.jsx("a",{href:"https://app.coconut.dev",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Coconut Dashboard"}),". This token enables the ",e.jsx("code",{className:"text-xs",children:"list_connectors"})," and ",e.jsx("code",{className:"text-xs",children:"connector_request"})," tools."]})]})]})})]}),e.jsxs(_,{children:[e.jsxs(F,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{className:"h-5 w-5"}),e.jsx(E,{children:"AI Assistant Settings"})]}),e.jsx(M,{children:"Configure default AI model and behavior for the AI assistant sidebar."})]}),e.jsxs(G,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"defaultModel",children:"Default AI Model"}),e.jsxs(Q,{value:H,onValueChange:Y,children:[e.jsx(W,{children:e.jsx(X,{placeholder:"Select default AI model"})}),e.jsx(Z,{children:z().map(s=>e.jsx(ee,{value:s.id,children:s.label},s.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This model will be selected by default when opening the AI assistant."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{onClick:V,disabled:D||n,children:D?"Saving...":"Save"})})]})]})]})}export{xe as default};
|
|
1
|
+
import{r as d,bD as A,w as i,j as e,bx as K,e as f,n as j,C as y,ad as v,I as N,B as r,H as b,a1 as k,h as $}from"./index-ByTA2ZiD.js";import{C as _,b as F,c as E,d as M,a as G}from"./card-CL5bB4cs.js";import{L as m}from"./label-Dp0-28_O.js";import{S as Q,a as W,b as X,c as Z,d as ee}from"./select-CfwLZl55.js";import{G as se}from"./globe-lpD9Jv31.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";const te=[{id:"openai/gpt-4o",label:"GPT-4o",provider:"openai",supportsMCP:!0,strengths:["balanced","reasoning","code","tools"],notes:"Great general model with tool/function calling support."},{id:"openai/gpt-4o-mini",label:"GPT-4o Mini",provider:"openai",supportsMCP:!0,strengths:["cost-effective","fast","tools"],notes:"Good for quick, inexpensive tasks with function calling."},{id:"openai/gpt-4.1",label:"GPT-4.1",provider:"openai",supportsMCP:!0,strengths:["coding","instruction following","long context"],notes:"Latest GPT-4 series with enhanced capabilities."},{id:"openai/o3-mini",label:"o3-mini",provider:"openai",supportsMCP:!0,strengths:["reasoning","math","coding"],notes:"Reasoning model optimized for efficiency."},{id:"anthropic/claude-sonnet-4.5",label:"Claude Sonnet 4.5",provider:"anthropic",supportsMCP:!0,strengths:["agents","coding","tools","fast","long context"],notes:"Most advanced Sonnet - 1.5-2x faster, optimized for agents and tool orchestration."},{id:"anthropic/claude-sonnet-4",label:"Claude Sonnet 4",provider:"anthropic",supportsMCP:!0,strengths:["reasoning","analysis","tools","coding"],notes:"Excellent tool use and reasoning capabilities."},{id:"anthropic/claude-3.5-sonnet",label:"Claude 3.5 Sonnet",provider:"anthropic",supportsMCP:!0,strengths:["reasoning","analysis","tools"],notes:"Reliable Claude model with strong tool support."},{id:"google/gemini-2.0-flash-001",label:"Gemini 2.0 Flash",provider:"google",supportsMCP:!0,strengths:["speed","multimodal","tools"],notes:"Fast Google model with function calling."},{id:"meta-llama/llama-3.1-405b-instruct",label:"Llama 3.1 405B",provider:"meta-llama",supportsMCP:!0,strengths:["reasoning","open weights","code"],notes:"High-capacity open model; function calling often available."},{id:"qwen/qwen-2.5-72b-instruct",label:"Qwen 2.5 72B",provider:"qwen",supportsMCP:!0,strengths:["cost-effective","code","tools"],notes:"Strong value open model with tool support."}],ae={models:te},re=ae;function z(){return re.models}function xe(){const[t,O]=d.useState({}),[n,R]=d.useState(!0),[D,L]=d.useState(!1),[x,U]=d.useState({}),[I,q]=d.useState({}),[H,Y]=d.useState(z()[0]?.id||"openai/gpt-4o"),[l,J]=d.useState({openrouter:!1,replicate:!1,anthropic:!1,openai:!1,gemini:!1,factorydroid:!1,callbackToken:!1});d.useEffect(()=>{P()},[]);const P=async()=>{try{R(!0);const s=await A("/api/v1/config?type=global");if(s.success&&s.data){const a=s.data.apiKeys||{},o={},c={};for(const C of["openrouter","replicate","anthropic","openai","gemini","factorydroid","callbackToken"]){const S=a[C];S&&typeof S=="string"&&S.trim()!==""?(o[C]=!0,c[C]="***"):(o[C]=!1,c[C]="")}O(c);const T=s.data.defaults&&s.data.defaults.model?String(s.data.defaults.model):void 0;Y(T||z()[0]?.id||"openai/gpt-4o")}}catch(s){console.error("Failed to load API keys:",s),i({title:"Error",description:"Failed to load API keys",variant:"destructive"})}finally{R(!1)}},p=(s,a)=>{O(o=>({...o,[s]:a}))},B=async s=>{try{q(T=>({...T,[s]:!0}));const a=t[s],o={provider:s};a&&a!=="***"&&(o.key=a);const c=await A("/api/v1/config/test",{method:"POST",body:JSON.stringify(o)});c.success&&c.message?i({title:"Test Result",description:c.message}):c.success?i({title:"Test Result",description:"Success"}):i({title:"Test Failed",description:c.message||"Unknown error",variant:"destructive"})}catch(a){i({title:"Test Failed",description:a instanceof Error?a.message:"Unknown error",variant:"destructive"})}finally{q(a=>({...a,[s]:!1}))}},h=s=>{J(a=>({...a,[s]:!a[s]}))},u=async s=>{try{const a={[s]:""};await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({apiKeys:a})}),i({title:"Success",description:`${s} API key cleared`}),await P()}catch(a){console.error("Failed to clear API key:",a),i({title:"Error",description:"Failed to clear API key",variant:"destructive"})}},g=async s=>{try{U(o=>({...o,[s]:!0}));const a={[s]:t[s]};await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({apiKeys:a})}),i({title:"Success",description:`${s} API key saved`}),await P()}catch(a){console.error("Failed to save API key:",a),i({title:"Error",description:"Failed to save API key",variant:"destructive"})}finally{U(a=>({...a,[s]:!1}))}},V=async()=>{try{L(!0),await A("/api/v1/config?type=global",{method:"PUT",body:JSON.stringify({defaults:{model:H}})}),i({title:"Success",description:"Default model saved successfully"})}catch(s){console.error("Failed to save default model:",s),i({title:"Error",description:"Failed to save default model",variant:"destructive"})}finally{L(!1)}},w={openrouter:"OPENROUTER_API_KEY",replicate:"REPLICATE_API_TOKEN",anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GEMINI_API_KEY",factorydroid:"FACTORY_API_KEY"};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"AI & LLM"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Coconut's connections to LLM providers."})]}),e.jsx(K,{}),e.jsxs(_,{children:[e.jsxs(F,{children:[e.jsx(E,{children:"API Keys & Authentication"}),e.jsx(M,{children:"Manage API keys and authentication tokens for integrated services."})]}),e.jsxs(G,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"AI Assistant API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keys used by the AI Assistant sidebar for chat and code suggestions."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("openrouter"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.openrouter&&t.openrouter!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.openrouter?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"OpenRouter"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.openrouter})]})]}),t.openrouter&&t.openrouter!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.openrouter&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"openrouterKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"openrouterKey",type:"password",placeholder:"sk-or-v1-...",className:"flex-1",value:t.openrouter||"",onChange:s=>p("openrouter",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("openrouter"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>B("openrouter"),disabled:!!I.openrouter,title:"Test API key",children:I.openrouter?"Testing...":"Test"}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("openrouter"),disabled:x.openrouter||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"OpenRouter"})]})]})]}),e.jsx(K,{className:"my-6"}),e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Resource Creation API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keys used for generating images and other resources."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("replicate"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.replicate&&t.replicate!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.replicate?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Replicate"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.replicate})]})]}),t.replicate&&t.replicate!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.replicate&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"replicateKey",children:"API Token"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"replicateKey",type:"password",placeholder:"r8_...",className:"flex-1",value:t.replicate||"",onChange:s=>p("replicate",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("replicate"),title:"Clear API token",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>B("replicate"),disabled:!!I.replicate,title:"Test API token",children:I.replicate?"Testing...":"Test"}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("replicate"),disabled:x.replicate||n,title:"Save API token",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token from"," ",e.jsx("a",{href:"https://replicate.com/account/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Replicate"})]})]})]}),e.jsx(K,{className:"my-6"}),e.jsxs("div",{className:"space-y-1 mb-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Coding Agent API Keys"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These keys are automatically provided to coding agents when they start running."})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("anthropic"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.anthropic&&t.anthropic!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.anthropic?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Anthropic Claude"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.anthropic})]})]}),t.anthropic&&t.anthropic!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.anthropic&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"anthropicKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"anthropicKey",type:"password",placeholder:"sk-ant-...",className:"flex-1",value:t.anthropic||"",onChange:s=>p("anthropic",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("anthropic"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("anthropic"),disabled:x.anthropic||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://console.anthropic.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Anthropic Console"})]})]})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("openai"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.openai&&t.openai!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.openai?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"OpenAI"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.openai})]})]}),t.openai&&t.openai!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.openai&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"openaiKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"openaiKey",type:"password",placeholder:"sk-...",className:"flex-1",value:t.openai||"",onChange:s=>p("openai",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("openai"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("openai"),disabled:x.openai||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"OpenAI Platform"})]})]})]}),e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("gemini"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.gemini&&t.gemini!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.gemini?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Google Gemini"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.gemini})]})]}),t.gemini&&t.gemini!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.gemini&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"geminiKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"geminiKey",type:"password",placeholder:"AIza...",className:"flex-1",value:t.gemini||"",onChange:s=>p("gemini",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("gemini"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("gemini"),disabled:x.gemini||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://makersuite.google.com/app/apikey",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Google AI Studio"})]})]})]}),e.jsxs("div",{className:"border rounded-lg mt-4",children:[e.jsxs("button",{onClick:()=>h("factorydroid"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.factorydroid&&t.factorydroid!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.factorydroid?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Factory Droid"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.factorydroid})]})]}),t.factorydroid&&t.factorydroid!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.factorydroid&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"factorydroidKey",children:"API Key"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"factorydroidKey",type:"password",placeholder:"fd-...",className:"flex-1",value:t.factorydroid||"",onChange:s=>p("factorydroid",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("factorydroid"),title:"Clear API key",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("factorydroid"),disabled:x.factorydroid||n,title:"Save API key",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your key from"," ",e.jsx("a",{href:"https://factorydroid.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Factory Droid"})]})]})]})]})]}),e.jsxs(_,{children:[e.jsxs(F,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-5 w-5"}),e.jsx(E,{children:"Coconut Control Plane"})]}),e.jsxs(M,{children:["Connect to the"," ",e.jsx("a",{href:"https://app.coconut.dev",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Coconut Dashboard"})," ","to access third-party connectors (Google Drive, Slack, HubSpot, Stripe, and more)."]})]}),e.jsx(G,{className:"space-y-4",children:e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs("button",{onClick:()=>h("callbackToken"),className:"w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex items-center justify-center w-8 h-8 rounded-md",t.callbackToken&&t.callbackToken!==""?"bg-green-100 dark:bg-green-950":"bg-muted"),children:l.callbackToken?e.jsx(j,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-medium",children:"Callback Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"COCONUT_CALLBACK_TOKEN"})]})]}),t.callbackToken&&t.callbackToken!==""&&e.jsx(v,{className:"h-5 w-5 text-green-600 dark:text-green-400"})]}),l.callbackToken&&e.jsxs("div",{className:"p-4 pt-0 space-y-2",children:[e.jsx(m,{htmlFor:"callbackTokenKey",children:"Callback Token"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(N,{id:"callbackTokenKey",type:"password",placeholder:"cpt_...",className:"flex-1",value:t.callbackToken||"",onChange:s=>p("callbackToken",s.target.value),disabled:n}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>u("callbackToken"),title:"Clear callback token",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>g("callbackToken"),disabled:x.callbackToken||n,title:"Save callback token",children:e.jsx(k,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Find your callback token in the"," ",e.jsx("a",{href:"https://app.coconut.dev",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Coconut Dashboard"}),". This token enables the ",e.jsx("code",{className:"text-xs",children:"list_connectors"})," and ",e.jsx("code",{className:"text-xs",children:"connector_request"})," tools."]})]})]})})]}),e.jsxs(_,{children:[e.jsxs(F,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{className:"h-5 w-5"}),e.jsx(E,{children:"AI Assistant Settings"})]}),e.jsx(M,{children:"Configure default AI model and behavior for the AI assistant sidebar."})]}),e.jsxs(G,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"defaultModel",children:"Default AI Model"}),e.jsxs(Q,{value:H,onValueChange:Y,children:[e.jsx(W,{children:e.jsx(X,{placeholder:"Select default AI model"})}),e.jsx(Z,{children:z().map(s=>e.jsx(ee,{value:s.id,children:s.label},s.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This model will be selected by default when opening the AI assistant."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(r,{onClick:V,disabled:D||n,children:D?"Saving...":"Save"})})]})]})]})}export{xe as default};
|