@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 +1 @@
|
|
|
1
|
-
import{r as i,a as W,A as m,j as e,bx as T,B as v,I as F,a1 as Y,bF as Z,bG as ee}from"./index-UXL5-kaP.js";import{C as E,b as B,c as U,d as I,a as O}from"./card-DPLdBoa5.js";import{L as c}from"./label-8VKluf9w.js";import{S as h}from"./switch-BUpDbrux.js";import{S as se,a as te,b as ae,c as ne,d as ie}from"./select-CyHFRA1Y.js";import{M as re}from"./message-square-CO8kDUed.js";import{C as oe}from"./circle-check-xMiP6SLO.js";import{C as V}from"./circle-x-z3iynaE7.js";import{R as q}from"./refresh-cw-tXYl1ePu.js";import"./index-DnZKG-_7.js";import"./chevron-up-DFd-7wxW.js";const y={enabled:!1,channelId:"",channelName:"",siteUrl:"",notifications:{proposals:{created:!0,statusChange:!0},jobs:{completed:!0,failed:!0},git:{push:!1,merge:!0}},hasBotToken:!1,hasSigningSecret:!1};function be(){const[t,k]=i.useState(y),[x,P]=i.useState(""),[p,$]=i.useState(""),[S]=i.useState(()=>typeof window<"u"?window.location.origin:""),[l,j]=i.useState({data:[],error:null,loading:!1}),[H,L]=i.useState(!0),[A,g]=i.useState(!1),[J,R]=i.useState(!1),[G,M]=i.useState(!1),[o,_]=i.useState(null),[b,N]=i.useState(null),{toast:r}=W(),z=i.useCallback(async()=>{L(!0);try{const a=await(await fetch(`${m}/api/v1/slack/config`)).json();if(a.success)k({...y,...a.data});else throw new Error(a.error||"Failed to load Slack configuration")}catch(s){console.error("Failed to load Slack config:",s),r({title:"Error",description:"Failed to load Slack configuration",variant:"destructive"})}finally{L(!1)}},[r]),D=i.useCallback(async()=>{R(!0),N(null);try{const a=await(await fetch(`${m}/api/v1/slack/test`,{method:"POST"})).json();a.success?(N({success:!0,teamName:a.teamName}),r({title:"Connected",description:`Connected to workspace: ${a.teamName}`})):(N({success:!1,error:a.error}),r({title:"Connection failed",description:a.error||"Failed to connect",variant:"destructive"}))}catch(s){N({success:!1,error:s.message}),r({title:"Error",description:s.message||"Connection test failed",variant:"destructive"})}finally{R(!1)}},[r]),C=i.useCallback(async()=>{j(s=>({...s,loading:!0,error:null}));try{const a=await(await fetch(`${m}/api/v1/slack/channels`)).json();if(a.success)j({data:a.data||[],error:null,loading:!1});else{const n=a.error||"Failed to load channels";j({data:[],error:n,loading:!1})}}catch(s){console.error("Failed to load Slack channels:",s),j({data:[],error:s.message||"Failed to load channels",loading:!1})}},[]),X=async()=>{g(!0);try{const s={};if(x&&x!=="***"&&(s.botToken=x),p&&p!=="***"&&(s.signingSecret=p),s.siteUrl=S,Object.keys(s).length===1&&s.siteUrl&&!x&&!p){r({title:"No changes",description:"Enter new tokens to save"}),g(!1);return}const n=await(await fetch(`${m}/api/v1/slack/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();if(n.success)k({...y,...n.data}),P(""),$(""),r({title:"Saved",description:"Slack tokens saved successfully"}),await D();else throw new Error(n.error||"Failed to save tokens")}catch(s){r({title:"Error",description:s.message||"Failed to save tokens",variant:"destructive"})}finally{g(!1)}},w=async s=>{g(!0);try{const n=await(await fetch(`${m}/api/v1/slack/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();if(n.success)k({...y,...n.data}),r({title:"Saved",description:"Configuration updated"});else throw new Error(n.error||"Failed to save configuration")}catch(a){r({title:"Error",description:a.message||"Failed to save",variant:"destructive"})}finally{g(!1)}},K=async()=>{M(!0);try{const a=await(await fetch(`${m}/api/v1/slack/notify`,{method:"POST"})).json();if(a.success)r({title:"Sent",description:"Test notification sent to Slack"});else throw new Error(a.error||"Failed to send notification")}catch(s){r({title:"Error",description:s.message||"Failed to send test notification",variant:"destructive"})}finally{M(!1)}},u=(s,a,n)=>{const Q={...t.notifications,[s]:{...t.notifications[s],[a]:n}};w({notifications:Q})},f=async s=>{_(s);try{const n=await(await fetch(`${m}/api/v1/slack/notify/example`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s})})).json();if(n.success)r({title:"Sent",description:`Example notification sent to ${t.channelName}`});else throw new Error(n.error||"Failed to send example notification")}catch(a){r({title:"Error",description:a.message||"Failed to send example notification",variant:"destructive"})}finally{_(null)}};if(i.useEffect(()=>{z()},[z]),i.useEffect(()=>{t.hasBotToken&&C()},[t.hasBotToken,C]),H)return e.jsx("div",{children:"Loading..."});const d=!!t.channelId;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Slack notifications for Coconut events."})]}),e.jsx(T,{}),e.jsxs(E,{children:[e.jsxs(B,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{className:"h-5 w-5"}),e.jsx(U,{children:"Slack Connection"})]}),e.jsx(I,{children:"Connect your Slack workspace to receive notifications from Coconut."})]}),e.jsxs(O,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between rounded border bg-muted/30 px-3 py-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:t.hasBotToken?b?.success?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-4 w-4 text-green-600"}),e.jsxs("span",{className:"text-sm font-medium text-green-600",children:["Connected to ",b.teamName]})]}):b?.error?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-red-600"}),e.jsx("span",{className:"text-sm text-red-600",children:b.error})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-4 rounded-full bg-yellow-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Token configured - click Test to verify"})]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"})]})}),e.jsxs(v,{variant:"outline",size:"sm",onClick:D,disabled:J||!t.hasBotToken,children:[e.jsx(q,{className:`h-4 w-4 mr-2 ${J?"animate-spin":""}`}),"Test"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"botToken",children:"Bot User OAuth Token"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(F,{id:"botToken",type:"password",placeholder:t.hasBotToken?"••••••••••••••••":"xoxb-...",value:x,onChange:s=>P(s.target.value),className:"flex-1"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Find this in your Slack app settings under OAuth & Permissions. The token should start with ",e.jsx("code",{className:"text-xs bg-muted px-1 rounded",children:"xoxb-"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"signingSecret",children:"Signing Secret"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(F,{id:"signingSecret",type:"password",placeholder:t.hasSigningSecret?"••••••••••••••••":"Enter signing secret",value:p,onChange:s=>$(s.target.value),className:"flex-1"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Find this in your Slack app settings under Basic Information → App Credentials."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"siteUrl",children:"Site URL"}),e.jsx(F,{id:"siteUrl",type:"text",value:S,disabled:!0,className:"bg-muted"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["This URL will be used for links in Slack notifications.",t.siteUrl&&t.siteUrl!==S&&e.jsxs("span",{className:"block mt-1 text-amber-600",children:["Currently saved: ",t.siteUrl]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(v,{onClick:X,disabled:A||!x&&!p,children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),A?"Saving...":"Save Tokens"]})}),e.jsxs("div",{className:"rounded border bg-muted/50 p-4 space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Setup Instructions"}),e.jsxs("ol",{className:"text-xs text-muted-foreground space-y-1 list-decimal list-inside",children:[e.jsxs("li",{children:["Go to ",e.jsx("a",{href:"https://api.slack.com/apps",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"api.slack.com/apps"})," and select your app"]}),e.jsxs("li",{children:['Under "OAuth & Permissions", add these Bot Token Scopes:',e.jsxs("ul",{className:"ml-4 mt-1 space-y-0.5",children:[e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"chat:write"})," - Send messages"]}),e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"channels:read"})," - List public channels"]}),e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"groups:read"})," - List private channels (optional)"]})]})]}),e.jsx("li",{children:"Install the app to your workspace and copy the Bot User OAuth Token"}),e.jsx("li",{children:'Under "Basic Information", copy the Signing Secret'})]})]})]})]}),e.jsxs(E,{children:[e.jsxs(B,{children:[e.jsx(U,{children:"Notification Channel"}),e.jsx(I,{children:"Select the Slack channel where notifications will be posted."})]}),e.jsxs(O,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{children:"Channel"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{value:t.channelId,onValueChange:s=>{const a=l.data.find(n=>n.id===s);w({channelId:s,channelName:a?`#${a.name}`:""})},disabled:!t.hasBotToken||l.loading||!!l.error,children:[e.jsx(te,{className:"flex-1",children:e.jsx(ae,{placeholder:l.loading?"Loading channels...":l.error?"Unable to load channels":"Select a channel"})}),e.jsx(ne,{children:l.data.map(s=>e.jsxs(ie,{value:s.id,children:[s.isPrivate?"🔒":"#"," ",s.name,!s.isMember&&" (bot not member)"]},s.id))})]}),e.jsx(v,{variant:"outline",size:"icon",onClick:C,disabled:l.loading||!t.hasBotToken,children:e.jsx(q,{className:`h-4 w-4 ${l.loading?"animate-spin":""}`})})]}),l.error&&e.jsxs("div",{className:"rounded border border-red-200 bg-red-50 p-3 text-xs text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200",children:[e.jsx("span",{className:"font-medium",children:"Error loading channels:"})," ",l.error]}),t.channelName&&!l.error&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Currently set to: ",e.jsx("span",{className:"font-medium",children:t.channelName})]}),!t.hasBotToken&&e.jsx("p",{className:"text-xs text-amber-600",children:"Configure your Bot Token above to select a channel."})]}),d&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Send a test notification to verify the setup"}),e.jsxs(v,{variant:"outline",size:"sm",onClick:K,disabled:G||!t.enabled,children:[e.jsx(Z,{className:"h-4 w-4 mr-2"}),G?"Sending...":"Send Test"]})]})]})]}),e.jsxs(E,{children:[e.jsxs(B,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"h-5 w-5"}),e.jsx(U,{children:"Notification Types"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{htmlFor:"notifications-enabled",className:"text-sm font-normal",children:"Enable notifications"}),e.jsx(h,{id:"notifications-enabled",checked:t.enabled,onCheckedChange:s=>w({enabled:s}),disabled:!t.hasBotToken||!d})]})]}),e.jsx(I,{children:"Choose which events trigger Slack notifications."})]}),e.jsxs(O,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Proposals"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"proposals-created",className:"text-sm font-normal",children:"New proposal created"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("proposal.created"),disabled:!d||o==="proposal.created",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="proposal.created"?"Sending...":"Send Example"}),e.jsx(h,{id:"proposals-created",checked:t.notifications.proposals.created,onCheckedChange:s=>u("proposals","created",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"proposals-status",className:"text-sm font-normal",children:"Proposal status changed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("proposal.statusChange"),disabled:!d||o==="proposal.statusChange",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="proposal.statusChange"?"Sending...":"Send Example"}),e.jsx(h,{id:"proposals-status",checked:t.notifications.proposals.statusChange,onCheckedChange:s=>u("proposals","statusChange",s),disabled:!t.enabled})]})]})]})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Scheduled Jobs"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"jobs-completed",className:"text-sm font-normal",children:"Job completed successfully"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("job.completed"),disabled:!d||o==="job.completed",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="job.completed"?"Sending...":"Send Example"}),e.jsx(h,{id:"jobs-completed",checked:t.notifications.jobs.completed,onCheckedChange:s=>u("jobs","completed",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"jobs-failed",className:"text-sm font-normal",children:"Job failed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("job.failed"),disabled:!d||o==="job.failed",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="job.failed"?"Sending...":"Send Example"}),e.jsx(h,{id:"jobs-failed",checked:t.notifications.jobs.failed,onCheckedChange:s=>u("jobs","failed",s),disabled:!t.enabled})]})]})]})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Git Operations"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"git-push",className:"text-sm font-normal",children:"Code pushed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("git.push"),disabled:!d||o==="git.push",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="git.push"?"Sending...":"Send Example"}),e.jsx(h,{id:"git-push",checked:t.notifications.git.push,onCheckedChange:s=>u("git","push",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"git-merge",className:"text-sm font-normal",children:"Branch merged"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("git.merge"),disabled:!d||o==="git.merge",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="git.merge"?"Sending...":"Send Example"}),e.jsx(h,{id:"git-merge",checked:t.notifications.git.merge,onCheckedChange:s=>u("git","merge",s),disabled:!t.enabled})]})]})]})]}),!t.enabled&&t.hasBotToken&&d&&e.jsx("div",{className:"rounded border border-amber-200 bg-amber-50 p-3 text-xs text-amber-700 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200",children:"Enable notifications above to start receiving Slack messages for these events."})]})]})]})}export{be as default};
|
|
1
|
+
import{r as i,a as W,A as m,j as e,bx as T,B as v,I as F,a1 as Y,bF as Z,bG as ee}from"./index-ByTA2ZiD.js";import{C as E,b as B,c as U,d as I,a as O}from"./card-CL5bB4cs.js";import{L as c}from"./label-Dp0-28_O.js";import{S as h}from"./switch-CX_Inx_p.js";import{S as se,a as te,b as ae,c as ne,d as ie}from"./select-CfwLZl55.js";import{M as re}from"./message-square-BPOApeM3.js";import{C as oe}from"./circle-check-D2LVHMl-.js";import{C as V}from"./circle-x-CuUVLiI-.js";import{R as q}from"./refresh-cw-Cj_5MZiJ.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";const y={enabled:!1,channelId:"",channelName:"",siteUrl:"",notifications:{proposals:{created:!0,statusChange:!0},jobs:{completed:!0,failed:!0},git:{push:!1,merge:!0}},hasBotToken:!1,hasSigningSecret:!1};function be(){const[t,k]=i.useState(y),[x,P]=i.useState(""),[p,$]=i.useState(""),[S]=i.useState(()=>typeof window<"u"?window.location.origin:""),[l,j]=i.useState({data:[],error:null,loading:!1}),[H,L]=i.useState(!0),[A,g]=i.useState(!1),[J,R]=i.useState(!1),[G,M]=i.useState(!1),[o,_]=i.useState(null),[b,N]=i.useState(null),{toast:r}=W(),z=i.useCallback(async()=>{L(!0);try{const a=await(await fetch(`${m}/api/v1/slack/config`)).json();if(a.success)k({...y,...a.data});else throw new Error(a.error||"Failed to load Slack configuration")}catch(s){console.error("Failed to load Slack config:",s),r({title:"Error",description:"Failed to load Slack configuration",variant:"destructive"})}finally{L(!1)}},[r]),D=i.useCallback(async()=>{R(!0),N(null);try{const a=await(await fetch(`${m}/api/v1/slack/test`,{method:"POST"})).json();a.success?(N({success:!0,teamName:a.teamName}),r({title:"Connected",description:`Connected to workspace: ${a.teamName}`})):(N({success:!1,error:a.error}),r({title:"Connection failed",description:a.error||"Failed to connect",variant:"destructive"}))}catch(s){N({success:!1,error:s.message}),r({title:"Error",description:s.message||"Connection test failed",variant:"destructive"})}finally{R(!1)}},[r]),C=i.useCallback(async()=>{j(s=>({...s,loading:!0,error:null}));try{const a=await(await fetch(`${m}/api/v1/slack/channels`)).json();if(a.success)j({data:a.data||[],error:null,loading:!1});else{const n=a.error||"Failed to load channels";j({data:[],error:n,loading:!1})}}catch(s){console.error("Failed to load Slack channels:",s),j({data:[],error:s.message||"Failed to load channels",loading:!1})}},[]),X=async()=>{g(!0);try{const s={};if(x&&x!=="***"&&(s.botToken=x),p&&p!=="***"&&(s.signingSecret=p),s.siteUrl=S,Object.keys(s).length===1&&s.siteUrl&&!x&&!p){r({title:"No changes",description:"Enter new tokens to save"}),g(!1);return}const n=await(await fetch(`${m}/api/v1/slack/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();if(n.success)k({...y,...n.data}),P(""),$(""),r({title:"Saved",description:"Slack tokens saved successfully"}),await D();else throw new Error(n.error||"Failed to save tokens")}catch(s){r({title:"Error",description:s.message||"Failed to save tokens",variant:"destructive"})}finally{g(!1)}},w=async s=>{g(!0);try{const n=await(await fetch(`${m}/api/v1/slack/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();if(n.success)k({...y,...n.data}),r({title:"Saved",description:"Configuration updated"});else throw new Error(n.error||"Failed to save configuration")}catch(a){r({title:"Error",description:a.message||"Failed to save",variant:"destructive"})}finally{g(!1)}},K=async()=>{M(!0);try{const a=await(await fetch(`${m}/api/v1/slack/notify`,{method:"POST"})).json();if(a.success)r({title:"Sent",description:"Test notification sent to Slack"});else throw new Error(a.error||"Failed to send notification")}catch(s){r({title:"Error",description:s.message||"Failed to send test notification",variant:"destructive"})}finally{M(!1)}},u=(s,a,n)=>{const Q={...t.notifications,[s]:{...t.notifications[s],[a]:n}};w({notifications:Q})},f=async s=>{_(s);try{const n=await(await fetch(`${m}/api/v1/slack/notify/example`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s})})).json();if(n.success)r({title:"Sent",description:`Example notification sent to ${t.channelName}`});else throw new Error(n.error||"Failed to send example notification")}catch(a){r({title:"Error",description:a.message||"Failed to send example notification",variant:"destructive"})}finally{_(null)}};if(i.useEffect(()=>{z()},[z]),i.useEffect(()=>{t.hasBotToken&&C()},[t.hasBotToken,C]),H)return e.jsx("div",{children:"Loading..."});const d=!!t.channelId;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Slack notifications for Coconut events."})]}),e.jsx(T,{}),e.jsxs(E,{children:[e.jsxs(B,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{className:"h-5 w-5"}),e.jsx(U,{children:"Slack Connection"})]}),e.jsx(I,{children:"Connect your Slack workspace to receive notifications from Coconut."})]}),e.jsxs(O,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between rounded border bg-muted/30 px-3 py-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:t.hasBotToken?b?.success?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-4 w-4 text-green-600"}),e.jsxs("span",{className:"text-sm font-medium text-green-600",children:["Connected to ",b.teamName]})]}):b?.error?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-red-600"}),e.jsx("span",{className:"text-sm text-red-600",children:b.error})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-4 rounded-full bg-yellow-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Token configured - click Test to verify"})]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"})]})}),e.jsxs(v,{variant:"outline",size:"sm",onClick:D,disabled:J||!t.hasBotToken,children:[e.jsx(q,{className:`h-4 w-4 mr-2 ${J?"animate-spin":""}`}),"Test"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"botToken",children:"Bot User OAuth Token"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(F,{id:"botToken",type:"password",placeholder:t.hasBotToken?"••••••••••••••••":"xoxb-...",value:x,onChange:s=>P(s.target.value),className:"flex-1"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Find this in your Slack app settings under OAuth & Permissions. The token should start with ",e.jsx("code",{className:"text-xs bg-muted px-1 rounded",children:"xoxb-"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"signingSecret",children:"Signing Secret"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(F,{id:"signingSecret",type:"password",placeholder:t.hasSigningSecret?"••••••••••••••••":"Enter signing secret",value:p,onChange:s=>$(s.target.value),className:"flex-1"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Find this in your Slack app settings under Basic Information → App Credentials."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"siteUrl",children:"Site URL"}),e.jsx(F,{id:"siteUrl",type:"text",value:S,disabled:!0,className:"bg-muted"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["This URL will be used for links in Slack notifications.",t.siteUrl&&t.siteUrl!==S&&e.jsxs("span",{className:"block mt-1 text-amber-600",children:["Currently saved: ",t.siteUrl]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(v,{onClick:X,disabled:A||!x&&!p,children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),A?"Saving...":"Save Tokens"]})}),e.jsxs("div",{className:"rounded border bg-muted/50 p-4 space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Setup Instructions"}),e.jsxs("ol",{className:"text-xs text-muted-foreground space-y-1 list-decimal list-inside",children:[e.jsxs("li",{children:["Go to ",e.jsx("a",{href:"https://api.slack.com/apps",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"api.slack.com/apps"})," and select your app"]}),e.jsxs("li",{children:['Under "OAuth & Permissions", add these Bot Token Scopes:',e.jsxs("ul",{className:"ml-4 mt-1 space-y-0.5",children:[e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"chat:write"})," - Send messages"]}),e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"channels:read"})," - List public channels"]}),e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"groups:read"})," - List private channels (optional)"]})]})]}),e.jsx("li",{children:"Install the app to your workspace and copy the Bot User OAuth Token"}),e.jsx("li",{children:'Under "Basic Information", copy the Signing Secret'})]})]})]})]}),e.jsxs(E,{children:[e.jsxs(B,{children:[e.jsx(U,{children:"Notification Channel"}),e.jsx(I,{children:"Select the Slack channel where notifications will be posted."})]}),e.jsxs(O,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{children:"Channel"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{value:t.channelId,onValueChange:s=>{const a=l.data.find(n=>n.id===s);w({channelId:s,channelName:a?`#${a.name}`:""})},disabled:!t.hasBotToken||l.loading||!!l.error,children:[e.jsx(te,{className:"flex-1",children:e.jsx(ae,{placeholder:l.loading?"Loading channels...":l.error?"Unable to load channels":"Select a channel"})}),e.jsx(ne,{children:l.data.map(s=>e.jsxs(ie,{value:s.id,children:[s.isPrivate?"🔒":"#"," ",s.name,!s.isMember&&" (bot not member)"]},s.id))})]}),e.jsx(v,{variant:"outline",size:"icon",onClick:C,disabled:l.loading||!t.hasBotToken,children:e.jsx(q,{className:`h-4 w-4 ${l.loading?"animate-spin":""}`})})]}),l.error&&e.jsxs("div",{className:"rounded border border-red-200 bg-red-50 p-3 text-xs text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200",children:[e.jsx("span",{className:"font-medium",children:"Error loading channels:"})," ",l.error]}),t.channelName&&!l.error&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Currently set to: ",e.jsx("span",{className:"font-medium",children:t.channelName})]}),!t.hasBotToken&&e.jsx("p",{className:"text-xs text-amber-600",children:"Configure your Bot Token above to select a channel."})]}),d&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Send a test notification to verify the setup"}),e.jsxs(v,{variant:"outline",size:"sm",onClick:K,disabled:G||!t.enabled,children:[e.jsx(Z,{className:"h-4 w-4 mr-2"}),G?"Sending...":"Send Test"]})]})]})]}),e.jsxs(E,{children:[e.jsxs(B,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"h-5 w-5"}),e.jsx(U,{children:"Notification Types"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{htmlFor:"notifications-enabled",className:"text-sm font-normal",children:"Enable notifications"}),e.jsx(h,{id:"notifications-enabled",checked:t.enabled,onCheckedChange:s=>w({enabled:s}),disabled:!t.hasBotToken||!d})]})]}),e.jsx(I,{children:"Choose which events trigger Slack notifications."})]}),e.jsxs(O,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Proposals"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"proposals-created",className:"text-sm font-normal",children:"New proposal created"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("proposal.created"),disabled:!d||o==="proposal.created",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="proposal.created"?"Sending...":"Send Example"}),e.jsx(h,{id:"proposals-created",checked:t.notifications.proposals.created,onCheckedChange:s=>u("proposals","created",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"proposals-status",className:"text-sm font-normal",children:"Proposal status changed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("proposal.statusChange"),disabled:!d||o==="proposal.statusChange",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="proposal.statusChange"?"Sending...":"Send Example"}),e.jsx(h,{id:"proposals-status",checked:t.notifications.proposals.statusChange,onCheckedChange:s=>u("proposals","statusChange",s),disabled:!t.enabled})]})]})]})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Scheduled Jobs"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"jobs-completed",className:"text-sm font-normal",children:"Job completed successfully"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("job.completed"),disabled:!d||o==="job.completed",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="job.completed"?"Sending...":"Send Example"}),e.jsx(h,{id:"jobs-completed",checked:t.notifications.jobs.completed,onCheckedChange:s=>u("jobs","completed",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"jobs-failed",className:"text-sm font-normal",children:"Job failed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("job.failed"),disabled:!d||o==="job.failed",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="job.failed"?"Sending...":"Send Example"}),e.jsx(h,{id:"jobs-failed",checked:t.notifications.jobs.failed,onCheckedChange:s=>u("jobs","failed",s),disabled:!t.enabled})]})]})]})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Git Operations"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"git-push",className:"text-sm font-normal",children:"Code pushed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("git.push"),disabled:!d||o==="git.push",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="git.push"?"Sending...":"Send Example"}),e.jsx(h,{id:"git-push",checked:t.notifications.git.push,onCheckedChange:s=>u("git","push",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"git-merge",className:"text-sm font-normal",children:"Branch merged"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("git.merge"),disabled:!d||o==="git.merge",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="git.merge"?"Sending...":"Send Example"}),e.jsx(h,{id:"git-merge",checked:t.notifications.git.merge,onCheckedChange:s=>u("git","merge",s),disabled:!t.enabled})]})]})]})]}),!t.enabled&&t.hasBotToken&&d&&e.jsx("div",{className:"rounded border border-amber-200 bg-amber-50 p-3 text-xs text-amber-700 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200",children:"Enable notifications above to start receiving Slack messages for these events."})]})]})]})}export{be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,bx as p,B as r,P as h,_ as j,ae as u,H as g,I as o}from"./index-
|
|
1
|
+
import{j as e,bx as p,B as r,P as h,_ as j,ae as u,H as g,I as o}from"./index-ByTA2ZiD.js";import{C as a,b as i,c as n,d as c,a as d}from"./card-CL5bB4cs.js";import{L as t}from"./label-Dp0-28_O.js";import{S as f,a as v,b as N,c as y,d as b}from"./select-CfwLZl55.js";import{B as l}from"./badge-BbfU_aPt.js";import{E as w}from"./eye-Cx9ZGkg5.js";import{D as C}from"./download-DeEju9jg.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";function B(){const m=[{id:"1",name:"Code Review Assistant",description:"Prompt for AI agents to perform thorough code reviews",category:"Code Review",usage:"cursor-cli, claude-code",lastUpdated:"2 days ago",active:!0},{id:"2",name:"Architecture Advisor",description:"System prompt for architectural decision guidance",category:"Architecture",usage:"gemini-cli, claude-code",lastUpdated:"1 week ago",active:!0},{id:"3",name:"Bug Analysis Expert",description:"Specialized prompt for debugging and error analysis",category:"Debugging",usage:"cursor-cli",lastUpdated:"3 days ago",active:!1},{id:"4",name:"Documentation Generator",description:"Prompt for generating comprehensive code documentation",category:"Documentation",usage:"github-copilot, claude-code",lastUpdated:"5 days ago",active:!0}],x=["Code Review","Architecture","Debugging","Documentation","Testing","Refactoring","Security","Performance"];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"System Prompts"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage system prompts used by AI agents and integrations for consistent behavior."})]}),e.jsx(p,{}),e.jsxs(a,{children:[e.jsx(i,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Prompt Library"}),e.jsx(c,{children:"Pre-configured prompts for different AI agents and use cases."})]}),e.jsxs(r,{size:"sm",children:[e.jsx(h,{className:"h-4 w-4 mr-2"}),"New Prompt"]})]})}),e.jsx(d,{children:e.jsx("div",{className:"space-y-4",children:m.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h4",{className:"font-medium",children:s.name}),e.jsx(l,{variant:s.active?"default":"secondary",children:s.active?"Active":"Inactive"}),e.jsx(l,{variant:"outline",children:s.category})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.description}),e.jsxs("div",{className:"flex items-center space-x-4 mt-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used by: ",s.usage]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Updated: ",s.lastUpdated]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(w,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(j,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(u,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(g,{className:"h-4 w-4"})})]})]},s.id))})})]}),e.jsxs(a,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Create New Prompt"}),e.jsx(c,{children:"Design a new system prompt for your AI agents and integrations."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(t,{htmlFor:"promptName",children:"Prompt Name"}),e.jsx(o,{id:"promptName",placeholder:"Enter prompt name"})]}),e.jsxs("div",{children:[e.jsx(t,{htmlFor:"promptCategory",children:"Category"}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(N,{placeholder:"Select category"})}),e.jsx(y,{children:x.map(s=>e.jsx(b,{value:s.toLowerCase(),children:s},s))})]})]})]}),e.jsxs("div",{children:[e.jsx(t,{htmlFor:"promptDescription",children:"Description"}),e.jsx(o,{id:"promptDescription",placeholder:"Brief description of the prompt's purpose"})]}),e.jsxs("div",{children:[e.jsx(t,{htmlFor:"targetIntegrations",children:"Target Integrations"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:["cursor-cli","claude-code","gemini-cli","github-copilot"].map(s=>e.jsxs("label",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",className:"rounded"}),e.jsx("span",{className:"text-sm",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(t,{htmlFor:"promptContent",children:"Prompt Content"}),e.jsx("textarea",{id:"promptContent",className:"w-full min-h-[200px] p-3 border rounded-md font-mono text-sm",placeholder:"You are an expert code reviewer. Your task is to..."})]}),e.jsxs("div",{children:[e.jsx(t,{htmlFor:"promptVariables",children:"Variables (JSON format)"}),e.jsx("textarea",{id:"promptVariables",className:"w-full min-h-[100px] p-3 border rounded-md font-mono text-sm",placeholder:'{"language": "typescript", "framework": "react", "style": "functional"}'})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(r,{variant:"outline",children:"Preview"}),e.jsx(r,{variant:"outline",children:"Save as Draft"}),e.jsx(r,{children:"Save & Activate"})]})]})]}),e.jsxs(a,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Prompt Templates"}),e.jsx(c,{children:"Import and export prompt templates for sharing across teams."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(r,{variant:"outline",size:"sm",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Import Template"]}),e.jsx(r,{variant:"outline",size:"sm",children:"Export All Prompts"}),e.jsx(r,{variant:"outline",size:"sm",children:"Export Selected"})]}),e.jsx("div",{className:"p-4 border-2 border-dashed rounded-lg text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag and drop prompt template files here, or click to browse"})})]})]})]})}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as Z,u as ee,a as se,r as a,A as u,j as e,B as i,ad as te,ae as A,m as ae,F as M,X as ie,ap as re,aq as le,ar as ne,as as oe}from"./index-UXL5-kaP.js";import{B as ce}from"./badge-vIqE5SOP.js";import{c as W}from"./clipboard-B9ndUJKl.js";import{A as B}from"./arrow-left-DWmf9YJp.js";import{L as de,H as me,I as ue,V as xe,M as R,F as he,a as I}from"./video-CY_dOujm.js";import{D as U}from"./download-CE8b59ER.js";import{T as fe}from"./tag-CkcZNLnh.js";function ke(){const{id:x}=Z(),b=ee(),{toast:o}=se(),[s,p]=a.useState(null),[G,C]=a.useState(!0),[L,h]=a.useState(null),[r,j]=a.useState(null),[f,F]=a.useState(!1),[g,c]=a.useState(!1),[V,E]=a.useState(!1),[S,T]=a.useState(!1);a.useEffect(()=>{x&&(C(!0),h(null),fetch(`${u}/api/v1/resources/${x}`).then(t=>{if(!t.ok)throw new Error(`Resource not found (${t.status})`);if(t.headers.get("content-type")?.includes("application/json"))return t.json();throw new Error("NEED_METADATA")}).then(t=>{if(t.success&&t.data)p(t.data);else if(t.id)p(t);else throw new Error("Invalid response")}).catch(async t=>{if(t.message==="NEED_METADATA")try{const d=await(await fetch(`${u}/api/v1/resources`)).json();if(d.success&&d.data){const m=d.data.find(Q=>Q.id===x);if(m){p(m);return}}h("Resource not found")}catch{h("Failed to load resource")}else h(t.message||"Failed to load resource")}).finally(()=>C(!1)))},[x]),a.useEffect(()=>{T(!1)},[s?.id]);const l=s?`${u}/api/v1/resources/${s.id}`:"",w=s?.thumbnailPath?`${u}/api/v1/resources/${s.id}/thumbnail`:"",D=s?.type.startsWith("image/")??!1,P=s?s.type==="image/svg+xml"||s.name.toLowerCase().endsWith(".svg"):!1,_=s?s.type==="application/pdf"||s.name.toLowerCase().endsWith(".pdf"):!1,H=s?.type.startsWith("video/")??!1,J=s?.type.startsWith("audio/")??!1,v=s?s.type.startsWith("text/")||s.type==="application/json"||s.type.includes("javascript")||s.type.includes("typescript")||s.type.includes("xml")||s.name.toLowerCase().match(/\.(txt|md|json|js|ts|jsx|tsx|css|html|xml|yaml|yml|log|sh|bash|zsh|fish)$/)!==null:!1,N=s?s.name.toLowerCase().endsWith(".md")||s.name.toLowerCase().endsWith(".markdown"):!1,y=s?s.type==="application/json"||s.name.toLowerCase().endsWith(".json"):!1,k=s?s.type==="text/html"||s.name.toLowerCase().endsWith(".html"):!1;a.useEffect(()=>{s&&(v||N||y||k)?(F(!0),fetch(l).then(t=>{if(t.ok)return t.text();throw new Error("Failed to load file")}).then(t=>j(t)).catch(t=>{console.error("Failed to load text content:",t),j(null)}).finally(()=>F(!1))):j(null)},[s?.id,v,N,y,k,l]),a.useEffect(()=>{const t=n=>{n.key==="Escape"&&g&&c(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[g]);const O=t=>{if(t===0)return"0 B";const n=1024,d=["B","KB","MB","GB"],m=Math.floor(Math.log(t)/Math.log(n));return parseFloat((t/Math.pow(n,m)).toFixed(2))+" "+d[m]},K=t=>new Date(t).toLocaleString(),z=t=>t.startsWith("image/")?e.jsx(ue,{className:"h-6 w-6"}):t.startsWith("video/")?e.jsx(xe,{className:"h-6 w-6"}):t.startsWith("audio/")?e.jsx(R,{className:"h-6 w-6"}):t.includes("text")||t.includes("document")||t.includes("code")?e.jsx(M,{className:"h-6 w-6"}):t.includes("json")||t.includes("javascript")||t.includes("typescript")?e.jsx(he,{className:"h-6 w-6"}):e.jsx(re,{className:"h-6 w-6"}),$=()=>{s&&window.open(`${u}/api/v1/resources/${s.id}?download=true`)},Y=async()=>{if(s)try{const t=`.nut/resources/files/${s.path}`;await W(t),o({title:"Path copied!",description:`Copied ${t} to clipboard`})}catch{o({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},q=async()=>{if(s)try{const t=`${window.location.origin}/resources/${s.id}`;await W(t),E(!0),o({title:"Link copied!",description:"Share link copied to clipboard"}),setTimeout(()=>E(!1),2e3)}catch{o({title:"Failed to copy",description:"Unable to copy link to clipboard",variant:"destructive"})}},X=()=>{if(!s)return null;if(P)return e.jsxs(e.Fragment,{children:[e.jsx("img",{src:l,alt:s.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}),e.jsx(i,{variant:"secondary",size:"icon",className:"absolute bottom-3 right-3 h-8 w-8 opacity-70 hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:e.jsx(I,{className:"h-4 w-4"})})]});if(_)return e.jsx("iframe",{src:l,className:"w-full h-full min-h-[600px] rounded-lg border",title:s.name});if(H)return e.jsx("video",{src:l,controls:!0,className:"max-w-full max-h-full rounded-lg shadow-lg",children:"Your browser does not support the video tag."});if(J)return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(R,{className:"h-24 w-24 text-muted-foreground/50"})}),e.jsx("div",{className:"flex-shrink-0 p-6 bg-muted/30 flex justify-center",children:e.jsx("audio",{src:l,controls:!0,className:"w-3/4 min-w-[300px]",children:"Your browser does not support the audio tag."})})]});if(N&&r!==null)return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6 prose prose-sm dark:prose-invert max-w-none",children:e.jsx(le,{remarkPlugins:[oe],rehypePlugins:[ne],children:r})});if(k&&r!==null)return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("iframe",{srcDoc:r,className:"w-full h-full min-h-[600px] rounded-lg border",title:s.name,sandbox:"allow-same-origin"});if(y&&r!==null){if(f)return e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})});let t=r;try{const n=JSON.parse(r);t=JSON.stringify(n,null,2)}catch{}return e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto",children:e.jsx("code",{children:t})})})}return v&&r!==null?f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto whitespace-pre-wrap",children:e.jsx("code",{children:r})})}):D?e.jsxs(e.Fragment,{children:[w&&!S&&e.jsx("img",{src:w,alt:s.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg blur-[2px] scale-[1.01]"}),e.jsx("img",{src:l,alt:s.name,className:`max-w-full max-h-full object-contain rounded-lg shadow-lg ${w&&!S?"absolute inset-0 m-auto opacity-0":""}`,onLoad:()=>T(!0)}),e.jsx(i,{variant:"secondary",size:"icon",className:"absolute bottom-3 right-3 h-8 w-8 opacity-70 hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:e.jsx(I,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-muted-foreground",children:[z(s.type),e.jsx("p",{className:"text-sm",children:"Preview not available for this file type"}),e.jsxs(i,{variant:"outline",onClick:$,children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),"Download to view"]})]})};return G?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading resource..."})}):L||!s?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:L||"Resource not found"}),e.jsxs(i,{variant:"outline",onClick:()=>b("/resources"),children:[e.jsx(B,{className:"mr-2 h-4 w-4"}),"Back to Resources"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-6 py-4 flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(i,{variant:"ghost",size:"icon",onClick:()=>b("/resources"),title:"Back to Resources",children:e.jsx(B,{className:"h-4 w-4"})}),z(s.type),e.jsxs("div",{className:"min-w-0 flex items-baseline gap-3",children:[e.jsx("h1",{className:"text-xl font-semibold truncate",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground flex-shrink-0",children:s.type})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(i,{variant:"ghost",size:"sm",onClick:q,title:"Copy share link",children:V?e.jsx(te,{className:"h-4 w-4"}):e.jsx(de,{className:"h-4 w-4"})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:Y,title:"Copy path to clipboard",children:e.jsx(A,{className:"h-4 w-4"})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:$,title:"Download",children:e.jsx(U,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 relative flex items-center justify-center bg-muted/30 p-6 overflow-hidden border rounded-lg",children:X()}),e.jsx("div",{className:"p-6 flex-shrink-0 bg-background",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-x-6 gap-y-2 md:grid-cols-2 text-sm",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Size:"}),e.jsx("span",{children:O(s.size)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Uploaded:"}),e.jsx("span",{children:K(s.uploadedAt)})]})]}),e.jsx("div",{className:"space-y-2",children:s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.metadata.tags.map(t=>e.jsx(ce,{variant:"secondary",className:"text-xs",children:t},t))})]})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.metadata.description?e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Description:"}),e.jsx("span",{className:"truncate flex-1",title:s.metadata.description,children:s.metadata.description})]}):e.jsx("div",{className:"flex-1"}),s.metadata.generationPrompt&&e.jsxs(i,{size:"sm",className:"h-6 text-xs px-2 flex-shrink-0",onClick:()=>{navigator.clipboard.writeText(s.metadata.generationPrompt||""),o({title:"Prompt copied!",description:"Generation prompt copied to clipboard"})},children:[e.jsx(A,{className:"h-2.5 w-2.5 mr-1"}),"Copy Prompt"]})]})]})})]}),g&&(D||P)&&e.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/95 flex items-center justify-center",onClick:()=>c(!1),children:[e.jsx(i,{variant:"ghost",size:"icon",className:"absolute top-4 right-4 h-10 w-10 text-white hover:bg-white/20",onClick:()=>c(!1),children:e.jsx(ie,{className:"h-6 w-6"})}),e.jsx("img",{src:l,alt:s.name,className:"max-w-[95vw] max-h-[95vh] object-contain",onClick:t=>t.stopPropagation()})]})]})}export{ke as default};
|
|
1
|
+
import{y as Z,u as ee,a as se,r as a,A as u,j as e,B as i,ad as te,ae as A,m as ae,F as M,X as ie,ap as re,aq as le,ar as ne,as as oe}from"./index-ByTA2ZiD.js";import{B as ce}from"./badge-BbfU_aPt.js";import{c as W}from"./clipboard-B9ndUJKl.js";import{A as B}from"./arrow-left-B9NBHEkS.js";import{L as de,H as me,I as ue,V as xe,M as R,F as he,a as I}from"./video-CuyRES-H.js";import{D as U}from"./download-DeEju9jg.js";import{T as fe}from"./tag-rYG4CdRx.js";function ke(){const{id:x}=Z(),b=ee(),{toast:o}=se(),[s,p]=a.useState(null),[G,C]=a.useState(!0),[L,h]=a.useState(null),[r,j]=a.useState(null),[f,F]=a.useState(!1),[g,c]=a.useState(!1),[V,E]=a.useState(!1),[S,T]=a.useState(!1);a.useEffect(()=>{x&&(C(!0),h(null),fetch(`${u}/api/v1/resources/${x}`).then(t=>{if(!t.ok)throw new Error(`Resource not found (${t.status})`);if(t.headers.get("content-type")?.includes("application/json"))return t.json();throw new Error("NEED_METADATA")}).then(t=>{if(t.success&&t.data)p(t.data);else if(t.id)p(t);else throw new Error("Invalid response")}).catch(async t=>{if(t.message==="NEED_METADATA")try{const d=await(await fetch(`${u}/api/v1/resources`)).json();if(d.success&&d.data){const m=d.data.find(Q=>Q.id===x);if(m){p(m);return}}h("Resource not found")}catch{h("Failed to load resource")}else h(t.message||"Failed to load resource")}).finally(()=>C(!1)))},[x]),a.useEffect(()=>{T(!1)},[s?.id]);const l=s?`${u}/api/v1/resources/${s.id}`:"",w=s?.thumbnailPath?`${u}/api/v1/resources/${s.id}/thumbnail`:"",D=s?.type.startsWith("image/")??!1,P=s?s.type==="image/svg+xml"||s.name.toLowerCase().endsWith(".svg"):!1,_=s?s.type==="application/pdf"||s.name.toLowerCase().endsWith(".pdf"):!1,H=s?.type.startsWith("video/")??!1,J=s?.type.startsWith("audio/")??!1,v=s?s.type.startsWith("text/")||s.type==="application/json"||s.type.includes("javascript")||s.type.includes("typescript")||s.type.includes("xml")||s.name.toLowerCase().match(/\.(txt|md|json|js|ts|jsx|tsx|css|html|xml|yaml|yml|log|sh|bash|zsh|fish)$/)!==null:!1,N=s?s.name.toLowerCase().endsWith(".md")||s.name.toLowerCase().endsWith(".markdown"):!1,y=s?s.type==="application/json"||s.name.toLowerCase().endsWith(".json"):!1,k=s?s.type==="text/html"||s.name.toLowerCase().endsWith(".html"):!1;a.useEffect(()=>{s&&(v||N||y||k)?(F(!0),fetch(l).then(t=>{if(t.ok)return t.text();throw new Error("Failed to load file")}).then(t=>j(t)).catch(t=>{console.error("Failed to load text content:",t),j(null)}).finally(()=>F(!1))):j(null)},[s?.id,v,N,y,k,l]),a.useEffect(()=>{const t=n=>{n.key==="Escape"&&g&&c(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[g]);const O=t=>{if(t===0)return"0 B";const n=1024,d=["B","KB","MB","GB"],m=Math.floor(Math.log(t)/Math.log(n));return parseFloat((t/Math.pow(n,m)).toFixed(2))+" "+d[m]},K=t=>new Date(t).toLocaleString(),z=t=>t.startsWith("image/")?e.jsx(ue,{className:"h-6 w-6"}):t.startsWith("video/")?e.jsx(xe,{className:"h-6 w-6"}):t.startsWith("audio/")?e.jsx(R,{className:"h-6 w-6"}):t.includes("text")||t.includes("document")||t.includes("code")?e.jsx(M,{className:"h-6 w-6"}):t.includes("json")||t.includes("javascript")||t.includes("typescript")?e.jsx(he,{className:"h-6 w-6"}):e.jsx(re,{className:"h-6 w-6"}),$=()=>{s&&window.open(`${u}/api/v1/resources/${s.id}?download=true`)},Y=async()=>{if(s)try{const t=`.nut/resources/files/${s.path}`;await W(t),o({title:"Path copied!",description:`Copied ${t} to clipboard`})}catch{o({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},q=async()=>{if(s)try{const t=`${window.location.origin}/resources/${s.id}`;await W(t),E(!0),o({title:"Link copied!",description:"Share link copied to clipboard"}),setTimeout(()=>E(!1),2e3)}catch{o({title:"Failed to copy",description:"Unable to copy link to clipboard",variant:"destructive"})}},X=()=>{if(!s)return null;if(P)return e.jsxs(e.Fragment,{children:[e.jsx("img",{src:l,alt:s.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}),e.jsx(i,{variant:"secondary",size:"icon",className:"absolute bottom-3 right-3 h-8 w-8 opacity-70 hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:e.jsx(I,{className:"h-4 w-4"})})]});if(_)return e.jsx("iframe",{src:l,className:"w-full h-full min-h-[600px] rounded-lg border",title:s.name});if(H)return e.jsx("video",{src:l,controls:!0,className:"max-w-full max-h-full rounded-lg shadow-lg",children:"Your browser does not support the video tag."});if(J)return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(R,{className:"h-24 w-24 text-muted-foreground/50"})}),e.jsx("div",{className:"flex-shrink-0 p-6 bg-muted/30 flex justify-center",children:e.jsx("audio",{src:l,controls:!0,className:"w-3/4 min-w-[300px]",children:"Your browser does not support the audio tag."})})]});if(N&&r!==null)return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6 prose prose-sm dark:prose-invert max-w-none",children:e.jsx(le,{remarkPlugins:[oe],rehypePlugins:[ne],children:r})});if(k&&r!==null)return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("iframe",{srcDoc:r,className:"w-full h-full min-h-[600px] rounded-lg border",title:s.name,sandbox:"allow-same-origin"});if(y&&r!==null){if(f)return e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})});let t=r;try{const n=JSON.parse(r);t=JSON.stringify(n,null,2)}catch{}return e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto",children:e.jsx("code",{children:t})})})}return v&&r!==null?f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto whitespace-pre-wrap",children:e.jsx("code",{children:r})})}):D?e.jsxs(e.Fragment,{children:[w&&!S&&e.jsx("img",{src:w,alt:s.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg blur-[2px] scale-[1.01]"}),e.jsx("img",{src:l,alt:s.name,className:`max-w-full max-h-full object-contain rounded-lg shadow-lg ${w&&!S?"absolute inset-0 m-auto opacity-0":""}`,onLoad:()=>T(!0)}),e.jsx(i,{variant:"secondary",size:"icon",className:"absolute bottom-3 right-3 h-8 w-8 opacity-70 hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:e.jsx(I,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-muted-foreground",children:[z(s.type),e.jsx("p",{className:"text-sm",children:"Preview not available for this file type"}),e.jsxs(i,{variant:"outline",onClick:$,children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),"Download to view"]})]})};return G?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading resource..."})}):L||!s?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:L||"Resource not found"}),e.jsxs(i,{variant:"outline",onClick:()=>b("/resources"),children:[e.jsx(B,{className:"mr-2 h-4 w-4"}),"Back to Resources"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-6 py-4 flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(i,{variant:"ghost",size:"icon",onClick:()=>b("/resources"),title:"Back to Resources",children:e.jsx(B,{className:"h-4 w-4"})}),z(s.type),e.jsxs("div",{className:"min-w-0 flex items-baseline gap-3",children:[e.jsx("h1",{className:"text-xl font-semibold truncate",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground flex-shrink-0",children:s.type})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(i,{variant:"ghost",size:"sm",onClick:q,title:"Copy share link",children:V?e.jsx(te,{className:"h-4 w-4"}):e.jsx(de,{className:"h-4 w-4"})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:Y,title:"Copy path to clipboard",children:e.jsx(A,{className:"h-4 w-4"})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:$,title:"Download",children:e.jsx(U,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 relative flex items-center justify-center bg-muted/30 p-6 overflow-hidden border rounded-lg",children:X()}),e.jsx("div",{className:"p-6 flex-shrink-0 bg-background",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-x-6 gap-y-2 md:grid-cols-2 text-sm",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Size:"}),e.jsx("span",{children:O(s.size)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Uploaded:"}),e.jsx("span",{children:K(s.uploadedAt)})]})]}),e.jsx("div",{className:"space-y-2",children:s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.metadata.tags.map(t=>e.jsx(ce,{variant:"secondary",className:"text-xs",children:t},t))})]})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.metadata.description?e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Description:"}),e.jsx("span",{className:"truncate flex-1",title:s.metadata.description,children:s.metadata.description})]}):e.jsx("div",{className:"flex-1"}),s.metadata.generationPrompt&&e.jsxs(i,{size:"sm",className:"h-6 text-xs px-2 flex-shrink-0",onClick:()=>{navigator.clipboard.writeText(s.metadata.generationPrompt||""),o({title:"Prompt copied!",description:"Generation prompt copied to clipboard"})},children:[e.jsx(A,{className:"h-2.5 w-2.5 mr-1"}),"Copy Prompt"]})]})]})})]}),g&&(D||P)&&e.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/95 flex items-center justify-center",onClick:()=>c(!1),children:[e.jsx(i,{variant:"ghost",size:"icon",className:"absolute top-4 right-4 h-10 w-10 text-white hover:bg-white/20",onClick:()=>c(!1),children:e.jsx(ie,{className:"h-6 w-6"})}),e.jsx("img",{src:l,alt:s.name,className:"max-w-[95vw] max-h-[95vh] object-contain",onClick:t=>t.stopPropagation()})]})]})}export{ke as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as xe,r as t,j as e,D as pe,b as ge,d as ve,f as je,v as le,S as os,B as F,ad as Xe,h as Ee,a as $e,A as ae,o as be,aa as Ve,p as ue,af as ca,ag as da,ah as ua,ai as we,aj as Fe,ak as _e,al as ma,am as Bs,an as ha,ao as xa,e as fa,I as We,ae as Ze,X as cs,C as $s,m as pa,F as Ne,ap as es,aq as ga,ar as va,as as ja,a4 as ba,a5 as wa,n as Na,a6 as ya,at as Je,P as ds,g as us,H as ms,au as _a}from"./index-
|
|
1
|
+
import{c as xe,r as t,j as e,D as pe,b as ge,d as ve,f as je,v as le,S as os,B as F,ad as Xe,h as Ee,a as $e,A as ae,o as be,aa as Ve,p as ue,af as ca,ag as da,ah as ua,ai as we,aj as Fe,ak as _e,al as ma,am as Bs,an as ha,ao as xa,e as fa,I as We,ae as Ze,X as cs,C as $s,m as pa,F as Ne,ap as es,aq as ga,ar as va,as as ja,a4 as ba,a5 as wa,n as Na,a6 as ya,at as Je,P as ds,g as us,H as ms,au as _a}from"./index-ByTA2ZiD.js";import{C as Ye,b as hs,a as Qe,c as Sa,d as Ca}from"./card-CL5bB4cs.js";import{L as C}from"./label-Dp0-28_O.js";import{B as Me}from"./badge-BbfU_aPt.js";import{c as ka}from"./clipboard-B9ndUJKl.js";import{S as B,a as $,b as U,c as z,d as K}from"./select-CfwLZl55.js";import{R as Us}from"./registry-ANRa5WBi.js";import{I as ye,M as fe,V as Be,L as Pa,H as Ea,F as ss,a as xs}from"./video-CuyRES-H.js";import{D as as}from"./download-DeEju9jg.js";import{C as zs}from"./chevron-left-B-7K6MNx.js";import{T as Ma}from"./tag-rYG4CdRx.js";import{S as Fa}from"./search-BgbqRUnf.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{u as N,a as E,r as s,A as o,j as e,B as v,L as R,a1 as D}from"./index-
|
|
1
|
+
import{u as N,a as E,r as s,A as o,j as e,B as v,L as R,a1 as D}from"./index-ByTA2ZiD.js";import{C as y,a as S,b as A,c as L}from"./card-CL5bB4cs.js";import{L as P}from"./label-Dp0-28_O.js";import{S as z,a as I,b as q,c as T,d as M}from"./select-CfwLZl55.js";import{M as O}from"./markdown-editor-DUmrf1eN.js";import{A as B}from"./arrow-left-B9NBHEkS.js";import{C as F}from"./circle-check-big-BwQ_q1N7.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";const d=[{id:"software-engineer",title:"Software Engineer",description:"Builds, refactors, and reviews high-quality code across stacks. Excellent at translating specs into implementation and optimizing system performance. Strong at debugging, architecture patterns, and accelerating development velocity."},{id:"product-strategist",title:"Product Strategist",description:"Defines product direction, clarifies requirements, and aligns work with user and business goals. Skilled in roadmap planning, prioritization, and transforming ambiguous ideas into actionable plans."},{id:"researcher",title:"Researcher",description:"Investigates topics deeply, synthesizes information, and produces evidence-based insights. Strong at literature review, competitive analysis, and generating clear summaries to inform decisions."},{id:"designer",title:"Designer",description:"Creates intuitive interfaces, user flows, and visual assets. Focused on usability, accessibility, and crafting polished experiences. Strong at wireframing and turning requirements into elegant solutions."},{id:"qa-engineer",title:"QA Engineer",description:"Identifies bugs, edge cases, and reliability gaps. Produces test plans, automated tests, and reproducible reports. Strong at ensuring product quality and preventing regressions."},{id:"devops-engineer",title:"DevOps Engineer",description:"Manages infrastructure, deployments, and operational reliability. Skilled with CI/CD, observability, automation, and environment provisioning. Ensures systems are scalable and fault-tolerant."},{id:"data-analyst",title:"Data Analyst",description:"Analyzes data, defines metrics, and generates actionable insights. Strong in SQL, visualization, experimentation, and turning raw data into strategic recommendations."},{id:"marketer",title:"Marketer",description:"Creates campaigns, messaging, and positioning to reach target audiences. Skilled in content, funnels, and brand strategy. Strong at synthesizing market needs and shaping demand."},{id:"sales-partnerships-agent",title:"Sales & Partnerships Agent",description:"Identifies prospects, crafts outreach, and develops strategic relationships. Strong at value articulation, objection handling, and mapping product capabilities to customer needs."},{id:"growth-operator",title:"Growth Operator",description:"Optimizes acquisition, activation, and retention through experimentation. Skilled in funnel analysis, rapid testing, and leveraging data for compounding growth."},{id:"customer-success-specialist",title:"Customer Success Specialist",description:"Ensures users succeed by providing onboarding, guidance, and proactive support. Strong at diagnosing user challenges and improving long-term satisfaction and retention."},{id:"orchestration-engineer",title:"Orchestration Engineer",description:"Coordinates multi-agent workflows, dependencies, and handoffs. Strong at breaking large tasks into sequenced steps and ensuring agents operate cohesively and efficiently."},{id:"context-curator",title:"Context Curator",description:"Maintains clean, accurate project context by organizing files, logs, and knowledge. Strong at eliminating ambiguity, ensuring agents have the right information at the right time."},{id:"documentation-writer",title:"Documentation Writer",description:"Produces clear technical docs, guides, READMEs, and CP summaries. Strong at structuring complex information and keeping knowledge bases up to date and accessible."}];function K(){const j=N(),{toast:a}=E(),[l,c]=s.useState(""),[r,g]=s.useState(""),[b,u]=s.useState(!0),[p,m]=s.useState(!1),h=s.useRef(!1),w=t=>{if(g(t),!h.current)return;const i=d.find(n=>n.id===t);i?.description&&c(i.description)};s.useEffect(()=>{Promise.all([fetch(`${o}/api/v1/context/role`).then(t=>t.json()),fetch(`${o}/api/v1/config`).then(t=>t.json())]).then(([t,i])=>{if(t.success&&c(t.document.content.trim()),i?.success){const n=i.data?.coconut?.role;n&&g(n)}h.current=!0,u(!1)}).catch(t=>{console.error("Failed to load context:",t),a({title:"Error",description:"Failed to load role definition",variant:"destructive"}),u(!1)})},[a]);const C=async()=>{m(!0);try{const t=r?d.find(k=>k.id===r)?.description:void 0,[i,n]=await Promise.all([fetch(`${o}/api/v1/context/role`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l,metadata:{}})}),fetch(`${o}/api/v1/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({coconut:{role:r||void 0,roleDescription:t}})})]),f=await i.json(),x=await n.json();if(f.success&&x.success)a({title:"Success",description:"Role definition saved successfully",action:e.jsx(F,{className:"h-4 w-4"})}),j("/context/role");else throw new Error(f.error||x.error||"Failed to save")}catch(t){console.error("Save error:",t),a({title:"Error",description:"Failed to save role definition",variant:"destructive"})}finally{m(!1)}};return b?e.jsx("div",{className:"space-y-6",children:e.jsx(y,{children:e.jsx(S,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Edit Role Definition"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Define your role, responsibilities, and guidelines"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(v,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(R,{to:"/context/role",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(B,{className:"w-4 h-4"})})}),e.jsxs(v,{onClick:C,disabled:p,size:"sm",children:[e.jsx(D,{className:"w-4 h-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:p?"Saving...":"Save"})]})]})]}),e.jsxs(y,{children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(L,{children:"Role Documentation"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"text-sm text-muted-foreground",children:"Role:"}),e.jsxs(z,{value:r,onValueChange:w,children:[e.jsx(I,{className:"w-48",children:e.jsx(q,{placeholder:"Select role"})}),e.jsx(T,{children:d.map(t=>e.jsx(M,{value:t.id,children:t.title},t.id))})]})]})]})}),e.jsx(S,{children:e.jsx(O,{value:l,onChange:t=>c(t||""),placeholder:`Write your role definition in markdown...
|
|
2
2
|
|
|
3
3
|
## Your Role
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N,r as t,A as v,j as e,v as C,F as g,B as a,L as c,_ as d,M as w,au as y,aq as b}from"./index-
|
|
1
|
+
import{a as N,r as t,A as v,j as e,v as C,F as g,B as a,L as c,_ as d,M as w,au as y,aq as b}from"./index-ByTA2ZiD.js";import{C as i,a as r,b as E}from"./card-CL5bB4cs.js";import{c as k}from"./clipboard-B9ndUJKl.js";function L(){const{toast:l}=N(),[o,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${v}/api/v1/context/role`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/role.md";try{await k(s),l({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),l({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"role-md",filename:"role.md",name:"role.md",path:".nut/context/role.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading role definition..."})]})})})}):!u||!o?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(g,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Role Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Role definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(c,{to:"/context/role/edit",children:[e.jsx(d,{className:"h-4 w-4 mr-2"}),"Create Role Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Role"}),e.jsx("p",{className:"text-muted-foreground",children:"This Coconut's responsibilities and guidelines"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(c,{to:"/context/role/edit",children:[e.jsx(d,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(E,{className:"pb-0"}),e.jsx(r,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(b,{children:o.content||"No content available"})})})]})]})}export{L as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as f,r,A as p,j as e,bx as F,B as l,P as L,I as c,H as T}from"./index-
|
|
1
|
+
import{c as f,r,A as p,j as e,bx as F,B as l,P as L,I as c,H as T}from"./index-ByTA2ZiD.js";import{C as I,b as z,a as _}from"./card-CL5bB4cs.js";import{L as n}from"./label-Dp0-28_O.js";import{B as D}from"./badge-BbfU_aPt.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as E,r as c,j as e,B as h,L as x,F as B,T as F,v as I,bx as D,A as p}from"./index-
|
|
1
|
+
import{y as E,r as c,j as e,B as h,L as x,F as B,T as F,v as I,bx as D,A as p}from"./index-ByTA2ZiD.js";import{C as o,a as m,b as N,c as v,d as z}from"./card-CL5bB4cs.js";import{B as b}from"./badge-BbfU_aPt.js";import{A as w}from"./arrow-left-B9NBHEkS.js";import{T as P}from"./triangle-alert-C0ovMJwZ.js";import{C as y}from"./clock-D-X3KCw6.js";const f=t=>{if(!t)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t))}catch{return t}},J=t=>{if(!t)return"—";const s=new Date(t).getTime()-Date.now(),a=Math.round(s/(1e3*60));if(Number.isNaN(a))return f(t);if(Math.abs(a)<1)return"now";if(a>0){if(a<60)return`in ${a}m`;const i=Math.round(a/60);return i<24?`in ${i}h`:`in ${Math.round(i/24)}d`}const r=Math.abs(a);if(r<60)return`${r}m ago`;const d=Math.round(r/60);return d<24?`${d}h ago`:`${Math.round(d/24)}d ago`},U=(t,n)=>{if(!n)return"In progress";const s=new Date(n).getTime()-new Date(t).getTime();if(s<1e3)return"<1s";const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const r=Math.floor(a/60),d=a%60;if(r<60)return`${r}m ${d}s`;const u=Math.floor(r/60),i=r%60;return`${u}h ${i}m`},T=t=>{switch(t){case"succeeded":return"default";case"running":return"secondary";case"failed":return"destructive";default:return"outline"}};function O(){const{id:t,runId:n}=E(),[s,a]=c.useState(null),[r,d]=c.useState(""),[u,i]=c.useState(null),[$,C]=c.useState(!0),[M,L]=c.useState(!1),[R,S]=c.useState(null);return c.useEffect(()=>{if(!t||!n)return;(async()=>{try{C(!0);const[l,j]=await Promise.all([fetch(`${p}/api/v1/jobs/${t}/runs/${n}`),fetch(`${p}/api/v1/jobs/${t}`)]),g=await l.json();if(g.success)a(g.data);else{S(g.error?.message||"Failed to fetch run");return}const A=await j.json();A.success&&d(A.data.name)}catch(l){S(l instanceof Error?l.message:"Unknown error")}finally{C(!1)}})()},[t,n]),c.useEffect(()=>{if(!t||!n||!s)return;(async()=>{L(!0);try{const l=await fetch(`${p}/api/v1/jobs/${t}/runs/${n}/log`);if(l.ok){const j=await l.text();i(j)}else i(null)}catch{i(null)}finally{L(!1)}})()},[t,n,s]),$?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:`/schedule/${t}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(w,{className:"h-4 w-4"})})}),e.jsx("div",{className:"h-6 bg-muted rounded w-48 animate-pulse"})]}),e.jsx(o,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})})]}):R||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:`/schedule/${t}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(w,{className:"h-4 w-4"})})}),e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:R||"Run not found"})]}),e.jsx(o,{children:e.jsxs(m,{className:"pt-6 text-center",children:[e.jsxs("p",{className:"text-muted-foreground",children:['The run with ID "',n,'" could not be found.']}),e.jsx(h,{asChild:!0,className:"mt-4",children:e.jsx(x,{to:`/schedule/${t}`,children:"Back to Job"})})]})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-1",children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent shrink-0",children:e.jsx(x,{to:`/schedule/${t}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(w,{className:"h-4 w-4"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Run Details"}),e.jsx(b,{variant:T(s.status),className:"capitalize",children:s.status})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:[r&&e.jsx(x,{to:`/schedule/${t}`,className:"hover:underline",children:r}),r&&" — ",f(s.startedAt)," (",J(s.startedAt),")"]})]})]})})}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[s.error&&e.jsx(o,{className:"border-destructive/50 bg-destructive/5",children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(P,{className:"h-5 w-5 text-destructive shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-destructive mb-1",children:"Error"}),e.jsx("p",{className:"text-sm text-destructive/90",children:s.error})]})]})})}),s.summary&&e.jsxs(o,{children:[e.jsx(N,{children:e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4"}),"Summary"]})}),e.jsx(m,{children:e.jsx("div",{className:"rounded-md bg-muted/50 p-4 font-mono text-sm leading-relaxed whitespace-pre-wrap",children:s.summary})})]}),e.jsxs(o,{children:[e.jsxs(N,{children:[e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4"}),"Full Log"]}),s.outputPath&&e.jsx(z,{children:e.jsx("code",{className:"text-xs",children:s.outputPath})})]}),e.jsx(m,{children:M?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground p-4",children:[e.jsx(I,{className:"h-4 w-4 animate-spin"}),"Loading log..."]}):u?e.jsx("div",{className:"rounded-md bg-muted/50 p-4 font-mono text-xs leading-relaxed max-h-[600px] overflow-auto whitespace-pre-wrap",children:u}):e.jsx("div",{className:"rounded-md border border-dashed bg-muted/20 p-6 text-center text-sm text-muted-foreground",children:"Log not available"})})]})]}),e.jsx("div",{className:"space-y-6",children:e.jsxs(o,{children:[e.jsx(N,{children:e.jsx(v,{children:"Run Information"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Status:"}),e.jsx(b,{variant:T(s.status),className:"capitalize",children:s.status})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Trigger:"}),e.jsx(b,{variant:"outline",className:"capitalize",children:s.trigger})]}),e.jsx(D,{}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Started:"}),e.jsx("span",{children:f(s.startedAt)})]}),s.finishedAt&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Finished:"}),e.jsx("span",{children:f(s.finishedAt)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Duration:"}),e.jsx("span",{className:"font-medium",children:U(s.startedAt,s.finishedAt)})]})]}),s.cliCommand&&e.jsxs(e.Fragment,{children:[e.jsx(D,{}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Command:"}),e.jsx("code",{className:"block mt-1 bg-muted px-2 py-1.5 rounded text-xs break-all",children:s.cliCommand})]})]})]})]})})]})]})}export{O as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as Le,ac as ze,r as u,j as e,B as c,v as P,P as oe,bI as me,z as W,E as ue,H as he,J as U,N as _,O as q,Q as V,R as Y,U as G,V as K,L as $,k as Q,bJ as He,C as xe,D as Be,b as We,d as Ue,f as _e,g as qe,I as X,a4 as pe,a5 as fe,n as ge,a6 as ve,a7 as je,a8 as Ne,a9 as be,o as Ve,aa as Ye,Y as Ge,A as N}from"./index-ByTA2ZiD.js";import{C as R,a as Z,c as ee,b as ye}from"./card-CL5bB4cs.js";import{B as E}from"./badge-BbfU_aPt.js";import{S as Ke,a as Qe,b as Xe,c as Ze,d as es}from"./select-CfwLZl55.js";import{L as f}from"./label-Dp0-28_O.js";import{S as ss}from"./switch-CX_Inx_p.js";import{T as ts,a as as,b as se,c as te}from"./tabs-Bj0YyeRI.js";import{R as rs}from"./refresh-cw-Cj_5MZiJ.js";import{P as we}from"./play-fOwEoIcu.js";import{P as ns}from"./pause-Bfz-QQZp.js";import{C as is}from"./clock-D-X3KCw6.js";import{S as Se}from"./server-u9FLHclt.js";import"./index-CuLP7P_G.js";import"./chevron-up-BwTmMEW2.js";const ne=[{id:"claude",label:"Claude Code"},{id:"gemini",label:"Google Gemini"},{id:"codex",label:"OpenAI Codex"},{id:"droid",label:"Factory Droid"},{id:"kiro",label:"Kiro"}],ls=[{label:"Monday",value:"monday"},{label:"Tuesday",value:"tuesday"},{label:"Wednesday",value:"wednesday"},{label:"Thursday",value:"thursday"},{label:"Friday",value:"friday"},{label:"Saturday",value:"saturday"},{label:"Sunday",value:"sunday"}],Ie=["monday","tuesday","wednesday","thursday","friday"],ds=a=>{if(!a)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(a))}catch{return a}},ae=a=>{if(!a)return"—";const h=new Date(a).getTime()-Date.now(),p=Math.round(h/(1e3*60));if(Number.isNaN(p))return ds(a);if(Math.abs(p)<1)return"now";if(p>0){if(p<60)return`in ${p}m`;const y=Math.round(p/60);return y<24?`in ${y}h`:`in ${Math.round(y/24)}d`}const b=Math.abs(p);if(b<60)return`${b}m ago`;const T=Math.round(b/60);return T<24?`${T}h ago`:`${Math.round(T/24)}d ago`},cs=a=>{if(a.type==="interval"){const o=a.daysOfWeek.map(h=>h.slice(0,3).toUpperCase()).join(", ");return`Every ${a.hours}h (${o||"All days"})`}return a.description||`Cron: ${a.expression}`},os=a=>{const o=ne.find(h=>h.id===a);return o?o.label:a},ke=a=>{switch(a){case"active":case"succeeded":return"default";case"paused":case"running":return"secondary";case"failed":return"destructive";default:return"outline"}},re=()=>({name:"",model:"claude",prompt:"",hours:6,daysOfWeek:new Set(Ie),status:!0,anchorHour:"",agentIds:[],mcpServers:[]}),Ce=a=>{if(a.schedule.type!=="interval")return re();const o=a.agentIds||(a.agentId?[a.agentId]:[]);return{name:a.name,model:ne.some(h=>h.id===a.model)?a.model:"claude",prompt:a.prompt,hours:a.schedule.hours,daysOfWeek:new Set(a.schedule.daysOfWeek),status:a.status==="active",anchorHour:a.schedule.anchorHour===void 0?"":String(a.schedule.anchorHour),agentIds:o,mcpServers:a.mcpServers||[]}},ms=a=>a?Array.isArray(a)?a.filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean):typeof a=="string"?a.split(",").map(o=>o.trim()).filter(Boolean):[]:[];function Cs(){const{toast:a}=Le(),{refresh:o}=ze(),[h,p]=u.useState([]),[b,T]=u.useState(!0),[J,y]=u.useState(!1),[F,w]=u.useState(!1),[n,x]=u.useState(()=>re()),[O,ie]=u.useState(!1),[S,k]=u.useState(null),[d,C]=u.useState(null),[g,Ae]=u.useState([]),[L,De]=u.useState([]),[z,H]=u.useState({open:!1,serverToRemove:null}),I=async(s=!1)=>{try{b||y(!0);const t=await fetch(`${N}/api/v1/jobs`);if(!t.ok)throw new Error(`Failed to fetch jobs (${t.status})`);const r=await t.json();if(!r?.success)throw new Error(r?.error?.message||"Unknown error loading jobs");const i=r.data??[];if(p(i),d){const l=i.find(m=>m.id===d.id);l&&(C(l),l.schedule.type!=="cron"&&x(Ce(l)))}s&&a({title:"Schedule refreshed",description:"Latest job information loaded."})}catch(t){console.error("Failed to load jobs:",t),a({title:"Failed to load schedule",description:t?.message??"Unknown error",variant:"destructive"})}finally{T(!1),y(!1)}};u.useEffect(()=>{I()},[]),u.useEffect(()=>{F&&(async()=>{try{const t=await fetch(`${N}/api/v1/skills`);if(t.ok){const i=await t.json(),m=(Array.isArray(i?.documents)?i.documents:[]).map(j=>({id:j.id,name:j?.metadata?.name||j.id,mcpServers:ms(j?.metadata?.metadata?.mcpServers)}));if(Ae(m),d){const A=(d.agentIds||(d.agentId?[d.agentId]:[])).filter(D=>!m.find(B=>B.id===D));A.length>0&&(a({title:"Some skills are no longer available",description:`The following skills have been removed: ${A.join(", ")}`,variant:"destructive"}),x(D=>({...D,agentIds:D.agentIds.filter(B=>m.find(Oe=>Oe.id===B))})))}}const r=await fetch(`${N}/api/v1/mcp`);if(r.ok){const i=await r.json();if(i?.success&&Array.isArray(i.servers)&&(De(i.servers),d?.mcpServers)){const l=d.mcpServers.filter(m=>!i.servers.includes(m));l.length>0&&(a({title:"Some MCP servers are no longer available",description:`The following servers have been removed: ${l.join(", ")}`,variant:"destructive"}),x(m=>({...m,mcpServers:m.mcpServers.filter(j=>i.servers.includes(j))})))}}}catch(t){console.error("Failed to load skills or MCP servers:",t)}})()},[F,d,a]);const v=s=>{x(t=>({...t,...s}))},le=(s,t)=>{const r=new Set(t);return g.filter(i=>s.includes(i.id)).forEach(i=>{i.mcpServers.forEach(l=>{L.includes(l)&&r.add(l)})}),Array.from(r)},Te=(s,t)=>{x(r=>{let i;if(t){i=[...r.agentIds,s];const l=g.find(m=>m.id===s);if(l&&l.mcpServers.length>0)return{...r,agentIds:i,mcpServers:le(i,r.mcpServers)}}else i=r.agentIds.filter(l=>l!==s);return{...r,agentIds:i}})},$e=(s,t)=>{if(!t&&g.filter(i=>n.agentIds.includes(i.id)&&i.mcpServers.includes(s)).length>0){H({open:!0,serverToRemove:s});return}x(r=>({...r,mcpServers:t?[...r.mcpServers,s]:r.mcpServers.filter(i=>i!==s)}))},Fe=()=>{const s=z.serverToRemove;s&&x(t=>({...t,mcpServers:t.mcpServers.filter(r=>r!==s)})),H({open:!1,serverToRemove:null})},Me=(s,t)=>{x(r=>{const i=new Set(r.daysOfWeek);return t?i.add(s):i.delete(s),i.size===0&&Ie.forEach(l=>i.add(l)),{...r,daysOfWeek:i}})},M=()=>{x(re())},de=()=>{C(null),M(),w(!0)},Pe=s=>{if(s._error){a({title:"Cannot edit corrupted job",description:"Please fix the job file manually at .nut/jobs/"+s.id+".md",variant:"destructive"});return}if(s.schedule.type==="cron"){a({title:"Manual edit required",description:"Cron-based jobs can be edited directly in .nut/jobs/<id>.md for now.",variant:"destructive"});return}C(s),x(Ce(s)),w(!0)},Re=async s=>{if(s.preventDefault(),!n.name.trim()){a({title:"Job name required",description:"Please provide a name for the scheduled job.",variant:"destructive"});return}if(!n.prompt.trim()){a({title:"Prompt required",description:"Please provide instructions for the scheduled job.",variant:"destructive"});return}ie(!0);const t=!!d;try{const r=Number(n.anchorHour.trim()),i=n.anchorHour.trim()===""||Number.isNaN(r)?void 0:Math.min(23,Math.max(0,r)),l={name:n.name.trim(),prompt:n.prompt.trim(),model:n.model,status:n.status?"active":"paused",schedule:{type:"interval",hours:Math.max(1,Number(n.hours)||6),daysOfWeek:Array.from(n.daysOfWeek),anchorHour:i},agentIds:n.agentIds.length>0?n.agentIds:void 0,mcpServers:n.mcpServers.length>0?n.mcpServers:void 0},m=t?`${N}/api/v1/jobs/${d?.id}`:`${N}/api/v1/jobs`,A=await fetch(m,{method:t?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!A.ok){const D=await A.json().catch(()=>({}));throw new Error(D?.error?.message||`Failed to ${t?"update":"create"} job (${A.status})`)}a({title:t?"Scheduled job updated":"Scheduled job created",description:l.name}),w(!1),C(null),M(),await I()}catch(r){console.error("Failed to submit job:",r),a({title:`Failed to ${d?"update":"create"} job`,description:r?.message??"Unknown error",variant:"destructive"})}finally{ie(!1)}},Ee=async s=>{if(s._error){a({title:"Cannot run corrupted job",description:"Please fix the job file manually at .nut/jobs/"+s.id+".md",variant:"destructive"});return}k(s.id);try{const t=await fetch(`${N}/api/v1/jobs/${s.id}/run`,{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r?.error?.message||`Failed to run job (${t.status})`)}a({title:"Run started",description:`${s.name} is executing.`}),await I(),await o()}catch(t){console.error("Failed to run job:",t),a({title:"Run failed to start",description:t?.message??"Unknown error",variant:"destructive"})}finally{k(null)}},Je=async s=>{if(s._error){a({title:"Cannot update corrupted job",description:"Please fix the job file manually at .nut/jobs/"+s.id+".md",variant:"destructive"});return}k(s.id);const t=s.status==="active"?"paused":"active";try{const r=await fetch(`${N}/api/v1/jobs/${s.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i?.error?.message||`Failed to update job (${r.status})`)}a({title:t==="active"?"Job resumed":"Job paused",description:s.name}),await I(),await o()}catch(r){console.error("Failed to update job status:",r),a({title:"Failed to update job",description:r?.message??"Unknown error",variant:"destructive"})}finally{k(null)}},ce=async s=>{k(s.id);try{const t=await fetch(`${N}/api/v1/jobs/${s.id}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r?.error?.message||`Failed to delete job (${t.status})`)}a({title:"Scheduled job deleted",description:s.name}),d?.id===s.id&&(w(!1),C(null),M()),await I()}catch(t){console.error("Failed to delete job:",t),a({title:"Failed to delete job",description:t?.message??"Unknown error",variant:"destructive"})}finally{k(null)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Jobs"}),e.jsx("p",{className:"text-md text-muted-foreground",children:"Automate recurring AI runs"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(c,{variant:"outline",onClick:()=>I(!0),disabled:b||J,children:[J?e.jsx(P,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(rs,{className:"mr-2 h-4 w-4"}),"Refresh"]}),e.jsxs(c,{onClick:de,children:[e.jsx(oe,{className:"mr-2 h-4 w-4"}),"New Scheduled Job"]})]})]}),b?e.jsx(R,{children:e.jsxs(Z,{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(P,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading scheduled jobs..."]})}):h.length===0?e.jsx(R,{className:"border-dashed",children:e.jsxs(Z,{className:"flex flex-col items-center justify-center py-16 px-6 text-center",children:[e.jsx("div",{className:"rounded-full bg-muted p-6 mb-6",children:e.jsx(me,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx(ee,{className:"text-2xl mb-3",children:"No scheduled jobs yet"}),e.jsx("p",{className:"text-muted-foreground max-w-md mb-6",children:"Automate recurring tasks with optional skills and MCP servers. Set up your first job to get started."}),e.jsxs("div",{className:"bg-accent/50 rounded-lg p-6 max-w-lg space-y-3 text-sm text-left",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-primary",children:"1"})}),e.jsx("p",{className:"text-muted-foreground",children:"Choose the days of the week and cadence that fit your workflow"})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-primary",children:"2"})}),e.jsx("p",{className:"text-muted-foreground",children:"Provide detailed instructions so the job can execute safely"})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-primary",children:"3"})}),e.jsx("p",{className:"text-muted-foreground",children:"All runs are logged under for review"})]})]}),e.jsxs(c,{onClick:de,className:"mt-8",size:"lg",children:[e.jsx(oe,{className:"mr-2 h-5 w-5"}),"Create Your First Job"]})]})}):e.jsx("div",{className:"grid gap-4",children:h.map(s=>s._error?e.jsx(R,{className:"border-destructive/50 bg-destructive/5",children:e.jsx(ye,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsxs(ee,{className:"text-lg truncate text-destructive",children:["Unable to load job: ",s.id]}),e.jsx(E,{variant:"destructive",className:"text-xs shrink-0",children:"Error"})]}),e.jsx("p",{className:"text-sm text-destructive/80 mt-1",children:s._error}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Please review the job file at ",e.jsxs("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:[".nut/jobs/",s.id,".md"]})]})]}),e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:e.jsxs(W,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(c,{size:"sm",variant:"ghost",disabled:S===s.id,className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(he,{className:"h-3.5 w-3.5"})})}),e.jsxs(U,{children:[e.jsxs(_,{children:[e.jsx(q,{children:"Delete corrupted job?"}),e.jsxs(V,{children:["This will remove the corrupted job file ",e.jsx("strong",{children:s.id}),". This action cannot be undone."]})]}),e.jsxs(Y,{children:[e.jsx(G,{children:"Cancel"}),e.jsx(K,{onClick:()=>ce(s),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})})]})})},s.id):e.jsxs(R,{className:"group relative overflow-hidden border-border hover:border-primary/50 transition-all hover:shadow-lg",children:[e.jsx(ye,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx($,{to:`/schedule/${s.id}`,className:"hover:underline",children:e.jsx(ee,{className:"text-lg truncate",children:s.name})}),e.jsx(E,{variant:ke(s.status),className:"capitalize text-xs shrink-0",children:s.status})]}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:s.description||s.prompt||"No description provided"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(c,{size:"sm",variant:"default",onClick:()=>Ee(s),disabled:S===s.id,className:"h-8 px-3",children:S===s.id?e.jsx(P,{className:"h-3.5 w-3.5 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(we,{className:"mr-1.5 h-3.5 w-3.5"}),"Run"]})}),e.jsx(c,{size:"sm",variant:"outline",asChild:!0,className:"h-8 px-3 text-xs",children:e.jsx($,{to:`/schedule/${s.id}`,children:"View"})}),e.jsx(c,{size:"sm",variant:"outline",onClick:()=>Pe(s),disabled:S===s.id,className:"h-8 px-3 text-xs",children:"Edit"}),e.jsx(c,{size:"sm",variant:"outline",onClick:()=>Je(s),disabled:S===s.id,className:"h-8 px-2",children:s.status==="active"?e.jsx(ns,{className:"h-3.5 w-3.5"}):e.jsx(we,{className:"h-3.5 w-3.5"})}),e.jsxs(W,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(c,{size:"sm",variant:"ghost",disabled:S===s.id,className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(he,{className:"h-3.5 w-3.5"})})}),e.jsxs(U,{children:[e.jsxs(_,{children:[e.jsx(q,{children:"Delete scheduled job?"}),e.jsxs(V,{children:["This will remove ",e.jsx("strong",{children:s.name}),". Existing run logs will remain in ",e.jsx("code",{children:".nut/jobs/logs"}),"."]})]}),e.jsxs(Y,{children:[e.jsx(G,{children:"Cancel"}),e.jsx(K,{onClick:()=>ce(s),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})}),e.jsxs(Z,{className:"space-y-3 pt-0",children:[e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md bg-accent/30",children:[e.jsx(is,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"min-w-0",children:e.jsx("div",{className:"font-semibold truncate",children:cs(s.schedule)})})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md bg-accent/30",children:[e.jsx(Q,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"font-semibold",children:os(s.model)})]}),e.jsx("div",{className:"flex items-center gap-2 p-2 rounded-md bg-accent/30",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Next"}),e.jsx("div",{className:"font-semibold truncate",children:ae(s.metadata.nextRunAt)})]})}),e.jsx("div",{className:"flex items-center gap-2 p-2 rounded-md bg-accent/30",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Last"}),e.jsx("div",{className:"font-semibold truncate",children:ae(s.metadata.lastRunAt)})]})})]}),(s.agentIds&&s.agentIds.length>0||s.agentId||s.mcpServers&&s.mcpServers.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[(s.agentIds||(s.agentId?[s.agentId]:[])).map(t=>e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(Q,{className:"h-3 w-3 text-blue-600 dark:text-blue-400"}),e.jsx("span",{className:"font-medium text-blue-900 dark:text-blue-100",children:t.replace(".md","")})]},t)),s.mcpServers&&s.mcpServers.length>0&&s.mcpServers.map(t=>e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-purple-50 dark:bg-purple-950/20 border border-purple-200 dark:border-purple-800",children:[e.jsx(Se,{className:"h-3 w-3 text-purple-600 dark:text-purple-400"}),e.jsx("span",{className:"font-medium text-purple-900 dark:text-purple-100",children:t})]},t))]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[e.jsx(He,{className:"h-3 w-3"}),"Recent Runs"]}),s.runs.length>1&&e.jsx(c,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",asChild:!0,children:e.jsxs($,{to:`/schedule/${s.id}`,children:["View All (",s.runs.length,")",e.jsx(xe,{className:"ml-1 h-3 w-3"})]})})]}),s.runs.length===0?e.jsx("div",{className:"rounded-md border border-dashed bg-muted/20 p-4 text-center text-xs text-muted-foreground",children:'No runs yet • Click "Run" to execute'}):e.jsxs("div",{className:"space-y-1.5",children:[s.runs.slice(0,3).map(t=>e.jsxs($,{to:`/schedule/${s.id}/run/${t.id}`,className:"flex items-center gap-2 p-2.5 rounded-md border bg-card/50 hover:bg-accent/50 transition-colors text-xs group",children:[e.jsx(E,{variant:ke(t.status),className:"capitalize text-[10px] h-5 shrink-0",children:t.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-muted-foreground truncate",children:ae(t.startedAt)}),t.error&&e.jsx("p",{className:"text-destructive font-medium mt-0.5 line-clamp-1",children:t.error})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[t.trigger==="manual"&&e.jsx(E,{variant:"outline",className:"text-[10px] h-5",children:"manual"}),e.jsx(xe,{className:"h-3 w-3 text-muted-foreground group-hover:text-foreground transition-colors"})]})]},t.id)),s.runs.length>3&&e.jsx(c,{variant:"ghost",size:"sm",className:"w-full h-7 text-xs",asChild:!0,children:e.jsxs($,{to:`/schedule/${s.id}`,children:["+",s.runs.length-3," more runs"]})})]})]})]})]},s.id))}),e.jsx(Be,{open:F,onOpenChange:s=>{w(s),s||(C(null),M())},children:e.jsxs(We,{className:"sm:max-w-[70rem] h-[min(875px,calc(100vh-2rem))] overflow-hidden !flex flex-col",children:[e.jsxs(Ue,{className:"space-y-2 pb-4 shrink-0",children:[e.jsxs(_e,{className:"text-xl flex items-center gap-2",children:[e.jsx(me,{className:"h-5 w-5 text-primary"}),d?"Edit Scheduled Job":"Create New Scheduled Job"]}),e.jsx(qe,{className:"text-sm",children:d?"Update the prompt, cadence, or skill selection":"Automate recurring tasks with optional skills and MCP access"})]}),e.jsxs("form",{onSubmit:Re,className:"flex flex-col flex-1 min-h-0",children:[e.jsxs(ts,{defaultValue:"basics",className:"flex-1 flex flex-col min-h-0",children:[e.jsxs(as,{className:"grid w-full grid-cols-3 mb-4 shrink-0",children:[e.jsx(se,{value:"basics",children:"Basics"}),e.jsx(se,{value:"schedule",children:"Schedule"}),e.jsx(se,{value:"advanced",children:"Advanced"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto pr-2 -mr-2 min-h-0",children:[e.jsxs(te,{value:"basics",className:"mt-0 space-y-5",children:[e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(f,{htmlFor:"job-name",className:"text-sm font-medium flex items-center gap-1.5",children:["Job Name",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(X,{id:"job-name",placeholder:"e.g., Publish docs nightly",value:n.name,onChange:s=>v({name:s.target.value}),className:"h-11",required:!0})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsx(f,{htmlFor:"job-model",className:"text-sm font-medium",children:"Agent"}),e.jsxs(Ke,{value:n.model,onValueChange:s=>v({model:s}),children:[e.jsx(Qe,{id:"job-model",className:"h-11",children:e.jsx(Xe,{placeholder:"Select a model"})}),e.jsx(Ze,{children:ne.map(s=>e.jsx(es,{value:s.id,children:s.label},s.id))})]})]})]}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(f,{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(Q,{className:"h-4 w-4"}),"Skills",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(optional)"})]}),e.jsxs(pe,{children:[e.jsx(fe,{asChild:!0,children:e.jsxs(c,{variant:"outline",className:"w-full h-11 justify-between font-normal",children:[n.agentIds.length===0?"Select skills...":n.agentIds.length===g.length&&g.length>0?"All skills selected":`${n.agentIds.length} skill${n.agentIds.length!==1?"s":""} selected`,e.jsx(ge,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(ve,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsxs(je,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Available Skills"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(c,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault();const t=g.map(r=>r.id);v({agentIds:t,mcpServers:le(t,n.mcpServers)})},children:"All"}),e.jsx(c,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:s=>{s.preventDefault(),v({agentIds:[]})},children:"None"})]})]}),e.jsx(Ne,{}),g.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-muted-foreground",children:"No skills found"}):g.map(s=>e.jsx(be,{checked:n.agentIds.includes(s.id),onCheckedChange:t=>Te(s.id,t),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",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",{className:"space-y-2.5",children:[e.jsxs(f,{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(Se,{className:"h-4 w-4"}),"MCP Servers",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(optional)"})]}),e.jsxs(pe,{children:[e.jsx(fe,{asChild:!0,children:e.jsxs(c,{variant:"outline",className:"w-full h-11 justify-between font-normal",children:[n.mcpServers.length===0?"No MCP servers selected":`${n.mcpServers.length} server${n.mcpServers.length!==1?"s":""} selected`,e.jsx(ge,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(ve,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsx(je,{children:"Available MCP Servers"}),e.jsx(Ne,{}),L.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-muted-foreground",children:"No MCP servers configured"}):L.map(s=>e.jsx(be,{checked:n.mcpServers.includes(s),onCheckedChange:t=>$e(s,t),children:s},s))]})]})]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(f,{htmlFor:"job-prompt",className:"text-sm font-medium flex items-center gap-1.5",children:[n.agentIds.length>0?"Custom Instructions":"Instructions",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(Ve,{id:"job-prompt",placeholder:n.agentIds.length>0?`Additional instructions to supplement the selected skills...
|
|
2
|
+
Example: Focus on performance optimizations`:`Example:
|
|
3
|
+
Run the following command and append the output to .nut/knowledge/runs.md:
|
|
4
|
+
pnpm test`,value:n.prompt,onChange:s=>v({prompt:s.target.value}),className:"h-[min(42vh,22rem)] resize-none font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-muted-foreground flex items-start gap-1.5",children:[e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:"⚠"}),e.jsx("span",{children:n.agentIds.length>0?"These custom instructions will be combined with the selected skills. Jobs run with autonomous permissions.":"Provide clear, actionable instructions. Jobs run with autonomous permissions - include safety checks where needed."})]})]})]}),e.jsx(te,{value:"schedule",className:"space-y-5 mt-0",children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-[1.2fr_1fr]",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{className:"text-sm font-medium",children:"Days of the Week"}),e.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:ls.map(s=>e.jsxs("label",{className:"flex items-center gap-2.5 text-sm rounded-md border border-input px-3.5 py-2.5 cursor-pointer hover:bg-accent/50 transition-colors",children:[e.jsx(Ye,{checked:n.daysOfWeek.has(s.value),onCheckedChange:t=>Me(s.value,t)}),e.jsx("span",{className:"font-medium",children:s.label})]},s.value))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select which days the job should run"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsx(f,{htmlFor:"job-hours",className:"text-sm font-medium",children:"Frequency (hours)"}),e.jsxs("div",{className:"relative",children:[e.jsx(X,{id:"job-hours",type:"number",min:1,value:n.hours,onChange:s=>v({hours:Number(s.target.value)||1}),className:"h-11 pr-16"}),e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"hours"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"How often the job runs on selected days"})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(f,{htmlFor:"job-anchor",className:"text-sm font-medium flex items-center gap-1.5",children:["Start Hour",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(optional)"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(X,{id:"job-anchor",type:"number",min:0,max:23,placeholder:"Auto",value:n.anchorHour,onChange:s=>v({anchorHour:s.target.value}),className:"h-11"}),e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"0-23"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Preferred starting hour in 24h format"})]})]})]})}),e.jsx(te,{value:"advanced",className:"space-y-5 mt-0",children:e.jsxs("div",{className:"flex items-start gap-4 rounded-lg border border-border bg-accent/20 p-4",children:[e.jsx(ss,{id:"job-status",checked:n.status,onCheckedChange:s=>v({status:s}),className:"mt-1"}),e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx(f,{htmlFor:"job-status",className:"text-base font-semibold cursor-pointer",children:n.status?"Start Active":"Start Paused"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.status?"Job will begin running on the configured schedule immediately after creation.":"Job will be created in a paused state. You can activate it later from the schedule page."})]})]})})]})]}),e.jsxs(Ge,{className:"gap-2 sm:gap-2 pt-4 border-t mt-4",children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>w(!1),disabled:O,className:"min-w-24",children:"Cancel"}),e.jsx(c,{type:"submit",disabled:O||!n.name.trim()||!n.prompt.trim(),className:"min-w-32",children:O?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"mr-2 h-4 w-4 animate-spin"}),d?"Saving...":"Creating..."]}):e.jsx(e.Fragment,{children:d?"Save Changes":"Create Job"})})]})]})]})}),e.jsx(W,{open:z.open,onOpenChange:s=>{s||H({open:!1,serverToRemove:null})},children:e.jsxs(U,{children:[e.jsxs(_,{children:[e.jsx(q,{children:"Remove MCP Server?"}),e.jsxs(V,{children:["One or more selected skills require the ",e.jsx("strong",{children:z.serverToRemove})," MCP server. Removing it may lead to unexpected consequences when the job runs."]})]}),e.jsxs(Y,{children:[e.jsx(G,{children:"Cancel"}),e.jsx(K,{onClick:Fe,children:"OK"})]})]})})]})}export{Cs as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as C,u as S,r as h,j as e,B as a,L as c,_ as E,H as T,k as A,A as N}from"./index-
|
|
1
|
+
import{y as C,u as S,r as h,j as e,B as a,L as c,_ as E,H as T,k as A,A as N}from"./index-ByTA2ZiD.js";import{C as l,b as d,a as o,c as f,d as z}from"./card-CL5bB4cs.js";import{B as v}from"./badge-BbfU_aPt.js";import{A as p}from"./arrow-left-B9NBHEkS.js";function B(n){return n.replace(/[-_]/g," ").replace(/\b\w/g,u=>u.toUpperCase())}const i={blue:{bg:"#dbeafe",border:"#2563eb",text:"#1e40af"},green:{bg:"#dcfce7",border:"#16a34a",text:"#166534"},red:{bg:"#fee2e2",border:"#dc2626",text:"#991b1b"},emerald:{bg:"#d1fae5",border:"#10b981",text:"#047857"},purple:{bg:"#f3e8ff",border:"#9333ea",text:"#6b21a8"},orange:{bg:"#fed7aa",border:"#ea580c",text:"#9a3412"},yellow:{bg:"#fef9c3",border:"#eab308",text:"#854d0e"},teal:{bg:"#ccfbf1",border:"#14b8a6",text:"#0f766e"},indigo:{bg:"#e0e7ff",border:"#6366f1",text:"#4338ca"},pink:{bg:"#fce7f3",border:"#ec4899",text:"#9f1239"},cyan:{bg:"#cffafe",border:"#06b6d4",text:"#155e75"},slate:{bg:"#f1f5f9",border:"#475569",text:"#334155"},gray:{bg:"#f3f4f6",border:"#6b7280",text:"#374151"}};function U(){const n=C(),u=S(),[s,w]=h.useState(null),[k,g]=h.useState(!0),[b,m]=h.useState(null);h.useEffect(()=>{async function r(){try{g(!0);const j=await(await fetch(`${N}/api/v1/skills/${n.id}`)).json();j.success?w(j.document):m(j.error||"Failed to fetch skill")}catch(t){m(t instanceof Error?t.message:"Unknown error")}finally{g(!1)}}n.id&&r()},[n.id]);const y=async()=>{if(!(!s||!confirm("Are you sure you want to delete this skill?")))try{const t=await(await fetch(`${N}/api/v1/skills/${s.id}`,{method:"DELETE"})).json();t.success?u("/skills"):m(t.error?.message||"Failed to delete skill")}catch(r){m(r instanceof Error?r.message:"Unknown error")}};if(k)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-64 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-32 animate-pulse mt-2"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/skills",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})})})]}),e.jsx(l,{children:e.jsxs(d,{children:[e.jsx("div",{className:"h-6 bg-muted rounded w-48 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-64 animate-pulse"})]})})]});if(b||!s)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Skill Not Found"}),e.jsx("p",{className:"text-muted-foreground",children:"The requested skill could not be found"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/skills",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})})})]}),e.jsx(l,{children:e.jsx(o,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-destructive",children:b||"Skill not found"})})})})]});const x=s.metadata?.color||"blue";return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:B(s.name)}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(c,{to:"/skills",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})}),e.jsx(a,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(c,{to:`/skills/${s.id}/edit`,children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(a,{variant:"destructive",size:"sm",onClick:y,children:[e.jsx(T,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Delete"})]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Description"})}),e.jsx(o,{children:e.jsx("p",{children:s.description})})]}),s.content&&e.jsxs(l,{children:[e.jsxs(d,{children:[e.jsx(f,{children:"Instructions"}),e.jsx(z,{children:"System prompt and behavior instructions for this skill"})]}),e.jsx(o,{children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-muted p-4 rounded-md",children:s.content})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Actions"})}),e.jsx(o,{className:"space-y-2",children:e.jsx(a,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(c,{to:`/terminal/sk-${s.id}`,children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Use Skill"]})})})]}),e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Information"})}),e.jsxs(o,{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"Color"}),e.jsx(v,{variant:"outline",className:"capitalize border-2",style:{backgroundColor:i[x]?.bg||i.blue.bg,color:i[x]?.text||i.blue.text,borderColor:i[x]?.border||i.blue.border},children:x})]}),s.allowedTools&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Allowed Tools"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.allowedTools})]}),s.metadata?.mcpServers&&s.metadata.mcpServers.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"MCP Servers"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:s.metadata.mcpServers.map(r=>e.jsx(v,{variant:"secondary",children:r},r))})]}),!s.allowedTools&&!(s.metadata?.mcpServers&&s.metadata.mcpServers.length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Tools"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No specific tools configured - inherits all tools"})]})]})]})]})]})]})}export{U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as Q,u as V,a as W,r as i,j as e,B as u,L as v,k as X,I as B,o as Y,aa as Z,A as y}from"./index-
|
|
1
|
+
import{y as Q,u as V,a as W,r as i,j as e,B as u,L as v,k as X,I as B,o as Y,aa as Z,A as y}from"./index-ByTA2ZiD.js";import{C as N,a as C,b as O,c as ee}from"./card-CL5bB4cs.js";import{L as l}from"./label-Dp0-28_O.js";import{B as se}from"./badge-BbfU_aPt.js";import{c as te}from"./clipboard-B9ndUJKl.js";import{A as D}from"./arrow-left-B9NBHEkS.js";import{C as re,a as ae}from"./clipboard-BHOFelnW.js";function me(){const{id:n}=Q(),q=V(),{toast:S}=W(),[U,k]=i.useState(!0),[o,w]=i.useState(!1),[d,c]=i.useState(null),[f,E]=i.useState(""),[x,P]=i.useState(""),[m,M]=i.useState("blue"),[h,F]=i.useState([]),[p,L]=i.useState(""),[$,g]=i.useState([]),[z,A]=i.useState(!0),[R,I]=i.useState(!1),_=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],H={blue:{bg:"#3b82f6",border:"#1e40af",text:"#ffffff"},green:{bg:"#22c55e",border:"#15803d",text:"#ffffff"},red:{bg:"#ef4444",border:"#b91c1c",text:"#ffffff"},emerald:{bg:"#10b981",border:"#047857",text:"#ffffff"},purple:{bg:"#a855f7",border:"#7e22ce",text:"#ffffff"},orange:{bg:"#f97316",border:"#c2410c",text:"#ffffff"},yellow:{bg:"#eab308",border:"#a16207",text:"#ffffff"},teal:{bg:"#14b8a6",border:"#0f766e",text:"#ffffff"},indigo:{bg:"#6366f1",border:"#4338ca",text:"#ffffff"},pink:{bg:"#ec4899",border:"#be185d",text:"#ffffff"},cyan:{bg:"#06b6d4",border:"#0e7490",text:"#ffffff"},slate:{bg:"#64748b",border:"#475569",text:"#ffffff"},gray:{bg:"#6b7280",border:"#4b5563",text:"#ffffff"}};i.useEffect(()=>{async function s(){try{k(!0);const r=await(await fetch(`${y}/api/v1/skills/${n}`)).json();if(!r.success)throw new Error(r.error||"Failed to load skill");const t=r.document;E(t.name||""),P(t.description||""),M(t.metadata?.color||"blue"),L(t.content||""),F(Array.isArray(t.metadata?.mcpServers)?t.metadata.mcpServers:[])}catch(a){const r=a instanceof Error?a.message:"Failed to load skill";c(r)}finally{k(!1)}}n&&s()},[n]),i.useEffect(()=>{let s=!0;return(async()=>{A(!0);try{const r=await fetch(`${y}/api/v1/mcp`);if(!r.ok)throw new Error("Failed to fetch MCP servers");const t=await r.json();if(!t?.success||!Array.isArray(t.servers)){s&&g([]);return}const b=t.mcpServers&&typeof t.mcpServers=="object"?t.mcpServers:{},K=t.servers.map(T=>{const j=b[T]??{};return{name:T,enabled:j?.enabled!==!1,description:typeof j?.description=="string"?j.description:void 0}});s&&g(K)}catch(r){console.error("Failed to load MCP servers",r),s&&g([])}finally{s&&A(!1)}})(),()=>{s=!1}},[]);const J=async()=>{const s=".nut/config.json";try{await te(s),I(!0),S({title:"Copied!",description:`${s} copied to clipboard`}),setTimeout(()=>I(!1),2e3)}catch(a){console.error("Failed to copy config path:",a),S({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},G=async s=>{if(s.preventDefault(),!f.trim()||!x.trim()||!p.trim()){c("Name, description, and skill instructions are required");return}try{w(!0),c(null);const a={name:f.trim(),description:x.trim(),content:p.trim(),metadata:{color:m,mcpServers:h.length?h:void 0}},t=await(await fetch(`${y}/api/v1/skills/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!t.success)throw new Error(t.error||"Failed to update skill");const b=t.document?.id||n;q(`/skills/${b}`)}catch(a){const r=a instanceof Error?a.message:"Failed to update skill";c(r)}finally{w(!1)}};return U?e.jsx("div",{className:"space-y-6",children:e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:"Loading skill..."})})}):d&&!f?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Skill"}),e.jsx("p",{className:"text-muted-foreground",children:"Unable to load skill"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/skills/${n}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})})})]}),e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:e.jsx("div",{className:"text-destructive",children:d})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Skill"}),e.jsxs("p",{className:"text-muted-foreground",children:["Skill ID: ",n]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/skills/${n}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})})})]}),e.jsxs(N,{children:[e.jsx(O,{children:e.jsxs(ee,{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5"}),"Skill Configuration"]})}),e.jsx(C,{children:e.jsxs("form",{onSubmit:G,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"name",children:"Name *"}),e.jsx(B,{id:"name",value:f,onChange:s=>E(s.target.value),disabled:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"description",children:"Description *"}),e.jsx(B,{id:"description",value:x,onChange:s=>P(s.target.value),disabled:o})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(s=>{const a=H[s];return e.jsx("button",{type:"button",onClick:()=>M(s),disabled:o,className:`w-10 h-10 rounded-md border-2 transition-all ${m===s?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:a.bg,borderColor:m===s?a.border:"hsl(var(--border))",...m===s&&{"--tw-ring-color":a.border}},title:s,children:e.jsx("span",{className:"sr-only",children:s})},s)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"content",children:"Skill Instructions *"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["System prompt or instructions for this skill's behavior."," ","Insert ",e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:".nut/config.json"})," ",e.jsx("button",{type:"button",onClick:J,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:R?e.jsx(re,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(ae,{className:"h-3.5 w-3.5 ml-0.5"})})," ","if you want the skill to be able to access its name, role, or email address."]}),e.jsx(Y,{id:"content",value:p,onChange:s=>L(s.target.value),rows:8,disabled:o,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"MCP Servers (Optional)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this skill requires. Leave empty to inherit all available servers."}),e.jsx("div",{className:"space-y-2",children:z?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers..."}):$.length===0?e.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):$.map(s=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[e.jsx(Z,{checked:h.includes(s.name),onCheckedChange:a=>{F(r=>a===!0?r.includes(s.name)?r:[...r,s.name]:r.filter(t=>t!==s.name))},disabled:o||!s.enabled}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s.name,!s.enabled&&e.jsx(se,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.enabled?s.description||"Enabled MCP server":"Enable this server in Settings to use it"})]})]},s.name))})]}),d&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:d}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(u,{type:"button",variant:"outline",asChild:!0,disabled:o,children:e.jsx(v,{to:`/skills/${n}`,children:"Cancel"})}),e.jsx(u,{type:"submit",disabled:o,children:o?"Saving...":"Save Changes"})]})]})})]})]})}export{me as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as M,j as e,S as $,$ as z,r as f,a as O,A as R,v as _,B as j,L as y,P as E,k as F,ad as B,ae as U}from"./index-
|
|
1
|
+
import{c as M,j as e,S as $,$ as z,r as f,a as O,A as R,v as _,B as j,L as y,P as E,k as F,ad as B,ae as U}from"./index-ByTA2ZiD.js";import{C as N,a as w,b as D,c as K}from"./card-CL5bB4cs.js";import{c as V}from"./clipboard-B9ndUJKl.js";import{R as H,L}from"./browser-modal-J9l3o5os.js";import{R as P,f as Y}from"./registry-ANRa5WBi.js";import{B as v}from"./badge-BbfU_aPt.js";import"./search-BgbqRUnf.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,bx as e,B as a,L as t}from"./index-
|
|
1
|
+
import{j as s,bx as e,B as a,L as t}from"./index-ByTA2ZiD.js";import{C as i,b as l,c as r,d as n,a as d}from"./card-CL5bB4cs.js";import{E as o}from"./external-link-CrRz0sU-.js";function h(){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:"Skills Management"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure and manage AI skills that automate various development tasks."})]}),s.jsx(e,{}),s.jsxs(i,{children:[s.jsxs(l,{children:[s.jsx(r,{children:"Skills"}),s.jsx(n,{children:"Skills are managed from the Skills page. Visit the skills page to create, edit, and manage your AI skills."})]}),s.jsx(d,{children:s.jsx(a,{asChild:!0,children:s.jsxs(t,{to:"/skills",children:[s.jsx(o,{className:"h-4 w-4 mr-2"}),"Go to Skills"]})})})]})]})}export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,j as t,I as p,B as h,P as j,X as N}from"./index-ByTA2ZiD.js";import{E as v}from"./external-link-CrRz0sU-.js";function w({sources:a,onChange:i,disabled:n}){const[l,c]=d.useState(""),[o,m]=d.useState(""),u=()=>{const e=l.trim();if(!e)return;const s=o.trim()||void 0,r={title:e,url:s};i([...a,r]),c(""),m("")},f=e=>{i(a.filter((s,r)=>r!==e))},x=e=>{e.key==="Enter"&&(e.preventDefault(),u())};return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[t.jsx(p,{placeholder:"Source title (e.g., Design System Audit)",value:l,onChange:e=>c(e.target.value),onKeyDown:x,disabled:n,className:"flex-1"}),t.jsx(p,{placeholder:"URL (optional)",value:o,onChange:e=>m(e.target.value),onKeyDown:x,disabled:n,className:"flex-1",type:"url"}),t.jsxs(h,{type:"button",variant:"outline",onClick:u,disabled:n||!l.trim(),className:"shrink-0",children:[t.jsx(j,{className:"h-4 w-4 sm:mr-1"}),t.jsx("span",{className:"hidden sm:inline",children:"Add"})]})]}),a.length>0&&t.jsx("ul",{className:"space-y-2",children:a.map((e,s)=>t.jsxs("li",{className:"flex items-start gap-2 rounded-md border bg-muted/50 p-2 text-sm",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium truncate",children:e.title}),e.url&&t.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary flex items-center gap-1 truncate",children:[t.jsx(v,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:e.url})]})]}),t.jsx(h,{type:"button",variant:"ghost",size:"sm",onClick:()=>f(s),disabled:n,className:"h-6 w-6 p-0 shrink-0","aria-label":`Remove source ${e.title}`,children:t.jsx(N,{className:"h-3 w-3"})})]},s))})]})}export{w as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,j as t,I as d,B as m,X as x}from"./index-
|
|
1
|
+
import{r as p,j as t,I as d,B as m,X as x}from"./index-ByTA2ZiD.js";import{B as f}from"./badge-BbfU_aPt.js";function j({tags:a,onChange:r,disabled:n,placeholder:o}){const[l,s]=p.useState(""),c=()=>{const e=l.trim();if(e){if(a.includes(e)){s("");return}r([...a,e]),s("")}},i=e=>{r(a.filter(u=>u!==e))};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(d,{placeholder:o||"Add a tag",value:l,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),c())},disabled:n}),t.jsx(m,{type:"button",variant:"outline",onClick:c,disabled:n,children:"Add"})]}),a.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:a.map(e=>t.jsxs(f,{variant:"secondary",className:"flex items-center gap-1",children:[e,t.jsx("button",{type:"button",onClick:()=>i(e),className:"ml-1 hover:text-destructive",disabled:n,"aria-label":`Remove tag ${e}`,children:t.jsx(x,{className:"h-3 w-3"})})]},e))})]})}export{j as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as T,y as xe,u as ue,r as i,a as pe,j as e,B as n,L as c,z as je,E as fe,H as ge,J as Ne,N as ye,O as ve,Q as be,R as we,U as Ce,V as ke,D as H,W as V,b as B,d as q,f as J,g as K,Y as G,_ as Se,$ as Q,a0 as De,m as Te,o as Ae,A as u}from"./index-
|
|
1
|
+
import{c as T,y as xe,u as ue,r as i,a as pe,j as e,B as n,L as c,z as je,E as fe,H as ge,J as Ne,N as ye,O as ve,Q as be,R as we,U as Ce,V as ke,D as H,W as V,b as B,d as q,f as J,g as K,Y as G,_ as Se,$ as Q,a0 as De,m as Te,o as Ae,A as u}from"./index-ByTA2ZiD.js";import{c as $e}from"./clipboard-B9ndUJKl.js";import{C as m,b as k,a as h,c as W,d as Pe}from"./card-CL5bB4cs.js";import{B as g}from"./badge-BbfU_aPt.js";import{L as Y}from"./label-Dp0-28_O.js";import{S as X,a as Z,b as ee,c as se,d as te}from"./select-CfwLZl55.js";import{T as Ue,a as ae,g as Ee}from"./status-utils-PwF3DXLL.js";import{A as S}from"./arrow-left-B9NBHEkS.js";import{C as Ie,a as Oe}from"./clipboard-BHOFelnW.js";import{A as Fe}from"./arrow-up-down-DIuMvAne.js";import{I as ze}from"./info-DxhTCbw1.js";import{P as Le}from"./play-fOwEoIcu.js";import{C as Me}from"./clock-D-X3KCw6.js";import{M as _e}from"./message-square-BPOApeM3.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.
|