blade-code 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blade.js +2 -2
- package/dist/{chunk-hjx5n3dw.js → chunk-0g9cb41d.js} +2 -2
- package/dist/{chunk-ctqf59q1.js → chunk-0z5qe4m2.js} +1 -1
- package/dist/{chunk-d4ex0qvs.js → chunk-11s7t9dp.js} +2 -2
- package/dist/{chunk-6yqzfz8t.js → chunk-1evg2hdd.js} +2 -2
- package/dist/{chunk-xhnyy54e.js → chunk-1x3846v7.js} +1 -1
- package/dist/chunk-3wghk9bp.js +1 -0
- package/dist/{chunk-twem6p0g.js → chunk-4fye39a8.js} +2 -2
- package/dist/chunk-510rwhx6.js +1 -0
- package/dist/{chunk-kawv31m3.js → chunk-5ad4qmfj.js} +1 -1
- package/dist/{chunk-0dj326ms.js → chunk-5fw9k1ff.js} +2 -2
- package/dist/{chunk-1pt090dg.js → chunk-6avkjdjc.js} +3 -3
- package/dist/{chunk-k47ssv3b.js → chunk-6jq8h5s9.js} +2 -2
- package/dist/{chunk-1smf2dj3.js → chunk-6x6zqjcs.js} +1 -1
- package/dist/{chunk-jt62ctz7.js → chunk-81p4kz0b.js} +1 -1
- package/dist/chunk-83dkggbx.js +1 -0
- package/dist/{chunk-pdydx73a.js → chunk-887qxhn5.js} +2 -2
- package/dist/{chunk-syj3anec.js → chunk-8epvwyg8.js} +2 -2
- package/dist/{chunk-tv4r86ez.js → chunk-8fp3q919.js} +2 -2
- package/dist/{chunk-yhpm9azy.js → chunk-9b297mzh.js} +1 -1
- package/dist/chunk-9jkbykwq.js +1 -0
- package/dist/{chunk-34pdtz4q.js → chunk-9xvnrq7m.js} +2 -2
- package/dist/chunk-a83s9mww.js +1 -0
- package/dist/{chunk-06h100e2.js → chunk-a90mfxv9.js} +1 -1
- package/dist/chunk-btst30by.js +6 -0
- package/dist/chunk-e9t5ga1b.js +1 -0
- package/dist/chunk-eycs00af.js +1577 -0
- package/dist/{chunk-49g067ek.js → chunk-f3pvwxp8.js} +3 -3
- package/dist/{chunk-neenhtxw.js → chunk-fkaebj8c.js} +1 -1
- package/dist/{chunk-bm8vwfez.js → chunk-fpdqvnmq.js} +2 -2
- package/dist/chunk-gvf4gff0.js +9 -0
- package/dist/{chunk-qwdbqjh7.js → chunk-j14rn2dx.js} +2 -2
- package/dist/{chunk-61952mn3.js → chunk-j77gyhpf.js} +1 -1
- package/dist/chunk-kcjgbbec.js +1 -0
- package/dist/{chunk-9ad7tt9s.js → chunk-kne7h7p5.js} +1 -1
- package/dist/{chunk-9xkjb87h.js → chunk-p4yrmzyr.js} +1 -1
- package/dist/chunk-q223bq79.js +1 -0
- package/dist/chunk-qwfqp465.js +2 -0
- package/dist/{chunk-gsfkrr25.js → chunk-rxjt7ma7.js} +1 -1
- package/dist/{chunk-wmes2tt9.js → chunk-s1y8w68s.js} +1 -1
- package/dist/{chunk-sr3bzb95.js → chunk-w11ht6f9.js} +2 -2
- package/dist/{chunk-dr06x0cw.js → chunk-w4xcmzjm.js} +1 -1
- package/dist/chunk-x83a97eh.js +1 -0
- package/dist/{chunk-x6gt63vz.js → chunk-y08szyf9.js} +28 -28
- package/dist/chunk-yfcfx0zk.js +6 -0
- package/dist/chunk-zns65xsy.js +2 -0
- package/dist/web/assets/FilePreview-60E51igH.js +7 -0
- package/dist/web/assets/{MarkdownRenderer-JJScfgAO.js → MarkdownRenderer-DU7jPn9K.js} +1 -1
- package/dist/web/assets/{McpModal-CiCuIUxC.js → McpModal-CAMU6yrS.js} +2 -2
- package/dist/web/assets/{SettingsModal-Bew818xl.js → SettingsModal-Cjj8NUQy.js} +1 -1
- package/dist/web/assets/{SettingsStore-B_4zN-c-.js → SettingsStore-CjvkbtuZ.js} +1 -1
- package/dist/web/assets/{SkillsModal-Cot4Rb89.js → SkillsModal-Cyc2JAFj.js} +1 -1
- package/dist/web/assets/{TerminalPanel-DxB67ObY.js → TerminalPanel-DI-Ls-U8.js} +1 -1
- package/dist/web/assets/index-BC0ssrep.js +16 -0
- package/dist/web/assets/index-Ci6gCUjf.css +1 -0
- package/dist/web/assets/{vendor-icons-DqO8ishN.js → vendor-icons-DBM55KTG.js} +70 -40
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-04920kz2.js +0 -1570
- package/dist/chunk-07jvw0kn.js +0 -1
- package/dist/chunk-14erxdhd.js +0 -1
- package/dist/chunk-42ch5zg4.js +0 -1
- package/dist/chunk-7j6rxyt8.js +0 -9
- package/dist/chunk-a12tmmfr.js +0 -1
- package/dist/chunk-cnftrx3g.js +0 -1
- package/dist/chunk-epp5jx5f.js +0 -6
- package/dist/chunk-j39q2kx7.js +0 -1
- package/dist/chunk-j6hpzkpq.js +0 -6
- package/dist/chunk-n4f8tseg.js +0 -2
- package/dist/chunk-nc4kfwef.js +0 -1
- package/dist/chunk-v3ctg84r.js +0 -1
- package/dist/chunk-v5rn5r1h.js +0 -1
- package/dist/web/assets/FilePreview-Chqi7chf.js +0 -7
- package/dist/web/assets/index-B-b3Yc5H.css +0 -1
- package/dist/web/assets/index-B3dW1Scg.js +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e}from"./vendor-react-FPIC4Czm.js";import{u as q,D as I,a as D,b as T,c as h}from"./index-B3dW1Scg.js";import{e as v}from"./useRequest-B4kP-cmG.js";import{n as z,z as M,X as L,h as H}from"./vendor-icons-DqO8ishN.js";import"./vendor-markdown-b9iCqZWK.js";import"./vendor-monaco-w6PwaWGP.js";import"./vendor-radix-DyP_DOwV.js";const J=async()=>{const a=await fetch("/skills");if(!a.ok)throw new Error("Failed to fetch skills");return a.json()},$=async()=>{const a=await fetch("/skills/catalog");if(!a.ok)throw new Error("Failed to fetch catalog");return a.json()};function te(){const{isSkillsOpen:a,toggleSkills:r}=q(),[d,c]=o.useState(null),[f,n]=o.useState(""),[p,u]=o.useState(!1),[C,i]=o.useState(!1),[F,x]=o.useState("confirm"),[w,m]=o.useState(null),[k,j]=o.useState(null),{data:b=[],loading:E,run:g}=v(J,{refreshDeps:[a],ready:a,onSuccess:t=>{t.length>0&&!d&&c(t[0].id)}}),{data:s=[]}=v($,{refreshDeps:[a],ready:a}),{runAsync:y}=v(async t=>{await fetch(`/skills/${encodeURIComponent(t)}`,{method:"DELETE"})},{manual:!0,onSuccess:g}),{runAsync:A,loading:S}=v(async(t,N)=>{if(!(await fetch(`/skills/${encodeURIComponent(t)}/toggle`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:N})})).ok)throw new Error("Failed to toggle skill")},{manual:!0,onSuccess:g}),O=b.filter(t=>t.name.toLowerCase().includes(f.toLowerCase())),l=o.useMemo(()=>b.find(t=>t.id===d)??b[0],[b,d]),R=()=>{u(!0)},P=t=>{j(t),m(null),x("confirm"),i(!0)},U=async()=>{if(k){x("installing"),m(null);try{const t=await fetch("/skills/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}),N=await t.json().catch(()=>({}));if(!t.ok||N.success===!1)throw new Error(N.error||"Failed to install skill");await g(),i(!1),u(!1)}catch(t){m(t instanceof Error?t.message:"Failed to install skill"),x("failed")}}};return e.jsxs(o.Fragment,{children:[e.jsx(I,{open:a,onOpenChange:r,children:e.jsxs(D,{className:"sm:max-w-[820px] h-[620px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl flex flex-col","aria-describedby":void 0,hideCloseButton:!0,children:[e.jsx(T,{className:"sr-only",children:"Skills"}),e.jsx("div",{className:"flex h-full min-h-0",children:e.jsxs("div",{className:"flex-1 p-8 flex flex-col gap-5 min-h-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:"Skills"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:R,className:"h-8 px-3 rounded-md bg-[#E5E7EB] text-[#111827] dark:bg-[#27272a] dark:text-[#E5E5E5] text-xs font-mono font-semibold flex items-center gap-1 hover:bg-[#D1D5DB] dark:hover:bg-[#32323a]",children:[e.jsx(z,{className:"h-3.5 w-3.5"}),"Install skill"]}),e.jsx("button",{onClick:g,className:"h-8 w-8 rounded-md text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] transition-colors flex items-center justify-center",disabled:E,children:e.jsx(M,{className:h("h-4 w-4",E&&"animate-spin")})}),e.jsx("button",{onClick:r,className:"h-8 w-8 rounded-md text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] transition-colors flex items-center justify-center",children:e.jsx(L,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex gap-5 flex-1 min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-[220px] flex flex-col gap-3 min-h-0 overflow-hidden",children:[e.jsx("div",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5] shrink-0",children:"Installed"}),e.jsx("input",{value:f,onChange:t=>n(t.target.value),placeholder:"Search skills...",className:"h-8 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] border border-transparent focus:outline-none focus:border-[#E5E7EB] dark:focus:border-[#27272a] shrink-0"}),e.jsxs("div",{className:"flex flex-col gap-2 overflow-y-auto flex-1 min-h-0 pr-1",children:[O.length===0&&!E&&e.jsx("div",{className:"text-center py-8 text-[#9CA3AF] dark:text-[#71717a] text-sm font-mono",children:"No skills installed"}),O.map(t=>e.jsxs("button",{onClick:()=>c(t.id),className:h("text-left rounded-lg px-3 py-2 flex flex-col gap-1 transition-colors",t.id===d?"bg-[#E5E7EB] dark:bg-[#111827]":"bg-white dark:bg-[#0C0C0C] hover:bg-[#F3F4F6] dark:hover:bg-[#18181b]"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[13px] font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:t.name}),e.jsx("span",{className:h("text-[11px] font-mono font-semibold",t.enabled?"text-[#16A34A] dark:text-[#22C55E]":"text-[#f59e0b]"),children:t.enabled?"Enabled":"Disabled"})]}),e.jsx("span",{className:"text-[11px] font-mono text-[#6B7280] dark:text-[#94a3b8] truncate",children:t.description||"No description"})]},t.id))]})]}),l?e.jsxs("div",{className:"flex-1 flex flex-col gap-3 overflow-y-auto pr-2 min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-base font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:l.name}),e.jsxs("span",{className:"text-xs font-mono text-[#9CA3AF] dark:text-[#71717a]",children:["v",l.version]})]}),e.jsx("p",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:l.description||"No description available"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>A(l.name,!l.enabled),disabled:S,className:h("h-7 px-3 rounded-md text-[11px] font-mono font-semibold",l.enabled?"bg-[#E5E7EB] text-[#111827] hover:bg-[#D1D5DB] dark:bg-[#27272a] dark:text-[#E5E5E5] dark:hover:bg-[#32323a]":"bg-[#16A34A] text-white hover:bg-[#15803D] dark:bg-[#22C55E] dark:text-[#0C0C0C] dark:hover:bg-[#1ea34b]",S&&"opacity-60 cursor-not-allowed"),children:S?"Saving...":l.enabled?"Disable":"Enable"}),e.jsx("button",{disabled:!0,title:"Editing not supported yet",className:"h-7 px-3 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold opacity-60 cursor-not-allowed",children:"Edit"}),e.jsxs("button",{onClick:()=>y(l.name),className:"h-7 px-3 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#ef4444] text-[11px] font-mono font-semibold flex items-center gap-1",children:[e.jsx(H,{className:"h-3 w-3"}),"Uninstall"]})]}),e.jsx("div",{className:"h-px bg-[#E5E7EB] dark:bg-[#1f2937]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Details"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[12px] font-mono",children:[e.jsx("span",{className:"text-[#9CA3AF] dark:text-[#71717a]",children:"Provider"}),e.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5]",children:l.provider}),e.jsx("span",{className:"text-[#9CA3AF] dark:text-[#71717a]",children:"Location"}),e.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5] truncate",children:l.location})]})]}),l.capabilities.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Capabilities"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.capabilities.map(t=>e.jsx("span",{className:"px-2 py-1 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[11px] font-mono text-[#111827] dark:text-[#E5E5E5]",children:t},t))})]}),l.allowedTools.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:["Allowed Tools (",l.allowedTools.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.allowedTools.map(t=>e.jsx("span",{className:"px-2 py-1 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[11px] font-mono text-[#111827] dark:text-[#E5E5E5]",children:t},t))})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-[#9CA3AF] dark:text-[#71717a] text-sm font-mono",children:"Select a skill to view details"})})]})]})})]})}),e.jsx(G,{open:p,catalog:s,installed:b.map(t=>t.name),onOpenChange:u,onInstall:P}),e.jsx(Q,{open:C,status:F,error:w,onCancel:()=>i(!1),onConfirm:U,onRetry:()=>x("confirm")})]})}function B({active:a,children:r,onClick:d}){return e.jsx("button",{onClick:d,className:h("px-3 py-1 rounded text-[12px] font-mono font-semibold transition-colors",a?"bg-[#E5E7EB] text-[#111827] dark:bg-[#27272a] dark:text-[#E5E5E5]":"text-[#6B7280] dark:text-[#a1a1aa]"),children:r})}function G({open:a,onOpenChange:r,onInstall:d,catalog:c,installed:f}){const[n,p]=o.useState("catalog"),[u,C]=o.useState(""),[i,F]=o.useState(null),[x,w]=o.useState(""),[m,k]=o.useState(""),j=c.filter(s=>s.name.toLowerCase().includes(u.toLowerCase())),b=()=>{if(n==="catalog"){if(!i)return;d({source:"catalog",name:i});return}if(n==="repo"){if(!x)return;d({source:"repo",url:x});return}m&&d({source:"local",path:m})},E=i?f.includes(i):!1,g=n==="catalog"&&(!i||E)||n==="repo"&&!x||n==="local"&&!m;return e.jsx(I,{open:a,onOpenChange:r,children:e.jsxs(D,{className:"sm:max-w-[540px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl","aria-describedby":void 0,hideCloseButton:!0,children:[e.jsx(T,{className:"sr-only",children:"Install Skill"}),e.jsxs("div",{className:"p-6 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-base font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:"Install Skill"}),e.jsx("button",{onClick:()=>r(!1),className:"h-8 w-8 rounded-md text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] transition-colors flex items-center justify-center",children:e.jsx(L,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2 p-1 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] w-fit",children:[e.jsx(B,{active:n==="catalog",onClick:()=>p("catalog"),children:"Catalog"}),e.jsx(B,{active:n==="repo",onClick:()=>p("repo"),children:"Repo"}),e.jsx(B,{active:n==="local",onClick:()=>p("local"),children:"Local"})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[n==="catalog"&&e.jsxs(e.Fragment,{children:[e.jsx("input",{value:u,onChange:s=>C(s.target.value),placeholder:"Search catalog...",className:"h-8 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] border border-transparent focus:outline-none focus:border-[#E5E7EB] dark:focus:border-[#27272a]"}),e.jsxs("div",{className:"flex flex-col gap-2 max-h-[240px] overflow-y-auto",children:[j.length===0&&e.jsx("div",{className:"text-center py-6 text-[#9CA3AF] dark:text-[#71717a] text-sm font-mono",children:"No skills found"}),j.map(s=>{const y=f.includes(s.name),A=i===s.name;return e.jsxs("button",{onClick:()=>F(s.name),className:h("rounded-lg px-3 py-2 flex flex-col gap-1 text-left transition-colors",A?"bg-[#E5E7EB] dark:bg-[#111827]":"bg-white dark:bg-[#0C0C0C] hover:bg-[#F3F4F6] dark:hover:bg-[#18181b]"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[13px] font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:s.name}),e.jsx("span",{className:h("text-[10px] font-mono px-2 py-0.5 rounded",s.tag==="Official"?"bg-[#22C55E]/20 text-[#16A34A] dark:text-[#22C55E]":"bg-[#3b82f6]/20 text-[#3b82f6]"),children:s.tag})]}),e.jsx("span",{className:"text-[11px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:s.description}),e.jsxs("span",{className:"text-[10px] font-mono text-[#9CA3AF] dark:text-[#71717a]",children:["by ",s.author]}),y&&e.jsx("span",{className:"text-[10px] font-mono text-[#16A34A] dark:text-[#22C55E]",children:"Installed"})]},s.name)})]})]}),n==="repo"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#a1a1aa]",children:"GitHub URL"}),e.jsx("input",{value:x,onChange:s=>w(s.target.value),placeholder:"https://github.com/org/skill",className:"h-8 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] border border-transparent focus:outline-none focus:border-[#E5E7EB] dark:focus:border-[#27272a]"}),e.jsx("span",{className:"inline-flex w-fit px-2 py-0.5 rounded bg-[#F3F4F6] dark:bg-[#18181b] text-[11px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:"Private repo supported (backend support required)"})]}),n==="local"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#a1a1aa]",children:"Local path"}),e.jsx("input",{value:m,onChange:s=>k(s.target.value),placeholder:"/Users/bytedance/skills/my-skill",className:"h-8 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] border border-transparent focus:outline-none focus:border-[#E5E7EB] dark:focus:border-[#27272a]"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx("button",{onClick:()=>r(!1),className:"h-7 px-3 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold",children:"Cancel"}),e.jsx("button",{onClick:b,disabled:g,className:h("h-7 px-3 rounded-md text-[11px] font-mono font-semibold",g?"bg-[#E5E7EB] text-[#9CA3AF] cursor-not-allowed dark:bg-[#27272a] dark:text-[#71717a]":"bg-[#16A34A] text-white dark:bg-[#22C55E] dark:text-[#0C0C0C]"),children:"Install"})]})]})]})})}function Q({open:a,status:r,error:d,onCancel:c,onConfirm:f,onRetry:n}){return e.jsx(I,{open:a,onOpenChange:p=>!p&&c(),children:e.jsxs(D,{className:"sm:max-w-[320px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl","aria-describedby":void 0,hideCloseButton:!0,children:[e.jsx(T,{className:"sr-only",children:"Install Status"}),e.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[r==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Confirm Install"}),e.jsx("p",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:"Install selected skill?"}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:c,className:"h-6 px-2.5 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold",children:"Cancel"}),e.jsx("button",{onClick:f,className:"h-6 px-2.5 rounded-md bg-[#16A34A] text-white dark:bg-[#22C55E] dark:text-[#0C0C0C] text-[11px] font-mono font-semibold",children:"Install"})]})]}),r==="installing"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Installing"}),e.jsx("p",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:"Downloading and verifying…"}),e.jsx("div",{className:"h-1.5 rounded-full bg-[#E5E7EB] dark:bg-[#18181b] overflow-hidden",children:e.jsx("div",{className:"h-full w-[45%] bg-[#16A34A] dark:bg-[#22C55E]"})}),e.jsx("span",{className:"text-[11px] font-mono text-[#9CA3AF] dark:text-[#71717a]",children:"~35%"}),e.jsx("button",{onClick:c,className:"self-end h-6 px-2.5 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold",children:"Hide"})]}),r==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Install Failed"}),e.jsx("p",{className:"text-[12px] font-mono text-[#f87171]",children:d||"Installation failed."}),e.jsx("p",{className:"text-[11px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:"Check access and try again."}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:c,className:"h-6 px-2.5 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold",children:"Close"}),e.jsx("button",{onClick:n,className:"h-6 px-2.5 rounded-md bg-[#16A34A] text-white dark:bg-[#22C55E] dark:text-[#0C0C0C] text-[11px] font-mono font-semibold",children:"Retry"})]})]})]})]})})}export{te as SkillsModal};
|
|
1
|
+
import{r as o,j as e}from"./vendor-react-FPIC4Czm.js";import{u as q,D as I,a as D,b as T,c as h}from"./index-BC0ssrep.js";import{e as v}from"./useRequest-B4kP-cmG.js";import{q as M,K as z,X as L,i as H}from"./vendor-icons-DBM55KTG.js";import"./vendor-markdown-b9iCqZWK.js";import"./vendor-monaco-w6PwaWGP.js";import"./vendor-radix-DyP_DOwV.js";const J=async()=>{const a=await fetch("/skills");if(!a.ok)throw new Error("Failed to fetch skills");return a.json()},$=async()=>{const a=await fetch("/skills/catalog");if(!a.ok)throw new Error("Failed to fetch catalog");return a.json()};function te(){const{isSkillsOpen:a,toggleSkills:r}=q(),[d,c]=o.useState(null),[f,n]=o.useState(""),[p,u]=o.useState(!1),[C,i]=o.useState(!1),[F,x]=o.useState("confirm"),[w,m]=o.useState(null),[k,j]=o.useState(null),{data:b=[],loading:E,run:g}=v(J,{refreshDeps:[a],ready:a,onSuccess:t=>{t.length>0&&!d&&c(t[0].id)}}),{data:s=[]}=v($,{refreshDeps:[a],ready:a}),{runAsync:y}=v(async t=>{await fetch(`/skills/${encodeURIComponent(t)}`,{method:"DELETE"})},{manual:!0,onSuccess:g}),{runAsync:A,loading:S}=v(async(t,N)=>{if(!(await fetch(`/skills/${encodeURIComponent(t)}/toggle`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:N})})).ok)throw new Error("Failed to toggle skill")},{manual:!0,onSuccess:g}),O=b.filter(t=>t.name.toLowerCase().includes(f.toLowerCase())),l=o.useMemo(()=>b.find(t=>t.id===d)??b[0],[b,d]),R=()=>{u(!0)},P=t=>{j(t),m(null),x("confirm"),i(!0)},U=async()=>{if(k){x("installing"),m(null);try{const t=await fetch("/skills/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}),N=await t.json().catch(()=>({}));if(!t.ok||N.success===!1)throw new Error(N.error||"Failed to install skill");await g(),i(!1),u(!1)}catch(t){m(t instanceof Error?t.message:"Failed to install skill"),x("failed")}}};return e.jsxs(o.Fragment,{children:[e.jsx(I,{open:a,onOpenChange:r,children:e.jsxs(D,{className:"sm:max-w-[820px] h-[620px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl flex flex-col","aria-describedby":void 0,hideCloseButton:!0,children:[e.jsx(T,{className:"sr-only",children:"Skills"}),e.jsx("div",{className:"flex h-full min-h-0",children:e.jsxs("div",{className:"flex-1 p-8 flex flex-col gap-5 min-h-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:"Skills"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:R,className:"h-8 px-3 rounded-md bg-[#E5E7EB] text-[#111827] dark:bg-[#27272a] dark:text-[#E5E5E5] text-xs font-mono font-semibold flex items-center gap-1 hover:bg-[#D1D5DB] dark:hover:bg-[#32323a]",children:[e.jsx(M,{className:"h-3.5 w-3.5"}),"Install skill"]}),e.jsx("button",{onClick:g,className:"h-8 w-8 rounded-md text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] transition-colors flex items-center justify-center",disabled:E,children:e.jsx(z,{className:h("h-4 w-4",E&&"animate-spin")})}),e.jsx("button",{onClick:r,className:"h-8 w-8 rounded-md text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] transition-colors flex items-center justify-center",children:e.jsx(L,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex gap-5 flex-1 min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-[220px] flex flex-col gap-3 min-h-0 overflow-hidden",children:[e.jsx("div",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5] shrink-0",children:"Installed"}),e.jsx("input",{value:f,onChange:t=>n(t.target.value),placeholder:"Search skills...",className:"h-8 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] border border-transparent focus:outline-none focus:border-[#E5E7EB] dark:focus:border-[#27272a] shrink-0"}),e.jsxs("div",{className:"flex flex-col gap-2 overflow-y-auto flex-1 min-h-0 pr-1",children:[O.length===0&&!E&&e.jsx("div",{className:"text-center py-8 text-[#9CA3AF] dark:text-[#71717a] text-sm font-mono",children:"No skills installed"}),O.map(t=>e.jsxs("button",{onClick:()=>c(t.id),className:h("text-left rounded-lg px-3 py-2 flex flex-col gap-1 transition-colors",t.id===d?"bg-[#E5E7EB] dark:bg-[#111827]":"bg-white dark:bg-[#0C0C0C] hover:bg-[#F3F4F6] dark:hover:bg-[#18181b]"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[13px] font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:t.name}),e.jsx("span",{className:h("text-[11px] font-mono font-semibold",t.enabled?"text-[#16A34A] dark:text-[#22C55E]":"text-[#f59e0b]"),children:t.enabled?"Enabled":"Disabled"})]}),e.jsx("span",{className:"text-[11px] font-mono text-[#6B7280] dark:text-[#94a3b8] truncate",children:t.description||"No description"})]},t.id))]})]}),l?e.jsxs("div",{className:"flex-1 flex flex-col gap-3 overflow-y-auto pr-2 min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-base font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:l.name}),e.jsxs("span",{className:"text-xs font-mono text-[#9CA3AF] dark:text-[#71717a]",children:["v",l.version]})]}),e.jsx("p",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:l.description||"No description available"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>A(l.name,!l.enabled),disabled:S,className:h("h-7 px-3 rounded-md text-[11px] font-mono font-semibold",l.enabled?"bg-[#E5E7EB] text-[#111827] hover:bg-[#D1D5DB] dark:bg-[#27272a] dark:text-[#E5E5E5] dark:hover:bg-[#32323a]":"bg-[#16A34A] text-white hover:bg-[#15803D] dark:bg-[#22C55E] dark:text-[#0C0C0C] dark:hover:bg-[#1ea34b]",S&&"opacity-60 cursor-not-allowed"),children:S?"Saving...":l.enabled?"Disable":"Enable"}),e.jsx("button",{disabled:!0,title:"Editing not supported yet",className:"h-7 px-3 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold opacity-60 cursor-not-allowed",children:"Edit"}),e.jsxs("button",{onClick:()=>y(l.name),className:"h-7 px-3 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#ef4444] text-[11px] font-mono font-semibold flex items-center gap-1",children:[e.jsx(H,{className:"h-3 w-3"}),"Uninstall"]})]}),e.jsx("div",{className:"h-px bg-[#E5E7EB] dark:bg-[#1f2937]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Details"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[12px] font-mono",children:[e.jsx("span",{className:"text-[#9CA3AF] dark:text-[#71717a]",children:"Provider"}),e.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5]",children:l.provider}),e.jsx("span",{className:"text-[#9CA3AF] dark:text-[#71717a]",children:"Location"}),e.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5] truncate",children:l.location})]})]}),l.capabilities.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Capabilities"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.capabilities.map(t=>e.jsx("span",{className:"px-2 py-1 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[11px] font-mono text-[#111827] dark:text-[#E5E5E5]",children:t},t))})]}),l.allowedTools.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:["Allowed Tools (",l.allowedTools.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.allowedTools.map(t=>e.jsx("span",{className:"px-2 py-1 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[11px] font-mono text-[#111827] dark:text-[#E5E5E5]",children:t},t))})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-[#9CA3AF] dark:text-[#71717a] text-sm font-mono",children:"Select a skill to view details"})})]})]})})]})}),e.jsx(G,{open:p,catalog:s,installed:b.map(t=>t.name),onOpenChange:u,onInstall:P}),e.jsx(K,{open:C,status:F,error:w,onCancel:()=>i(!1),onConfirm:U,onRetry:()=>x("confirm")})]})}function B({active:a,children:r,onClick:d}){return e.jsx("button",{onClick:d,className:h("px-3 py-1 rounded text-[12px] font-mono font-semibold transition-colors",a?"bg-[#E5E7EB] text-[#111827] dark:bg-[#27272a] dark:text-[#E5E5E5]":"text-[#6B7280] dark:text-[#a1a1aa]"),children:r})}function G({open:a,onOpenChange:r,onInstall:d,catalog:c,installed:f}){const[n,p]=o.useState("catalog"),[u,C]=o.useState(""),[i,F]=o.useState(null),[x,w]=o.useState(""),[m,k]=o.useState(""),j=c.filter(s=>s.name.toLowerCase().includes(u.toLowerCase())),b=()=>{if(n==="catalog"){if(!i)return;d({source:"catalog",name:i});return}if(n==="repo"){if(!x)return;d({source:"repo",url:x});return}m&&d({source:"local",path:m})},E=i?f.includes(i):!1,g=n==="catalog"&&(!i||E)||n==="repo"&&!x||n==="local"&&!m;return e.jsx(I,{open:a,onOpenChange:r,children:e.jsxs(D,{className:"sm:max-w-[540px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl","aria-describedby":void 0,hideCloseButton:!0,children:[e.jsx(T,{className:"sr-only",children:"Install Skill"}),e.jsxs("div",{className:"p-6 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-base font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:"Install Skill"}),e.jsx("button",{onClick:()=>r(!1),className:"h-8 w-8 rounded-md text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] transition-colors flex items-center justify-center",children:e.jsx(L,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2 p-1 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] w-fit",children:[e.jsx(B,{active:n==="catalog",onClick:()=>p("catalog"),children:"Catalog"}),e.jsx(B,{active:n==="repo",onClick:()=>p("repo"),children:"Repo"}),e.jsx(B,{active:n==="local",onClick:()=>p("local"),children:"Local"})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[n==="catalog"&&e.jsxs(e.Fragment,{children:[e.jsx("input",{value:u,onChange:s=>C(s.target.value),placeholder:"Search catalog...",className:"h-8 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] border border-transparent focus:outline-none focus:border-[#E5E7EB] dark:focus:border-[#27272a]"}),e.jsxs("div",{className:"flex flex-col gap-2 max-h-[240px] overflow-y-auto",children:[j.length===0&&e.jsx("div",{className:"text-center py-6 text-[#9CA3AF] dark:text-[#71717a] text-sm font-mono",children:"No skills found"}),j.map(s=>{const y=f.includes(s.name),A=i===s.name;return e.jsxs("button",{onClick:()=>F(s.name),className:h("rounded-lg px-3 py-2 flex flex-col gap-1 text-left transition-colors",A?"bg-[#E5E7EB] dark:bg-[#111827]":"bg-white dark:bg-[#0C0C0C] hover:bg-[#F3F4F6] dark:hover:bg-[#18181b]"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[13px] font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:s.name}),e.jsx("span",{className:h("text-[10px] font-mono px-2 py-0.5 rounded",s.tag==="Official"?"bg-[#22C55E]/20 text-[#16A34A] dark:text-[#22C55E]":"bg-[#3b82f6]/20 text-[#3b82f6]"),children:s.tag})]}),e.jsx("span",{className:"text-[11px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:s.description}),e.jsxs("span",{className:"text-[10px] font-mono text-[#9CA3AF] dark:text-[#71717a]",children:["by ",s.author]}),y&&e.jsx("span",{className:"text-[10px] font-mono text-[#16A34A] dark:text-[#22C55E]",children:"Installed"})]},s.name)})]})]}),n==="repo"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#a1a1aa]",children:"GitHub URL"}),e.jsx("input",{value:x,onChange:s=>w(s.target.value),placeholder:"https://github.com/org/skill",className:"h-8 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] border border-transparent focus:outline-none focus:border-[#E5E7EB] dark:focus:border-[#27272a]"}),e.jsx("span",{className:"inline-flex w-fit px-2 py-0.5 rounded bg-[#F3F4F6] dark:bg-[#18181b] text-[11px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:"Private repo supported (backend support required)"})]}),n==="local"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#a1a1aa]",children:"Local path"}),e.jsx("input",{value:m,onChange:s=>k(s.target.value),placeholder:"/Users/bytedance/skills/my-skill",className:"h-8 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] border border-transparent focus:outline-none focus:border-[#E5E7EB] dark:focus:border-[#27272a]"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx("button",{onClick:()=>r(!1),className:"h-7 px-3 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold",children:"Cancel"}),e.jsx("button",{onClick:b,disabled:g,className:h("h-7 px-3 rounded-md text-[11px] font-mono font-semibold",g?"bg-[#E5E7EB] text-[#9CA3AF] cursor-not-allowed dark:bg-[#27272a] dark:text-[#71717a]":"bg-[#16A34A] text-white dark:bg-[#22C55E] dark:text-[#0C0C0C]"),children:"Install"})]})]})]})})}function K({open:a,status:r,error:d,onCancel:c,onConfirm:f,onRetry:n}){return e.jsx(I,{open:a,onOpenChange:p=>!p&&c(),children:e.jsxs(D,{className:"sm:max-w-[320px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl","aria-describedby":void 0,hideCloseButton:!0,children:[e.jsx(T,{className:"sr-only",children:"Install Status"}),e.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[r==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Confirm Install"}),e.jsx("p",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:"Install selected skill?"}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:c,className:"h-6 px-2.5 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold",children:"Cancel"}),e.jsx("button",{onClick:f,className:"h-6 px-2.5 rounded-md bg-[#16A34A] text-white dark:bg-[#22C55E] dark:text-[#0C0C0C] text-[11px] font-mono font-semibold",children:"Install"})]})]}),r==="installing"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Installing"}),e.jsx("p",{className:"text-[12px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:"Downloading and verifying…"}),e.jsx("div",{className:"h-1.5 rounded-full bg-[#E5E7EB] dark:bg-[#18181b] overflow-hidden",children:e.jsx("div",{className:"h-full w-[45%] bg-[#16A34A] dark:bg-[#22C55E]"})}),e.jsx("span",{className:"text-[11px] font-mono text-[#9CA3AF] dark:text-[#71717a]",children:"~35%"}),e.jsx("button",{onClick:c,className:"self-end h-6 px-2.5 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold",children:"Hide"})]}),r==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"text-sm font-mono font-semibold text-[#111827] dark:text-[#E5E5E5]",children:"Install Failed"}),e.jsx("p",{className:"text-[12px] font-mono text-[#f87171]",children:d||"Installation failed."}),e.jsx("p",{className:"text-[11px] font-mono text-[#6B7280] dark:text-[#94a3b8]",children:"Check access and try again."}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:c,className:"h-6 px-2.5 rounded-md bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[11px] font-mono font-semibold",children:"Close"}),e.jsx("button",{onClick:n,className:"h-6 px-2.5 rounded-md bg-[#16A34A] text-white dark:bg-[#22C55E] dark:text-[#0C0C0C] text-[11px] font-mono font-semibold",children:"Retry"})]})]})]})]})})}export{te as SkillsModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as t}from"./vendor-react-FPIC4Czm.js";import{u as B,c as m}from"./index-
|
|
1
|
+
import{r,j as t}from"./vendor-react-FPIC4Czm.js";import{u as B,c as m}from"./index-BC0ssrep.js";import{a as z}from"./SettingsStore-CjvkbtuZ.js";import{D as y,o as A,L as v}from"./vendor-xterm-DuYZoU4T.js";import{r as j,M as C,X as N}from"./vendor-icons-DBM55KTG.js";import"./vendor-markdown-b9iCqZWK.js";import"./vendor-monaco-w6PwaWGP.js";import"./vendor-radix-DyP_DOwV.js";const I=()=>{const{isTerminalOpen:s,toggleTerminal:x}=B(),[i,p]=r.useState(!1),[E,l]=r.useState(!1),d=z(),u=r.useRef(null),o=r.useRef(null),b=r.useRef(null),c=r.useRef(null),k=r.useCallback(()=>{var a;if(((a=c.current)==null?void 0:a.readyState)===WebSocket.OPEN)return;const n=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/terminal/ws`,e=new WebSocket(n);c.current=e,e.onopen=()=>{l(!0)},e.onmessage=h=>{var f;(f=o.current)==null||f.write(h.data)},e.onclose=()=>{l(!1)},e.onerror=()=>{l(!1)}},[]),g=r.useCallback(()=>{c.current&&(c.current.close(),c.current=null),l(!1)},[]),w=r.useCallback(n=>{var e;((e=c.current)==null?void 0:e.readyState)===WebSocket.OPEN&&c.current.send(n)},[]);return r.useEffect(()=>{if(!s||!u.current||o.current)return;const n={background:"#ffffff",foreground:"#111827",cursor:"#111827",cursorAccent:"#ffffff",selectionBackground:"#E5E7EB",black:"#111827",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#7c3aed",cyan:"#0891b2",white:"#111827",brightBlack:"#6b7280",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#a855f7",brightCyan:"#22d3ee",brightWhite:"#111827"},e=new y({cursorBlink:!0,cursorStyle:"bar",fontSize:14,fontFamily:"JetBrains Mono, Menlo, Monaco, Consolas, monospace",allowTransparency:!0,scrollback:1e4,theme:d?{background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#0a0a0a",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"}:n}),a=new A,h=new v;return e.loadAddon(a),e.loadAddon(h),e.open(u.current),a.fit(),e.onData(f=>{w(f)}),o.current=e,b.current=a,k(),()=>{g(),e.dispose(),o.current=null,b.current=null}},[s,k,g,w]),r.useEffect(()=>{o.current&&(o.current.options.theme=d?{background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#0a0a0a",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"}:{background:"#ffffff",foreground:"#111827",cursor:"#111827",cursorAccent:"#ffffff",selectionBackground:"#E5E7EB",black:"#111827",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#7c3aed",cyan:"#0891b2",white:"#111827",brightBlack:"#6b7280",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#a855f7",brightCyan:"#22d3ee",brightWhite:"#111827"})},[d]),r.useEffect(()=>{if(!s||i)return;const n=()=>{var a;(a=b.current)==null||a.fit()};window.addEventListener("resize",n);const e=setTimeout(n,100);return()=>{window.removeEventListener("resize",n),clearTimeout(e)}},[s,i]),s?t.jsxs("div",{className:m("fixed bottom-0 left-0 right-0 z-40 bg-white dark:bg-[#0a0a0a] border-t border-[#E5E7EB] dark:border-zinc-800 transition-all duration-200",i?"h-10":"h-72"),children:[t.jsxs("div",{className:"flex items-center justify-between h-10 px-3 border-b border-[#E5E7EB] dark:border-zinc-800 bg-[#F9FAFB] dark:bg-zinc-900/50",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(j,{className:"h-4 w-4 text-[#9CA3AF] dark:text-zinc-400"}),t.jsx("span",{className:"text-sm text-[#6B7280] dark:text-zinc-400",children:"Terminal"}),t.jsx("span",{className:m("w-2 h-2 rounded-full",E?"bg-green-500":"bg-zinc-600")})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{onClick:()=>p(!i),className:"p-1.5 rounded hover:bg-[#E5E7EB] text-[#9CA3AF] hover:text-[#111827] dark:hover:bg-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200 transition-colors",children:t.jsx(C,{className:"h-4 w-4"})}),t.jsx("button",{onClick:()=>{g(),x()},className:"p-1.5 rounded hover:bg-[#E5E7EB] text-[#9CA3AF] hover:text-[#111827] dark:hover:bg-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200 transition-colors",children:t.jsx(N,{className:"h-4 w-4"})})]})]}),t.jsx("div",{ref:u,className:m("h-[calc(100%-40px)] p-2",i&&"hidden")})]}):null};export{I as TerminalPanel};
|