adam-agent-server 1.2.1 → 1.2.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/README.md +4 -7
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{ChannelDetail-DoQs1auJ.js → ChannelDetail-eWtIGhAd.js} +1 -1
- package/web/dist/assets/{Channels-Dc6QduC1.js → Channels-2veauYsm.js} +1 -1
- package/web/dist/assets/{Chat-NrKA_MiZ.js → Chat-Bha4vXwT.js} +1 -1
- package/web/dist/assets/{Dashboard-C67v0x7e.js → Dashboard-cDHpOWnY.js} +1 -1
- package/web/dist/assets/EnvVarEditor-CaCpNT3y.js +1 -0
- package/web/dist/assets/{Evolution-CbFOTN2o.js → Evolution-Ao-gdHbS.js} +1 -1
- package/web/dist/assets/{GoalDetail-DYUbYJpT.js → GoalDetail-CX2i9A5a.js} +1 -1
- package/web/dist/assets/{Goals-7eD9_7Qo.js → Goals-DdM0tFus.js} +1 -1
- package/web/dist/assets/{Logs-CDFbfvQT.js → Logs-DJhpDtCA.js} +1 -1
- package/web/dist/assets/{Memories-D0J8Es-o.js → Memories-CYN99g2T.js} +1 -1
- package/web/dist/assets/{Plugins-CXCUhsEZ.js → Plugins-gcMpBdyq.js} +1 -1
- package/web/dist/assets/{RoleDetail-C2lXyAjt.js → RoleDetail-s7u-Shk3.js} +2 -2
- package/web/dist/assets/{Roles-Bia_f3ml.js → Roles-CCy1H7PY.js} +1 -1
- package/web/dist/assets/{Settings-CzgdtkLo.js → Settings-JbgBxBeo.js} +1 -1
- package/web/dist/assets/{Strategies-CRdpzdUe.js → Strategies-CO4LwZjS.js} +1 -1
- package/web/dist/assets/{Switch-B05Q1L98.js → Switch-CTAIxUd_.js} +1 -1
- package/web/dist/assets/{TaskDetail-4yYEVV6Z.js → TaskDetail-DEg_oUwx.js} +1 -1
- package/web/dist/assets/{Work-CE6TB6LG.js → Work-BpKK_uXA.js} +1 -1
- package/web/dist/assets/{index-oA-kWqT5.js → index-rvaixveh.js} +5 -5
- package/web/dist/index.html +1 -1
- package/web/dist/assets/EnvVarEditor-DeCQryTm.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{J as t,O as n,P as r,Y as i,Z as a,_ as o,f as s,h as c,l as ee,nt as l,o as u,t as te,v as ne,z as re}from"./vendor-icons-CkI4-NxL.js";import{t as d}from"./vendor-react-DLRtONKt.js";import{r as f}from"./dist-HyCSN_hp.js";import{f as p,t as m,w as h}from"./index-oA-kWqT5.js";import{t as g}from"./Card-4mOZntHG.js";import{a as ie}from"./format-DvtQjPZn.js";import{t as ae}from"./EmptyState-BlgMMAr-.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./Table-BxbnOSbq.js";var C=e(l(),1),w=d();function oe({manifest:e}){if(!e)return null;let t=[];return e.skills.length>0&&t.push({label:`Skill(${e.skills.length})`,variant:`info`}),e.agents.length>0&&t.push({label:`Agent(${e.agents.length})`,variant:`success`}),e.mcpServers.length>0&&t.push({label:`MCP(${e.mcpServers.length})`,variant:`warning`}),e.hooks.length>0&&t.push({label:`Hook(${e.hooks.length})`,variant:`default`}),e.lspServers.length>0&&t.push({label:`LSP(${e.lspServers.length})`,variant:`default`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>(0,w.jsx)(m,{variant:e.variant,children:e.label},e.label))})}function T(){let[e,l]=(0,C.useState)([]),[d,T]=(0,C.useState)([]),[E,se]=(0,C.useState)([]),[ce,le]=(0,C.useState)(new Set),[D,O]=(0,C.useState)(!0),[k,A]=(0,C.useState)(!1),[j,M]=(0,C.useState)(null),[N,ue]=(0,C.useState)(!1),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(null),[R,z]=(0,C.useState)(!1),[B,V]=(0,C.useState)(``),[H,de]=(0,C.useState)([]),[U,fe]=(0,C.useState)(!1),[pe,me]=(0,C.useState)(new Set),[W,G]=(0,C.useState)(`all`),[K,he]=(0,C.useState)([]),q=(0,C.useCallback)(async()=>{O(!0);try{l((await f(`/plugins`)).plugins)}catch(e){h.error(e instanceof Error?e.message:`Failed to load plugins`)}finally{O(!1)}},[]),J=(0,C.useCallback)(async()=>{A(!0),M(null);try{let[e,t]=await Promise.all([f(`/plugins/marketplace`).catch(()=>({available:[],installed:[]})),f(`/plugins/marketplaces`)]);se(e.available),le(new Set(e.installed.map(e=>e.id))),T(t.sources)}catch(e){M(e instanceof Error?e.message:`Failed to load marketplace`)}finally{A(!1)}},[]),ge=(0,C.useCallback)(async()=>{try{de((await f(`/plugins/stats?limit=20`)).stats)}catch{}},[]),Y=(0,C.useCallback)(async()=>{try{he((await f(`/roles`)).roles)}catch{}},[]);(0,C.useEffect)(()=>{q(),J(),Y()},[q,J,Y]);let _e=async(e,t)=>{L(e);try{await f(`/plugins/${encodeURIComponent(e)}/${t?`enable`:`disable`}`,{method:`POST`}),h.success(`${e} ${t?`enabled`:`disabled`} globally`),l(n=>n.map(n=>n.id===e?{...n,globalEnabled:t}:n))}catch(e){h.error(e instanceof Error?e.message:`Failed to ${t?`enable`:`disable`} plugin`)}finally{L(null)}},ve=async e=>{L(e);try{await f(`/plugins/uninstall/${encodeURIComponent(e)}`,{method:`POST`}),h.success(`Plugin uninstalled`),await Promise.all([q(),J()])}catch(e){h.error(e instanceof Error?e.message:`Uninstall failed`)}finally{L(null)}},ye=async(e,t,n)=>{L(e);try{await f(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:`project`,cwd:n})});let r=K.find(e=>e.id===t)?.name??t;h.success(`Installed ${e.split(`@`)[0]} for ${r}`),await q()}catch(e){h.error(e instanceof Error?e.message:`Install to role failed`)}finally{L(null)}},X=async()=>{if(B.trim())try{await f(`/plugins/install/${encodeURIComponent(B.trim())}`,{method:`POST`,body:JSON.stringify({})}),h.success(`Source added`),V(``),z(!1),await J()}catch(e){h.error(e instanceof Error?e.message:`Failed to add source`)}},Z=async(e,t=`user`,n)=>{L(e);try{await f(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:t,cwd:n})});let r=t===`project`&&n?`${e.split(`@`)[0]} for ${n.split(`/`).pop()}`:e.split(`@`)[0];h.success(`Installed ${r}`),await Promise.all([q(),J()])}catch(e){h.error(e instanceof Error?e.message:`Install failed`)}finally{L(null)}},be=e=>{me(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Q=W===`all`?e:e.filter(e=>e.scope===W),$=P?E.filter(e=>e.name.toLowerCase().includes(P.toLowerCase())||e.description.toLowerCase().includes(P.toLowerCase())):E;return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Plugins`}),(0,w.jsx)(p,{variant:`ghost`,size:`sm`,onClick:()=>void q(),children:(0,w.jsx)(c,{size:14})})]}),(0,w.jsxs)(g,{children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(r,{size:14,className:`text-slate-400 flex-shrink-0`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${W===`all`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>G(`all`),children:`All`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${W===`user`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>G(`user`),children:`User`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${W===`project`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>G(`project`),children:`Project`}),(0,w.jsx)(`span`,{className:`h-4 w-px bg-slate-700 mx-1`}),d.map(e=>(0,w.jsx)(m,{variant:`muted`,className:`text-xs`,children:e.name},e.name)),(0,w.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[k&&(0,w.jsx)(n,{size:12,className:`animate-spin text-slate-500`}),k?null:(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>z(!R),children:R?(0,w.jsx)(te,{size:12}):(0,w.jsx)(ne,{size:12})})]})]}),R&&(0,w.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,w.jsx)(`input`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:B,onChange:e=>V(e.target.value),placeholder:`https://github.com/org/marketplace-repo`,onKeyDown:e=>{e.key===`Enter`&&X()}}),(0,w.jsx)(p,{size:`sm`,onClick:()=>void X(),disabled:!B.trim(),children:`Add`})]})]}),D?(0,w.jsx)(g,{children:(0,w.jsx)(`div`,{className:`py-8 text-center text-sm text-slate-500`,children:`Loading...`})}):Q.length===0?(0,w.jsx)(g,{children:(0,w.jsx)(ae,{icon:(0,w.jsx)(o,{size:32}),title:`No plugins`,description:W===`all`?`No plugins installed. Browse the marketplace or install from a URL.`:`No ${W}-scope plugins installed.`})}):(0,w.jsx)(g,{padding:!1,children:(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{className:`w-8`}),(0,w.jsx)(v,{children:`Name`}),(0,w.jsx)(v,{children:`Version`}),(0,w.jsx)(v,{children:`Scope`}),(0,w.jsx)(v,{children:`Type`}),(0,w.jsx)(v,{children:`Activation`}),(0,w.jsx)(v,{children:`Actions`})]})}),(0,w.jsx)(y,{children:Q.map((e,r)=>{let a=pe.has(e.id),o=e.id.split(`@`)[0],s=I===e.id,c=e.projectPath?`${e.id}:${e.projectPath}`:`${e.id}:${r}`;return(0,w.jsxs)(C.Fragment,{children:[(0,w.jsxs)(b,{className:`group`,children:[(0,w.jsx)(x,{children:(0,w.jsx)(`button`,{onClick:()=>be(e.id),className:`text-slate-500 hover:text-slate-300`,children:a?(0,w.jsx)(i,{size:12}):(0,w.jsx)(t,{size:12})})}),(0,w.jsx)(x,{className:`font-medium text-slate-200`,children:o}),(0,w.jsx)(x,{className:`text-xs text-slate-400`,children:e.version?`v${e.version}`:`—`}),(0,w.jsxs)(x,{children:[(0,w.jsx)(m,{variant:e.scope===`user`?`info`:`warning`,children:e.scope}),e.scope===`project`&&e.projectPath&&(0,w.jsx)(`div`,{className:`text-[10px] text-slate-600 truncate max-w-[120px]`,title:e.projectPath,children:e.projectPath.split(`/`).pop()})]}),(0,w.jsx)(x,{children:(0,w.jsx)(oe,{manifest:e.manifest})}),(0,w.jsx)(x,{children:(0,w.jsx)(m,{variant:e.globalEnabled?`success`:`destructive`,children:e.globalEnabled?`User On`:`User Off`})}),(0,w.jsx)(x,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,disabled:s,onClick:()=>void _e(e.id,!e.globalEnabled),children:s?(0,w.jsx)(n,{size:10,className:`animate-spin`}):e.globalEnabled?`Disable`:`Enable`}),(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs text-red-400`,disabled:s,onClick:()=>void ve(e.id),children:(0,w.jsx)(u,{size:10})})]})})]}),a&&(0,w.jsx)(b,{className:`bg-slate-900/50`,children:(0,w.jsx)(x,{colSpan:7,className:`px-6 py-3`,children:e.manifest?(0,w.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[e.manifest.description&&(0,w.jsx)(`p`,{className:`text-slate-400`,children:e.manifest.description}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[e.manifest.skills.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Skills`}),e.manifest.skills.map(e=>(0,w.jsxs)(`div`,{className:`text-slate-400`,children:[(0,w.jsx)(`span`,{className:`text-slate-200`,children:e.name}),e.description&&(0,w.jsxs)(`span`,{className:`ml-1 text-slate-500`,children:[`— `,e.description]})]},e.name))]}),e.manifest.agents.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Agents`}),e.manifest.agents.map(e=>(0,w.jsxs)(`div`,{className:`text-slate-400`,children:[(0,w.jsx)(`span`,{className:`text-slate-200`,children:e.name}),e.description&&(0,w.jsxs)(`span`,{className:`ml-1 text-slate-500`,children:[`— `,e.description]})]},e.name))]}),e.manifest.mcpServers.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`MCP Servers`}),e.manifest.mcpServers.map(e=>(0,w.jsx)(`div`,{className:`text-slate-400`,children:e},e))]}),e.manifest.hooks.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Hooks`}),e.manifest.hooks.map(e=>(0,w.jsx)(`div`,{className:`text-slate-400`,children:e},e))]})]}),(0,w.jsx)(`div`,{className:`text-slate-600 font-mono truncate mt-1`,title:e.installPath,children:e.installPath}),K.length>0&&e.scope===`user`&&(0,w.jsxs)(`div`,{className:`mt-3 pt-2 border-t border-slate-800`,children:[(0,w.jsx)(`span`,{className:`text-slate-400 mr-2`,children:`Install to Role:`}),K.map(t=>(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-5 px-2 text-[10px] mr-1`,disabled:I===e.id,onClick:()=>void ye(e.id,t.id,t.workspacePath),children:t.name},t.id))]})]}):(0,w.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Loading manifest...`})})},`${e.id}-detail`)]},c)})})]})}),(0,w.jsxs)(g,{children:[(0,w.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-slate-300`,onClick:()=>ue(!N),children:[(0,w.jsx)(ee,{size:14,className:`text-slate-400`}),`Marketplace (`,E.length,`)`,N?(0,w.jsx)(i,{size:12,className:`ml-auto`}):(0,w.jsx)(t,{size:12,className:`ml-auto`})]}),N&&(0,w.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(s,{size:14,className:`absolute left-2.5 top-2 text-slate-500`}),(0,w.jsx)(`input`,{className:`w-full rounded border border-slate-700 bg-slate-900 pl-8 pr-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-600 focus:border-blue-500 focus:outline-none`,value:P,onChange:e=>F(e.target.value),placeholder:`Search available plugins...`})]}),k?(0,w.jsx)(`p`,{className:`text-xs text-slate-500 text-center py-2`,children:`Loading marketplace...`}):j?(0,w.jsx)(`p`,{className:`text-xs text-red-400 text-center py-2`,children:j}):$.length===0?(0,w.jsx)(`p`,{className:`text-xs text-slate-500 text-center py-2`,children:P?`No plugins match your search`:`No marketplace plugins available`}):(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{children:`Name`}),(0,w.jsx)(v,{children:`Description`}),(0,w.jsx)(v,{children:`Source`}),(0,w.jsx)(v,{children:`Action`})]})}),(0,w.jsx)(y,{children:$.map(e=>{let t=ce.has(e.pluginId),r=I===e.pluginId;return(0,w.jsxs)(b,{children:[(0,w.jsx)(x,{className:`font-medium text-slate-200 text-xs`,children:e.name}),(0,w.jsx)(x,{className:`text-xs text-slate-400 max-w-[300px] truncate`,title:e.description,children:e.description}),(0,w.jsx)(x,{children:(0,w.jsx)(m,{variant:`muted`,className:`text-[10px]`,children:e.marketplaceName})}),(0,w.jsx)(x,{children:t?(0,w.jsx)(m,{variant:`success`,className:`text-[10px]`,children:`Installed`}):(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:()=>void Z(e.pluginId),children:r?(0,w.jsx)(n,{size:10,className:`animate-spin`}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(re,{size:10,className:`mr-1`}),` Install`]})}),K.length>0&&(0,w.jsxs)(`div`,{className:`relative group/install`,children:[(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1 text-xs text-slate-500`,children:(0,w.jsx)(i,{size:10})}),(0,w.jsx)(`div`,{className:`absolute right-0 top-full mt-1 z-10 hidden group-hover/install:block bg-slate-800 border border-slate-700 rounded shadow-lg py-1 min-w-[140px]`,children:K.map(t=>(0,w.jsx)(`button`,{className:`block w-full text-left px-3 py-1 text-xs text-slate-300 hover:bg-slate-700`,disabled:r,onClick:()=>void Z(e.pluginId,`project`,t.workspacePath),children:t.name},t.id))})]})]})})]},e.pluginId)})})]})]})]}),(0,w.jsxs)(g,{children:[(0,w.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-slate-300`,onClick:()=>{!U&&H.length===0&&ge(),fe(!U)},children:[(0,w.jsx)(a,{size:14,className:`text-slate-400`}),`Usage Stats`,U?(0,w.jsx)(i,{size:12,className:`ml-auto`}):(0,w.jsx)(t,{size:12,className:`ml-auto`})]}),U&&(0,w.jsx)(`div`,{className:`mt-3`,children:H.length===0?(0,w.jsx)(`p`,{className:`text-xs text-slate-500 text-center py-2`,children:`No usage data yet`}):(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{children:`Plugin`}),(0,w.jsx)(v,{children:`Usage Count`}),(0,w.jsx)(v,{children:`Last Used`})]})}),(0,w.jsx)(y,{children:H.map(e=>(0,w.jsxs)(b,{children:[(0,w.jsx)(x,{className:`font-medium text-slate-200 text-xs`,children:e.pluginName}),(0,w.jsx)(x,{className:`font-mono text-xs text-slate-400`,children:e.usageCount}),(0,w.jsx)(x,{className:`text-xs text-slate-400`,children:e.lastUsed?ie(e.lastUsed):`—`})]},e.pluginPath))})]})})]})]})}export{T as Plugins};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{J as t,O as n,P as r,Y as i,Z as a,_ as o,f as s,h as c,l as ee,nt as l,o as u,t as te,v as ne,z as re}from"./vendor-icons-CkI4-NxL.js";import{t as d}from"./vendor-react-DLRtONKt.js";import{r as f}from"./dist-HyCSN_hp.js";import{f as p,t as m,w as h}from"./index-rvaixveh.js";import{t as g}from"./Card-4mOZntHG.js";import{a as ie}from"./format-DvtQjPZn.js";import{t as ae}from"./EmptyState-BlgMMAr-.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./Table-BxbnOSbq.js";var C=e(l(),1),w=d();function oe({manifest:e}){if(!e)return null;let t=[];return e.skills.length>0&&t.push({label:`Skill(${e.skills.length})`,variant:`info`}),e.agents.length>0&&t.push({label:`Agent(${e.agents.length})`,variant:`success`}),e.mcpServers.length>0&&t.push({label:`MCP(${e.mcpServers.length})`,variant:`warning`}),e.hooks.length>0&&t.push({label:`Hook(${e.hooks.length})`,variant:`default`}),e.lspServers.length>0&&t.push({label:`LSP(${e.lspServers.length})`,variant:`default`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>(0,w.jsx)(m,{variant:e.variant,children:e.label},e.label))})}function T(){let[e,l]=(0,C.useState)([]),[d,T]=(0,C.useState)([]),[E,se]=(0,C.useState)([]),[ce,le]=(0,C.useState)(new Set),[D,O]=(0,C.useState)(!0),[k,A]=(0,C.useState)(!1),[j,M]=(0,C.useState)(null),[N,ue]=(0,C.useState)(!1),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)(null),[R,z]=(0,C.useState)(!1),[B,V]=(0,C.useState)(``),[H,de]=(0,C.useState)([]),[U,fe]=(0,C.useState)(!1),[pe,me]=(0,C.useState)(new Set),[W,G]=(0,C.useState)(`all`),[K,he]=(0,C.useState)([]),q=(0,C.useCallback)(async()=>{O(!0);try{l((await f(`/plugins`)).plugins)}catch(e){h.error(e instanceof Error?e.message:`Failed to load plugins`)}finally{O(!1)}},[]),J=(0,C.useCallback)(async()=>{A(!0),M(null);try{let[e,t]=await Promise.all([f(`/plugins/marketplace`).catch(()=>({available:[],installed:[]})),f(`/plugins/marketplaces`)]);se(e.available),le(new Set(e.installed.map(e=>e.id))),T(t.sources)}catch(e){M(e instanceof Error?e.message:`Failed to load marketplace`)}finally{A(!1)}},[]),ge=(0,C.useCallback)(async()=>{try{de((await f(`/plugins/stats?limit=20`)).stats)}catch{}},[]),Y=(0,C.useCallback)(async()=>{try{he((await f(`/roles`)).roles)}catch{}},[]);(0,C.useEffect)(()=>{q(),J(),Y()},[q,J,Y]);let _e=async(e,t)=>{L(e);try{await f(`/plugins/${encodeURIComponent(e)}/${t?`enable`:`disable`}`,{method:`POST`}),h.success(`${e} ${t?`enabled`:`disabled`} globally`),l(n=>n.map(n=>n.id===e?{...n,globalEnabled:t}:n))}catch(e){h.error(e instanceof Error?e.message:`Failed to ${t?`enable`:`disable`} plugin`)}finally{L(null)}},ve=async e=>{L(e);try{await f(`/plugins/uninstall/${encodeURIComponent(e)}`,{method:`POST`}),h.success(`Plugin uninstalled`),await Promise.all([q(),J()])}catch(e){h.error(e instanceof Error?e.message:`Uninstall failed`)}finally{L(null)}},ye=async(e,t,n)=>{L(e);try{await f(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:`project`,cwd:n})});let r=K.find(e=>e.id===t)?.name??t;h.success(`Installed ${e.split(`@`)[0]} for ${r}`),await q()}catch(e){h.error(e instanceof Error?e.message:`Install to role failed`)}finally{L(null)}},X=async()=>{if(B.trim())try{await f(`/plugins/install/${encodeURIComponent(B.trim())}`,{method:`POST`,body:JSON.stringify({})}),h.success(`Source added`),V(``),z(!1),await J()}catch(e){h.error(e instanceof Error?e.message:`Failed to add source`)}},Z=async(e,t=`user`,n)=>{L(e);try{await f(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:t,cwd:n})});let r=t===`project`&&n?`${e.split(`@`)[0]} for ${n.split(`/`).pop()}`:e.split(`@`)[0];h.success(`Installed ${r}`),await Promise.all([q(),J()])}catch(e){h.error(e instanceof Error?e.message:`Install failed`)}finally{L(null)}},be=e=>{me(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Q=W===`all`?e:e.filter(e=>e.scope===W),$=P?E.filter(e=>e.name.toLowerCase().includes(P.toLowerCase())||e.description.toLowerCase().includes(P.toLowerCase())):E;return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`h1`,{className:`text-lg font-semibold text-slate-100`,children:`Plugins`}),(0,w.jsx)(p,{variant:`ghost`,size:`sm`,onClick:()=>void q(),children:(0,w.jsx)(c,{size:14})})]}),(0,w.jsxs)(g,{children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(r,{size:14,className:`text-slate-400 flex-shrink-0`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${W===`all`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>G(`all`),children:`All`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${W===`user`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>G(`user`),children:`User`}),(0,w.jsx)(`button`,{className:`rounded-full px-2 py-0.5 text-xs transition-colors ${W===`project`?`bg-blue-600 text-white`:`bg-slate-800 text-slate-400 hover:bg-slate-700`}`,onClick:()=>G(`project`),children:`Project`}),(0,w.jsx)(`span`,{className:`h-4 w-px bg-slate-700 mx-1`}),d.map(e=>(0,w.jsx)(m,{variant:`muted`,className:`text-xs`,children:e.name},e.name)),(0,w.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[k&&(0,w.jsx)(n,{size:12,className:`animate-spin text-slate-500`}),k?null:(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>z(!R),children:R?(0,w.jsx)(te,{size:12}):(0,w.jsx)(ne,{size:12})})]})]}),R&&(0,w.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,w.jsx)(`input`,{className:`flex-1 rounded border border-slate-700 bg-slate-900 px-2 py-1.5 text-sm text-slate-200 focus:border-blue-500 focus:outline-none`,value:B,onChange:e=>V(e.target.value),placeholder:`https://github.com/org/marketplace-repo`,onKeyDown:e=>{e.key===`Enter`&&X()}}),(0,w.jsx)(p,{size:`sm`,onClick:()=>void X(),disabled:!B.trim(),children:`Add`})]})]}),D?(0,w.jsx)(g,{children:(0,w.jsx)(`div`,{className:`py-8 text-center text-sm text-slate-500`,children:`Loading...`})}):Q.length===0?(0,w.jsx)(g,{children:(0,w.jsx)(ae,{icon:(0,w.jsx)(o,{size:32}),title:`No plugins`,description:W===`all`?`No plugins installed. Browse the marketplace or install from a URL.`:`No ${W}-scope plugins installed.`})}):(0,w.jsx)(g,{padding:!1,children:(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{className:`w-8`}),(0,w.jsx)(v,{children:`Name`}),(0,w.jsx)(v,{children:`Version`}),(0,w.jsx)(v,{children:`Scope`}),(0,w.jsx)(v,{children:`Type`}),(0,w.jsx)(v,{children:`Activation`}),(0,w.jsx)(v,{children:`Actions`})]})}),(0,w.jsx)(y,{children:Q.map((e,r)=>{let a=pe.has(e.id),o=e.id.split(`@`)[0],s=I===e.id,c=e.projectPath?`${e.id}:${e.projectPath}`:`${e.id}:${r}`;return(0,w.jsxs)(C.Fragment,{children:[(0,w.jsxs)(b,{className:`group`,children:[(0,w.jsx)(x,{children:(0,w.jsx)(`button`,{onClick:()=>be(e.id),className:`text-slate-500 hover:text-slate-300`,children:a?(0,w.jsx)(i,{size:12}):(0,w.jsx)(t,{size:12})})}),(0,w.jsx)(x,{className:`font-medium text-slate-200`,children:o}),(0,w.jsx)(x,{className:`text-xs text-slate-400`,children:e.version?`v${e.version}`:`—`}),(0,w.jsxs)(x,{children:[(0,w.jsx)(m,{variant:e.scope===`user`?`info`:`warning`,children:e.scope}),e.scope===`project`&&e.projectPath&&(0,w.jsx)(`div`,{className:`text-[10px] text-slate-600 truncate max-w-[120px]`,title:e.projectPath,children:e.projectPath.split(`/`).pop()})]}),(0,w.jsx)(x,{children:(0,w.jsx)(oe,{manifest:e.manifest})}),(0,w.jsx)(x,{children:(0,w.jsx)(m,{variant:e.globalEnabled?`success`:`destructive`,children:e.globalEnabled?`User On`:`User Off`})}),(0,w.jsx)(x,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,disabled:s,onClick:()=>void _e(e.id,!e.globalEnabled),children:s?(0,w.jsx)(n,{size:10,className:`animate-spin`}):e.globalEnabled?`Disable`:`Enable`}),(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs text-red-400`,disabled:s,onClick:()=>void ve(e.id),children:(0,w.jsx)(u,{size:10})})]})})]}),a&&(0,w.jsx)(b,{className:`bg-slate-900/50`,children:(0,w.jsx)(x,{colSpan:7,className:`px-6 py-3`,children:e.manifest?(0,w.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[e.manifest.description&&(0,w.jsx)(`p`,{className:`text-slate-400`,children:e.manifest.description}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[e.manifest.skills.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Skills`}),e.manifest.skills.map(e=>(0,w.jsxs)(`div`,{className:`text-slate-400`,children:[(0,w.jsx)(`span`,{className:`text-slate-200`,children:e.name}),e.description&&(0,w.jsxs)(`span`,{className:`ml-1 text-slate-500`,children:[`— `,e.description]})]},e.name))]}),e.manifest.agents.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Agents`}),e.manifest.agents.map(e=>(0,w.jsxs)(`div`,{className:`text-slate-400`,children:[(0,w.jsx)(`span`,{className:`text-slate-200`,children:e.name}),e.description&&(0,w.jsxs)(`span`,{className:`ml-1 text-slate-500`,children:[`— `,e.description]})]},e.name))]}),e.manifest.mcpServers.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`MCP Servers`}),e.manifest.mcpServers.map(e=>(0,w.jsx)(`div`,{className:`text-slate-400`,children:e},e))]}),e.manifest.hooks.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-1 font-semibold text-slate-300`,children:`Hooks`}),e.manifest.hooks.map(e=>(0,w.jsx)(`div`,{className:`text-slate-400`,children:e},e))]})]}),(0,w.jsx)(`div`,{className:`text-slate-600 font-mono truncate mt-1`,title:e.installPath,children:e.installPath}),K.length>0&&e.scope===`user`&&(0,w.jsxs)(`div`,{className:`mt-3 pt-2 border-t border-slate-800`,children:[(0,w.jsx)(`span`,{className:`text-slate-400 mr-2`,children:`Install to Role:`}),K.map(t=>(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-5 px-2 text-[10px] mr-1`,disabled:I===e.id,onClick:()=>void ye(e.id,t.id,t.workspacePath),children:t.name},t.id))]})]}):(0,w.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Loading manifest...`})})},`${e.id}-detail`)]},c)})})]})}),(0,w.jsxs)(g,{children:[(0,w.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-slate-300`,onClick:()=>ue(!N),children:[(0,w.jsx)(ee,{size:14,className:`text-slate-400`}),`Marketplace (`,E.length,`)`,N?(0,w.jsx)(i,{size:12,className:`ml-auto`}):(0,w.jsx)(t,{size:12,className:`ml-auto`})]}),N&&(0,w.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(s,{size:14,className:`absolute left-2.5 top-2 text-slate-500`}),(0,w.jsx)(`input`,{className:`w-full rounded border border-slate-700 bg-slate-900 pl-8 pr-3 py-1.5 text-sm text-slate-200 placeholder:text-slate-600 focus:border-blue-500 focus:outline-none`,value:P,onChange:e=>F(e.target.value),placeholder:`Search available plugins...`})]}),k?(0,w.jsx)(`p`,{className:`text-xs text-slate-500 text-center py-2`,children:`Loading marketplace...`}):j?(0,w.jsx)(`p`,{className:`text-xs text-red-400 text-center py-2`,children:j}):$.length===0?(0,w.jsx)(`p`,{className:`text-xs text-slate-500 text-center py-2`,children:P?`No plugins match your search`:`No marketplace plugins available`}):(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{children:`Name`}),(0,w.jsx)(v,{children:`Description`}),(0,w.jsx)(v,{children:`Source`}),(0,w.jsx)(v,{children:`Action`})]})}),(0,w.jsx)(y,{children:$.map(e=>{let t=ce.has(e.pluginId),r=I===e.pluginId;return(0,w.jsxs)(b,{children:[(0,w.jsx)(x,{className:`font-medium text-slate-200 text-xs`,children:e.name}),(0,w.jsx)(x,{className:`text-xs text-slate-400 max-w-[300px] truncate`,title:e.description,children:e.description}),(0,w.jsx)(x,{children:(0,w.jsx)(m,{variant:`muted`,className:`text-[10px]`,children:e.marketplaceName})}),(0,w.jsx)(x,{children:t?(0,w.jsx)(m,{variant:`success`,className:`text-[10px]`,children:`Installed`}):(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:()=>void Z(e.pluginId),children:r?(0,w.jsx)(n,{size:10,className:`animate-spin`}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(re,{size:10,className:`mr-1`}),` Install`]})}),K.length>0&&(0,w.jsxs)(`div`,{className:`relative group/install`,children:[(0,w.jsx)(p,{variant:`ghost`,size:`sm`,className:`h-6 px-1 text-xs text-slate-500`,children:(0,w.jsx)(i,{size:10})}),(0,w.jsx)(`div`,{className:`absolute right-0 top-full mt-1 z-10 hidden group-hover/install:block bg-slate-800 border border-slate-700 rounded shadow-lg py-1 min-w-[140px]`,children:K.map(t=>(0,w.jsx)(`button`,{className:`block w-full text-left px-3 py-1 text-xs text-slate-300 hover:bg-slate-700`,disabled:r,onClick:()=>void Z(e.pluginId,`project`,t.workspacePath),children:t.name},t.id))})]})]})})]},e.pluginId)})})]})]})]}),(0,w.jsxs)(g,{children:[(0,w.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-slate-300`,onClick:()=>{!U&&H.length===0&&ge(),fe(!U)},children:[(0,w.jsx)(a,{size:14,className:`text-slate-400`}),`Usage Stats`,U?(0,w.jsx)(i,{size:12,className:`ml-auto`}):(0,w.jsx)(t,{size:12,className:`ml-auto`})]}),U&&(0,w.jsx)(`div`,{className:`mt-3`,children:H.length===0?(0,w.jsx)(`p`,{className:`text-xs text-slate-500 text-center py-2`,children:`No usage data yet`}):(0,w.jsxs)(S,{children:[(0,w.jsx)(_,{children:(0,w.jsxs)(b,{children:[(0,w.jsx)(v,{children:`Plugin`}),(0,w.jsx)(v,{children:`Usage Count`}),(0,w.jsx)(v,{children:`Last Used`})]})}),(0,w.jsx)(y,{children:H.map(e=>(0,w.jsxs)(b,{children:[(0,w.jsx)(x,{className:`font-medium text-slate-200 text-xs`,children:e.pluginName}),(0,w.jsx)(x,{className:`font-mono text-xs text-slate-400`,children:e.usageCount}),(0,w.jsx)(x,{className:`text-xs text-slate-400`,children:e.lastUsed?ie(e.lastUsed):`—`})]},e.pluginPath))})]})})]})]})}export{T as Plugins};
|