@shawnstack/quickforge 1.5.5 → 1.5.6
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 +11 -11
- package/dist/assets/AgentProfilesPage-DFUA4KiP.js +1 -0
- package/dist/assets/{ChatPanelHost-u0K5IWMF.js → ChatPanelHost-CBoFtBvB.js} +55 -55
- package/dist/assets/PluginsPage-CKOP-P02.js +1 -0
- package/dist/assets/ScheduledTasksPage-CRPvyfmE.js +2 -0
- package/dist/assets/SettingsWorkspacePage-Csr6xu0M.js +1320 -0
- package/dist/assets/SharedConversationPage-7I9MiMcj.js +1 -0
- package/dist/assets/TerminalDock-DWZAOy7v.js +2 -0
- package/dist/assets/WorkspaceInspector-D4k8zQ4s.js +3 -0
- package/dist/assets/WorkspaceReaderDialog-Dli8GgAq.js +1 -0
- package/dist/assets/{diff-line-counts-N83e7__F.js → diff-line-counts-Dvz3MNk2.js} +1 -1
- package/dist/assets/icons-DXrzz0RO.js +1 -0
- package/dist/assets/index-BDNDRaPf.css +3 -0
- package/dist/assets/index-BIslkXQt.js +69 -0
- package/dist/assets/mcp-servers-dialog-DXR3fnZY.js +20 -0
- package/dist/assets/{monaco-DtXl4zfe.js → monaco-k8av2MY0.js} +1 -1
- package/dist/assets/{pi-web-ui-CBet4bMl.js → pi-web-ui-DFNE2m5b.js} +1 -1
- package/dist/assets/{react-vendor-BjDQPVuK.js → react-vendor-xMa3TUTb.js} +1 -1
- package/dist/assets/skills-dialog-Dax-_Ze5.js +1 -0
- package/dist/assets/{useAppTheme-Bm6HIzLF.js → useAppTheme-BzB8Q6AC.js} +1 -1
- package/dist/index.html +7 -5
- package/package.json +1 -1
- package/server/agent-manager.mjs +15 -0
- package/server/approval-store.mjs +34 -2
- package/server/index.mjs +3 -0
- package/server/public-api.mjs +45 -0
- package/server/routes/storage.mjs +29 -9
- package/server/storage.mjs +13 -4
- package/dist/assets/AgentProfilesPage-nVhgwanY.js +0 -1
- package/dist/assets/PluginsPage-BVRTC0rz.js +0 -1
- package/dist/assets/ScheduledTasksPage-D37TE2cM.js +0 -2
- package/dist/assets/SharedConversationPage-D5hnzsZC.js +0 -1
- package/dist/assets/TerminalDock-NvH9esAS.js +0 -2
- package/dist/assets/WorkspaceInspector-DbnO1fei.js +0 -3
- package/dist/assets/WorkspaceReaderDialog-BcxIbNBq.js +0 -1
- package/dist/assets/icons-Uo4Gd-eK.js +0 -1
- package/dist/assets/index-DiaCCmXE.js +0 -1482
- package/dist/assets/index-KdiXReMI.css +0 -3
- /package/dist/assets/{plugin-api-YfYj_Bd7.js → plugin-api-UKg_cgSG.js} +0 -0
- /package/dist/assets/{xterm-5XDrJ343.js → xterm-BtSXYfUR.js} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t}from"./icons-DXrzz0RO.js";function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e){if(Array.isArray(e))return e}function i(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function o(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?s(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t){if(e==null)return{};var n,r,i=u(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function u(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function d(e,t){return r(e)||a(e,t)||m(e,t)||o()}function f(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?g(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function y(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function b(e){return{}.toString.call(e).includes(`Object`)}function x(e){return!Object.keys(e).length}function S(e){return typeof e==`function`}function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function w(e,t){return b(t)||k(`changeType`),Object.keys(t).some(function(t){return!C(e,t)})&&k(`changeField`),t}function T(e){S(e)||k(`selectorType`)}function E(e){S(e)||b(e)||k(`handlerType`),b(e)&&Object.values(e).some(function(e){return!S(e)})&&k(`handlersType`)}function D(e){e||k(`initialIsRequired`),b(e)||k(`initialType`),x(e)&&k(`initialContent`)}function O(e,t){throw Error(e[t]||e.default)}var k=y(O)({initialIsRequired:`initial state is required`,initialType:`initial state should be an object`,initialContent:`initial state shouldn't be an empty object`,handlerType:`handler should be an object or a function`,handlersType:`all handlers should be a functions`,selectorType:`selector should be a function`,changeType:`provided value of changes should be an object`,changeField:`it seams you want to change a field in the state which is not specified in the "initial" state`,default:"an unknown error accured in `state-local` package"}),A={changes:w,selector:T,handler:E,initial:D};function j(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};A.initial(e),A.handler(t);var n={current:e},r=y(P)(n,t),i=y(N)(n),a=y(A.changes)(e),o=y(M)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return A.selector(e),e(n.current)}function c(e){v(r,i,a,o)(e)}return[s,c]}function M(e,t){return S(t)?t(e.current):t}function N(e,t){return e.current=_(_({},e.current),t),t}function P(e,t,n){return S(t)?t(e.current):Object.keys(n).forEach(function(n){return t[n]?.call(t,e.current[n])}),n}var F={create:j},I={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs`}};function ee(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function te(e){return{}.toString.call(e).includes(`Object`)}function ne(e){return e||R(`configIsRequired`),te(e)||R(`configType`),e.urls?(re(),{paths:{vs:e.urls.monacoBase}}):e}function re(){console.warn(L.deprecation)}function ie(e,t){throw Error(e[t]||e.default)}var L={configIsRequired:`the configuration object is required`,configType:`the configuration object should be an object`,default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
3
|
You are using deprecated way of configuration.
|
|
4
4
|
|
|
@@ -2767,4 +2767,4 @@ ${this.content||``}</pre
|
|
|
2767
2767
|
${je({variant:`outline`,onClick:()=>this.handleCancel(),children:N(`Cancel`)})}
|
|
2768
2768
|
${je({variant:`default`,onClick:()=>this.handleConfirm(),children:N(`Confirm`)})}
|
|
2769
2769
|
`})}
|
|
2770
|
-
`})}};i$([r()],o$.prototype,`headerTitle`,void 0),i$([r()],o$.prototype,`message`,void 0),i$([r()],o$.prototype,`defaultValue`,void 0),i$([r()],o$.prototype,`isPassword`,void 0),i$([o()],o$.prototype,`inputValue`,void 0),o$=a$=i$([l(`prompt-dialog`)],o$);export{
|
|
2770
|
+
`})}};i$([r()],o$.prototype,`headerTitle`,void 0),i$([r()],o$.prototype,`message`,void 0),i$([r()],o$.prototype,`defaultValue`,void 0),i$([r()],o$.prototype,`isPassword`,void 0),i$([o()],o$.prototype,`inputValue`,void 0),o$=a$=i$([l(`prompt-dialog`)],o$);export{WQ as a,tz as c,He as d,Le as f,N as g,I as h,e$ as i,ze as l,Te as m,n$ as n,jQ as o,Oe as p,t$ as r,xQ as s,r$ as t,Ve as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DWdDZTNf.js";import{Et as t}from"./icons-Uo4Gd-eK.js";var n=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,ee=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<ee)}function E(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=E,D=function(){k.postMessage(null)}}else D=function(){_(E,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),r=e(((e,t)=>{t.exports=n()})),i=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),a=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=e((e=>{var n=r(),i=t(),o=a();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},I=[],L=-1;function re(e){return{current:e}}function R(e){0>L||(e.current=I[L],I[L]=null,L--)}function z(e,t){L++,I[L]=e.current,e.current=t}var B=re(null),ie=re(null),ae=re(null),oe=re(null);function se(e,t){switch(z(ae,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ce(){R(B),R(ie),R(ae)}function V(e){e.memoizedState!==null&&z(oe,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function le(e){ie.current===e&&(R(B),R(ie)),oe.current===e&&(R(oe),Qf._currentValue=ne)}var H,ue;function de(e){if(H===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||``,ue=-1<e.stack.indexOf(`
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t}from"./icons-DXrzz0RO.js";var n=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,ee=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<ee)}function E(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=E,D=function(){k.postMessage(null)}}else D=function(){_(E,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),r=e(((e,t)=>{t.exports=n()})),i=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),a=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=e((e=>{var n=r(),i=t(),o=a();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},I=[],L=-1;function re(e){return{current:e}}function R(e){0>L||(e.current=I[L],I[L]=null,L--)}function z(e,t){L++,I[L]=e.current,e.current=t}var B=re(null),ie=re(null),ae=re(null),oe=re(null);function se(e,t){switch(z(ae,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ce(){R(B),R(ie),R(ae)}function V(e){e.memoizedState!==null&&z(oe,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function le(e){ie.current===e&&(R(B),R(ie)),oe.current===e&&(R(oe),Qf._currentValue=ne)}var H,ue;function de(e){if(H===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||``,ue=-1<e.stack.indexOf(`
|
|
2
2
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
3
|
`+H+e+ue}var fe=!1;function pe(e,t){if(!e||fe)return``;fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
4
|
`),l=s.split(`
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t}from"./icons-DXrzz0RO.js";import{y as n}from"./index-BIslkXQt.js";var r=e(t(),1);function i(){let[e,t]=(0,r.useState)(()=>n());return(0,r.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement,r=()=>t(n());r();let i=new MutationObserver(r);return i.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>i.disconnect()},[]),e}export{i as t};
|
package/dist/index.html
CHANGED
|
@@ -11,16 +11,18 @@
|
|
|
11
11
|
<meta name="apple-mobile-web-app-title" content="QuickForge" />
|
|
12
12
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
13
13
|
<title>速构 QuickForge</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-BIslkXQt.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-DWdDZTNf.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/pi-ai-Cx633yhb.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/lit-vendor-Dr3cpBGF.js">
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/pi-web-ui-
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/pi-web-ui-DFNE2m5b.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/css-utils-rkE68RDy.js">
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/icons-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/react-vendor-
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/icons-DXrzz0RO.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/react-vendor-xMa3TUTb.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/assets/logger-B65Akg8A.js">
|
|
23
|
-
<link rel="
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/index-BIslkXQt.js">
|
|
24
|
+
<link rel="modulepreload" crossorigin href="/assets/skills-dialog-Dax-_Ze5.js">
|
|
25
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BDNDRaPf.css">
|
|
24
26
|
</head>
|
|
25
27
|
<body>
|
|
26
28
|
<div id="root"></div>
|
package/package.json
CHANGED
package/server/agent-manager.mjs
CHANGED
|
@@ -41,6 +41,8 @@ import {
|
|
|
41
41
|
safeReadTools,
|
|
42
42
|
pendingApprovals,
|
|
43
43
|
pendingAutoCompactApprovals,
|
|
44
|
+
getPendingApprovalForSession,
|
|
45
|
+
getPendingAutoCompactApprovalForSession,
|
|
44
46
|
commandToolPermissionError,
|
|
45
47
|
createCommandToolPermissions,
|
|
46
48
|
} from './approval-store.mjs'
|
|
@@ -166,6 +168,8 @@ function createApprovalPromise(session, toolCallId, toolName, args, source) {
|
|
|
166
168
|
if (!session) return { block: true, reason: 'No active session for tool approval.' }
|
|
167
169
|
return new Promise((resolve, reject) => {
|
|
168
170
|
let settled = false
|
|
171
|
+
const requestedAt = Date.now()
|
|
172
|
+
const expiresAt = requestedAt + APPROVAL_TIMEOUT_MS
|
|
169
173
|
|
|
170
174
|
const timeout = setTimeout(() => {
|
|
171
175
|
if (settled) return
|
|
@@ -215,6 +219,8 @@ function createApprovalPromise(session, toolCallId, toolName, args, source) {
|
|
|
215
219
|
toolName,
|
|
216
220
|
args,
|
|
217
221
|
source,
|
|
222
|
+
requestedAt,
|
|
223
|
+
expiresAt,
|
|
218
224
|
})
|
|
219
225
|
|
|
220
226
|
emitSessionEvent(session, {
|
|
@@ -233,6 +239,8 @@ function createAutoCompactApprovalPromise(session, details = {}) {
|
|
|
233
239
|
const approvalId = randomUUID()
|
|
234
240
|
return new Promise((resolve, reject) => {
|
|
235
241
|
let settled = false
|
|
242
|
+
const requestedAt = Date.now()
|
|
243
|
+
const expiresAt = requestedAt + APPROVAL_TIMEOUT_MS
|
|
236
244
|
const timeout = setTimeout(() => {
|
|
237
245
|
if (settled) return
|
|
238
246
|
settled = true
|
|
@@ -277,6 +285,11 @@ function createAutoCompactApprovalPromise(session, details = {}) {
|
|
|
277
285
|
reject(err)
|
|
278
286
|
},
|
|
279
287
|
sessionId: session.sessionId,
|
|
288
|
+
usage: details.usage,
|
|
289
|
+
thresholdPercent: details.settings?.thresholdPercent,
|
|
290
|
+
keepRecentTurns: details.settings?.keepRecentTurns,
|
|
291
|
+
requestedAt,
|
|
292
|
+
expiresAt,
|
|
280
293
|
})
|
|
281
294
|
|
|
282
295
|
emitSessionEvent(session, {
|
|
@@ -1930,6 +1943,8 @@ export function getSessionState(sessionId) {
|
|
|
1930
1943
|
messages: session.agent.state.messages,
|
|
1931
1944
|
contextCompaction: session.contextCompaction,
|
|
1932
1945
|
contextUsage: getSessionContextUsage(session),
|
|
1946
|
+
pendingToolApproval: getPendingApprovalForSession(session.sessionId),
|
|
1947
|
+
pendingAutoCompactApproval: getPendingAutoCompactApprovalForSession(session.sessionId),
|
|
1933
1948
|
isStreaming: session.agent.state.isStreaming,
|
|
1934
1949
|
errorMessage: session.agent.state.errorMessage,
|
|
1935
1950
|
}
|
|
@@ -41,12 +41,44 @@ export const safeReadTools = new Set([
|
|
|
41
41
|
// Pending approval queues
|
|
42
42
|
// ---------------------------------------------------------------------------
|
|
43
43
|
|
|
44
|
-
/** toolCallId → { resolve, reject, sessionId, toolName, args, source, timeout } */
|
|
44
|
+
/** toolCallId → { resolve, reject, sessionId, toolName, args, source, timeout, requestedAt, expiresAt } */
|
|
45
45
|
export const pendingApprovals = new Map()
|
|
46
46
|
|
|
47
|
-
/** approvalId → { resolve, reject, sessionId, timeout } */
|
|
47
|
+
/** approvalId → { resolve, reject, sessionId, timeout, usage, thresholdPercent, keepRecentTurns, requestedAt, expiresAt } */
|
|
48
48
|
export const pendingAutoCompactApprovals = new Map()
|
|
49
49
|
|
|
50
|
+
export function getPendingApprovalForSession(sessionId) {
|
|
51
|
+
for (const [toolCallId, approval] of pendingApprovals) {
|
|
52
|
+
if (approval.sessionId === sessionId) {
|
|
53
|
+
return {
|
|
54
|
+
toolCallId,
|
|
55
|
+
toolName: approval.toolName,
|
|
56
|
+
args: approval.args,
|
|
57
|
+
source: approval.source,
|
|
58
|
+
requestedAt: approval.requestedAt,
|
|
59
|
+
expiresAt: approval.expiresAt,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function getPendingAutoCompactApprovalForSession(sessionId) {
|
|
67
|
+
for (const [approvalId, approval] of pendingAutoCompactApprovals) {
|
|
68
|
+
if (approval.sessionId === sessionId) {
|
|
69
|
+
return {
|
|
70
|
+
approvalId,
|
|
71
|
+
usage: approval.usage,
|
|
72
|
+
thresholdPercent: approval.thresholdPercent,
|
|
73
|
+
keepRecentTurns: approval.keepRecentTurns,
|
|
74
|
+
requestedAt: approval.requestedAt,
|
|
75
|
+
expiresAt: approval.expiresAt,
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return null
|
|
80
|
+
}
|
|
81
|
+
|
|
50
82
|
// ---------------------------------------------------------------------------
|
|
51
83
|
// Permission helpers
|
|
52
84
|
// ---------------------------------------------------------------------------
|
package/server/index.mjs
CHANGED
|
@@ -71,12 +71,15 @@ function getRestartSupport() {
|
|
|
71
71
|
async function getSystemStatus() {
|
|
72
72
|
const config = await readProjectConfig()
|
|
73
73
|
const restartSupport = getRestartSupport()
|
|
74
|
+
const packageInfo = await getPackageInfo(projectRoot)
|
|
74
75
|
return {
|
|
75
76
|
ok: true,
|
|
76
77
|
mode: isDev ? 'development' : 'production',
|
|
77
78
|
pid: process.pid,
|
|
78
79
|
bootId,
|
|
79
80
|
startedAt,
|
|
81
|
+
version: packageInfo.version,
|
|
82
|
+
package: packageInfo,
|
|
80
83
|
restartSupported: restartSupport.supported,
|
|
81
84
|
restartUnsupportedReason: restartSupport.reason,
|
|
82
85
|
dataDir,
|
package/server/public-api.mjs
CHANGED
|
@@ -31,6 +31,42 @@ function getPort(port) {
|
|
|
31
31
|
return Number(port || 5176)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function normalizeVersion(version) {
|
|
35
|
+
return String(version || '').trim().replace(/^v/i, '')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function getQuickForgeHealthVersion(health) {
|
|
39
|
+
return health?.version || health?.package?.version || health?.packageInfo?.version || null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function isQuickForgeHealthCompatible(health, options = {}) {
|
|
43
|
+
if (!health) return false
|
|
44
|
+
if (options.reuseExisting === false) return false
|
|
45
|
+
|
|
46
|
+
const expectedVersion = normalizeVersion(options.expectedVersion)
|
|
47
|
+
if (!expectedVersion && options.reuseExisting !== 'same-version') return true
|
|
48
|
+
|
|
49
|
+
const actualVersion = normalizeVersion(getQuickForgeHealthVersion(health))
|
|
50
|
+
return Boolean(actualVersion && actualVersion === expectedVersion)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function createVersionMismatchError(health, options = {}) {
|
|
54
|
+
const expectedVersion = normalizeVersion(options.expectedVersion) || 'unknown'
|
|
55
|
+
const actualVersion = getQuickForgeHealthVersion(health) || 'unknown'
|
|
56
|
+
const port = getPort(options.port)
|
|
57
|
+
const error = new Error(
|
|
58
|
+
`A QuickForge service is already running on port ${port}, but its version (${actualVersion}) does not match this desktop runtime (${expectedVersion}). `
|
|
59
|
+
+ 'QuickForge Desktop will not reuse the mismatched service because it can load incompatible frontend assets. '
|
|
60
|
+
+ 'Please close the existing QuickForge/qf service or start Desktop on another port.',
|
|
61
|
+
)
|
|
62
|
+
error.code = 'QUICKFORGE_VERSION_MISMATCH'
|
|
63
|
+
error.expectedVersion = expectedVersion
|
|
64
|
+
error.actualVersion = actualVersion
|
|
65
|
+
error.pid = health?.pid
|
|
66
|
+
error.port = port
|
|
67
|
+
return error
|
|
68
|
+
}
|
|
69
|
+
|
|
34
70
|
function buildEnv(options = {}) {
|
|
35
71
|
const host = normalizeHost(options.host)
|
|
36
72
|
const port = getPort(options.port)
|
|
@@ -53,6 +89,10 @@ function buildEnv(options = {}) {
|
|
|
53
89
|
return env
|
|
54
90
|
}
|
|
55
91
|
|
|
92
|
+
export function prepareQuickForgeEnv(options = {}) {
|
|
93
|
+
Object.assign(process.env, buildEnv(options))
|
|
94
|
+
}
|
|
95
|
+
|
|
56
96
|
export function getQuickForgeUrl(options = {}) {
|
|
57
97
|
const host = getDisplayHost(normalizeHost(options.host))
|
|
58
98
|
const port = getPort(options.port)
|
|
@@ -105,6 +145,10 @@ export async function startQuickForge(options = {}) {
|
|
|
105
145
|
const healthUrl = getQuickForgeHealthUrl(options)
|
|
106
146
|
|
|
107
147
|
if (existingHealth) {
|
|
148
|
+
if (!isQuickForgeHealthCompatible(existingHealth, options)) {
|
|
149
|
+
throw createVersionMismatchError(existingHealth, options)
|
|
150
|
+
}
|
|
151
|
+
|
|
108
152
|
return {
|
|
109
153
|
url,
|
|
110
154
|
healthUrl,
|
|
@@ -119,6 +163,7 @@ export async function startQuickForge(options = {}) {
|
|
|
119
163
|
}
|
|
120
164
|
|
|
121
165
|
if (options.inline === true) {
|
|
166
|
+
prepareQuickForgeEnv(options)
|
|
122
167
|
await import(serverScriptUrl)
|
|
123
168
|
const health = await waitForQuickForge(options)
|
|
124
169
|
if (!health) throw new Error('QuickForge failed to start: health check timed out')
|
|
@@ -6,13 +6,24 @@ const metadataIndexCache = new Map()
|
|
|
6
6
|
const MAX_METADATA_INDEX_CACHE_ENTRIES = 50
|
|
7
7
|
const METADATA_INDEX_CACHE_TTL_MS = 1000
|
|
8
8
|
|
|
9
|
-
function metadataIndexCacheKey({ scope, projectId, indexName, direction, archived }) {
|
|
10
|
-
return JSON.stringify({ scope: scope || '', projectId: projectId || '', indexName, direction, archived: archived || '' })
|
|
9
|
+
function metadataIndexCacheKey({ scope, projectId, indexName, direction, archived, pinned }) {
|
|
10
|
+
return JSON.stringify({ scope: scope || '', projectId: projectId || '', indexName, direction, archived: archived || '', pinned: pinned || '' })
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function isProjectAggregateScope(scope) {
|
|
14
|
+
return scope === 'projects' || scope === 'project-all'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function isValidPinnedAt(value) {
|
|
18
|
+
if (typeof value !== 'string') return false
|
|
19
|
+
const normalized = value.trim()
|
|
20
|
+
if (!normalized || normalized === 'undefined' || normalized === 'null' || normalized === 'false') return false
|
|
21
|
+
return !Number.isNaN(Date.parse(normalized))
|
|
11
22
|
}
|
|
12
23
|
|
|
13
24
|
function sortIndexedValues(values, store, indexName, direction) {
|
|
14
25
|
values.sort((a, b) => {
|
|
15
|
-
if (store === 'sessions-metadata' && indexName === 'lastModified') {
|
|
26
|
+
if (store === 'sessions-metadata' && (indexName === 'lastModified' || indexName === 'createdAt')) {
|
|
16
27
|
const leftPinned = getComparable(a, 'pinnedAt')
|
|
17
28
|
const rightPinned = getComparable(b, 'pinnedAt')
|
|
18
29
|
if (leftPinned !== rightPinned) {
|
|
@@ -33,7 +44,7 @@ function sortIndexedValues(values, store, indexName, direction) {
|
|
|
33
44
|
return values
|
|
34
45
|
}
|
|
35
46
|
|
|
36
|
-
async function readIndexedValues(store, indexName, direction, scope, projectId, archived) {
|
|
47
|
+
async function readIndexedValues(store, indexName, direction, scope, projectId, archived, pinned) {
|
|
37
48
|
if (store !== 'sessions-metadata') {
|
|
38
49
|
let data
|
|
39
50
|
if (scope && store === 'sessions') {
|
|
@@ -45,21 +56,29 @@ async function readIndexedValues(store, indexName, direction, scope, projectId,
|
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
const revision = getStoreRevision(store)
|
|
48
|
-
const key = metadataIndexCacheKey({ scope, projectId, indexName, direction, archived })
|
|
59
|
+
const key = metadataIndexCacheKey({ scope, projectId, indexName, direction, archived, pinned })
|
|
49
60
|
const cached = metadataIndexCache.get(key)
|
|
50
61
|
const now = Date.now()
|
|
51
62
|
if (cached && cached.revision === revision && now - cached.cachedAt < METADATA_INDEX_CACHE_TTL_MS) return cached.values
|
|
52
63
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
const projectAggregateScope = isProjectAggregateScope(scope)
|
|
65
|
+
const data = projectAggregateScope
|
|
66
|
+
? await readStore(store)
|
|
67
|
+
: scope
|
|
68
|
+
? await readSessionStoreScoped(store, scope, scope === 'project' ? projectId : undefined)
|
|
69
|
+
: await readStore(store)
|
|
56
70
|
const values = sortIndexedValues(
|
|
57
71
|
Object.values(data)
|
|
72
|
+
.filter((value) => !projectAggregateScope || (value?.scope === 'project' && value?.projectId))
|
|
58
73
|
.filter((value) => value?.messageCount !== 0)
|
|
59
74
|
.filter((value) => {
|
|
60
75
|
if (archived === 'only') return Boolean(value?.archivedAt)
|
|
61
76
|
if (archived === 'include') return true
|
|
62
77
|
return !value?.archivedAt
|
|
78
|
+
})
|
|
79
|
+
.filter((value) => {
|
|
80
|
+
if (pinned === 'only') return isValidPinnedAt(value?.pinnedAt)
|
|
81
|
+
return true
|
|
63
82
|
}),
|
|
64
83
|
store,
|
|
65
84
|
indexName,
|
|
@@ -113,10 +132,11 @@ export async function handleStorageApi(req, res, url) {
|
|
|
113
132
|
const limitParam = url.searchParams.get('limit')
|
|
114
133
|
const offsetParam = url.searchParams.get('offset')
|
|
115
134
|
const archived = url.searchParams.get('archived')
|
|
135
|
+
const pinned = url.searchParams.get('pinned')
|
|
116
136
|
|
|
117
137
|
await ensureStorage()
|
|
118
138
|
|
|
119
|
-
const values = await readIndexedValues(store, indexName, direction, scope, projectId, archived)
|
|
139
|
+
const values = await readIndexedValues(store, indexName, direction, scope, projectId, archived, pinned)
|
|
120
140
|
|
|
121
141
|
const total = values.length
|
|
122
142
|
const limit = limitParam ? parseInt(limitParam, 10) : undefined
|
package/server/storage.mjs
CHANGED
|
@@ -612,10 +612,19 @@ async function listSessionStoreFiles(storeName) {
|
|
|
612
612
|
async function readSessionStore(storeName) {
|
|
613
613
|
if (storeName === 'sessions') return readAllSessionValues()
|
|
614
614
|
|
|
615
|
-
const
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
615
|
+
const result = { ...await readJsonFile(sessionStoreFile(storeName, { scope: 'global' }), {}) }
|
|
616
|
+
for (const projectId of await listProjectIds()) {
|
|
617
|
+
const data = await readJsonFile(sessionStoreFile(storeName, { scope: 'project', projectId }), {})
|
|
618
|
+
if (storeName !== 'sessions-metadata') {
|
|
619
|
+
Object.assign(result, data)
|
|
620
|
+
continue
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
for (const [id, value] of Object.entries(data)) {
|
|
624
|
+
result[id] = value && typeof value === 'object'
|
|
625
|
+
? { ...value, scope: 'project', projectId: value.projectId || projectId }
|
|
626
|
+
: value
|
|
627
|
+
}
|
|
619
628
|
}
|
|
620
629
|
return result
|
|
621
630
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ct as t,Et as n,T as r,a as i,c as a,rt as o}from"./icons-Uo4Gd-eK.js";import{n as s}from"./react-vendor-BjDQPVuK.js";import{D as c,E as l,F as u,I as d,M as f,N as p,O as m,P as h,T as g,k as _}from"./index-DiaCCmXE.js";var v=e(n(),1),y=s();function b(){return{name:``,label:``,description:``,systemPrompt:``,allowedTools:[`read_file`,`grep_files`],maxRuntimeMs:`1800000`,maxToolCalls:`300`,enabledAsSubagent:!0}}function x(e){return{name:e.name,label:e.label,description:e.description??``,systemPrompt:e.systemPrompt??``,allowedTools:e.allowedTools??[],maxRuntimeMs:String(e.maxRuntimeMs??18e5),maxToolCalls:String(e.maxToolCalls??300),enabledAsSubagent:e.enabledAsSubagent}}function S(e){return{name:e.name.trim().toLowerCase(),label:e.label.trim(),description:e.description.trim(),systemPrompt:e.systemPrompt.trim(),allowedTools:e.allowedTools,maxRuntimeMs:Number(e.maxRuntimeMs||18e5),maxToolCalls:Number(e.maxToolCalls||300),enabledAsSubagent:e.enabledAsSubagent}}function C(e){return!!(e.name.trim()&&e.label.trim()&&e.allowedTools.length>0)}async function w(e,t){let n=await fetch(e,{...t,headers:{"content-type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`请求失败`);return r}function T(){let[e,n]=(0,v.useState)([]),[s,T]=(0,v.useState)([]),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(()=>b()),[M,N]=(0,v.useState)(!1),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(!1),[R,z]=(0,v.useState)(),[B,V]=(0,v.useState)(`off`),[H,U]=(0,v.useState)(``),[W,G]=(0,v.useState)(null);async function K(){let[e,t]=await Promise.all([w(`/api/agent-profiles`),w(`/api/agent-profiles/available-tools`)]);n(e.agents),T(t.tools)}(0,v.useEffect)(()=>{let e=!1;async function t(){try{let[t,r]=await Promise.all([w(`/api/agent-profiles`),w(`/api/agent-profiles/available-tools`)]);if(e)return;n(t.agents),T(r.tools)}catch(t){e||U(t instanceof Error?t.message:d(`requestFailed`))}}return t(),()=>{e=!0}},[]),(0,v.useEffect)(()=>{let e=!1;async function t(){try{let t=await c(),n=await l(t),r=await m(t),i=r.model??await _(t)??n[0];if(e)return;z(i),V(r.thinkingLevel??g(i))}catch{}}return t(),()=>{e=!0}},[]),(0,v.useEffect)(()=>{if(!W)return;let e=()=>G(null);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[W]);let q=(0,v.useMemo)(()=>e.find(e=>e.id===O)??null,[e,O]);function J(e,t){j(n=>({...n,[e]:t}))}function Y(e){j(t=>({...t,allowedTools:t.allowedTools.includes(e)?t.allowedTools.filter(t=>t!==e):[...t.allowedTools,e]}))}function X(){k(null),j(b()),F(``),U(``),D(!0)}function Z(e){k(e.id),j(x(e)),F(``),U(``),D(!0)}function Q(){M||I||(D(!1),k(null),j(b()),F(``))}async function $(){let e=P.trim();if(!e){U(d(`aiFillAgentInputRequired`));return}if(!R){U(d(`aiFillAgentNoModel`));return}L(!0),U(``);try{let t=await w(`/api/agent-profiles/ai-fill`,{method:`POST`,body:JSON.stringify({instruction:e,model:R,thinkingLevel:B})});j(e=>({...e,name:t.agent.name,label:t.agent.label,description:t.agent.description,systemPrompt:t.agent.systemPrompt}))}catch(e){U(e instanceof Error?e.message:d(`aiFillAgentFailed`))}finally{L(!1)}}async function ee(){if(C(A)){N(!0),U(``);try{let e=S(A);O?await w(`/api/agent-profiles/${encodeURIComponent(O)}`,{method:`PATCH`,body:JSON.stringify(e)}):await w(`/api/agent-profiles`,{method:`POST`,body:JSON.stringify(e)}),Q(),await K()}catch(e){U(e instanceof Error?e.message:d(`requestFailed`))}finally{N(!1)}}}async function te(e){if(e.builtin||e.readonly)return;let t=!e.enabledAsSubagent,r=e.enabledAsSubagent;n(n=>n.map(n=>n.id===e.id?{...n,enabledAsSubagent:t}:n)),G(null);try{await w(`/api/agent-profiles/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:JSON.stringify({enabledAsSubagent:t})})}catch(t){n(t=>t.map(t=>t.id===e.id?{...t,enabledAsSubagent:r}:t)),U(t instanceof Error?t.message:d(`requestFailed`))}}async function ne(e){if(!(e.builtin||e.readonly)&&await f({description:d(`confirmDeleteAgent`),confirmLabel:d(`confirmDelete`),cancelLabel:d(`cancel`),variant:`destructive`})){U(``);try{await w(`/api/agent-profiles/${encodeURIComponent(e.id)}`,{method:`DELETE`}),await K()}catch(e){U(e instanceof Error?e.message:d(`requestFailed`))}}}return(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,y.jsx)(`div`,{className:`border-b border-border px-6 py-5`,children:(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-2xl bg-primary/10 text-primary`,children:(0,y.jsx)(t,{className:`size-5`})}),(0,y.jsx)(`div`,{children:(0,y.jsxs)(`h1`,{className:`inline-flex items-center gap-1.5 text-lg font-semibold text-foreground`,children:[d(`agentsTab`),(0,y.jsx)(p,{label:d(`agentsDescription`)})]})})]}),(0,y.jsx)(h,{onClick:X,children:d(`createAgent`)})]})}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,y.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:[H&&!E?(0,y.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:H}):null,(0,y.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:e.map(e=>(0,y.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`h3`,{className:u(`truncate text-sm font-medium`,e.enabledAsSubagent?`text-foreground/90`:`text-muted-foreground`),children:e.label}),e.builtin?(0,y.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary`,children:d(`builtinAgent`)}):null]}),(0,y.jsx)(`p`,{className:`mt-1 font-mono text-xs text-muted-foreground`,children:e.name}),e.source&&!e.builtin?(0,y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.source,e.relativePath?` · ${e.relativePath}`:``]}):null,(0,y.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description||d(`noDescription`)})]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabledAsSubagent,disabled:e.builtin||e.readonly,className:u(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,e.enabledAsSubagent?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>void te(e),title:e.enabledAsSubagent?d(`disableAsSubagent`):d(`enableAsSubagent`),children:(0,y.jsx)(`span`,{className:u(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,e.enabledAsSubagent?`translate-x-5`:`translate-x-0`)})}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(h,{variant:`ghost`,size:`icon`,onClick:()=>G(W===e.id?null:e.id),title:d(`moreActions`),children:(0,y.jsx)(o,{className:`size-4`})}),W===e.id?(0,y.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 w-36 overflow-hidden rounded-xl border border-border bg-popover py-1 text-sm shadow-quickforge`,children:[(0,y.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:e.builtin||e.readonly,onClick:()=>{G(null),Z(e)},children:[(0,y.jsx)(r,{className:`size-3.5`}),d(`editTask`)]}),(0,y.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left text-destructive hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:e.builtin||e.readonly,onClick:()=>{G(null),ne(e)},children:[(0,y.jsx)(i,{className:`size-3.5`}),d(`delete`)]})]}):null]})]})]}),(0,y.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1`,children:e.allowedTools.map(e=>(0,y.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground`,children:e},e))}),(0,y.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-border pt-3 text-xs text-muted-foreground sm:grid-cols-2`,children:[(0,y.jsxs)(`span`,{children:[d(`maxRuntimeMs`),e.maxRuntimeMs??`-`]}),(0,y.jsxs)(`span`,{children:[d(`maxToolCalls`),e.maxToolCalls??`-`]})]})]},e.id))})]})}),E?(0,y.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onMouseDown:e=>{e.target===e.currentTarget&&Q()},children:(0,y.jsxs)(`div`,{className:`flex max-h-[90vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,y.jsxs)(`div`,{className:`shrink-0 border-b border-border px-5 py-4`,children:[(0,y.jsx)(`h2`,{className:`text-base font-medium text-foreground`,children:d(q?`editAgent`:`createAgent`)}),q?.readonly?(0,y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:d(`builtinAgentReadonly`)}):null]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(`div`,{className:`rounded-2xl border border-border bg-muted/20 p-3`,children:[(0,y.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,y.jsx)(a,{className:`size-4 text-primary`}),d(`aiFillAgent`),(0,y.jsx)(p,{label:d(`aiFillAgentDescription`)})]}),(0,y.jsx)(`textarea`,{className:`min-h-20 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground/65 focus:border-ring disabled:opacity-60`,value:P,disabled:!!q?.readonly||I,onChange:e=>F(e.target.value),placeholder:d(`aiFillAgentPlaceholder`)}),(0,y.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,y.jsxs)(h,{variant:`outline`,size:`sm`,onClick:()=>void $(),disabled:!!q?.readonly||I||!P.trim(),children:[(0,y.jsx)(a,{className:`mr-1 size-3.5`}),d(I?`aiFillAgentLoading`:`aiFillAgent`)]})})]}),(0,y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[d(`agentName`),(0,y.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.name,disabled:!!q?.readonly,onChange:e=>J(`name`,e.target.value),placeholder:`reviewer`})]}),(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[d(`agentLabel`),(0,y.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.label,disabled:!!q?.readonly,onChange:e=>J(`label`,e.target.value),placeholder:d(`agentLabelPlaceholder`)})]})]}),(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[d(`agentDescription`),(0,y.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.description,disabled:!!q?.readonly,onChange:e=>J(`description`,e.target.value)})]}),(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[d(`agentSystemPrompt`),(0,y.jsx)(`textarea`,{className:`mt-1 min-h-36 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.systemPrompt,disabled:!!q?.readonly,onChange:e=>J(`systemPrompt`,e.target.value)})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-2 text-sm font-medium text-foreground`,children:d(`allowedTools`)}),(0,y.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:s.map(e=>(0,y.jsxs)(`label`,{className:`flex items-start gap-2 rounded-xl border border-border bg-muted/20 p-3 text-sm disabled:opacity-60`,children:[(0,y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,disabled:!!q?.readonly,checked:A.allowedTools.includes(e.name),onChange:()=>Y(e.name)}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),(0,y.jsx)(`span`,{className:`ml-2 font-mono text-xs text-muted-foreground`,children:e.name}),e.riskLevel===`dangerous`?(0,y.jsx)(`span`,{className:`ml-2 rounded-full bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700`,children:d(`highRiskTool`)}):null,(0,y.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:e.description})]})]},e.name))})]}),(0,y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[d(`maxRuntimeMs`),(0,y.jsx)(`input`,{type:`number`,className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.maxRuntimeMs,disabled:!!q?.readonly,onChange:e=>J(`maxRuntimeMs`,e.target.value)})]}),(0,y.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[d(`maxToolCalls`),(0,y.jsx)(`input`,{type:`number`,className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:A.maxToolCalls,disabled:!!q?.readonly,onChange:e=>J(`maxToolCalls`,e.target.value)})]})]}),(0,y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:A.enabledAsSubagent,disabled:!!q?.readonly,onChange:e=>J(`enabledAsSubagent`,e.target.checked)}),d(`enabledAsSubagent`)]}),H?(0,y.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:H}):null]})}),(0,y.jsx)(`div`,{className:`shrink-0 border-t border-border px-5 py-4`,children:(0,y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,y.jsx)(h,{variant:`outline`,onClick:Q,disabled:M||I,children:d(`cancel`)}),(0,y.jsx)(h,{onClick:ee,disabled:M||I||!!q?.readonly||!C(A),children:d(`save`)})]})})]})}):null]})}export{T as AgentProfilesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Et as t,I as n,i as r,l as i,r as a,v as o,y as s}from"./icons-Uo4Gd-eK.js";import{n as c}from"./react-vendor-BjDQPVuK.js";import{F as l,I as u,N as d,P as f}from"./index-DiaCCmXE.js";import{n as p,r as m,t as h}from"./plugin-api-YfYj_Bd7.js";var g=e(t(),1),_=c();function v(e){return e===`loaded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`error`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`}function y(e){return e===`loaded`?u(`pluginStatusLoaded`):e===`disabled`?u(`pluginStatusDisabled`):e===`error`?u(`pluginStatusError`):e}function b(e){switch(e){case`openai-documents`:return{label:u(`pluginOpenaiDocumentsName`),description:u(`pluginOpenaiDocumentsDescription`)};case`openai-spreadsheets`:return{label:u(`pluginOpenaiSpreadsheetsName`),description:u(`pluginOpenaiSpreadsheetsDescription`)};case`openai-presentations`:return{label:u(`pluginOpenaiPresentationsName`),description:u(`pluginOpenaiPresentationsDescription`)};default:return null}}function x(e){return b(e.name)?.label||(e.displayName||e.name).replace(/^OpenAI\s+/i,``)}function S(e){return b(e.name)?.description||e.description||u(`noDescription`)}function C(e){return(e.label||e.name||e.quickForgeName).replace(/^OpenAI\s+/i,``)}function w({onChanged:e}){let[t,c]=(0,g.useState)(null),[b,w]=(0,g.useState)(!0),[T,E]=(0,g.useState)(null),[D,O]=(0,g.useState)(null),[k,A]=(0,g.useState)(null),j=(0,g.useCallback)(async(t=`load`)=>{A(null),w(!0);try{c(t===`reload`?await p():await h()),t===`reload`&&e?.()}catch(e){A(e instanceof Error?e.message:u(`pluginsLoadFailed`))}finally{w(!1)}},[e]);(0,g.useEffect)(()=>{let e=!1;return h().then(t=>{e||c(t)}).catch(t=>{e||A(t instanceof Error?t.message:u(`pluginsLoadFailed`))}).finally(()=>{e||w(!1)}),()=>{e=!0}},[]);let M=(0,g.useMemo)(()=>{let e=t?.plugins||[];return{total:e.length,enabled:e.filter(e=>e.enabled).length,tools:e.reduce((e,t)=>e+t.tools.length,0)}},[t]),N=(0,g.useMemo)(()=>D&&(t?.plugins||[]).find(e=>e.name===D)||null,[t,D]),P=async(t,n)=>{E(t),A(null);try{c(await m(t,n)),e?.()}catch(e){A(e instanceof Error?e.message:u(`pluginsSaveFailed`))}finally{E(null)}};return(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,_.jsxs)(`div`,{className:`border-b border-border px-6 py-5`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-2xl bg-primary/10 text-primary`,children:(0,_.jsx)(s,{className:`size-5`})}),(0,_.jsx)(`div`,{children:(0,_.jsxs)(`h1`,{className:`inline-flex items-center gap-1.5 text-lg font-semibold text-foreground`,children:[u(`plugins`),(0,_.jsx)(d,{label:u(`pluginsDescription`)})]})})]}),(0,_.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>void j(`reload`),disabled:b,children:[b?(0,_.jsx)(n,{className:`mr-2 size-4 animate-spin`}):(0,_.jsx)(o,{className:`mr-2 size-4`}),u(`pluginsReload`)]})]}),(0,_.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,_.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5`,children:u(`pluginsCount`,M)}),(0,_.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5`,children:u(`pluginToolsCount`,{count:M.tools})})]})]}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:[k?(0,_.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:k}):null,t?.errors?.length?(0,_.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-amber-500/30 bg-amber-500/8 p-3 text-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-amber-700 dark:text-amber-300`,children:[(0,_.jsx)(r,{className:`size-4`}),u(`pluginDiscoveryErrors`)]}),t.errors.map((e,t)=>(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[(0,_.jsx)(`span`,{className:`font-mono text-xs`,children:e.dir}),`: `,e.error]},`${e.dir}-${t}`))]}):null,b&&!t?(0,_.jsxs)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:[(0,_.jsx)(n,{className:`mr-2 size-4 animate-spin`}),u(`loadingPlugins`)]}):null,!b&&t&&t.plugins.length===0?(0,_.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/15 p-4 text-xs text-muted-foreground/55`,children:[(0,_.jsx)(`div`,{className:`text-base font-medium text-foreground`,children:u(`noPlugins`)}),(0,_.jsx)(`p`,{className:`mt-2`,children:u(`noPluginsDescription`)}),(0,_.jsx)(`div`,{className:`mt-4 space-y-1`,children:(t.searchPaths||[]).map(e=>(0,_.jsx)(`div`,{className:`font-mono text-xs`,children:e},e))})]}):null,(0,_.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(t?.plugins||[]).map(e=>(0,_.jsxs)(`article`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`truncate text-sm font-medium text-foreground/90`,children:x(e)}),(0,_.jsxs)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:[`v`,e.version]}),(0,_.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-xs`,v(e.status)),children:y(e.status)})]}),(0,_.jsx)(`p`,{className:`mt-2 line-clamp-2 text-sm text-muted-foreground`,children:S(e)})]}),(0,_.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1.5`,children:[(0,_.jsxs)(f,{variant:e.enabled?`outline`:`default`,size:`sm`,disabled:T===e.name,onClick:()=>void P(e.name,!e.enabled),children:[T===e.name?(0,_.jsx)(n,{className:`mr-2 size-4 animate-spin`}):null,e.enabled?u(`disablePlugin`):u(`enablePlugin`)]}),(0,_.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>O(e.name),children:u(`viewDetails`)})]})]}),e.error?(0,_.jsx)(`div`,{className:`mt-3 rounded-lg border border-destructive/30 bg-destructive/8 px-3 py-2 text-sm text-destructive`,children:e.error}):null,(0,_.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 border-t border-border pt-3 text-xs text-muted-foreground`,children:[(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,_.jsx)(a,{className:`size-3`}),u(`pluginToolsCount`,{count:e.tools.length})]}),(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,_.jsx)(i,{className:`size-3`}),u(`pluginPermissionsCount`,{count:e.permissions.length})]}),(0,_.jsx)(`span`,{children:e.enabled?u(`enabled`):u(`disabled`)})]})]},e.name))})]})}),N?(0,_.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onMouseDown:e=>{e.target===e.currentTarget&&O(null)},children:(0,_.jsxs)(`div`,{className:`flex max-h-[90vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,_.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-border px-5 py-4`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`h2`,{className:`text-base font-medium text-foreground`,children:u(`pluginDetails`)}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-sm text-muted-foreground`,children:x(N)})]}),(0,_.jsx)(f,{variant:`ghost`,size:`sm`,onClick:()=>O(null),children:u(`close`)})]}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,_.jsxs)(`div`,{className:`space-y-4`,children:[N.error?(0,_.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/8 px-3 py-2 text-sm text-destructive`,children:N.error}):null,(0,_.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S(N)}),(0,_.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-border pt-3 text-xs text-muted-foreground sm:grid-cols-2`,children:[(0,_.jsxs)(`span`,{children:[u(`pluginVersion`),`:`,N.version]}),(0,_.jsxs)(`span`,{children:[u(`status`),`:`,y(N.status)]}),(0,_.jsx)(`span`,{children:u(`pluginToolsCount`,{count:N.tools.length})}),(0,_.jsx)(`span`,{children:N.enabled?u(`enabled`):u(`disabled`)})]})]}),(0,_.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,_.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,_.jsx)(a,{className:`size-4 text-muted-foreground`}),u(`pluginTools`)]}),N.tools.length?(0,_.jsx)(`div`,{className:`space-y-2`,children:N.tools.map(e=>(0,_.jsxs)(`div`,{className:`rounded-xl bg-muted/30 px-3 py-2`,children:[(0,_.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:C(e)}),e.description?(0,_.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}):null]},e.quickForgeName))}):(0,_.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:u(`pluginNoTools`)})]}),(0,_.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,_.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,_.jsx)(i,{className:`size-4 text-muted-foreground`}),u(`pluginPermissions`)]}),N.permissions.length?(0,_.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:N.permissions.map(e=>(0,_.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground`,children:e},e))}):(0,_.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:u(`pluginNoPermissions`)}),(0,_.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground/80`,children:u(`pluginTrustedNotice`)})]})]})})]})}):null]})}export{w as PluginsPage};
|