@shawnstack/quickforge 1.5.6 → 1.6.3
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 +19 -17
- package/dist/assets/AgentProfilesPage-BTWTENpJ.js +1 -0
- package/dist/assets/{ChatPanelHost-CBoFtBvB.js → ChatPanelHost-DBCQpcp1.js} +2 -2
- package/dist/assets/PluginsPage-DRbQLXc6.js +1 -0
- package/dist/assets/ScheduledTasksPage-_Te96TTL.js +2 -0
- package/dist/assets/SettingsWorkspacePage-B3KByRv9.js +1412 -0
- package/dist/assets/{SharedConversationPage-7I9MiMcj.js → SharedConversationPage-CJr-rzR4.js} +1 -1
- package/dist/assets/TerminalDock-DSsVoL0f.js +2 -0
- package/dist/assets/WorkspaceInspector-HuIqe-Y6.js +3 -0
- package/dist/assets/{WorkspaceReaderDialog-Dli8GgAq.js → WorkspaceReaderDialog-au2UL_Ti.js} +1 -1
- package/dist/assets/{diff-line-counts-Dvz3MNk2.js → diff-line-counts-CnZu37tM.js} +1 -1
- package/dist/assets/{icons-DXrzz0RO.js → icons-B0ihJZtt.js} +1 -1
- package/dist/assets/index-CTo6RkZO.js +63 -0
- package/dist/assets/index-hb3vYF5_.css +3 -0
- package/dist/assets/mcp-servers-dialog-1Y9X80tB.js +5 -0
- package/dist/assets/{monaco-k8av2MY0.js → monaco-BKEc9mhB.js} +1 -1
- package/dist/assets/{react-vendor-xMa3TUTb.js → react-vendor-EwqQ8x7m.js} +1 -1
- package/dist/assets/skills-dialog-vMwLkH49.js +1 -0
- package/dist/assets/{useAppTheme-BzB8Q6AC.js → useAppTheme-CG1_MfzA.js} +1 -1
- package/dist/index.html +6 -6
- package/package.json +4 -1
- package/server/agent-manager.mjs +3 -1
- package/server/index.mjs +4 -3
- package/server/routes/backup.mjs +80 -6
- package/server/routes/system.mjs +5 -0
- package/server/storage.mjs +6 -5
- package/server/utils/package-update.mjs +46 -0
- package/dist/assets/AgentProfilesPage-DFUA4KiP.js +0 -1
- package/dist/assets/PluginsPage-CKOP-P02.js +0 -1
- package/dist/assets/ScheduledTasksPage-CRPvyfmE.js +0 -2
- package/dist/assets/SettingsWorkspacePage-Csr6xu0M.js +0 -1320
- package/dist/assets/TerminalDock-DWZAOy7v.js +0 -2
- package/dist/assets/WorkspaceInspector-D4k8zQ4s.js +0 -3
- package/dist/assets/index-BDNDRaPf.css +0 -3
- package/dist/assets/index-BIslkXQt.js +0 -69
- package/dist/assets/mcp-servers-dialog-DXR3fnZY.js +0 -20
- package/dist/assets/skills-dialog-Dax-_Ze5.js +0 -1
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{$ as t,At as n,I as r,T as i,a,h as o,v as s,x as c,y as l}from"./icons-DXrzz0RO.js";import{n as u}from"./react-vendor-xMa3TUTb.js";import{$ as d,M as f,Q as p,et as m,it as h,m as g}from"./index-BIslkXQt.js";var _=e(n(),1),v=u();function y(e){return e===`connected`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`error`?`bg-destructive/12 text-destructive`:e===`disabled`?`bg-muted text-muted-foreground`:`bg-amber-500/12 text-amber-700 dark:text-amber-300`}var b=12;function x({server:e,toggling:t,reconnecting:n,onToggle:o,onEdit:c,onDelete:l,onReconnect:u}){let f=e.tools?.slice(0,b)??[],p=e.toolCount??e.tools?.length??0,g=Math.max(0,p-f.length),_=e.enabled&&e.status!==`connected`;return(0,v.jsxs)(`div`,{className:`rounded-lg border border-border p-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.name}),(0,v.jsx)(`span`,{className:m(`rounded-full px-2 py-0.5 text-[11px]`,y(e.status)),children:e.status||`unknown`}),(0,v.jsx)(`span`,{className:`text-[11px] text-muted-foreground/60`,children:h(`mcpToolsCount`,{count:p})})]}),(0,v.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground/65`,children:e.transport===`stdio`?`${e.command} ${(e.args||[]).join(` `)}`:e.url}),e.error?(0,v.jsx)(`div`,{className:`mt-1 text-xs text-destructive`,children:e.error}):null]}),(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,v.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,disabled:t,className:m(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,e.enabled?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>o(e),title:e.enabled?h(`pauseTask`):h(`enable`),children:(0,v.jsx)(`span`,{className:m(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,e.enabled?`translate-x-5`:`translate-x-0`)})}),_?(0,v.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground`,onClick:()=>u(e.name),disabled:n,"aria-label":h(`mcpReconnectServer`),title:h(`mcpReconnectServer`),children:n?(0,v.jsx)(r,{className:`size-4 animate-spin`}):(0,v.jsx)(s,{className:`size-4`})}):null,(0,v.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground`,onClick:()=>c(e),"aria-label":h(`editTask`),title:h(`editTask`),children:(0,v.jsx)(i,{className:`size-4`})}),(0,v.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-destructive`,onClick:()=>l(e.name),"aria-label":h(`delete`),title:h(`delete`),children:(0,v.jsx)(a,{className:`size-4`})})]})]}),f.length>0?(0,v.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[f.map(e=>(0,v.jsx)(`span`,{className:`rounded-md bg-muted/28 px-1.5 py-0.5 text-[11px] text-muted-foreground/75`,title:e.quickForgeName,children:e.name},e.quickForgeName)),g>0?(0,v.jsx)(`span`,{className:`rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground/55`,children:h(`mcpMoreTools`,{count:g})}):null]}):null]})}function S(){return{name:``,transport:`stdio`,command:``,args:[],url:``,cwd:``,env:{}}}function ee(e){return{name:e.name,transport:e.transport,command:e.command,args:e.args||[],url:e.url||``,cwd:e.cwd||``,env:e.env||{}}}function C(e){return(e||[]).join(`
|
|
2
|
-
`)}function w(e){return Object.entries(e||{}).map(([e,t])=>`${e}=${t}`).join(`
|
|
3
|
-
`)}function T(e){return e.split(`
|
|
4
|
-
`).map(e=>e.trim()).filter(Boolean)}function E(e){let t={};for(let n of e.split(`
|
|
5
|
-
`)){let e=n.trim();if(!e)continue;let r=e.indexOf(`=`);if(r<=0)continue;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();i&&(t[i]=a)}return t}function D(e){let t={type:e.transport||`stdio`};e.transport===`stdio`?(t.command=e.command||``,t.args=e.args||[],e.cwd&&(t.cwd=e.cwd),e.env&&Object.keys(e.env).length>0&&(t.env=e.env)):(t.url=e.url||``,e.env&&Object.keys(e.env).length>0&&(t.headers=e.env));let n=e.name||`server`;return JSON.stringify({mcpServers:{[n]:t}},null,2)}function O(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function te(e){let t;try{t=JSON.parse(e)}catch{throw Error(h(`mcpInvalidJson`))}if(!O(t))throw Error(h(`mcpInvalidConfigJson`));let n=``,r=null;if(O(t.mcpServers)){let e=Object.entries(t.mcpServers);if(e.length===0)throw Error(h(`mcpEmptyConfigJson`));let[i,a]=e[0];n=i,O(a)&&(r=a)}else r=t;if(!r)throw Error(h(`mcpInvalidConfigJson`));let i=String(r.transport||r.type||`stdio`);if(![`stdio`,`http`,`sse`].includes(i))throw Error(h(`mcpInvalidTransport`,{name:n||`server`}));let a=r.env??r.headers??{};return{name:n,transport:i,command:String(r.command||``),args:Array.isArray(r.args)?r.args:[],url:String(r.url||``),cwd:String(r.cwd||``),env:O(a)?a:{}}}var k=`mb-1 block text-xs text-muted-foreground/72`,A=`min-h-20 w-full resize-y rounded-md border border-input bg-background px-2 py-1.5 font-mono text-xs text-foreground outline-none focus:border-ring`,j=`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm outline-none focus:border-ring`;function M({value:e,onChange:t,isEdit:n,disabled:r}){let i=e.transport===`stdio`,a=n=>t({...e,...n});return(0,v.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground/60`,children:h(n?`mcpEditServer`:`mcpAddServer`)}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-name`,children:h(`mcpServerName`)}),(0,v.jsx)(g,{id:`mcp-server-name`,value:e.name,onChange:e=>a({name:e.target.value}),placeholder:h(`mcpNamePlaceholder`),disabled:n||r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-transport`,children:h(`mcpTransport`)}),(0,v.jsxs)(`select`,{id:`mcp-server-transport`,className:j,value:e.transport,onChange:e=>a({transport:e.target.value}),disabled:r,children:[(0,v.jsx)(`option`,{value:`stdio`,children:`stdio`}),(0,v.jsx)(`option`,{value:`http`,children:`http`}),(0,v.jsx)(`option`,{value:`sse`,children:`sse`})]})]}),i?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-command`,children:h(`mcpCommand`)}),(0,v.jsx)(g,{id:`mcp-server-command`,value:e.command,onChange:e=>a({command:e.target.value}),placeholder:h(`mcpCommandPlaceholder`),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-args`,children:h(`mcpArgs`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-args`,className:A,value:C(e.args),onChange:e=>a({args:T(e.target.value)}),spellCheck:!1,disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-cwd`,children:h(`mcpCwd`)}),(0,v.jsx)(g,{id:`mcp-server-cwd`,value:e.cwd,onChange:e=>a({cwd:e.target.value}),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-env`,children:h(`mcpEnv`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-env`,className:A,value:w(e.env),onChange:e=>a({env:E(e.target.value)}),spellCheck:!1,disabled:r})]})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-url`,children:h(`mcpUrl`)}),(0,v.jsx)(g,{id:`mcp-server-url`,value:e.url,onChange:e=>a({url:e.target.value}),placeholder:h(`mcpUrlPlaceholder`),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-headers`,children:h(`mcpHeaders`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-headers`,className:A,value:w(e.env),onChange:e=>a({env:E(e.target.value)}),spellCheck:!1,disabled:r})]})]})]})}function N({configText:e,onConfigTextChange:t,onImport:n,onUseExample:i,saving:a}){return(0,v.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,v.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-foreground/90`,children:[h(`mcpImportConfig`),(0,v.jsx)(p,{label:h(`mcpImportConfigDescription`)})]}),(0,v.jsx)(`textarea`,{className:`min-h-96 w-full resize-y rounded-md border border-input bg-background px-2 py-1.5 font-mono text-xs text-foreground outline-none focus:border-ring`,value:e,onChange:e=>t(e.target.value),spellCheck:!1}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsx)(d,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,disabled:a,children:h(`mcpUseExample`)}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsxs)(d,{type:`button`,size:`sm`,onClick:()=>n(`merge`),disabled:a||!e.trim(),children:[a?(0,v.jsx)(r,{className:`mr-1.5 size-3.5 animate-spin`}):(0,v.jsx)(c,{className:`mr-1.5 size-3.5`}),h(`mcpImportUpdate`)]}),(0,v.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>n(`replace`),disabled:a||!e.trim(),children:h(`mcpReplaceAll`)})]})]})]})}var P=`{
|
|
6
|
-
"mcpServers": {
|
|
7
|
-
"zai-mcp-server": {
|
|
8
|
-
"type": "stdio",
|
|
9
|
-
"command": "npx",
|
|
10
|
-
"args": [
|
|
11
|
-
"-y",
|
|
12
|
-
"@z_ai/mcp-server"
|
|
13
|
-
],
|
|
14
|
-
"env": {
|
|
15
|
-
"Z_AI_API_KEY": "\${Z_AI_API_KEY}",
|
|
16
|
-
"Z_AI_MODE": "ZHIPU"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}`;async function F(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`HTTP ${e.status}`);return t}function I(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function ne(e){let t;try{t=JSON.parse(e)}catch{throw Error(h(`mcpInvalidJson`))}if(!I(t)||!I(t.mcpServers))throw Error(h(`mcpInvalidConfigJson`));let n=Object.entries(t.mcpServers);if(n.length===0)throw Error(h(`mcpEmptyConfigJson`));for(let[e,t]of n){if(!/^(?!.*--)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(e))throw Error(h(`mcpInvalidServerName`,{name:e}));if(!I(t))throw Error(h(`mcpInvalidServerConfig`,{name:e}));let n=String(t.transport||t.type||`stdio`);if(![`stdio`,`http`,`sse`].includes(n))throw Error(h(`mcpInvalidTransport`,{name:e}));if(n===`stdio`&&typeof t.command!=`string`)throw Error(h(`mcpMissingCommand`,{name:e}));if(n!==`stdio`&&typeof t.url!=`string`)throw Error(h(`mcpMissingUrl`,{name:e}));if(t.args!==void 0&&!Array.isArray(t.args))throw Error(h(`mcpArgsMustBeArray`,{name:e}));if(t.env!==void 0&&!I(t.env))throw Error(h(`mcpEnvMustBeObject`,{name:e}));if(t.headers!==void 0&&!I(t.headers))throw Error(h(`mcpHeadersMustBeObject`,{name:e}))}return t}function L({active:e=!0,className:n}){let[i,a]=(0,_.useState)([]),[s,u]=(0,_.useState)(P),[g,y]=(0,_.useState)(!1),[b,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!1),[E,O]=(0,_.useState)(new Set),[k,A]=(0,_.useState)(null),[j,I]=(0,_.useState)(``),[L,R]=(0,_.useState)(!1),[z,B]=(0,_.useState)(null),[V,H]=(0,_.useState)(S),[U,W]=(0,_.useState)(`form`),[G,K]=(0,_.useState)(``),[q,J]=(0,_.useState)(``),Y=(0,_.useCallback)(e=>{a(e?.servers??[])},[]),X=(0,_.useCallback)(async()=>{y(!0),I(``);try{Y(await F(await fetch(`/api/mcp/servers`)))}catch(e){I(e instanceof Error?e.message:h(`mcpLoadFailed`))}finally{y(!1)}},[Y]);if((0,_.useEffect)(()=>{if(!e)return;let t=window.setTimeout(()=>{X()},0);return()=>window.clearTimeout(t)},[e,X]),!e)return null;let Z=e=>{e===`json`&&(K(D(V)),J(``)),W(e)},re=()=>{B(null),H(S()),W(`form`),R(!0),I(``)},ie=e=>{let t=ee(e);B(e),H(t),K(D(t)),J(``),W(`form`),R(!0),I(``)},Q=()=>{R(!1),B(null),K(``),J(``),I(``)},ae=e=>{H(e)},oe=e=>{K(e);try{let t=te(e);H(e=>({...t,name:t.name||e.name})),J(``)}catch(e){J(e instanceof Error?e.message:h(`mcpInvalidJson`))}},se=async e=>{if(!w&&!(e===`replace`&&!await f({description:h(`mcpReplaceConfirm`),confirmLabel:h(`mcpReplaceAll`),cancelLabel:h(`cancel`)}))){T(!0),I(``);try{let t=ne(s);Y(await F(await fetch(`/api/mcp/config`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:e,...t})})))}catch(e){I(e instanceof Error?e.message:h(`mcpSaveFailed`))}finally{T(!1)}}},ce=async()=>{if(!b){if(q&&U===`json`){I(q);return}C(!0),I(``);try{Y(await F(await fetch(`/api/mcp/servers`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({server:{...V,enabled:z?.enabled??!0}})}))),Q()}catch(e){I(e instanceof Error?e.message:h(`mcpSaveFailed`))}finally{C(!1)}}},le=async e=>{if(await f({description:h(`mcpDeleteConfirm`,{name:e}),confirmLabel:h(`confirmDelete`),cancelLabel:h(`cancel`),variant:`destructive`})){I(``);try{Y(await F(await fetch(`/api/mcp/servers/${encodeURIComponent(e)}`,{method:`DELETE`})))}catch(e){I(e instanceof Error?e.message:h(`mcpDeleteFailed`))}}},ue=async e=>{if(!E.has(e.name)){O(t=>new Set(t).add(e.name)),I(``);try{Y(await F(await fetch(`/api/mcp/servers/${encodeURIComponent(e.name)}/enabled`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})})))}catch(e){I(e instanceof Error?e.message:h(`mcpSaveFailed`))}finally{O(t=>{let n=new Set(t);return n.delete(e.name),n})}}},de=async()=>{y(!0),I(``);try{Y(await F(await fetch(`/api/mcp/reconnect`,{method:`POST`})))}catch(e){I(e instanceof Error?e.message:h(`mcpReconnectFailed`))}finally{y(!1)}},fe=async e=>{if(!k){A(e),I(``);try{Y(await F(await fetch(`/api/mcp/reconnect/${encodeURIComponent(e)}`,{method:`POST`})))}catch(e){I(e instanceof Error?e.message:h(`mcpReconnectFailed`))}finally{A(null)}}},$=!!z,pe=!!V.name.trim()&&!!(V.transport===`stdio`?V.command.trim():V.url.trim());return(0,v.jsxs)(`div`,{className:m(`flex h-full min-h-0 flex-col overflow-hidden bg-background`,n),children:[j?(0,v.jsx)(`div`,{className:`m-4 mb-0 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:j}):null,(0,v.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:(0,v.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_26rem]`,children:[(0,v.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-medium text-foreground/90`,children:h(`mcpConfiguredServers`)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsxs)(d,{type:`button`,variant:`ghost`,size:`sm`,onClick:re,disabled:L&&!$,children:[(0,v.jsx)(c,{className:`mr-1.5 size-3.5`}),h(`mcpAddServer`)]}),(0,v.jsxs)(d,{type:`button`,variant:`ghost`,size:`sm`,onClick:de,disabled:g,children:[g?(0,v.jsx)(r,{className:`mr-1.5 size-3.5 animate-spin`}):(0,v.jsx)(l,{className:`mr-1.5 size-3.5`}),h(`mcpReconnect`)]})]})]}),g&&i.length===0?(0,v.jsxs)(`div`,{className:`flex items-center justify-center gap-2 rounded-lg border border-border py-8 text-sm text-muted-foreground`,children:[(0,v.jsx)(r,{className:`size-4 animate-spin`}),h(`loading`)]}):i.length===0?(0,v.jsx)(`div`,{className:`rounded-lg border border-border bg-muted/15 p-4 text-sm text-muted-foreground/72`,children:h(`mcpNoServersDescription`)}):i.map(e=>(0,v.jsx)(x,{server:e,toggling:E.has(e.name),reconnecting:k===e.name,onToggle:e=>{ue(e)},onEdit:ie,onDelete:e=>{le(e)},onReconnect:e=>{fe(e)}},e.name))]}),(0,v.jsx)(`div`,{className:`flex min-h-0 flex-col rounded-lg border border-border`,children:L?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`flex border-b border-border`,children:[(0,v.jsxs)(`button`,{type:`button`,onClick:()=>Z(`form`),className:m(`flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-xs font-medium transition-colors`,U===`form`?`border-b-2 border-primary text-foreground/90 -mb-px`:`text-muted-foreground/60 hover:text-foreground/85`),children:[(0,v.jsx)(o,{className:`size-3.5`}),h(`mcpTabServer`)]}),(0,v.jsxs)(`button`,{type:`button`,onClick:()=>Z(`json`),className:m(`flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-xs font-medium transition-colors`,U===`json`?`border-b-2 border-primary text-foreground/90 -mb-px`:`text-muted-foreground/60 hover:text-foreground/85`),children:[(0,v.jsx)(t,{className:`size-3.5`}),h(`mcpTabJson`)]})]}),(0,v.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:U===`form`?(0,v.jsx)(M,{value:V,onChange:ae,isEdit:$,disabled:b}):(0,v.jsxs)(`div`,{className:`space-y-2 p-3`,children:[(0,v.jsx)(`textarea`,{className:`min-h-96 w-full resize-y rounded-md border border-input bg-background px-2 py-1.5 font-mono text-xs text-foreground outline-none focus:border-ring`,value:G,onChange:e=>oe(e.target.value),spellCheck:!1}),q?(0,v.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:q}):null,(0,v.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-foreground/90`,children:[h(`mcpTabJson`),(0,v.jsx)(p,{label:h(`mcpImportConfigDescription`)})]})]})}),(0,v.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border p-3`,children:[(0,v.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,onClick:Q,disabled:b,children:h(`cancel`)}),(0,v.jsxs)(d,{type:`button`,size:`sm`,onClick:()=>{ce()},disabled:b||!pe,children:[b?(0,v.jsx)(r,{className:`mr-1.5 size-3.5 animate-spin`}):null,h(`save`)]})]})]}):(0,v.jsx)(N,{configText:s,onConfigTextChange:u,onImport:e=>{se(e)},onUseExample:()=>{u(P),I(``)},saving:w})})]})})]})}export{L as McpServersPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-DWdDZTNf.js";import{At as n,Et as r,I as i,g as a,xt as o,yt as s}from"./icons-DXrzz0RO.js";import{n as c}from"./react-vendor-xMa3TUTb.js";import{$ as l,Q as u,et as d,it as f}from"./index-BIslkXQt.js";var p=t({SkillsDialog:()=>v,SkillsManagerPanel:()=>_}),m=e(n(),1),h=c();async function g(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`HTTP ${e.status}`);return t}function _({active:e=!0,scope:t,project:n,embedded:c=!1,closeOnSave:p=!1,onClose:_,onSaved:v}){let[y,b]=(0,m.useState)([]),[x,S]=(0,m.useState)(()=>new Set),[C,w]=(0,m.useState)(``),[T,E]=(0,m.useState)([]),[D,O]=(0,m.useState)(!1),[k,A]=(0,m.useState)(!1),[j,M]=(0,m.useState)(``),N=t===`project`,[P,F]=(0,m.useState)(null),[I,L]=(0,m.useState)(null),[R,z]=(0,m.useState)(!1),[B,V]=(0,m.useState)(``),H=(0,m.useCallback)(()=>{F(null),L(null),V(``)},[]),U=(0,m.useCallback)(()=>{H(),_?.()},[_,H]);(0,m.useEffect)(()=>{if(!e||N&&!n)return;let t=!1;return(async()=>{O(!0),M(``);try{let e=N?`/api/skills?projectId=${encodeURIComponent(n.id)}`:`/api/skills?scope=global`,r=await g(await fetch(e));if(t)return;b(Array.isArray(r.skills)?r.skills:[]),S(new Set(Array.isArray(r.selectedSkills)?r.selectedSkills:[])),E(Array.isArray(r.searchPaths)?r.searchPaths:[])}catch(e){t||M(e instanceof Error?e.message:f(`failedToLoadSkills`))}finally{t||O(!1)}})(),()=>{t=!0}},[e,n,N]),(0,m.useEffect)(()=>{if(!e||c)return;let t=e=>{e.key===`Escape`&&(P?H():k||U())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,U,c,k,P,H]);let W=(0,m.useMemo)(()=>{let e=C.trim().toLowerCase();return e?y.filter(t=>[t.name,t.displayName,t.description,t.source,t.compatibility,t.allowedTools,...t.tags??[],...t.triggers??[]].filter(Boolean).join(` `).toLowerCase().includes(e)):y},[C,y]),G=async e=>{F(e),L(null),V(``),z(!0);try{let t=new URLSearchParams({name:e});N&&n?(t.set(`scope`,`project`),t.set(`projectId`,n.id)):t.set(`scope`,`global`),L(await g(await fetch(`/api/skills/content?${t}`)))}catch(e){V(e instanceof Error?e.message:f(`failedToReadSkill`))}finally{z(!1)}},K=()=>{H()};if(!e||N&&!n)return null;let q=e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},J=async()=>{if(!k){A(!0),M(``);try{let e=await g(await fetch(N?`/api/skills/project`:`/api/skills/global`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(N?{projectId:n.id,selectedSkills:[...x]}:{selectedSkills:[...x]})}));v({scope:t,project:N?e.projects?.find(e=>e.id===n.id)??{...n,skills:e.selectedSkills}:void 0,projects:e.projects,selectedSkills:e.selectedSkills}),p&&U()}catch(e){M(e instanceof Error?e.message:f(`failedToSaveSkills`))}finally{A(!1)}}},Y=f(N?`projectSkills`:`globalSkills`),X=N?f(`projectSkillsDescription`,{project:n.name}):f(`globalSkillsDescription`),Z=!!P;return(0,h.jsx)(`div`,{className:c?`flex h-full min-h-0 flex-col`:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onClick:e=>{!c&&e.target===e.currentTarget&&!k&&U()},children:(0,h.jsxs)(`div`,{className:c?`flex h-full min-h-0 flex-col overflow-hidden bg-background`:`flex max-h-[85vh] w-full max-w-2xl flex-col rounded-lg border border-border bg-background shadow-quickforge`,children:[(0,h.jsx)(`div`,{className:`border-b border-border p-4`,children:Z?(0,h.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,onClick:K,children:[(0,h.jsx)(s,{className:`size-4`}),f(`backToSkillList`)]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-base font-semibold text-foreground`,children:[Y,(0,h.jsx)(u,{label:X})]}),T.length?(0,h.jsxs)(`p`,{className:`mt-2 break-all text-xs text-muted-foreground/65`,children:[f(`skillSearchPaths`),`: `,T.join(` · `)]}):null]})}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:Z?R?(0,h.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-sm text-muted-foreground`,children:[(0,h.jsx)(i,{className:`size-4 animate-spin`}),f(`loading`)]}):B?(0,h.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:B}):I?(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsxs)(`div`,{className:`rounded-md border border-border px-3 py-2 text-sm space-y-1`,children:[(0,h.jsxs)(`div`,{className:`font-medium text-foreground/90`,children:[I.displayName||I.name,I.version?(0,h.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`v`,I.version]}):null]}),I.description?(0,h.jsx)(`div`,{className:`text-muted-foreground/70`,children:I.description}):null,(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-0.5 text-xs text-muted-foreground/60`,children:[I.source?(0,h.jsx)(`span`,{children:I.source}):null,I.compatibility?(0,h.jsxs)(`span`,{children:[`· `,I.compatibility]}):null,I.allowedTools?(0,h.jsxs)(`span`,{children:[`· `,I.allowedTools]}):null,I.license?(0,h.jsxs)(`span`,{children:[`· `,I.license]}):null]}),I.tags?.length?(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:I.tags.map(e=>(0,h.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground`,children:e},e))}):null,I.triggers?.length?(0,h.jsxs)(`div`,{className:`text-xs text-muted-foreground/60`,children:[`Triggers: `,I.triggers.join(`, `)]}):null]}),I.instructions?(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-md border border-border bg-muted/30 px-4 py-3 text-sm leading-6 text-foreground/80 font-mono`,children:I.instructions}):(0,h.jsx)(`div`,{className:`py-4 text-center text-sm text-muted-foreground`,children:f(`noSkillContent`)})]}):null:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2`,children:[(0,h.jsx)(a,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,h.jsx)(`input`,{value:C,onChange:e=>w(e.target.value),placeholder:f(`searchSkills`),className:`min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/45`,disabled:D||k})]}),j?(0,h.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:j}):null,(0,h.jsxs)(`div`,{className:`rounded-md border border-border`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-3 py-2 text-xs text-muted-foreground`,children:[(0,h.jsx)(`span`,{children:f(`availableSkills`)}),(0,h.jsx)(`span`,{children:f(`selectedSkillsCount`,{count:x.size})})]}),(0,h.jsx)(`div`,{className:c?`min-h-0 flex-1 overflow-y-auto p-1`:`max-h-[46vh] overflow-y-auto p-1`,children:D?(0,h.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-3 py-8 text-sm text-muted-foreground`,children:[(0,h.jsx)(i,{className:`size-4 animate-spin`}),f(`loading`)]}):W.length===0?(0,h.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:f(`noMatchingSkills`)}):W.map(e=>{let t=x.has(e.name);return(0,h.jsxs)(`div`,{className:d(`flex w-full items-start gap-3 rounded-md px-3 py-3 text-left text-sm transition-colors hover:bg-muted/28 disabled:opacity-50`,t&&`bg-muted/28`),children:[(0,h.jsx)(`button`,{type:`button`,className:d(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded border border-input`,t&&`border-primary bg-primary text-primary-foreground`),onClick:()=>q(e.name),disabled:k,"aria-label":t?`Deselect ${e.name}`:`Select ${e.name}`,children:t?(0,h.jsx)(o,{className:`size-3.5`}):null}),(0,h.jsxs)(`span`,{className:`min-w-0 flex-1 cursor-pointer`,onClick:()=>q(e.name),children:[(0,h.jsx)(`span`,{className:`block truncate font-medium text-foreground/90`,children:e.displayName||e.name}),e.description?(0,h.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground/70`,children:e.description}):null,(0,h.jsxs)(`span`,{className:`mt-1 flex flex-wrap gap-1 text-[11px] text-muted-foreground/60`,children:[e.source?(0,h.jsx)(`span`,{children:e.source}):null,e.compatibility?(0,h.jsxs)(`span`,{children:[`· `,e.compatibility]}):null,e.allowedTools?(0,h.jsxs)(`span`,{children:[`· `,e.allowedTools]}):null]}),e.tags?.length?(0,h.jsx)(`span`,{className:`mt-2 flex flex-wrap gap-1`,children:e.tags.slice(0,5).map(e=>(0,h.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground`,children:e},e))}):null]}),(0,h.jsx)(`button`,{type:`button`,className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-colors hover:bg-muted/28 hover:text-foreground`,onClick:()=>void G(e.name),disabled:k||R,title:f(`readSkill`),"aria-label":`${f(`readSkill`)}: ${e.displayName||e.name}`,children:(0,h.jsx)(r,{className:`size-4`})})]},e.name)})})]})]})}),Z?null:(0,h.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border p-4`,children:[c?null:(0,h.jsx)(l,{type:`button`,variant:`outline`,onClick:U,disabled:k,children:f(`cancel`)}),(0,h.jsx)(l,{type:`button`,onClick:J,disabled:D||k,children:f(k?`saving`:`save`)})]})]})})}function v({open:e,scope:t,project:n,onOpenChange:r,onSaved:i}){return(0,h.jsx)(_,{active:e,scope:t,project:n,closeOnSave:!0,onClose:()=>r(!1),onSaved:i})}export{p as n,v as t};
|