pikiclaw 0.3.43 → 0.3.45
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 +20 -0
- package/README.zh-CN.md +19 -0
- package/dashboard/dist/assets/AgentTab-DS0jZ2GV.js +1 -0
- package/dashboard/dist/assets/{BrandIcon-B8b3FPnG.js → BrandIcon-DSj09eUd.js} +1 -1
- package/dashboard/dist/assets/{DirBrowser-Cbaz6ZHh.js → DirBrowser-DwzWrIWw.js} +1 -1
- package/dashboard/dist/assets/ExtensionsTab-DfRScHTz.js +1 -0
- package/dashboard/dist/assets/{IMAccessTab-CuV69gYL.js → IMAccessTab-BDoyR2EO.js} +1 -1
- package/dashboard/dist/assets/{Modal-BKPSRhxf.js → Modal-CoNLEvWc.js} +1 -1
- package/dashboard/dist/assets/{Modals-BWBQWll3.js → Modals-vXVWUz-q.js} +1 -1
- package/dashboard/dist/assets/{Select-CFHw36Z8.js → Select-BmvyKLPe.js} +1 -1
- package/dashboard/dist/assets/SessionPanel-CmIIamVj.js +1 -0
- package/dashboard/dist/assets/{SystemTab-BRUIp2R6.js → SystemTab-QSfoxx-7.js} +1 -1
- package/dashboard/dist/assets/index-BvfckPdk.css +1 -0
- package/dashboard/dist/assets/index-DEXOVIim.js +3 -0
- package/dashboard/dist/assets/index-DpUwNPM1.js +22 -0
- package/dashboard/dist/assets/mlx-DhWwjtMw.png +0 -0
- package/dashboard/dist/assets/{shared-DAJq9A77.js → shared-CTAv1sVN.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/agent/cli/auth.js +77 -104
- package/dist/agent/cli/detector.js +5 -1
- package/dist/agent/driver.js +8 -0
- package/dist/agent/drivers/claude.js +29 -1
- package/dist/agent/drivers/codex.js +79 -11
- package/dist/agent/drivers/gemini.js +1 -0
- package/dist/agent/drivers/hermes.js +2 -0
- package/dist/agent/stream.js +68 -28
- package/dist/bot/bot.js +38 -7
- package/dist/bot/command-ui.js +122 -27
- package/dist/bot/commands.js +21 -5
- package/dist/catalog/cli-tools.js +37 -9
- package/dist/catalog/local-models.js +35 -53
- package/dist/cli/main.js +97 -6
- package/dist/core/process-control.js +43 -0
- package/dist/dashboard/routes/local-models.js +170 -156
- package/dist/model/store.js +5 -3
- package/package.json +1 -1
- package/dashboard/dist/assets/AgentTab-Cyeivxea.js +0 -1
- package/dashboard/dist/assets/ExtensionsTab-C3GfpbUe.js +0 -1
- package/dashboard/dist/assets/SessionPanel-B5MisS16.js +0 -1
- package/dashboard/dist/assets/index-0_4Nfh3u.js +0 -19
- package/dashboard/dist/assets/index-BKX45VMn.css +0 -1
- package/dashboard/dist/assets/index-VSVNxqie.js +0 -5
- package/dashboard/dist/assets/lmstudio-syaFPWNA.png +0 -0
package/README.md
CHANGED
|
@@ -165,6 +165,26 @@ npx pikiclaw@latest --doctor # Environment health check only
|
|
|
165
165
|
|
|
166
166
|
</details>
|
|
167
167
|
|
|
168
|
+
<details>
|
|
169
|
+
<summary><b>Want to run it on a server? Docker is supported.</b></summary>
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
docker run -d --name pikiclaw -p 3939:3939 \
|
|
173
|
+
-e TELEGRAM_BOT_TOKEN=... \
|
|
174
|
+
-e ANTHROPIC_API_KEY=sk-ant-... \
|
|
175
|
+
-v pikiclaw-config:/home/piki/.pikiclaw \
|
|
176
|
+
-v pikiclaw-workspace:/workspace \
|
|
177
|
+
ghcr.io/xiaotonng/pikiclaw:latest
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The official multi-arch image (`linux/amd64` + `linux/arm64`) bakes in
|
|
181
|
+
`claude-code`, `codex`, and `gemini-cli`. A `docker-compose.yml` example
|
|
182
|
+
ships in the repo root — see [docs/DOCKER.md](docs/DOCKER.md) for the
|
|
183
|
+
full reference (auth flows, volume layout, reverse-proxy / TLS, pinning
|
|
184
|
+
agent CLI versions).
|
|
185
|
+
|
|
186
|
+
</details>
|
|
187
|
+
|
|
168
188
|
---
|
|
169
189
|
|
|
170
190
|
## How People Are Using It
|
package/README.zh-CN.md
CHANGED
|
@@ -165,6 +165,25 @@ npx pikiclaw@latest --doctor # 仅检查并诊断当前环境
|
|
|
165
165
|
|
|
166
166
|
</details>
|
|
167
167
|
|
|
168
|
+
<details>
|
|
169
|
+
<summary><b>想跑在服务器上?官方支持 Docker。</b></summary>
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
docker run -d --name pikiclaw -p 3939:3939 \
|
|
173
|
+
-e TELEGRAM_BOT_TOKEN=... \
|
|
174
|
+
-e ANTHROPIC_API_KEY=sk-ant-... \
|
|
175
|
+
-v pikiclaw-config:/home/piki/.pikiclaw \
|
|
176
|
+
-v pikiclaw-workspace:/workspace \
|
|
177
|
+
ghcr.io/xiaotonng/pikiclaw:latest
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
官方多架构镜像(`linux/amd64` + `linux/arm64`)已内置 `claude-code`、
|
|
181
|
+
`codex`、`gemini-cli`。仓库根目录提供了 `docker-compose.yml` 示例 ——
|
|
182
|
+
完整说明(鉴权方式、卷布局、反向代理 / TLS、固定 agent CLI 版本)
|
|
183
|
+
见 [docs/DOCKER.md](docs/DOCKER.md)。
|
|
184
|
+
|
|
185
|
+
</details>
|
|
186
|
+
|
|
168
187
|
---
|
|
169
188
|
|
|
170
189
|
## 典型的应用场景
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,j as e,b as Oe}from"./react-vendor-DTcmqLiz.js";import{c as F,u as $,a as V,B as _,S as G,k as O,b as De,g as Q,E as he,A as Be}from"./index-DEXOVIim.js";import{B as Y}from"./BrandIcon-DSj09eUd.js";import{M as ee,a as te,L as H,I as K}from"./Modal-CoNLEvWc.js";import{S as q}from"./Select-BmvyKLPe.js";import{A as ce,S as Ue}from"./shared-CTAv1sVN.js";import"./router-Cav8lq-m.js";function xe(n,t){return!!(n&&t instanceof Node&&n.contains(t))}function _e(n,t){if(t.length===0)return!0;const a=`${n.label} ${n.description||""} ${n.meta||""}`.toLowerCase();return t.every(s=>a.includes(s))}function we({value:n,options:t,onChange:a,className:s,placeholder:o="—",disabled:l=!1,searchPlaceholder:d="Search models...",noMatchesText:w="No matches",currentLabel:u="Current"}){const i=t.find(m=>m.value===n),g=t.length<=1,[f,j]=r.useState(!1),[p,C]=r.useState(""),[E,A]=r.useState(null),L=r.useRef(null),M=r.useRef(null),x=r.useRef(null);r.useEffect(()=>{if(!f)return;const m=c=>{xe(L.current,c.target)||xe(M.current,c.target)||j(!1)},b=c=>{c.key==="Escape"&&j(!1)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",b)}},[f]),r.useEffect(()=>{f||C("")},[f]),r.useEffect(()=>{if(f){const m=window.setTimeout(()=>x.current?.focus(),0);return()=>window.clearTimeout(m)}},[f]),r.useLayoutEffect(()=>{if(!f)return;const m=()=>{const b=L.current;if(!b)return;const c=b.getBoundingClientRect(),S=window.innerHeight-c.bottom-12,P=c.top-12,D=S<280&&P>S,U=Math.max(220,Math.min(360,D?P:S));A({left:c.left,top:D?Math.max(12,c.top-U-8):c.bottom+8,width:c.width,maxHeight:U})};return m(),window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0)}},[f]);const N=r.useMemo(()=>p.trim().toLowerCase().split(/\s+/).filter(Boolean),[p]),R=r.useMemo(()=>t.filter(m=>m.value!==n&&_e(m,N)),[t,n,N]);if(g)return e.jsx("div",{className:F("flex h-9 w-full items-center rounded-md border border-edge bg-panel-alt px-3 text-[13px] text-fg-5 shadow-none",l&&"cursor-not-allowed",s),children:e.jsx("span",{className:F("truncate",!i&&"text-fg-6"),children:i?.label||o})});const y=m=>{l||(a(m),j(!1))},h=(m,b)=>e.jsxs("button",{type:"button",role:"option","aria-selected":b,onClick:()=>y(m.value),className:F("flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left text-[13px] transition-colors duration-200",b?"bg-panel text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)]":"text-fg-3 hover:bg-panel-alt hover:text-fg-2"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label}),m.meta&&e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-5",children:m.meta})]}),m.description&&e.jsx("div",{className:"mt-0.5 truncate text-[11px] leading-relaxed text-fg-5",children:m.description})]}),b&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"mt-0.5 shrink-0 text-fg-4",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]},m.value),B=m=>{const b=[];let c;for(const v of m)v.group&&v.group!==c?(b.push(e.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-fg-5",children:v.group},`__group:${v.group}`)),c=v.group):v.group||(c=void 0),b.push(h(v,!1));return b},z=f&&E?Oe.createPortal(e.jsxs("div",{ref:M,role:"listbox",className:"fixed z-[220] flex flex-col overflow-hidden rounded-xl border border-edge-h bg-[var(--th-dropdown)] p-1.5 shadow-[0_24px_64px_rgba(2,6,23,0.22)] backdrop-blur-xl",style:{left:E.left,top:E.top,width:E.width,maxHeight:E.maxHeight},children:[e.jsxs("div",{className:"relative px-1.5 pt-1 pb-2",children:[e.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-3.5 flex items-center text-fg-5",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsx("input",{ref:x,type:"text",value:p,onChange:m=>C(m.target.value),placeholder:d,spellCheck:!1,autoComplete:"off",className:F("h-8 w-full rounded-md border border-control-border bg-control pl-7 pr-2 text-[12px] text-fg shadow-sm","transition-[border-color,box-shadow,background] duration-200 outline-none","placeholder:text-fg-5","focus:border-control-border-h focus:bg-control-h focus:shadow-[0_0_0_4px_var(--th-glow-a)]")})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-5",children:u}),h(i,!0),e.jsx("div",{className:"my-1.5 border-t border-edge"})]}),R.length>0?B(R):e.jsx("div",{className:"px-3 py-3 text-center text-[12px] text-fg-5",children:w})]})]}),document.body):null;return e.jsxs("div",{ref:L,className:F("relative",s),children:[e.jsxs("button",{type:"button",disabled:l,"aria-haspopup":"listbox","aria-expanded":f,onClick:()=>j(m=>!m),className:F("flex h-9 w-full items-center rounded-md border border-control-border bg-control px-3 pr-8 text-left text-[13px] text-fg shadow-sm","transition-[border-color,box-shadow,background] duration-200 outline-none","hover:border-control-border-h hover:bg-control-h","focus-visible:border-control-border-h focus-visible:shadow-[0_0_0_4px_var(--th-glow-a)]","disabled:cursor-not-allowed disabled:bg-panel-alt disabled:border-edge disabled:text-fg-5","disabled:shadow-none disabled:hover:border-edge disabled:hover:bg-panel-alt",f&&"border-control-border-h bg-control-h shadow-[0_0_0_4px_var(--th-glow-a)]"),children:[e.jsx("span",{className:F("min-w-0 flex-1 truncate",!i&&"text-fg-5"),children:i?.label||o}),e.jsx("span",{className:F("pointer-events-none absolute inset-y-0 right-3 flex items-center text-fg-4 transition-transform duration-200",f&&"rotate-180"),children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),z]})}const J=[{id:"openrouter",kind:"openai-compatible",name:{zh:"OpenRouter",en:"OpenRouter"},blurb:{zh:"一个 key 通行 300+ 模型",en:"One key, 300+ models"},baseURL:"https://openrouter.ai/api/v1",envVar:"OPENROUTER_API_KEY",defaultModel:"anthropic/claude-sonnet-4"},{id:"qwen",kind:"openai-compatible",name:{zh:"通义千问 Qwen",en:"Alibaba Qwen"},blurb:{zh:"阿里云 DashScope",en:"Alibaba DashScope"},baseURL:"https://dashscope.aliyuncs.com/compatible-mode/v1",envVar:"DASHSCOPE_API_KEY",defaultModel:"qwen3-max"},{id:"doubao",kind:"openai-compatible",name:{zh:"豆包 Seed",en:"Doubao Seed"},blurb:{zh:"字节跳动 · 火山方舟",en:"ByteDance Volcengine Ark"},baseURL:"https://ark.cn-beijing.volces.com/api/v3",envVar:"ARK_API_KEY",defaultModel:"doubao-seed-1-6-250615"},{id:"glm",kind:"openai-compatible",name:{zh:"智谱 GLM",en:"Zhipu GLM"},blurb:{zh:"GLM-4.6 / Z.AI",en:"GLM-4.6 / Z.AI"},baseURL:"https://open.bigmodel.cn/api/paas/v4",envVar:"ZAI_API_KEY",defaultModel:"glm-4.6"},{id:"minimax",kind:"openai-compatible",name:{zh:"MiniMax",en:"MiniMax"},blurb:{zh:"M2 / abab",en:"M2 / abab"},baseURL:"https://api.minimax.chat/v1",envVar:"MINIMAX_API_KEY",defaultModel:"MiniMax-M2"},{id:"deepseek",kind:"openai-compatible",name:{zh:"DeepSeek",en:"DeepSeek"},blurb:{zh:"深度求索官方 API",en:"DeepSeek official API"},baseURL:"https://api.deepseek.com",envVar:"DEEPSEEK_API_KEY",defaultModel:"deepseek-chat"},{id:"anthropic",kind:"anthropic",name:{zh:"Anthropic 直连",en:"Anthropic Direct"},blurb:{zh:"Claude 官方 API",en:"Official Claude API"},baseURL:"https://api.anthropic.com",envVar:"ANTHROPIC_API_KEY",defaultModel:"claude-sonnet-4-5"},{id:"google",kind:"google",name:{zh:"Google AI Studio",en:"Google AI Studio"},blurb:{zh:"Gemini 官方 API",en:"Official Gemini API"},baseURL:"https://generativelanguage.googleapis.com/v1beta",envVar:"GEMINI_API_KEY",defaultModel:"gemini-2.5-pro"},{id:"openai",kind:"openai",name:{zh:"OpenAI 直连",en:"OpenAI Direct"},blurb:{zh:"gpt-5 / o-系列",en:"gpt-5 / o-series"},baseURL:"https://api.openai.com/v1",envVar:"OPENAI_API_KEY",defaultModel:"gpt-5"},{id:"custom",kind:"openai-compatible",name:{zh:"自定义端点",en:"Custom"},blurb:{zh:"其他 OpenAI 兼容端点",en:"Other OpenAI-compatible endpoint"},baseURL:"",envVar:""}];function $e(n){return n==="zh-CN"?{sectionTitle:"模型供应商",sectionHint:"连接你自己的模型供应商,凭据加密存入系统 Keychain,可绑定到任意一个智能体。",addLabel:"接入新供应商",validate:"校验",validating:"校验中",edit:"编辑",remove:"删除",removeConfirm:"删除该供应商?已绑定的智能体会自动恢复为官方 Auth。",unbound:"尚未被任何智能体使用",boundOne:"已绑定",boundN:t=>`${t} 个智能体在用`,notConnected:"未接入",modalAddTitle:"接入模型供应商",modalAddHint:t=>t?`已套用 ${t} 模板,仅需粘贴 API Key。`:"填入端点和凭据,保存后即可在智能体卡片上选用。",modalEditTitle:"编辑供应商配置",modalEditHint:"修改端点、凭据或模型参数。修改凭据会清空已校验状态。",fieldName:"配置名称",fieldNamePlaceholder:"例如:OpenRouter · 个人",fieldKind:"API 类型",fieldBaseURL:"Base URL",fieldCredentialSource:"凭据来源",fieldApiKey:"API Key",fieldApiKeyHint:"通过 @napi-rs/keyring 写入系统 Keychain,setting.json 仅保存引用。",fieldEnvVar:"环境变量名",fieldCommand:"获取命令(执行结果作为 key)",fieldModelId:"模型 ID",fieldEffort:"推理强度",fieldEffortHelp:"可用范围由模型决定,留空表示沿用模型默认值。",effortHermesNote:"Hermes 当前从 ~/.hermes/config.yaml 读取推理强度,Profile 上的 effort 暂仅做记录。",credPaste:"粘贴 API Key(推荐,写入系统 Keychain)",credEnv:"从环境变量读取",credCommand:"运行命令获取(1Password / pass / gh 等)",effortDefault:"(沿用默认)",cancel:"取消",save:"保存",saving:"保存中",validationReady:"已就绪",validationInvalid:"凭据无效",validationError:"网络/服务错误",validationUnvalidated:"未校验",providerOnlyHint:"保存后回到智能体卡片,点击「BYOK」选择具体的模型与推理强度。",credentialLabel:"凭据",modelsAvailable:t=>`可用 ${t} 个模型`}:{sectionTitle:"Model Providers",sectionHint:"Connect your own model providers. Keys are encrypted in the OS keychain and can be bound to any agent.",addLabel:"Add provider",validate:"Validate",validating:"Validating",edit:"Edit",remove:"Remove",removeConfirm:"Remove this provider? Bound agents will fall back to native auth.",unbound:"Not used by any agent yet",boundOne:"Bound to",boundN:t=>`${t} agents in use`,notConnected:"Not connected",modalAddTitle:"Connect Model Provider",modalAddHint:t=>t?`Pre-filled from the ${t} template — just paste your API key.`:"Enter endpoint and credential. After saving, choose models on the agent cards above.",modalEditTitle:"Edit Provider",modalEditHint:"Update the endpoint, credential, or model. Changing the credential clears the validated state.",fieldName:"Display name",fieldNamePlaceholder:"e.g. OpenRouter · Personal",fieldKind:"API kind",fieldBaseURL:"Base URL",fieldCredentialSource:"Credential source",fieldApiKey:"API key",fieldApiKeyHint:"Stored in the OS keychain via @napi-rs/keyring; setting.json keeps only a reference.",fieldEnvVar:"Environment variable name",fieldCommand:"Command (stdout becomes the key)",fieldModelId:"Model ID",fieldEffort:"Reasoning effort",fieldEffortHelp:"Available values depend on the chosen model; leave blank to use the default.",effortHermesNote:"Hermes currently reads reasoning_effort from ~/.hermes/config.yaml; Profile.effort is recorded only for now.",credPaste:"Paste API key (recommended — stored in OS keychain)",credEnv:"Read from environment variable",credCommand:"Run a command (1Password / pass / gh, …)",effortDefault:"(default)",cancel:"Cancel",save:"Save",saving:"Saving",validationReady:"Ready",validationInvalid:"Invalid",validationError:"Error",validationUnvalidated:"Not validated",providerOnlyHint:'After saving, head back to an agent card and click "BYOK" to choose the model and effort.',credentialLabel:"Credential",modelsAvailable:t=>`${t} models available`}}const se={anthropic:{zh:"Anthropic 原生",en:"Anthropic native"},openai:{zh:"OpenAI 原生",en:"OpenAI native"},"openai-compatible":{zh:"OpenAI 兼容",en:"OpenAI-compatible"},google:{zh:"Google AI Studio",en:"Google AI Studio"}};function ge(n,t){return t==="zh-CN"?se[n].zh:se[n].en}async function le(n){return(await fetch(n)).json()}async function X(n,t,a){return(await fetch(t,{method:n,headers:{"Content-Type":"application/json"},body:a?JSON.stringify(a):void 0})).json()}function Ie(n){const t=(()=>{try{return new URL(n.baseURL)}catch{return null}})(),a=t?.host.toLowerCase()??"",s=t?.port??"";return(a.startsWith("127.0.0.1")||a.startsWith("localhost"))&&s==="11434"?"ollama":(a.startsWith("127.0.0.1")||a.startsWith("localhost"))&&s==="8080"?"mlx":a.includes("openrouter")?"openrouter":a.includes("anthropic")?"anthropic":a.includes("deepseek")?"deepseek":a.includes("googleapis")||a.includes("vertex")?"google":a.includes("openai.com")?"openai":a.includes("dashscope")||a.includes("qwen")||a.includes("aliyun")?"qwen":a.includes("volces")||a.includes("volcengine")||a.includes("doubao")?"doubao":a.includes("bigmodel")||a.includes("zhipu")||a.includes("z.ai")?"glm":a.includes("minimax")?"minimax":n.kind==="anthropic"?"anthropic":n.kind==="google"?"google":n.kind==="openai"?"openai":"custom"}function ze({desc:n,copy:t,locale:a,onPick:s}){const{provider:o,template:l}=n,d=!!o,w=o?Ie(o):l?.id??"custom",u=o?.name??(l?a==="zh-CN"?l.name.zh:l.name.en:""),i=l?a==="zh-CN"?l.blurb.zh:l.blurb.en:"",g=o?.validation?.state??null,f=o?.validation?.modelCount;let j=null,p="";o&&(g==="ready"?(j="bg-emerald-500",p=f!=null?t.modelsAvailable(f):t.validationReady):g==="invalid"?(j="bg-rose-500",p=t.validationInvalid):g==="error"?(j="bg-amber-500",p=t.validationError):(j="bg-fg-6",p=t.validationUnvalidated));const C=d&&o.validation?.detail&&g!=="ready"?o.validation.detail:i;return e.jsxs("button",{type:"button",onClick:()=>s(n),className:"group relative flex h-[68px] items-center gap-2.5 rounded-lg border border-edge bg-panel-alt px-3 py-2 text-left transition-all duration-200 hover:-translate-y-0.5 hover:border-edge-strong hover:bg-panel hover:shadow-[0_4px_16px_rgba(15,23,42,0.06)]",children:[e.jsx(Y,{brand:w,size:26}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[j&&e.jsx("span",{className:F("inline-block h-[6px] w-[6px] shrink-0 rounded-full",j),title:p}),e.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-fg",children:u})]}),C&&e.jsx("div",{className:"truncate text-[11px] leading-snug text-fg-5",title:C,children:C})]}),g==="ready"&&f!=null&&e.jsx("span",{className:"shrink-0 font-mono text-[11px] text-fg-5",title:t.modelsAvailable(f),children:f})]})}function ie(n,t){return{name:t==="zh-CN"?`${n.name.zh}`:`${n.name.en}`,kind:n.kind,baseURL:n.baseURL,credMode:"paste",apiKey:"",envVar:n.envVar||"API_KEY",cmdLine:"op read op://Personal/Provider/key"}}function Fe({open:n,copy:t,locale:a,initial:s,initialTemplateName:o,existingProvider:l,onClose:d,onSaved:w,onRemove:u}){const[i,g]=r.useState(()=>s||ie(J[0],a)),[f,j]=r.useState(!1),[p,C]=r.useState(null);r.useEffect(()=>{n&&(g(s||ie(J[0],a)),C(null))},[n,s,a]);const E=!!l,A=!!o||E,L=r.useCallback(async()=>{C(null),j(!0);try{const x=i.credMode==="env"?{source:"env",varName:i.envVar.trim()}:i.credMode==="command"?{source:"command",argv:i.cmdLine.trim().split(/\s+/).filter(Boolean)}:null;let N;if(E&&l){const y={name:i.name.trim()||l.name,baseURL:i.baseURL.trim()};i.credMode==="paste"&&i.apiKey?y.apiKey=i.apiKey:x&&(y.credentialRef=x);const h=await X("PATCH",`/api/models/providers/${l.id}`,y);if(!h.ok){C(h.error||"Failed to update provider");return}N=l.id}else{const y={kind:i.kind,name:i.name.trim()||`${ge(i.kind,a)}`,baseURL:i.baseURL.trim()};i.credMode==="paste"?y.apiKey=i.apiKey:x&&(y.credentialRef=x);const h=await X("POST","/api/models/providers",y);if(!h.ok||!h.provider){C(h.error||"Failed to create provider");return}N=h.provider.id}const R=await X("POST",`/api/models/providers/${N}/validate`);if(w(),R.validation&&R.validation.state!=="ready"){C(`${t.validationInvalid}: ${R.validation.detail}`);return}d()}catch(x){C(x?.message||String(x))}finally{j(!1)}},[i,E,l,a,w,d,t.validationInvalid]),M=!f&&i.name.trim().length>0&&i.baseURL.trim().length>0&&(i.credMode!=="paste"||(E?!0:i.apiKey.length>0))&&(i.credMode!=="env"||i.envVar.trim().length>0)&&(i.credMode!=="command"||i.cmdLine.trim().length>0);return e.jsxs(ee,{open:n,onClose:d,children:[e.jsx(te,{title:E?t.modalEditTitle:t.modalAddTitle,description:E?t.modalEditHint:t.modalAddHint(o||null),onClose:d}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(H,{children:t.fieldName}),e.jsx(K,{value:i.name,onChange:x=>g(N=>({...N,name:x.target.value})),placeholder:t.fieldNamePlaceholder})]}),A?e.jsxs("div",{children:[e.jsx(H,{children:t.fieldBaseURL}),e.jsx(K,{value:i.baseURL,onChange:x=>g(N=>({...N,baseURL:x.target.value})),placeholder:"https://…"})]}):e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(H,{children:t.fieldKind}),e.jsx(q,{value:i.kind,options:Object.keys(se).map(x=>({value:x,label:ge(x,a)})),onChange:x=>g(N=>({...N,kind:x}))})]}),e.jsxs("div",{children:[e.jsx(H,{children:t.fieldBaseURL}),e.jsx(K,{value:i.baseURL,onChange:x=>g(N=>({...N,baseURL:x.target.value})),placeholder:"https://…"})]})]}),e.jsxs("div",{children:[e.jsx(H,{children:t.fieldCredentialSource}),e.jsx(q,{value:i.credMode,options:[{value:"paste",label:t.credPaste},{value:"env",label:t.credEnv},{value:"command",label:t.credCommand}],onChange:x=>g(N=>({...N,credMode:x}))})]}),i.credMode==="paste"&&e.jsxs("div",{children:[e.jsx(H,{children:t.fieldApiKey}),e.jsx(K,{type:"password",value:i.apiKey,onChange:x=>g(N=>({...N,apiKey:x.target.value})),placeholder:E?"••••••••":"sk-…"}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children:t.fieldApiKeyHint})]}),i.credMode==="env"&&e.jsxs("div",{children:[e.jsx(H,{children:t.fieldEnvVar}),e.jsx(K,{value:i.envVar,onChange:x=>g(N=>({...N,envVar:x.target.value})),placeholder:"OPENROUTER_API_KEY"})]}),i.credMode==="command"&&e.jsxs("div",{children:[e.jsx(H,{children:t.fieldCommand}),e.jsx(K,{value:i.cmdLine,onChange:x=>g(N=>({...N,cmdLine:x.target.value})),placeholder:"op read op://Personal/OpenRouter/key"})]}),p&&e.jsx("div",{className:"rounded-md border border-rose-700/40 bg-rose-900/20 px-3 py-2 text-xs text-rose-200",children:p})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-between gap-2 border-t border-edge pt-4",children:[e.jsx("div",{children:E&&u&&e.jsx("button",{type:"button",onClick:()=>{u()},className:"text-[12px] text-fg-5 transition hover:text-[var(--th-err)]",children:t.remove})}),e.jsx(ce,{primary:{label:f?t.saving:t.save,onClick:L,disabled:!M},secondary:{label:t.cancel,onClick:d}})]})]})}function Me(){const[n,t]=r.useState([]),[a,s]=r.useState([]),[o,l]=r.useState({}),d=r.useCallback(async()=>{const[u,i,g]=await Promise.all([le("/api/models/providers"),le("/api/models/profiles"),le("/api/models/agents")]);t(u.providers||[]),s(i.profiles||[]);const f={};for(const j of g.bindings||[])f[j.agent]=j.activeProfileId;l(f)},[]),w=r.useCallback(async(u,i)=>{await X("POST",`/api/models/agents/${u}/active`,{profileId:i}),await d()},[d]);return r.useEffect(()=>{d()},[d]),{providers:n,profiles:a,bindings:o,reload:d,setActiveProfile:w}}function ve(n){return n.replace(/\/+$/,"").replace(/^http:\/\/localhost(?=[:/]|$)/i,"http://127.0.0.1").replace(/^https:\/\/localhost(?=[:/]|$)/i,"https://127.0.0.1")}function be(n,t){const a=ve(n.baseURL);return t.some(s=>ve(s.openAIBaseURL)===a)}function Ke({snapshot:n,localBackends:t}={}){const a=Me(),s=n??a,{providers:o,reload:l}=s,d=t??[],w=$(M=>M.locale),u=r.useMemo(()=>$e(w),[w]);$(M=>M.toast);const[i,g]=r.useState(null),f=r.useCallback(async M=>{confirm(u.removeConfirm)&&(await X("DELETE",`/api/models/providers/${M.id}`),await l())},[u,l]),j=r.useMemo(()=>{if(!i||i.kind!=="edit")return null;const{provider:M}=i;return{name:M.name,kind:M.kind,baseURL:M.baseURL,credMode:"paste",apiKey:"",envVar:J.find(x=>x.kind===M.kind)?.envVar||"API_KEY",cmdLine:"op read op://Personal/Provider/key"}},[i]),p=r.useMemo(()=>!i||i.kind!=="add"?null:ie(i.template,w),[i,w]),C=i&&i.kind==="add"&&i.template.id!=="custom"?w==="zh-CN"?i.template.name.zh:i.template.name.en:null,E=r.useMemo(()=>{const M=new Map;for(const x of o){const N=Ie(x);M.has(N)||M.set(N,x)}return M},[o]),A=r.useMemo(()=>{const M=o.filter(y=>!be(y,d)),x=new Set,N=[];for(const y of J){if(y.id==="custom")continue;const h=E.get(y.id);h&&!be(h,d)?(x.add(h.id),N.push({template:y,provider:h})):N.push({template:y})}for(const y of M)x.has(y.id)||N.push({provider:y});const R=J.find(y=>y.id==="custom");return R&&N.push({template:R}),N},[o,E,d]),L=r.useCallback(M=>{if(M.provider){g({kind:"edit",provider:M.provider});return}M.template&&g({kind:"add",template:M.template})},[]);return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",children:A.map((M,x)=>e.jsx(ze,{desc:M,copy:u,locale:w,onPick:L},M.provider?.id??`tpl-${M.template?.id??x}`))}),i&&e.jsx(Fe,{open:!0,copy:u,locale:w,initial:i.kind==="edit"?j:p,initialTemplateName:C,existingProvider:i.kind==="edit"?i.provider:void 0,onClose:()=>g(null),onSaved:l,onRemove:i.kind==="edit"?async()=>{await f(i.provider),g(null)}:void 0})]})}const Ve=4;function Ge(n){return n==="zh-CN"?{sectionLabel:"本地后端",hostLabel:"本机",hostUnknown:"检测中…",refresh:"刷新",refreshing:"刷新中…",loadFailed:"加载失败",tileStatusDetected:"已运行",tileStatusNotDetected:"未检测到",tileStatusUnsupported:"不支持当前系统",tileBadgeReady:t=>`${t} 个模型已就绪`,tileBlurbOllama:"跨平台默认,CLI 友好,模型下载到本地后常驻",tileBlurbMlx:"Apple Silicon 原生,性能压榨极限,按需启动",tileInstalledModels:t=>`${t} 个模型`,modalTitle:t=>`准备 ${t}`,modalDescription:t=>`安装 ${t}、下载所需模型、核对运行状态——本地模型的全部配置都在这里完成。`,stepStatus:"后端状态",stepModels:"模型",statusRunning:"已运行",statusNotRunning:"未在本机检测到此后端",statusUnsupportedDesc:t=>`${t} 不支持当前系统。`,statusRecheck:"重新检测",statusRechecking:"检测中…",statusInstallHeader:"安装命令",statusInstallDocs:"官方安装文档",statusRunHint:"启动服务(安装后)",statusHomepageCta:"官网",statusAutoAttachedHint:t=>`本地 ${t} 已在运行;继续在下方下载并核对所需模型。`,modelsInstalledHeader:t=>`已就绪(${t})`,modelsInstalledEmpty:"后端在线,但尚未加载任何模型。在终端按下方命令准备一个。",modelsRecommendedHeader:"推荐模型 · 在终端执行以下命令准备",modelsBackendOffline:"启动后端后再返回此处准备模型。",fitOk:"推荐",fitTight:"勉强可跑",fitNoGo:"内存不足",modelInstalledBadge:"已就绪",pullPrefix:"终端执行",copyCommand:"复制",copied:"已复制",closeBtn:"完成"}:{sectionLabel:"Local backends",hostLabel:"This machine",hostUnknown:"Detecting…",refresh:"Refresh",refreshing:"Refreshing…",loadFailed:"Failed to load local backends",tileStatusDetected:"Running",tileStatusNotDetected:"Not detected",tileStatusUnsupported:"Not supported on this OS",tileBadgeReady:t=>`${t} models ready`,tileBlurbOllama:"Cross-platform default, CLI-friendly, models persist on disk",tileBlurbMlx:"Apple Silicon native, peak performance, on-demand launch",tileInstalledModels:t=>`${t} models`,modalTitle:t=>`Prepare ${t}`,modalDescription:t=>`Install ${t}, download the models you want, and verify they're running — all the local-model configuration lives in this panel.`,stepStatus:"Backend status",stepModels:"Models",statusRunning:"Running",statusNotRunning:"Backend not detected on this machine",statusUnsupportedDesc:t=>`${t} does not run on this OS.`,statusRecheck:"Re-check",statusRechecking:"Checking…",statusInstallHeader:"Install commands",statusInstallDocs:"Official install docs",statusRunHint:"Start the server (after install)",statusHomepageCta:"Homepage",statusAutoAttachedHint:t=>`Local ${t} is running. Continue below to download and verify the models you need.`,modelsInstalledHeader:t=>`Ready (${t})`,modelsInstalledEmpty:"Backend is up but no model is loaded. Use the command below to prepare one.",modelsRecommendedHeader:"Recommended models — run these in your terminal",modelsBackendOffline:"Start the backend first, then come back to prepare models.",fitOk:"Recommended",fitTight:"Tight fit",fitNoGo:"Not enough RAM",modelInstalledBadge:"Ready",pullPrefix:"Run in terminal",copyCommand:"Copy",copied:"Copied",closeBtn:"Done"}}function re(n,t){return n===null?"tight":n>=t+Ve?"ok":n>=t?"tight":"no-go"}function Ye(n,t){const a=n.id==="ollama"?t.ollamaTag:t.mlxModel;return a?n.pullCommandTemplate.replace("${model}",a):null}function We(n){return!n||!Number.isFinite(n)?"—":`${(n/1024**3).toFixed(0)} GB`}function qe(n){if(!n||!Number.isFinite(n))return"";const t=n/1024**3;return t>=1?`${t.toFixed(1)} GB`:`${(n/1024**2).toFixed(0)} MB`}function Ze(n,t){return t.filter(a=>n.id==="ollama"?!!a.ollamaTag:!!a.mlxModel)}function de(n,t){const a=t.id==="ollama"?n.ollamaTag:n.mlxModel;if(!a)return null;const s=a.split(":")[0].toLowerCase();for(const o of t.models)if(o.id.toLowerCase().startsWith(s))return o.id;return null}function Ce(){const[n,t]=r.useState([]),[a,s]=r.useState([]),[o,l]=r.useState(null),[d,w]=r.useState(!0),[u,i]=r.useState(null),g=r.useCallback(async()=>{w(!0),i(null);try{const f=await V.probeLocalModels();if(!f.ok)throw new Error(f.error||"Failed to load local backends");return t(f.backends||[]),s(f.catalog||[]),l(f.currentOs??null),{addedProviderIds:f.addedProviderIds??[]}}catch(f){return i(f?.message||String(f)),{addedProviderIds:[]}}finally{w(!1)}},[]);return r.useEffect(()=>{g()},[g]),{backends:n,catalog:a,currentOs:o,loading:d,error:u,refresh:g}}function Qe({backend:n,copy:t,onClick:a}){const s=!n.supportedOnThisOs,o=n.id==="ollama"?t.tileBlurbOllama:t.tileBlurbMlx,l=s?e.jsx(O,{variant:"muted",children:t.tileStatusUnsupported}):n.detected?e.jsx(O,{variant:"ok",children:t.tileBadgeReady(n.models.length)}):null,d=n.detected?`${n.version?`v${n.version} · `:""}${t.tileInstalledModels(n.models.length)}`:o;return e.jsxs("button",{type:"button",onClick:a,className:"group relative flex h-[104px] flex-col rounded-lg border border-edge bg-panel-alt px-4 py-3.5 text-left transition-all duration-200 hover:-translate-y-0.5 hover:border-edge-strong hover:bg-panel hover:shadow-[0_4px_16px_rgba(15,23,42,0.06)]",children:[e.jsxs("div",{className:"flex w-full items-start justify-between gap-2",children:[e.jsx(Y,{brand:n.id,size:32}),l]}),e.jsxs("div",{className:"mt-auto min-w-0",children:[e.jsx("div",{className:"truncate text-[14px] font-semibold tracking-tight text-fg group-hover:text-fg",children:n.label}),e.jsx("div",{className:"mt-1 truncate text-[11.5px] leading-relaxed text-fg-5",title:d,children:d})]})]})}function je({index:n,label:t,done:a}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border text-[10px] font-semibold ${a?"border-transparent bg-[var(--th-badge-accent-bg)] text-[var(--th-badge-accent-text)]":"border-edge bg-panel-alt text-fg-4"}`,children:a?"✓":n}),e.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-[0.16em] text-fg-3",children:t})]})}function Je({name:n,sizeBytes:t}){return e.jsxs("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-edge bg-panel-alt px-2 py-0.5 text-[11px] text-fg-3",children:[e.jsx("span",{className:"truncate font-mono",children:n}),t?e.jsx("span",{className:"shrink-0 text-fg-5",children:qe(t)}):null]})}function oe({label:n,cmd:t,copy:a,onCopy:s}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"flex-1 truncate rounded-md border border-edge bg-panel px-2.5 py-1.5 font-mono text-[12px] text-fg-3",title:t,children:[n&&e.jsx("span",{className:"mr-2 text-fg-5",children:n}),t]}),e.jsx("button",{type:"button",onClick:()=>s(t),className:"shrink-0 rounded-md border border-edge bg-panel-alt px-2 py-1 text-[11px] text-fg-3 transition hover:border-edge-strong hover:bg-panel",children:a.copyCommand})]})}function Xe({entry:n,backend:t,totalRamGb:a,copy:s,locale:o,onCopy:l}){const d=re(a,n.minRamGb),w=o==="zh-CN"?n.descriptionZh:n.description,u=de(n,t),i=Ye(t,n);return e.jsx("div",{className:"rounded-md border border-edge bg-panel-alt px-3 py-2.5",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-[13px] font-semibold text-fg",children:n.name}),e.jsx("span",{className:"text-[11px] text-fg-5",children:n.publisher}),d==="ok"&&e.jsx(O,{variant:"ok",children:s.fitOk}),d==="tight"&&e.jsx(O,{variant:"warn",children:s.fitTight}),d==="no-go"&&e.jsx(O,{variant:"err",children:s.fitNoGo}),u&&e.jsx(O,{variant:"accent",children:s.modelInstalledBadge})]}),e.jsx("div",{className:"text-[12px] leading-relaxed text-fg-4",children:w}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] text-fg-5",children:[e.jsxs("span",{children:[n.paramsB,"B params"]}),e.jsxs("span",{children:[n.sizeGb," GB on disk"]}),e.jsxs("span",{children:["≥ ",n.minRamGb," GB RAM"]}),n.homepage&&e.jsx("a",{href:n.homepage,target:"_blank",rel:"noreferrer",className:"text-accent underline-offset-2 hover:underline",children:o==="zh-CN"?"模型主页":"Model card"})]}),!u&&d!=="no-go"&&i&&e.jsx(oe,{label:s.pullPrefix,cmd:i,copy:s,onCopy:l})]})})}function et({open:n,backend:t,catalog:a,totalRamGb:s,currentOs:o,copy:l,locale:d,onClose:w,onRefresh:u,onCopy:i}){const[g,f]=r.useState(!1);r.useEffect(()=>{f(!1)},[t?.detected,t?.id]);const j=r.useMemo(()=>t?Ze(t,a).sort((A,L)=>{const M=re(s,A.minRamGb),x=re(s,L.minRamGb),N=h=>h==="ok"?0:h==="tight"?1:2,R=de(A,t)?0:1,y=de(L,t)?0:1;return R!==y?R-y:N(M)-N(x)}):[],[t,a,s]);if(!t)return null;const p=!t.supportedOnThisOs,C=o?t.install[o]||[]:[],E=async()=>{f(!0);try{await u()}finally{f(!1)}};return e.jsxs(ee,{open:n,onClose:w,wide:!0,children:[e.jsx(te,{title:l.modalTitle(t.label),description:l.modalDescription(t.label),onClose:w}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{className:"space-y-2",children:[e.jsx(je,{index:1,label:l.stepStatus,done:t.detected}),e.jsxs("div",{className:"space-y-2 rounded-md border border-edge bg-panel-alt px-3.5 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-edge bg-panel",children:e.jsx(Y,{brand:t.id,size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-fg",children:t.label}),p?e.jsx(O,{variant:"muted",children:l.tileStatusUnsupported}):t.detected?e.jsx(O,{variant:"ok",children:l.statusRunning}):e.jsx(O,{variant:"muted",children:l.tileStatusNotDetected})]}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children:p?e.jsx(e.Fragment,{children:l.statusUnsupportedDesc(t.label)}):t.detected?e.jsxs(e.Fragment,{children:[t.version&&e.jsxs(e.Fragment,{children:["v",t.version," · "]}),e.jsx("span",{className:"font-mono",children:t.baseURL})]}):e.jsx(e.Fragment,{children:l.statusNotRunning})})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("a",{href:t.homepage,target:"_blank",rel:"noreferrer",className:"text-[12px] text-accent underline-offset-2 hover:underline",children:l.statusHomepageCta}),!p&&e.jsx(_,{variant:"outline",size:"sm",disabled:g,onClick:()=>{E()},children:g?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"h-3 w-3"})," ",l.statusRechecking]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"↻"})," ",l.statusRecheck]})})]})]}),!p&&t.detected&&t.existingProviderId&&e.jsx("div",{className:"rounded-md border border-emerald-700/20 bg-emerald-700/5 px-2.5 py-1.5 text-[11px] leading-relaxed text-emerald-700 dark:text-emerald-300",children:l.statusAutoAttachedHint(t.label)}),!p&&!t.detected&&e.jsxs("div",{className:"space-y-2 pt-1",children:[C.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:l.statusInstallHeader}),C.map((A,L)=>e.jsx(oe,{label:A.label,cmd:A.cmd,copy:l,onCopy:i},L)),t.install.docs&&e.jsxs("a",{href:t.install.docs,target:"_blank",rel:"noreferrer",className:"text-[11px] text-accent underline-offset-2 hover:underline",children:[l.statusInstallDocs," →"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:l.statusRunHint}),e.jsx(oe,{label:t.runHint.label,cmd:t.runHint.cmd,copy:l,onCopy:i})]})]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx(je,{index:2,label:l.stepModels,done:t.detected&&t.models.length>0}),t.detected?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-md border border-edge bg-panel-alt px-3.5 py-3",children:[e.jsx("div",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:l.modelsInstalledHeader(t.models.length)}),t.models.length===0?e.jsx("div",{className:"text-[12px] text-fg-5",children:l.modelsInstalledEmpty}):e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(A=>e.jsx(Je,{name:A.id,sizeBytes:A.sizeBytes},A.id))})]}),j.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:l.modelsRecommendedHeader}),e.jsx("div",{className:"space-y-1.5",children:j.map(A=>e.jsx(Xe,{entry:A,backend:t,totalRamGb:s,copy:l,locale:d,onCopy:i},A.id))})]})]}):e.jsx("div",{className:"rounded-md border border-edge bg-panel-alt px-3.5 py-3 text-[12px] text-fg-5",children:l.modelsBackendOffline})]})]}),e.jsx("div",{className:"mt-6 border-t border-edge pt-4",children:e.jsx(ce,{primary:{label:l.closeBtn,onClick:w}})})]})}function tt({snapshot:n,onConnected:t}){const a=$(h=>h.locale),s=$(h=>h.host),o=$(h=>h.toast),l=r.useMemo(()=>Ge(a),[a]),d=Ce(),w=n??d,{backends:u,catalog:i,currentOs:g,loading:f,error:j,refresh:p}=w,[C,E]=r.useState(null),A=r.useMemo(()=>u.find(h=>h.id===C)??null,[u,C]),L=r.useRef("");r.useEffect(()=>{const h=u.map(B=>B.existingProviderId||"").join(",");h!==L.current&&(L.current=h,t&&u.some(B=>B.existingProviderId)&&t())},[u,t]);const M=r.useCallback(async()=>{const h=await p();return t&&h.addedProviderIds.length>0&&await t(),h},[p,t]),x=r.useCallback(h=>{navigator.clipboard?.writeText(h),o(l.copied)},[l.copied,o]),N=s?.totalMem?s.totalMem/1024**3:null,R=s?`${s.cpuModel||s.arch} · ${We(s.totalMem)} RAM`:l.hostUnknown,y=u.length>0?u:[{id:"ollama",label:"Ollama",detected:!1,baseURL:"http://127.0.0.1:11434",openAIBaseURL:"http://127.0.0.1:11434/v1",models:[],existingProviderId:null,homepage:"https://ollama.com/",install:{},runHint:{cmd:"ollama serve"},pullCommandTemplate:"ollama pull ${model}",supportedOnThisOs:!0},{id:"mlx",label:"mlx-lm",detected:!1,baseURL:"http://127.0.0.1:8080",openAIBaseURL:"http://127.0.0.1:8080/v1",models:[],existingProviderId:null,homepage:"https://github.com/ml-explore/mlx-lm",install:{},runHint:{cmd:"mlx_lm.server --port 8080"},pullCommandTemplate:"mlx_lm.server --model ${model} --port 8080",supportedOnThisOs:!0}];return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"text-[12px] text-fg-5",children:[e.jsx("span",{className:"font-semibold uppercase tracking-[0.14em] text-fg-5",children:l.hostLabel}),e.jsx("span",{className:"mx-2 text-fg-6",children:"·"}),e.jsx("span",{className:"text-fg-3",children:R})]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:()=>{M()},disabled:f,children:f?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"h-3 w-3"})," ",l.refreshing]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"↻"})," ",l.refresh]})})]}),e.jsxs("div",{className:"space-y-1.5 pt-1",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.18em] text-fg-5",children:l.sectionLabel}),e.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:y.map(h=>e.jsx(Qe,{backend:h,copy:l,locale:a,onClick:()=>E(h.id)},h.id))})]}),j&&e.jsx("div",{className:"rounded-md border border-rose-700/40 bg-rose-900/20 px-3 py-2 text-xs text-rose-200",children:j}),e.jsx(et,{open:C!==null,backend:A,catalog:i,totalRamGb:N,currentOs:g,copy:l,locale:a,onClose:()=>E(null),onRefresh:M,onCopy:x})]})}function nt(n){return!n||!Number.isFinite(n)?null:n>=1e6?`${Math.round(n/1e5)/10}M ctx`:n>=1e3?`${Math.round(n/1e3)}K ctx`:`${n} ctx`}function ye(n){const t=(()=>{try{return new URL(n.baseURL)}catch{return null}})(),a=t?.host.toLowerCase()??"",s=t?.port??"";return(a.startsWith("127.0.0.1")||a.startsWith("localhost"))&&s==="11434"?"ollama":(a.startsWith("127.0.0.1")||a.startsWith("localhost"))&&s==="8080"?"mlx":a.includes("openrouter")?"openrouter":a.includes("anthropic")?"anthropic":a.includes("deepseek")?"deepseek":a.includes("googleapis")||a.includes("vertex")?"google":a.includes("openai.com")?"openai":a.includes("dashscope")||a.includes("qwen")||a.includes("aliyun")?"qwen":a.includes("volces")||a.includes("volcengine")||a.includes("doubao")?"doubao":a.includes("bigmodel")||a.includes("zhipu")||a.includes("z.ai")?"glm":a.includes("minimax")?"minimax":n.kind==="anthropic"?"anthropic":n.kind==="google"?"google":n.kind==="openai"?"openai":"custom"}function at(n){return n==="zh-CN"?{sectionTitle:"我的模型",sectionHint:"把你常用的模型登记成一条条快捷方式,自由起别名。这是一份纯粹的选择列表——智能体会从这里挑模型,但谁选了什么不会反向显示在这里。",addLabel:"添加模型",empty:"还没有登记任何模型",emptyHint:'先在下方"模型供应商"里接入一个供应商,再点上方"添加模型"把常用的几个固定下来。',addModalTitle:"添加模型",editModalTitle:"编辑模型",fieldName:"显示名",fieldNameHint:"智能体卡片和 IM 选择菜单里会看到的名称;留空则直接用模型 ID。",fieldProvider:"供应商",fieldProviderEmpty:'没有可用的供应商;请先在下方"模型供应商"里接入一个。',fieldProviderLockedHint:'想换别的供应商?关闭这个窗口,先到下方"模型供应商"里接入。',fieldModelId:"模型",fieldModelIdHint:"从供应商 /v1/models 拉到的真实模型列表中挑选。",fieldModelIdLoading:"正在拉取该供应商的模型列表…",fieldModelIdEmpty:"该供应商没有返回模型列表(或还未校验),可手动输入模型 ID。",fieldModelIdToggleManual:"改为手动输入",fieldModelIdToggleList:"从列表选择",fieldModelIdSearchPlaceholder:"搜索模型",fieldModelIdSearchEmpty:"没有匹配的模型",fieldModelIdCurrentLabel:"当前",fieldEffort:"推理强度",effortDefault:"(沿用默认)",cancel:"取消",save:"保存",saving:"保存中",remove:"删除",removeConfirm:"删除这个模型条目?已经选择它的智能体会自动回退到官方认证。",via:"经由"}:{sectionTitle:"My Models",sectionHint:"Register the models you actually use as named shortcuts. A pure selection list — agents pick from here, but who picks what does not bubble back into this view.",addLabel:"Add model",empty:"No models registered yet",emptyHint:"Connect a provider below first, then come back here to pin the few you actually use.",addModalTitle:"Add Model",editModalTitle:"Edit Model",fieldName:"Display name",fieldNameHint:"Shown in agent cards and the IM model picker. Leave empty to use the model id as-is.",fieldProvider:"Provider",fieldProviderEmpty:'No providers configured yet; add one in "Model Providers" below first.',fieldProviderLockedHint:'Want a different provider? Close this dialog and connect one in "Model Providers" below.',fieldModelId:"Model",fieldModelIdHint:"Picked from the provider's live /v1/models list.",fieldModelIdLoading:"Loading the provider's model list…",fieldModelIdEmpty:"This provider returned no model list (or has not been validated yet). Enter a model ID manually.",fieldModelIdToggleManual:"Enter manually",fieldModelIdToggleList:"Pick from list",fieldModelIdSearchPlaceholder:"Search models",fieldModelIdSearchEmpty:"No matching models",fieldModelIdCurrentLabel:"Current",fieldEffort:"Reasoning effort",effortDefault:"(default)",cancel:"Cancel",save:"Save",saving:"Saving",remove:"Remove",removeConfirm:"Remove this model entry? Agents that picked it will fall back to native auth.",via:"via"}}async function Ee(n,t,a){return(await fetch(t,{method:n,headers:{"Content-Type":"application/json"},body:a?JSON.stringify(a):void 0})).json()}const lt=["","low","medium","high","xhigh","max"];function st({open:n,copy:t,providers:a,initial:s,existing:o,onClose:l,onSaved:d,onRemove:w}){const[u,i]=r.useState(s),[g,f]=r.useState(!1),[j,p]=r.useState(null),[C,E]=r.useState(()=>new Map),[A,L]=r.useState(!1),[M,x]=r.useState(null),[N,R]=r.useState(!1);r.useEffect(()=>{n&&(i(s),p(null),R(!1),E(new Map))},[n,s]),r.useEffect(()=>{if(!n)return;const m=u.providerId;if(!m||C.has(m))return;let b=!1;return L(!0),x(null),(async()=>{try{const v=await(await fetch(`/api/models/providers/${m}/models`)).json();if(b)return;const S=v.modelInfos&&v.modelInfos.length>0?v.modelInfos:(v.models||[]).map(P=>({id:P}));E(P=>{const D=new Map(P);return D.set(m,S),D}),!v.ok&&v.error&&x(v.error)}catch(c){b||x(c?.message||String(c))}finally{b||L(!1)}})(),()=>{b=!0}},[n,u.providerId,C]);const y=!!o,h=C.get(u.providerId)??null,B=r.useCallback(async()=>{p(null),f(!0);try{const m={name:u.name.trim()||void 0,providerId:u.providerId,modelId:u.modelId.trim(),effort:u.effort||null},b=y&&o?`/api/models/profiles/${o.id}`:"/api/models/profiles",v=await Ee(y?"PATCH":"POST",b,m);if(!v.ok){p(v.error||"Failed to save");return}d(),l()}catch(m){p(m?.message||String(m))}finally{f(!1)}},[u,y,o,d,l]),z=!g&&!!u.providerId&&u.modelId.trim().length>0;return e.jsxs(ee,{open:n,onClose:l,children:[e.jsx(te,{title:y?t.editModalTitle:t.addModalTitle,description:t.sectionHint,onClose:l}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(H,{children:t.fieldProvider}),a.length===0?e.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700",children:t.fieldProviderEmpty}):(()=>{const m=y||a.length<=1,b=a.find(c=>c.id===u.providerId)??a[0];return m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-10 w-full items-center gap-2.5 rounded-md border border-edge bg-panel-alt px-3",children:[e.jsx(Y,{brand:ye(b),size:20}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium text-fg-2",children:b.name}),e.jsx("div",{className:"truncate font-mono text-[10.5px] leading-tight text-fg-5",children:b.baseURL})]})]}),!y&&e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children:t.fieldProviderLockedHint})]}):e.jsx(q,{value:u.providerId,options:a.map(c=>({value:c.id,label:`${c.name} · ${c.baseURL}`})),onChange:c=>i(v=>({...v,providerId:c}))})})()]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-baseline justify-between gap-2",children:[e.jsx(H,{className:"mb-0",children:t.fieldModelId}),h&&h.length>0&&e.jsx("button",{type:"button",onClick:()=>R(m=>!m),className:"text-[11px] text-fg-5 transition hover:text-fg-3",children:N?t.fieldModelIdToggleList:t.fieldModelIdToggleManual})]}),A&&e.jsxs("div",{className:"flex h-9 items-center gap-2 rounded-md border border-edge bg-panel-alt px-3 text-[12px] text-fg-5",children:[e.jsx(G,{}),t.fieldModelIdLoading]}),!A&&!N&&h&&h.length>0&&(()=>{const b=[...!h.some(c=>c.id===u.modelId)&&u.modelId?[{value:u.modelId,label:u.modelId,description:t.fieldModelIdCurrentLabel}]:[],...h.map(c=>({value:c.id,label:c.id,description:c.name&&c.name.toLowerCase()!==c.id.toLowerCase()?c.name:void 0,meta:c.contextLength?nt(c.contextLength):void 0}))];return e.jsx(we,{value:u.modelId,options:b,onChange:c=>i(v=>({...v,modelId:c})),searchPlaceholder:t.fieldModelIdSearchPlaceholder,noMatchesText:t.fieldModelIdSearchEmpty,currentLabel:t.fieldModelIdCurrentLabel})})(),!A&&(N||!h||h.length===0)&&e.jsxs(e.Fragment,{children:[e.jsx(K,{value:u.modelId,onChange:m=>i(b=>({...b,modelId:m.target.value})),placeholder:"anthropic/claude-sonnet-4"}),(!h||h.length===0)&&!M&&e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children:t.fieldModelIdEmpty})]}),M&&e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-amber-700",children:M}),!N&&h&&h.length>0&&e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children:t.fieldModelIdHint})]}),e.jsxs("div",{children:[e.jsx(H,{children:t.fieldName}),e.jsx(K,{value:u.name,onChange:m=>i(b=>({...b,name:m.target.value})),placeholder:u.modelId||"anthropic/claude-sonnet-4"}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children:t.fieldNameHint})]}),e.jsxs("div",{children:[e.jsx(H,{children:t.fieldEffort}),e.jsx(q,{value:u.effort,options:lt.map(m=>({value:m,label:m||t.effortDefault})),onChange:m=>i(b=>({...b,effort:m}))})]}),j&&e.jsx("div",{className:"rounded-md border border-rose-700/40 bg-rose-900/20 px-3 py-2 text-xs text-rose-200",children:j})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-between gap-2 border-t border-edge pt-4",children:[e.jsx("div",{children:y&&w&&e.jsx("button",{type:"button",onClick:()=>{w()},className:"text-[12px] text-fg-5 transition hover:text-[var(--th-err)]",children:t.remove})}),e.jsx(ce,{primary:{label:g?t.saving:t.save,onClick:B,disabled:!z},secondary:{label:t.cancel,onClick:l}})]})]})}function it({profile:n,provider:t,copy:a,onPick:s}){const o=t?ye(t):"custom";return e.jsxs("button",{type:"button",onClick:s,className:"group relative flex h-[120px] flex-col rounded-lg border border-edge bg-panel-alt px-4 py-3.5 text-left transition-all duration-200 hover:-translate-y-0.5 hover:border-edge-strong hover:bg-panel hover:shadow-[0_4px_16px_rgba(15,23,42,0.06)]",children:[e.jsxs("div",{className:"flex w-full items-start justify-between gap-2",children:[e.jsx(Y,{brand:o,size:28}),n.effort&&e.jsx(O,{variant:"muted",children:n.effort})]}),e.jsxs("div",{className:"mt-auto min-w-0",children:[e.jsx("div",{className:"truncate text-[14px] font-semibold tracking-tight text-fg",children:n.name}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] leading-relaxed text-fg-4",children:n.modelId}),e.jsxs("div",{className:"mt-1 truncate text-[11.5px] text-fg-5",children:[a.via," ",t?.name??"?"]})]})]})}function rt({onClick:n,label:t}){return e.jsxs("button",{type:"button",onClick:n,className:"flex h-[120px] flex-col items-center justify-center rounded-lg border border-dashed border-edge bg-panel-alt text-fg-4 transition hover:border-edge-strong hover:bg-panel hover:text-fg-2",children:[e.jsx("div",{className:"text-2xl leading-none",children:"+"}),e.jsx("div",{className:"mt-1 text-[12.5px] font-medium tracking-tight",children:t})]})}function dt({snapshot:n}){const{providers:t,profiles:a,reload:s}=n,o=$(p=>p.locale),l=r.useMemo(()=>at(o),[o]),[d,w]=r.useState(null),u=r.useMemo(()=>new Map(t.map(p=>[p.id,p])),[t]),i=r.useCallback(async p=>{confirm(l.removeConfirm)&&(await Ee("DELETE",`/api/models/profiles/${p.id}`),await s())},[l,s]),g=r.useMemo(()=>({name:"",providerId:t[0]?.id??"",modelId:"",effort:""}),[t]),f=r.useMemo(()=>{if(!d||d.kind!=="edit")return null;const p=d.profile;return{name:p.name,providerId:p.providerId,modelId:p.modelId,effort:p.effort||""}},[d]),j=a.length===0;return e.jsxs("div",{className:"space-y-2",children:[j&&e.jsxs("div",{className:"rounded-lg border border-dashed border-edge bg-panel-alt px-4 py-6 text-center",children:[e.jsx("div",{className:"text-[13.5px] font-semibold text-fg-2",children:l.empty}),e.jsx("div",{className:"mx-auto mt-1 max-w-md text-[12px] leading-relaxed text-fg-5",children:l.emptyHint}),t.length>0&&e.jsx("div",{className:"mt-3",children:e.jsx(_,{variant:"primary",size:"sm",onClick:()=>w({kind:"add"}),children:l.addLabel})})]}),!j&&e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",children:[a.map(p=>e.jsx(it,{profile:p,provider:u.get(p.providerId)??null,copy:l,onPick:()=>w({kind:"edit",profile:p})},p.id)),t.length>0&&e.jsx(rt,{label:l.addLabel,onClick:()=>w({kind:"add"})})]}),d&&e.jsx(st,{open:!0,copy:l,providers:t,initial:d.kind==="edit"?f:g,existing:d.kind==="edit"?d.profile:null,onClose:()=>w(null),onSaved:s,onRemove:d.kind==="edit"?async()=>{await i(d.profile),w(null)}:void 0})]})}const ot=["claude","codex","gemini","hermes"];function ct(n){return n==="hermes"}function ut(n){const t=(n||"").toLowerCase().trim();return t==="openrouter"?"openrouter":t==="anthropic"?"anthropic":t==="openai"?"openai":t==="google"||t==="gemini"?"google":t==="deepseek"?"deepseek":t==="qwen"||t==="dashscope"?"qwen":t==="doubao"||t==="volces"||t==="volcengine"?"doubao":t==="glm"||t==="zhipu"||t==="bigmodel"?"glm":t==="minimax"?"minimax":"custom"}function mt(n){const t=(()=>{try{return new URL(n.baseURL).host.toLowerCase()}catch{return""}})();return t.includes("openrouter")?"openrouter":t.includes("anthropic")?"anthropic":t.includes("deepseek")?"deepseek":t.includes("googleapis")||t.includes("vertex")?"google":t.includes("openai.com")?"openai":t.includes("dashscope")||t.includes("qwen")||t.includes("aliyun")?"qwen":t.includes("volces")||t.includes("volcengine")||t.includes("doubao")?"doubao":t.includes("bigmodel")||t.includes("zhipu")||t.includes("z.ai")?"glm":t.includes("minimax")?"minimax":n.kind==="anthropic"?"anthropic":n.kind==="google"?"google":n.kind==="openai"?"openai":"custom"}function Ne(n,t){const a=n.bindings[t];if(!a)return null;const s=n.profiles.find(l=>l.id===a);if(!s)return null;const o=n.providers.find(l=>l.id===s.providerId);return o?{profileId:s.id,providerId:o.id,providerName:o.name,providerBrand:mt(o),modelId:s.modelId,effort:s.effort||null}:null}function ft(n){return n==="zh-CN"?{defaultsTitle:"新会话默认值",defaultsHint:"决定新建对话默认走哪个智能体。具体模型与推理强度由该智能体卡片下的「供应商 / 模型 / 推理强度」决定。",defaultsEditTitle:"修改默认智能体",defaultsEditHint:"选择新建对话默认走哪个智能体。",defaultsSaved:"默认智能体已更新",editDefaults:"修改默认",agentsTitle:"可用智能体",defaultAgent:"默认智能体",installLabel:"安装状态",versionLabel:"版本",defaultBadge:"默认",installed:"已安装",notInstalled:"未安装",notInstalledHint:"安装该智能体的本地 CLI 后即可在此配置供应商与模型。",noModel:"未设置",noVersion:"版本未知",loadFailed:"无法加载智能体状态",updateAvailable:"有新版本",updateSkipped:"自动更新已跳过",updateFailed:"自动更新失败",update:"升级",updating:"升级中…",checkUpdate:"检查更新",checking:"检查中…",upToDate:"已是最新",install:"安装",installing:"安装中…",profilesHint:"把你常用的模型登记成一条条快捷方式,自由起别名。这是一份纯粹的选择列表——智能体(包括 Hermes)会从这里挑模型,但选了谁不会反向显示在这里。",profilesTitle:"我的模型",modelsTitle:"模型供应商",modelsHint:'接入 BYOK 供应商;接入后可在上方"我的模型"里挑选具体模型并固定下来。',localTitle:"本地模型",localHint:"在本机检测 Ollama / mlx-lm 并按内存推荐合适的开源模型;接入后会作为一个供应商出现在智能体卡片中。",rowProvider:"供应商",rowModel:"模型",rowEffort:"推理强度",providerNative:"官方(CLI 内置认证)",providerNativeFromAgent:"智能体自身配置",effortDefault:"默认",modelLoading:"正在拉取模型列表…",modelEmpty:"该供应商未返回模型列表,请使用自定义输入。",modelCustomToggle:"改为自定义输入",modelListToggle:"从列表选择",modelCustomPlaceholder:"anthropic/claude-sonnet-4",modelSearchPlaceholder:"搜索模型",modelSearchEmpty:"没有匹配的模型",modelCurrentLabel:"当前",modelGroupNative:"官方",modelGroupProfiles:"我的模型",modelPickerEmpty:"没有可选模型",modelPickerEmptyHint:'该智能体的官方模型列表为空,且你还没有登记任何"我的模型"。',saveChanges:"保存",saving:"保存中…",saved:"已保存",configError:"保存失败",externalNativeNote:t=>`Hermes 当前从 ${t||"~/.hermes/config.yaml"} 读取这些值;切换为某个 BYOK 供应商可由 pikiclaw 接管。`,configure:"配置",configModalTitle:t=>`配置 ${t}`,rowSummaryNative:"官方认证",rowSummaryNoModel:"未选模型",rowSummaryNoEffort:"默认强度"}:{defaultsTitle:"New Session Defaults",defaultsHint:"Pick which agent new sessions use by default. Provider / Model / Effort live on each agent card below.",defaultsEditTitle:"Change Default Agent",defaultsEditHint:"Which agent should new sessions use by default?",defaultsSaved:"Default agent updated",editDefaults:"Change default",agentsTitle:"Available Agents",defaultAgent:"Default Agent",installLabel:"Install",versionLabel:"Version",defaultBadge:"Default",installed:"Installed",notInstalled:"Not installed",notInstalledHint:"Install the local CLI for this agent to configure its provider and model.",noModel:"Not set",noVersion:"Version unavailable",loadFailed:"Failed to load agent status",updateAvailable:"Update available",updateSkipped:"Auto-update skipped",updateFailed:"Auto-update failed",update:"Update",updating:"Updating…",checkUpdate:"Check update",checking:"Checking…",upToDate:"Up to date",install:"Install",installing:"Installing…",profilesTitle:"My Models",profilesHint:"Register the models you actually use as named shortcuts. A pure selection list — agents (including Hermes) pick from here, but who picks what does not bubble back into this view.",modelsTitle:"Model Providers",modelsHint:'Connect BYOK providers; pin specific models above in "My Models".',localTitle:"Local Models",localHint:"Detect Ollama / mlx-lm on this machine and surface coding models that fit your RAM. Connected backends show up as a provider on the agent cards.",rowProvider:"Provider",rowModel:"Model",rowEffort:"Effort",providerNative:"Native (CLI auth)",providerNativeFromAgent:"agent's own config",effortDefault:"default",modelLoading:"Loading model list…",modelEmpty:"Provider returned no model list — use custom input.",modelCustomToggle:"Use custom input",modelListToggle:"Pick from list",modelCustomPlaceholder:"anthropic/claude-sonnet-4",modelSearchPlaceholder:"Search models",modelSearchEmpty:"No matching models",modelCurrentLabel:"Current",modelGroupNative:"Native",modelGroupProfiles:"My Models",modelPickerEmpty:"No models available",modelPickerEmptyHint:'This agent has no native model list, and no "My Models" entries are registered.',saveChanges:"Save",saving:"Saving…",saved:"Saved",configError:"Save failed",externalNativeNote:t=>`Hermes reads these values from ${t||"~/.hermes/config.yaml"}; pick a BYOK provider to let pikiclaw take over.`,configure:"Configure",configModalTitle:t=>`Configure ${t}`,rowSummaryNative:"Native auth",rowSummaryNoModel:"No model",rowSummaryNoEffort:"Default effort"}}function pt(n,t){const a=n.filter(o=>o.installed);return(a.length?a:n).map(o=>({value:o.agent,label:`${Q(o.agent).label} · ${o.installed?o.version||t.installed:t.notInstalled}`}))}function ke(n,t){n({defaultAgent:t.defaultAgent,agents:t.agents})}function ht(n,t,a){if(a)return{kind:"profile",modelId:a.modelId,profileId:a.profileId,effort:a.effort||""};const s=t?.nativeConfig||null;return{kind:"native",modelId:s?.model||t?.selectedModel||"",profileId:null,effort:s?.effort||t?.selectedEffort||""}}function xt(n,t){return n.kind===t.kind&&(n.profileId||"")===(t.profileId||"")&&n.modelId.trim()===t.modelId.trim()&&(n.effort||"")===(t.effort||"")}function gt(n){return n.kind==="profile"&&n.profileId?`p:${n.profileId}`:`n:${n.modelId}`}function vt(n){return n.startsWith("n:")?{kind:"native",modelId:n.slice(2)}:n.startsWith("p:")?{kind:"profile",profileId:n.slice(2)}:null}function bt({agentId:n,agentStatus:t,boundInfo:a,copy:s,layer:o,toast:l,onSaved:d,onCancel:w,t:u}){const i=ct(n),g=t.nativeConfig||null,f=r.useMemo(()=>ht(n,t,a),[n,t,a]),[j,p]=r.useState(f),[C,E]=r.useState(!1),[A,L]=r.useState(null);r.useEffect(()=>{p(f),L(null)},[f]);const x=j.kind==="native"&&i,N=r.useMemo(()=>{const b=he[n]||he.claude;return[{value:"",label:s.effortDefault},...b.map(c=>({value:c,label:c}))]},[n,s.effortDefault]),R=r.useMemo(()=>{const b=[];if(!i)for(const v of t.models){const S=v.alias?.toLowerCase().replace(/[\s_-]/g,""),P=v.id.toLowerCase().replace(/[\s_-]/g,""),D=v.alias&&S!==P;b.push({value:`n:${v.id}`,label:v.id,description:D?v.alias:void 0,group:s.modelGroupNative})}const c=new Set(Be[n]||[]);for(const v of o.profiles){const S=o.providers.find(Z=>Z.id===v.providerId);if(!S||!c.has(S.kind))continue;const P=S.name,U=v.name.trim().toLowerCase()!==v.modelId.trim().toLowerCase()?`${P} · ${v.modelId}`:P;b.push({value:`p:${v.id}`,label:v.name,description:U,group:s.modelGroupProfiles})}return b},[n,t.models,o.profiles,o.providers,s.modelGroupNative,s.modelGroupProfiles,i]),y=gt(j),h=r.useCallback(b=>{const c=vt(b);if(c)if(c.kind==="native")p(v=>({...v,kind:"native",modelId:c.modelId,profileId:null,effort:v.kind==="profile"?t.nativeSelectedEffort||t.nativeConfig?.effort||"":v.effort}));else{const v=o.profiles.find(S=>S.id===c.profileId);p(S=>({...S,kind:"profile",profileId:c.profileId,modelId:v?.modelId||S.modelId,effort:v?.effort||S.effort}))}},[o.profiles,t.nativeSelectedEffort,t.nativeConfig]),B=!xt(j,f),z=!C&&B&&(x||!!j.modelId.trim()||j.kind==="profile"),m=r.useCallback(async()=>{L(null),E(!0);try{const b=j.effort||null;if(j.kind==="native"){if(o.bindings[n]&&await o.setActiveProfile(n,null),!i){const c={agent:n},v=j.modelId.trim();if(v&&v!==(t.nativeSelectedModel||"")&&(c.model=v),b!==(t.nativeSelectedEffort||null)&&(c.effort=b),Object.keys(c).length>1){const S=await V.updateRuntimeAgent(c);if(!S.ok)throw new Error(S.error||"Failed to update agent")}}}else{if(!j.profileId)throw new Error("No profile selected");if(await o.setActiveProfile(n,j.profileId),b!==(t.selectedEffort||null)){const c=await V.updateRuntimeAgent({agent:n,effort:b});if(!c.ok)throw new Error(c.error||"Failed to update agent")}}await Promise.resolve(d()),l(s.saved)}catch(b){const c=b?.message||String(b);L(c),l(`${s.configError}: ${c}`,!1)}finally{E(!1)}},[n,t,s,j,i,o,d,l]);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]",children:[e.jsxs("div",{children:[e.jsx(H,{className:"!mb-1 text-[11px]",children:s.rowModel}),x?e.jsx("div",{className:"flex h-9 items-center rounded-md border border-control-border bg-control px-3 text-[13px] text-fg-3",children:e.jsx("span",{className:"truncate font-mono",children:g?.model||s.noModel})}):R.length===0?e.jsxs("div",{className:"rounded-md border border-edge bg-panel-alt px-3 py-3",children:[e.jsx("div",{className:"text-[12px] font-medium text-fg-3",children:s.modelPickerEmpty}),e.jsx("div",{className:"mt-0.5 text-[11px] leading-relaxed text-fg-5",children:s.modelPickerEmptyHint})]}):e.jsx(we,{value:y,options:R,onChange:h,placeholder:"—",searchPlaceholder:s.modelSearchPlaceholder,noMatchesText:s.modelSearchEmpty,currentLabel:s.modelCurrentLabel})]}),e.jsxs("div",{children:[e.jsx(H,{className:"!mb-1 text-[11px]",children:s.rowEffort}),x?e.jsx("div",{className:"flex h-9 items-center rounded-md border border-control-border bg-control px-3 text-[13px] text-fg-3",children:e.jsx("span",{className:"font-mono",children:g?.effort||s.effortDefault})}):e.jsx(q,{value:j.effort,options:N,onChange:b=>p(c=>({...c,effort:b}))})]})]}),x&&e.jsx("div",{className:"text-[11px] leading-relaxed text-fg-5",children:s.externalNativeNote(g?.configPath||"")}),A&&e.jsx("div",{className:"rounded-md border border-rose-700/40 bg-rose-900/20 px-3 py-2 text-xs text-rose-200",children:A}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"sm",onClick:w,disabled:C,children:u("modal.cancel")}),e.jsxs(_,{variant:"primary",size:"sm",disabled:!z,onClick:()=>{m()},children:[C&&e.jsx(G,{className:"h-3 w-3"}),C?s.saving:s.saveChanges]})]})]})}function jt(n,t,a){if(t)return{providerBrand:t.providerBrand,providerLabel:t.providerName,modelText:t.modelId||a.rowSummaryNoModel,effortText:t.effort||a.rowSummaryNoEffort};const s=n.nativeConfig||null,o=s?.provider||null;return{providerBrand:ut(o),providerLabel:a.rowSummaryNative,modelText:n.nativeSelectedModel||s?.model||n.selectedModel||a.rowSummaryNoModel,effortText:n.nativeSelectedEffort||s?.effort||n.selectedEffort||a.rowSummaryNoEffort}}function Nt({agent:n,copy:t,t:a,installing:s,onInstall:o,updatingAgent:l,checkingAgent:d,onUpdate:w,onCheckUpdate:u,onEdit:i,loading:g=!1,boundInfo:f}){const j=Q(n.agent),p=j.advantageKey?a(j.advantageKey):"",C=n.installed?jt(n,f,t):null;return e.jsxs("div",{className:"glass rounded-md border border-edge px-3.5 py-2.5 shadow-[0_1px_0_rgba(255,255,255,0.02),0_4px_12px_rgba(15,23,42,0.05)]",title:p||void 0,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-edge bg-panel-alt",children:e.jsx(Y,{brand:n.agent,size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-[14px] font-semibold tracking-tight text-fg",children:j.label}),n.isDefault&&e.jsx(O,{variant:"accent",children:t.defaultBadge}),g?e.jsxs(O,{variant:"muted",children:[e.jsx(G,{className:"h-3 w-3"})," ",a("status.loading")]}):n.installed?e.jsx(O,{variant:"ok",children:t.installed}):e.jsx(O,{variant:"muted",children:t.notInstalled}),n.installed&&n.updateAvailable&&e.jsx(O,{variant:"warn",children:t.updateAvailable}),n.installed&&n.version&&e.jsxs("span",{className:"text-[11px] font-mono text-fg-5",children:["v",n.version]}),n.latestVersion&&n.updateAvailable&&e.jsxs("span",{className:"text-[11px] text-amber-400",children:["→ ",n.latestVersion]})]}),C?e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-fg-4",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Y,{brand:C.providerBrand,size:11}),e.jsx("span",{className:"text-fg-3",children:C.providerLabel})]}),e.jsx("span",{className:"text-fg-6","aria-hidden":"true",children:"·"}),e.jsx("span",{className:"font-mono text-fg-3",children:C.modelText}),e.jsx("span",{className:"text-fg-6","aria-hidden":"true",children:"·"}),e.jsx("span",{children:C.effortText})]}):p?e.jsx("div",{className:"mt-0.5 truncate text-[11px] text-fg-5",children:p}):null]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[g&&e.jsx("div",{className:"inline-flex h-7 items-center gap-2 px-2 text-[11px] text-fg-5",children:e.jsx(G,{className:"h-3 w-3"})}),!g&&!n.installed&&e.jsx(_,{variant:"primary",size:"sm",disabled:s,onClick:()=>o(n),children:s?t.installing:t.install}),!g&&n.installed&&n.updateAvailable&&e.jsx(_,{variant:"outline",size:"sm",disabled:l,onClick:()=>w(n),children:l?t.updating:t.update}),!g&&n.installed&&!n.updateAvailable&&e.jsx(_,{variant:"ghost",size:"icon",disabled:d,onClick:()=>u(n),title:t.checkUpdate,"aria-label":t.checkUpdate,className:"h-7 w-7",children:d?e.jsx(G,{className:"h-3 w-3"}):e.jsx("span",{"aria-hidden":"true",children:"↻"})}),!g&&n.installed&&e.jsx(_,{variant:"outline",size:"sm",onClick:()=>i(n),children:t.configure})]})]}),!g&&n.installed&&n.updateAvailable&&n.updateStatus==="skipped"&&n.updateDetail&&e.jsxs("div",{className:"mt-1.5 text-[11px] leading-relaxed",style:{color:"var(--th-badge-warn-text)"},children:[t.updateSkipped,": ",n.updateDetail]}),!g&&n.installed&&n.updateStatus==="failed"&&n.updateDetail&&e.jsxs("div",{className:"mt-1.5 text-[11px] leading-relaxed",style:{color:"var(--th-badge-err-text)"},children:[t.updateFailed,": ",n.updateDetail]})]})}function At(){const n=$(k=>k.locale),t=$(k=>k.toast),a=$(k=>k.agentStatus),s=$(k=>k.setAgentStatus),o=$(k=>k.refreshAgentStatus),l=r.useMemo(()=>De(n),[n]),d=r.useMemo(()=>ft(n),[n]),w=Me(),u=Ce(),[i,g]=r.useState(a?{defaultAgent:a.defaultAgent,agents:a.agents}:null),[f,j]=r.useState(!a),[p,C]=r.useState(null),[E,A]=r.useState(!1),[L,M]=r.useState(null),[x,N]=r.useState(!1),[R,y]=r.useState("codex"),[h,B]=r.useState(null),[z,m]=r.useState(null),[b,c]=r.useState(null),v=r.useRef(!!a);r.useEffect(()=>{a&&(ke(g,a),v.current||(v.current=!0,j(!1)))},[a]);const S=r.useCallback(k=>{ke(g,k),s(k)},[s]),P=r.useCallback(async()=>{v.current||j(!0);try{const k=await V.getAgentStatus();return S(k),C(null),v.current=!0,k}catch(k){const I=k instanceof Error?k.message:d.loadFailed;return C(I),v.current||t(I,!1),null}finally{j(!1)}},[S,d.loadFailed,t]);r.useEffect(()=>{a?o():P()},[]);const D=r.useMemo(()=>{const k=i?.agents||[],I=new Map(k.map(T=>[T.agent,T]));return ot.map(T=>{const pe=I.get(T);if(pe)return pe;const He=Q(T);return{agent:T,label:He.label,installed:!1,version:void 0,installCommand:void 0,selectedModel:null,selectedEffort:null,isDefault:i?.defaultAgent===T,models:[],usage:null}})},[i]),U=i?.defaultAgent||"codex",Z=D.find(k=>k.agent===U)||null,ue=D.filter(k=>k.installed).length>0,Se=pt(D,d),me=r.useCallback(async k=>{A(!0);try{const I=await V.updateRuntimeAgent(k);if(!I.ok)throw new Error(I.error||l("config.applyFailed"));return S(I),I}catch(I){const T=I instanceof Error?I.message:l("config.applyFailed");return t(T,!1),P(),null}finally{A(!1)}},[S,P,l,t]);r.useEffect(()=>{x&&y(U)},[U,x]);const Ae=r.useCallback(async()=>{if(R===U){N(!1);return}await me({defaultAgent:R})&&(t(d.defaultsSaved),N(!1))},[d.defaultsSaved,U,R,t,me]),Le=r.useCallback(async k=>{if(!L){M(k.agent);try{const I=await V.installAgent(k.agent);if(!I.ok)throw new Error(I.error||l("config.agentInstallFailed"));S(I),t(l("config.agentInstalled"))}catch(I){const T=I instanceof Error?I.message:l("config.agentInstallFailed");t(T,!1),P()}finally{M(I=>I===k.agent?null:I)}}},[S,L,P,l,t]),Re=r.useCallback(async k=>{if(!h){B(k.agent);try{const I=await V.updateAgent(k.agent);if(!I.ok)throw new Error(I.error||l("config.agentInstallFailed"));S(I),t(d.upToDate)}catch(I){const T=I instanceof Error?I.message:d.updateFailed;t(T,!1),P()}finally{B(I=>I===k.agent?null:I)}}},[S,d.updateFailed,d.upToDate,P,l,t,h]),Pe=r.useCallback(async k=>{if(!z){m(k.agent);try{const I=await V.checkAgentUpdate(k.agent);if(!I.ok)throw new Error(I.error||d.loadFailed);S(I)}catch(I){const T=I instanceof Error?I.message:d.loadFailed;t(T,!1),P()}finally{m(I=>I===k.agent?null:I)}}},[S,z,d.loadFailed,P,t]),ne=f&&!i,Te=ne?l("status.loading"):Z?Q(Z.agent).label:d.notInstalled;ne?l("status.loading"):Z?.installed?d.installed:d.notInstalled;const fe=r.useCallback(async()=>{await w.reload(),await P()},[w,P]),W=b?D.find(k=>k.agent===b)??null:null,ae=W?Q(W.agent):null;return e.jsxs("div",{className:"animate-in space-y-4",children:[e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.18em] text-fg-5",children:d.agentsTitle}),ne?e.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-fg-5",children:[e.jsx(G,{className:"h-3 w-3"}),e.jsx("span",{children:d.defaultAgent})]}):e.jsxs("button",{type:"button",onClick:()=>N(!0),disabled:E||!ue,title:d.editDefaults,className:"group inline-flex items-center gap-1.5 rounded-full border border-edge bg-panel-alt px-3 py-1 text-[12px] transition hover:border-edge-strong hover:bg-panel disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("span",{className:"text-fg-5 group-hover:text-fg-4",children:d.defaultAgent}),e.jsx(Y,{brand:U,size:14}),e.jsx("span",{className:"font-semibold text-fg-2",children:Te}),e.jsx("svg",{className:"text-fg-6 transition group-hover:text-fg-3",width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]})]}),e.jsx("div",{className:"grid grid-cols-1 gap-2 lg:grid-cols-2",children:D.map(k=>e.jsx(Nt,{agent:k,copy:d,t:l,installing:L===k.agent,loading:ne,onInstall:Le,updatingAgent:h===k.agent,checkingAgent:z===k.agent,onUpdate:Re,onCheckUpdate:Pe,onEdit:I=>c(I.agent),boundInfo:Ne(w,k.agent)},k.agent))})]}),p&&e.jsx(Ue,{className:"border-amber-500/20 bg-amber-500/5",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[13px] text-fg-2",children:p}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>{P()},children:l("sessions.retry")})]})}),e.jsxs("section",{className:"space-y-3 pt-4",children:[e.jsx("div",{className:"flex items-baseline justify-between border-t border-edge pt-4",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-semibold tracking-tight text-fg",children:d.profilesTitle}),e.jsx("div",{className:"mt-0.5 text-[13px] leading-relaxed text-fg-4",children:d.profilesHint})]})}),e.jsx(dt,{snapshot:w})]}),e.jsxs("section",{className:"space-y-3 pt-4",children:[e.jsx("div",{className:"flex items-baseline justify-between border-t border-edge pt-4",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-semibold tracking-tight text-fg",children:d.modelsTitle}),e.jsx("div",{className:"mt-0.5 text-[13px] leading-relaxed text-fg-4",children:d.modelsHint})]})}),e.jsx(Ke,{snapshot:w,localBackends:u.backends})]}),e.jsxs("section",{className:"space-y-3 pt-4",children:[e.jsx("div",{className:"flex items-baseline justify-between border-t border-edge pt-4",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-semibold tracking-tight text-fg",children:d.localTitle}),e.jsx("div",{className:"mt-0.5 text-[13px] leading-relaxed text-fg-4",children:d.localHint})]})}),e.jsx(tt,{snapshot:u,onConnected:fe})]}),e.jsx(ee,{open:!!W,onClose:()=>c(null),wide:!0,children:W&&ae&&e.jsxs(e.Fragment,{children:[e.jsx(te,{title:d.configModalTitle(ae.label),description:ae.advantageKey?l(ae.advantageKey):void 0,onClose:()=>c(null)}),e.jsx(bt,{agentId:W.agent,agentStatus:W,boundInfo:Ne(w,W.agent),copy:d,layer:w,toast:t,t:l,onSaved:async()=>{await fe(),c(null)},onCancel:()=>c(null)})]})}),e.jsxs(ee,{open:x,onClose:()=>N(!1),children:[e.jsx(te,{title:d.defaultsEditTitle,description:d.defaultsEditHint,onClose:()=>N(!1)}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(H,{children:d.defaultAgent}),e.jsx(q,{value:R,options:Se,onChange:k=>y(k),disabled:E||!ue,placeholder:d.notInstalled})]})}),e.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[e.jsx(_,{variant:"ghost",onClick:()=>N(!1),children:l("modal.cancel")}),e.jsx(_,{variant:"primary",disabled:E||R===U,onClick:()=>{Ae()},children:l(E?"config.validating":"modal.save")})]})]})]})}export{At as AgentTab,At as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./react-vendor-DTcmqLiz.js";import{c as g}from"./index-VSVNxqie.js";const a="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAF+0lEQVRYha2XbXBUZxXHf+e5u4SkCZjg0NIWnQLJLgRF5UWnL75MP9gMjqPT2eyC0qlMiYxOUAR206LOyhiSTVscp52O0xamWgu7WTp0qLUz6kht6Qed1L7M5GUTsAoDTRSIJJos2b33+GFfWMJuNqmcT/c595z/+d3nOc+9zxXKWE9Li7tm0fjyqmT6H0t/Fp8sFz9XM+UCauouH8Rx+ifmWWdP7Q0sLRbT98g3lySC/mcSQd+GGwrQt2vzx1G2ZEa6KJ3S1mJxlpOKIDyEmEM3FGCk5vw5YCw3FmFbb9hXfV2gcm/26vINBfhS+LU0qgcKXB9xT1hbr6kdDhtgcYaDxHSNwVBg92Ao0DMY8n97zgAAZnK8U2AoX1D0++rzWfkC44k6wAVghP7C3EQo8Iiijyq61oEDiV2bPjojwKk234pEsPnh/lDgzpyv/olXrwi6qyDsjsQy2ZQXmJdefPWWvp0v3uZ/CLQ9NxZINpxJj84IYDvmOUT2G/T1DD0CUB/pflnhd1eT5Mcnwl90Adi23JzPl9TbAEN7fF9AeapQW5AOicftGQFEOJ+9tEDbB9v8x99r21wLYBlnJ5AGUKhfklz8QEbY3J71nVnZceziUPAbtzvGxAB3wdPH6yPRx6cXvw4gbbm/B5zIO5SvVKjdMxAMrKvviPcpHMyLqvyoN+ybh7AUwIi+M9TaVOGI/SJwc4Fsf6rS2SqgxQBkukPDYTM40RdCZB/Z5gKmEGmzjStq2alBoDqbvF2hEWgF9oEuAvlugdx/Deaz9ZEjvcWKFwXIWaLNv14cDqmwugDvFRVOi8qOrOMdhT6BzQhvoNxzjbjItxo6o8+VqjEjAMBQa1OFXbXwh4KGuLqmDleXToHzwG1FpLs9kah/uvf98IPz08nkSuZbp+vDL4zNCJAHaQt82lH9JfCJ2cQrTFjq8hiZGrfVtQGcDQhrFNYAywELuFw15SwRgN6dvrrahcnkreGXJ0pCtDZVOFULwsCerEBJExhVGAY8FH/Z2cBvPJHY1ySx13cbaXMaqACSwCVRLqlhVNBRVTOm4lxCOSdqPkB0FdA2m5kosGGEHpC3UP2z6uRJb9fx8SwsJEL+nwBNwEKgWqBSoXaORQqtH+VNhDdErJMNnYf/ViqwbBNO3lRbVZFSS9yyIG1jucRuVuGnM6TZZL4d/wS9KEgawIH/gF5EzAWBvzecto9KPG7PqgkBTu0NLHVs7VBlcxnwS8ALgtyp6Kco3S9/OF850lQWYCD41RpMZUiUH5BZmgkRDqmyVaCqeJYeS1dqwJq4UoG56S5w7hb4PMp6YH426LJR1+qSAOrzWYPLZCvIPuAWAIHXxGGXY3geWAV6DOTrJRR+r5q8P9dskNtJ1etBVl4R19FPdh4eLQowEPR5RKxfgebOeGMqGvLMX/V0YrK/W+B+4ATCYZRnEJ5E+Q5gFM4AFwQ+I8hbLks2Ltt/ZKTUg163Rwfamrcj5q/54spvLZes9nZ2/yIx0b8jW/wCLmeLOLoCAEdeAjmYnaWPGXga9Jiia1O28+bAbt8dswJQEFF5IrO2chGVBzxdsY0r2qNnBx5uvkuELkAFedDTHj+nIl4AIzJsjL2XTAOisB+XtqryKLBcLHNyKLSpsSyAgKrKJoRtbksaPV3R5yFz7BaHOOBGOdAQib6SRV4L4KQZqe+I/wvYmZWqE1ue8nbFggjbgDoH/VOxY3vZXdDT0uKuqR37I+jdIH9JV9r3NIbjU717fLe4jPkASDVEYhW5730i2PwqIvdlZkK3eCPdv06E/GuAbmCBJxJbUnIGill13b8fyxRnRG070BiOTwG4MeuyszBSeNiw3KZFYDTzdPLzU7u3LPZEYu+qTq5Tlev+K2YESAQD94rKjqzgl72Pxd/P3VNLsgAyXJizoj161kG3Z4d1aZP6HIC36/i4tyt6dE4AasQNDIhxNnoisXevvZndJcLw9DxvpLsb5XGE9yzD2ZlqzPpVPN0SIf854FaUZz1dsW0fVqdsD5Q05Qhgg7z+oTX+Xyv2pzNX+x+eTlGviPgh3AAAAABJRU5ErkJggg==",h="/assets/codex-DYadqqp0.png",n="/assets/feishu-C4OMrjCW.ico",r="/assets/gemini-BYkEpiWr.svg",A="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdefs%3e%3clinearGradient%20x1='50%25'%20y1='0%25'%20x2='50%25'%20y2='100%25'%20id='linearGradient-1'%3e%3cstop%20stop-color='%2338AEEB'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23279AD1'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20id='Artboard'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3ccircle%20id='Oval'%20fill='url(%23linearGradient-1)'%20cx='8'%20cy='8'%20r='8'%3e%3c/circle%3e%3cpath%20d='M3.17026167,7.83635602%20C5.78750201,6.74265999%207.53273882,6.02162863%208.40597211,5.67326193%20C10.8992306,4.67860423%2011.2454541,4.53439191%2011.5831299,4.52864956%20C11.6573986,4.52743168%2011.8385417,4.55776042%2011.9798438,4.67645833%20C12.1211458,4.79515625%2012.1635786,4.87206678%2012.1755371,4.93908691%20C12.1874957,5.00610705%2012.1862759,5.21456762%2012.1744385,5.3338623%20C12.0393279,6.69547283%2011.5259342,9.83829771%2011.2285121,11.3633248%20C11.1026617,12.008621%2010.8548582,12.2249854%2010.6149558,12.2461596%20C10.0935924,12.2921758%209.69769267,11.9156852%209.19272668,11.5981993%20C8.40255458,11.1013965%208.13911734,10.9180161%207.3721185,10.4332283%20C6.48571864,9.87297217%206.85080034,9.6784879%207.35595703,9.17524981%20C7.48815894,9.04355001%209.67825076,7.04590073%209.71077046,6.86250183%20C9.7391276,6.70257812%209.7494847,6.68189389%209.67664063,6.60973958%20C9.60379655,6.53758527%209.51674192,6.54658941%209.46083149,6.55876051%20C9.38158015,6.57601267%208.17521836,7.33962686%205.84174612,8.84960308%20C5.48344358,9.08558775%205.15890428,9.20056741%204.86812819,9.19454205%20C4.54757089,9.18789957%203.93094724,9.02070014%203.47255094,8.87778221%20C2.91030922,8.70248755%202.46345069,8.609808%202.50236203,8.31210343%20C2.52262946,8.15704047%202.74526267,7.998458%203.17026167,7.83635602%20Z'%20id='Path-3'%20fill='%23FFFFFF'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",w="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%2307C160'/%3e%3cpath%20d='M42%2033c-16.569%200-30%2011.64-30%2026%200%208.084%204.283%2015.306%2011.008%2020.073L18%2095l20.832-8.102A37.33%2037.33%200%200%200%2042%2087c16.569%200%2030-11.64%2030-26S58.569%2033%2042%2033Z'%20fill='%23fff'/%3e%3cpath%20d='M85%2048c-13.807%200-25%209.402-25%2021%200%2011.598%2011.193%2021%2025%2021%202.545%200%205-.319%207.29-.91L109%2095l-4.772-12.27C109.078%2079.05%20112%2074.232%20112%2069c0-11.598-12.193-21-27-21Z'%20fill='%23fff'%20opacity='.95'/%3e%3ccircle%20cx='33'%20cy='56'%20r='4.5'%20fill='%2307C160'/%3e%3ccircle%20cx='50'%20cy='56'%20r='4.5'%20fill='%2307C160'/%3e%3ccircle%20cx='77'%20cy='66'%20r='4'%20fill='%2307C160'/%3e%3ccircle%20cx='92'%20cy='66'%20r='4'%20fill='%2307C160'/%3e%3c/svg%3e",d="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%234A154B'/%3e%3crect%20x='50'%20y='14'%20width='28'%20height='44'%20rx='14'%20fill='%232EB67D'/%3e%3crect%20x='70'%20y='50'%20width='44'%20height='28'%20rx='14'%20fill='%23ECB22E'/%3e%3crect%20x='50'%20y='70'%20width='28'%20height='44'%20rx='14'%20fill='%23E01E5A'/%3e%3crect%20x='14'%20y='50'%20width='44'%20height='28'%20rx='14'%20fill='%2336C5F0'/%3e%3c/svg%3e",x="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%235865F2'/%3e%3cpath%20fill='%23fff'%20d='M89.4%2036.9c-5.6-2.6-11.6-4.4-17.9-5.5l-.8%201.6c5.9%201%2011.2%202.6%2016.1%205-6-3-12.7-5-19.8-6-1.5-.2-2.9-.3-4.4-.4-.5%200-1%200-1.5%200s-1%200-1.5%200c-1.5%200-2.9.2-4.4.4-7.1%201-13.8%203-19.8%206%204.9-2.4%2010.2-4%2016.1-5l-.8-1.6C44.2%2032.5%2038.2%2034.3%2032.6%2036.9%2022%2053%2019%2068.7%2020.5%2084.3c8.1%206%2016%209.6%2023.7%2012%201.5-2.1%202.9-4.3%204.1-6.6-2.4-.9-4.6-2-6.8-3.3.6-.4%201.1-.9%201.7-1.3%2013.5%206.3%2028%206.3%2041.4%200%20.6.4%201.1.9%201.7%201.3-2.1%201.3-4.4%202.4-6.8%203.3%201.2%202.3%202.6%204.5%204.1%206.6%207.7-2.4%2015.6-6%2023.7-12%201.7-18.1-2.9-33.7-12.9-47.4ZM52.3%2074.8c-4.4%200-8-4.1-8-9.1s3.5-9.1%208-9.1c4.4%200%208%204.1%208%209.1s-3.6%209.1-8%209.1Zm23.5%200c-4.4%200-8-4.1-8-9.1s3.5-9.1%208-9.1c4.4%200%208%204.1%208%209.1s-3.5%209.1-8%209.1Z'/%3e%3c/svg%3e",f="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%231989FA'/%3e%3cpath%20fill='%23fff'%20d='M64.6%2026.5c-21%200-38%2017-38%2038%200%2021%2017%2038%2038%2038%206%200%2011.7-1.4%2016.7-3.9l21.3%204.6-7.6-19c4.6-5.7%207.4-12.9%207.4-20.7%200-21-17.1-37.9-37.8-37.9Zm-1.2%2053.8%205.5-13.6c-3.8.2-7.5.4-11.3.5L70.4%2049c-3.4%200-6.5.1-9.4.3l3.9-13.5h11.7l-3.8%2013.4c2.4-.1%204.6-.3%206.7-.5l-9.8%2017.6c4.6-.1%208.8-.3%2012.5-.6L63.4%2080.3Z'/%3e%3c/svg%3e",m="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%2307C160'/%3e%3cpath%20fill='%23fff'%20d='M32%2030h36c8%200%2014%206%2014%2014v18c0%208-6%2014-14%2014H56l-14%2012%204-12h-14c-8%200-14-6-14-14V44c0-8%206-14%2014-14Z'/%3e%3cpath%20fill='%23fff'%20opacity='.55'%20d='M56%2054h32c8%200%2014%206%2014%2014v18c0%208-6%2014-14%2014H80l-14%2012%204-12h-14c-8%200-14-6-14-14V68c0-8%206-14%2014-14Z'/%3e%3ccircle%20cx='44'%20cy='52'%20r='4'%20fill='%2307C160'/%3e%3ccircle%20cx='60'%20cy='52'%20r='4'%20fill='%2307C160'/%3e%3ccircle%20cx='72'%20cy='80'%20r='3.5'%20fill='%23fff'/%3e%3ccircle%20cx='86'%20cy='80'%20r='3.5'%20fill='%23fff'/%3e%3c/svg%3e",v="/assets/playwright-BldPFZgC.ico",C="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M23.15%202.587L18.21.21a1.494%201.494%200%200%200-1.705.29l-9.46%208.63-4.12-3.128a.999.999%200%200%200-1.276.057L.327%207.261A1%201%200%200%200%20.326%208.74L3.899%2012%20.326%2015.26a1%201%200%200%200%20.001%201.479L1.65%2017.94a.999.999%200%200%200%201.276.057l4.12-3.128%209.46%208.63a1.492%201.492%200%200%200%201.704.29l4.942-2.377A1.5%201.5%200%200%200%2024%2020.06V3.939a1.5%201.5%200%200%200-.85-1.352zm-5.146%2014.861L10.826%2012l7.178-5.448v10.896z'%20fill='%23007ACC'/%3e%3c/svg%3e",L="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3crect%20width='24'%20height='24'%20rx='5.5'%20fill='%2319191C'/%3e%3cpath%20d='M7%205l10%207-4.5%201.5L15.5%2019l-2.2.8-3-5.5L7%2017z'%20fill='%23fff'/%3e%3c/svg%3e",p="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3crect%20width='24'%20height='24'%20rx='5.5'%20fill='%230BA48A'/%3e%3cpath%20d='M8%2018l2-12h2.5l-1.2%205h4.2L10%2018H8zm3.5-3.5l3-7.5'%20fill='%23fff'%20fill-rule='evenodd'/%3e%3c/svg%3e",B="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3crect%20width='24'%20height='24'%20rx='5.5'%20fill='%234A90D9'/%3e%3crect%20x='5'%20y='5'%20width='14'%20height='12'%20rx='1.5'%20fill='%236DB3F2'/%3e%3crect%20x='5'%20y='5'%20width='14'%20height='3.5'%20rx='1.5'%20fill='%233D7ABF'/%3e%3ccircle%20cx='8.5'%20cy='6.8'%20r='.8'%20fill='%23FF5F57'/%3e%3ccircle%20cx='11'%20cy='6.8'%20r='.8'%20fill='%23FEBC2E'/%3e%3ccircle%20cx='13.5'%20cy='6.8'%20r='.8'%20fill='%2328C840'/%3e%3crect%20x='7'%20y='10.5'%20width='10'%20height='1'%20rx='.5'%20fill='%23fff'%20opacity='.7'/%3e%3crect%20x='7'%20y='13'%20width='7'%20height='1'%20rx='.5'%20fill='%23fff'%20opacity='.5'/%3e%3c/svg%3e",y="/assets/hermes-BAarh-tH.png",u="/assets/openrouter-CsJ_bD5Q.ico",D="/assets/anthropic-BAdojD7P.ico",E="/assets/deepseek-BeYNZEk0.ico",F="/assets/qwen-xykkX0_y.png",b="/assets/doubao-DloFDuFR.png",z="data:image/png;base64,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",J="/assets/minimax-PuEGTfrF.ico",k="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='currentColor'%20aria-label='OpenAI'%3e%3cpath%20d='M22.282%209.821a5.985%205.985%200%200%200-.516-4.91%206.046%206.046%200%200%200-6.51-2.9A6.065%206.065%200%200%200%204.981%204.18a5.985%205.985%200%200%200-3.998%202.9%206.046%206.046%200%200%200%20.743%207.097%205.98%205.98%200%200%200%20.51%204.911%206.051%206.051%200%200%200%206.515%202.9A5.985%205.985%200%200%200%2013.26%2024a6.056%206.056%200%200%200%205.772-4.206%205.99%205.99%200%200%200%203.997-2.9%206.056%206.056%200%200%200-.747-7.073zM13.26%2022.43a4.476%204.476%200%200%201-2.876-1.04l.141-.081%204.779-2.758a.795.795%200%200%200%20.392-.681v-6.737l2.02%201.168a.071.071%200%200%201%20.038.052v5.583a4.504%204.504%200%200%201-4.494%204.494zM3.6%2018.304a4.47%204.47%200%200%201-.535-3.014l.142.085%204.783%202.759a.771.771%200%200%200%20.78%200l5.843-3.369v2.332a.08.08%200%200%201-.033.062L9.74%2019.95a4.5%204.5%200%200%201-6.14-1.646zM2.34%207.896a4.485%204.485%200%200%201%202.366-1.973V11.6a.766.766%200%200%200%20.388.677l5.815%203.355-2.02%201.168a.076.076%200%200%201-.071%200l-4.83-2.786A4.504%204.504%200%200%201%202.34%207.872zm16.597%203.855l-5.833-3.387L15.119%207.2a.076.076%200%200%201%20.071%200l4.83%202.791a4.494%204.494%200%200%201-.676%208.105v-5.678a.79.79%200%200%200-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776%200%200%200-.785%200L9.409%209.23V6.897a.066.066%200%200%201%20.028-.061l4.83-2.787a4.5%204.5%200%200%201%206.68%204.66zm-12.64%204.135l-2.02-1.164a.08.08%200%200%201-.038-.057V6.075a4.5%204.5%200%200%201%207.375-3.453l-.142.08L8.704%205.46a.795.795%200%200%200-.393.681zm1.097-2.365l2.602-1.5%202.607%201.5v3l-2.597%201.5-2.607-1.5z'/%3e%3c/svg%3e",I="/assets/ollama-Bt9O-2K_.png",P="/assets/lmstudio-syaFPWNA.png",Q={claude:a,codex:h,gemini:r,telegram:A,feishu:n,weixin:w,slack:d,discord:x,dingtalk:f,wecom:m,playwright:v,vscode:C,cursor:L,windsurf:p,finder:B,hermes:y,openrouter:u,anthropic:D,deepseek:E,google:r,qwen:F,doubao:b,glm:z,minimax:J,openai:k,ollama:I,lmstudio:P},N={custom:{letter:"+",color:"#94a3b8",bg:"rgba(148,163,184,0.12)"}};function Z({brand:t,size:e=18,className:l}){const i=Q[t];if(i)return s.jsx("img",{src:i,alt:"","aria-hidden":"true",draggable:!1,className:g("shrink-0 object-contain select-none",l),style:{width:e,height:e}});const c=N[t];if(!c)return null;const o=c.letter.length>1;return s.jsx("span",{"aria-hidden":"true",className:g("inline-flex shrink-0 items-center justify-center rounded-md font-semibold tracking-tight select-none",l),style:{width:e,height:e,background:c.bg,color:c.color,fontSize:Math.round(e*(o?.42:.55)),lineHeight:1,letterSpacing:o?"-0.02em":"normal"},children:c.letter})}export{Z as B};
|
|
1
|
+
import{j as s}from"./react-vendor-DTcmqLiz.js";import{c as g}from"./index-DEXOVIim.js";const a="data:image/png;base64,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",h="/assets/codex-DYadqqp0.png",n="/assets/feishu-C4OMrjCW.ico",r="/assets/gemini-BYkEpiWr.svg",A="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdefs%3e%3clinearGradient%20x1='50%25'%20y1='0%25'%20x2='50%25'%20y2='100%25'%20id='linearGradient-1'%3e%3cstop%20stop-color='%2338AEEB'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23279AD1'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20id='Artboard'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3ccircle%20id='Oval'%20fill='url(%23linearGradient-1)'%20cx='8'%20cy='8'%20r='8'%3e%3c/circle%3e%3cpath%20d='M3.17026167,7.83635602%20C5.78750201,6.74265999%207.53273882,6.02162863%208.40597211,5.67326193%20C10.8992306,4.67860423%2011.2454541,4.53439191%2011.5831299,4.52864956%20C11.6573986,4.52743168%2011.8385417,4.55776042%2011.9798438,4.67645833%20C12.1211458,4.79515625%2012.1635786,4.87206678%2012.1755371,4.93908691%20C12.1874957,5.00610705%2012.1862759,5.21456762%2012.1744385,5.3338623%20C12.0393279,6.69547283%2011.5259342,9.83829771%2011.2285121,11.3633248%20C11.1026617,12.008621%2010.8548582,12.2249854%2010.6149558,12.2461596%20C10.0935924,12.2921758%209.69769267,11.9156852%209.19272668,11.5981993%20C8.40255458,11.1013965%208.13911734,10.9180161%207.3721185,10.4332283%20C6.48571864,9.87297217%206.85080034,9.6784879%207.35595703,9.17524981%20C7.48815894,9.04355001%209.67825076,7.04590073%209.71077046,6.86250183%20C9.7391276,6.70257812%209.7494847,6.68189389%209.67664063,6.60973958%20C9.60379655,6.53758527%209.51674192,6.54658941%209.46083149,6.55876051%20C9.38158015,6.57601267%208.17521836,7.33962686%205.84174612,8.84960308%20C5.48344358,9.08558775%205.15890428,9.20056741%204.86812819,9.19454205%20C4.54757089,9.18789957%203.93094724,9.02070014%203.47255094,8.87778221%20C2.91030922,8.70248755%202.46345069,8.609808%202.50236203,8.31210343%20C2.52262946,8.15704047%202.74526267,7.998458%203.17026167,7.83635602%20Z'%20id='Path-3'%20fill='%23FFFFFF'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",w="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%2307C160'/%3e%3cpath%20d='M42%2033c-16.569%200-30%2011.64-30%2026%200%208.084%204.283%2015.306%2011.008%2020.073L18%2095l20.832-8.102A37.33%2037.33%200%200%200%2042%2087c16.569%200%2030-11.64%2030-26S58.569%2033%2042%2033Z'%20fill='%23fff'/%3e%3cpath%20d='M85%2048c-13.807%200-25%209.402-25%2021%200%2011.598%2011.193%2021%2025%2021%202.545%200%205-.319%207.29-.91L109%2095l-4.772-12.27C109.078%2079.05%20112%2074.232%20112%2069c0-11.598-12.193-21-27-21Z'%20fill='%23fff'%20opacity='.95'/%3e%3ccircle%20cx='33'%20cy='56'%20r='4.5'%20fill='%2307C160'/%3e%3ccircle%20cx='50'%20cy='56'%20r='4.5'%20fill='%2307C160'/%3e%3ccircle%20cx='77'%20cy='66'%20r='4'%20fill='%2307C160'/%3e%3ccircle%20cx='92'%20cy='66'%20r='4'%20fill='%2307C160'/%3e%3c/svg%3e",x="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%234A154B'/%3e%3crect%20x='50'%20y='14'%20width='28'%20height='44'%20rx='14'%20fill='%232EB67D'/%3e%3crect%20x='70'%20y='50'%20width='44'%20height='28'%20rx='14'%20fill='%23ECB22E'/%3e%3crect%20x='50'%20y='70'%20width='28'%20height='44'%20rx='14'%20fill='%23E01E5A'/%3e%3crect%20x='14'%20y='50'%20width='44'%20height='28'%20rx='14'%20fill='%2336C5F0'/%3e%3c/svg%3e",d="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%235865F2'/%3e%3cpath%20fill='%23fff'%20d='M89.4%2036.9c-5.6-2.6-11.6-4.4-17.9-5.5l-.8%201.6c5.9%201%2011.2%202.6%2016.1%205-6-3-12.7-5-19.8-6-1.5-.2-2.9-.3-4.4-.4-.5%200-1%200-1.5%200s-1%200-1.5%200c-1.5%200-2.9.2-4.4.4-7.1%201-13.8%203-19.8%206%204.9-2.4%2010.2-4%2016.1-5l-.8-1.6C44.2%2032.5%2038.2%2034.3%2032.6%2036.9%2022%2053%2019%2068.7%2020.5%2084.3c8.1%206%2016%209.6%2023.7%2012%201.5-2.1%202.9-4.3%204.1-6.6-2.4-.9-4.6-2-6.8-3.3.6-.4%201.1-.9%201.7-1.3%2013.5%206.3%2028%206.3%2041.4%200%20.6.4%201.1.9%201.7%201.3-2.1%201.3-4.4%202.4-6.8%203.3%201.2%202.3%202.6%204.5%204.1%206.6%207.7-2.4%2015.6-6%2023.7-12%201.7-18.1-2.9-33.7-12.9-47.4ZM52.3%2074.8c-4.4%200-8-4.1-8-9.1s3.5-9.1%208-9.1c4.4%200%208%204.1%208%209.1s-3.6%209.1-8%209.1Zm23.5%200c-4.4%200-8-4.1-8-9.1s3.5-9.1%208-9.1c4.4%200%208%204.1%208%209.1s-3.5%209.1-8%209.1Z'/%3e%3c/svg%3e",f="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%231989FA'/%3e%3cpath%20fill='%23fff'%20d='M64.6%2026.5c-21%200-38%2017-38%2038%200%2021%2017%2038%2038%2038%206%200%2011.7-1.4%2016.7-3.9l21.3%204.6-7.6-19c4.6-5.7%207.4-12.9%207.4-20.7%200-21-17.1-37.9-37.8-37.9Zm-1.2%2053.8%205.5-13.6c-3.8.2-7.5.4-11.3.5L70.4%2049c-3.4%200-6.5.1-9.4.3l3.9-13.5h11.7l-3.8%2013.4c2.4-.1%204.6-.3%206.7-.5l-9.8%2017.6c4.6-.1%208.8-.3%2012.5-.6L63.4%2080.3Z'/%3e%3c/svg%3e",m="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='128'%20height='128'%20rx='28'%20fill='%2307C160'/%3e%3cpath%20fill='%23fff'%20d='M32%2030h36c8%200%2014%206%2014%2014v18c0%208-6%2014-14%2014H56l-14%2012%204-12h-14c-8%200-14-6-14-14V44c0-8%206-14%2014-14Z'/%3e%3cpath%20fill='%23fff'%20opacity='.55'%20d='M56%2054h32c8%200%2014%206%2014%2014v18c0%208-6%2014-14%2014H80l-14%2012%204-12h-14c-8%200-14-6-14-14V68c0-8%206-14%2014-14Z'/%3e%3ccircle%20cx='44'%20cy='52'%20r='4'%20fill='%2307C160'/%3e%3ccircle%20cx='60'%20cy='52'%20r='4'%20fill='%2307C160'/%3e%3ccircle%20cx='72'%20cy='80'%20r='3.5'%20fill='%23fff'/%3e%3ccircle%20cx='86'%20cy='80'%20r='3.5'%20fill='%23fff'/%3e%3c/svg%3e",v="/assets/playwright-BldPFZgC.ico",C="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M23.15%202.587L18.21.21a1.494%201.494%200%200%200-1.705.29l-9.46%208.63-4.12-3.128a.999.999%200%200%200-1.276.057L.327%207.261A1%201%200%200%200%20.326%208.74L3.899%2012%20.326%2015.26a1%201%200%200%200%20.001%201.479L1.65%2017.94a.999.999%200%200%200%201.276.057l4.12-3.128%209.46%208.63a1.492%201.492%200%200%200%201.704.29l4.942-2.377A1.5%201.5%200%200%200%2024%2020.06V3.939a1.5%201.5%200%200%200-.85-1.352zm-5.146%2014.861L10.826%2012l7.178-5.448v10.896z'%20fill='%23007ACC'/%3e%3c/svg%3e",L="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3crect%20width='24'%20height='24'%20rx='5.5'%20fill='%2319191C'/%3e%3cpath%20d='M7%205l10%207-4.5%201.5L15.5%2019l-2.2.8-3-5.5L7%2017z'%20fill='%23fff'/%3e%3c/svg%3e",p="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3crect%20width='24'%20height='24'%20rx='5.5'%20fill='%230BA48A'/%3e%3cpath%20d='M8%2018l2-12h2.5l-1.2%205h4.2L10%2018H8zm3.5-3.5l3-7.5'%20fill='%23fff'%20fill-rule='evenodd'/%3e%3c/svg%3e",B="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3crect%20width='24'%20height='24'%20rx='5.5'%20fill='%234A90D9'/%3e%3crect%20x='5'%20y='5'%20width='14'%20height='12'%20rx='1.5'%20fill='%236DB3F2'/%3e%3crect%20x='5'%20y='5'%20width='14'%20height='3.5'%20rx='1.5'%20fill='%233D7ABF'/%3e%3ccircle%20cx='8.5'%20cy='6.8'%20r='.8'%20fill='%23FF5F57'/%3e%3ccircle%20cx='11'%20cy='6.8'%20r='.8'%20fill='%23FEBC2E'/%3e%3ccircle%20cx='13.5'%20cy='6.8'%20r='.8'%20fill='%2328C840'/%3e%3crect%20x='7'%20y='10.5'%20width='10'%20height='1'%20rx='.5'%20fill='%23fff'%20opacity='.7'/%3e%3crect%20x='7'%20y='13'%20width='7'%20height='1'%20rx='.5'%20fill='%23fff'%20opacity='.5'/%3e%3c/svg%3e",y="/assets/hermes-BAarh-tH.png",u="/assets/openrouter-CsJ_bD5Q.ico",D="/assets/anthropic-BAdojD7P.ico",E="/assets/deepseek-BeYNZEk0.ico",F="/assets/qwen-xykkX0_y.png",b="/assets/doubao-DloFDuFR.png",z="data:image/png;base64,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",J="/assets/minimax-PuEGTfrF.ico",k="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='currentColor'%20aria-label='OpenAI'%3e%3cpath%20d='M22.282%209.821a5.985%205.985%200%200%200-.516-4.91%206.046%206.046%200%200%200-6.51-2.9A6.065%206.065%200%200%200%204.981%204.18a5.985%205.985%200%200%200-3.998%202.9%206.046%206.046%200%200%200%20.743%207.097%205.98%205.98%200%200%200%20.51%204.911%206.051%206.051%200%200%200%206.515%202.9A5.985%205.985%200%200%200%2013.26%2024a6.056%206.056%200%200%200%205.772-4.206%205.99%205.99%200%200%200%203.997-2.9%206.056%206.056%200%200%200-.747-7.073zM13.26%2022.43a4.476%204.476%200%200%201-2.876-1.04l.141-.081%204.779-2.758a.795.795%200%200%200%20.392-.681v-6.737l2.02%201.168a.071.071%200%200%201%20.038.052v5.583a4.504%204.504%200%200%201-4.494%204.494zM3.6%2018.304a4.47%204.47%200%200%201-.535-3.014l.142.085%204.783%202.759a.771.771%200%200%200%20.78%200l5.843-3.369v2.332a.08.08%200%200%201-.033.062L9.74%2019.95a4.5%204.5%200%200%201-6.14-1.646zM2.34%207.896a4.485%204.485%200%200%201%202.366-1.973V11.6a.766.766%200%200%200%20.388.677l5.815%203.355-2.02%201.168a.076.076%200%200%201-.071%200l-4.83-2.786A4.504%204.504%200%200%201%202.34%207.872zm16.597%203.855l-5.833-3.387L15.119%207.2a.076.076%200%200%201%20.071%200l4.83%202.791a4.494%204.494%200%200%201-.676%208.105v-5.678a.79.79%200%200%200-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776%200%200%200-.785%200L9.409%209.23V6.897a.066.066%200%200%201%20.028-.061l4.83-2.787a4.5%204.5%200%200%201%206.68%204.66zm-12.64%204.135l-2.02-1.164a.08.08%200%200%201-.038-.057V6.075a4.5%204.5%200%200%201%207.375-3.453l-.142.08L8.704%205.46a.795.795%200%200%200-.393.681zm1.097-2.365l2.602-1.5%202.607%201.5v3l-2.597%201.5-2.607-1.5z'/%3e%3c/svg%3e",I="/assets/ollama-Bt9O-2K_.png",Q="/assets/mlx-DhWwjtMw.png",P={claude:a,codex:h,gemini:r,telegram:A,feishu:n,weixin:w,slack:x,discord:d,dingtalk:f,wecom:m,playwright:v,vscode:C,cursor:L,windsurf:p,finder:B,hermes:y,openrouter:u,anthropic:D,deepseek:E,google:r,qwen:F,doubao:b,glm:z,minimax:J,openai:k,ollama:I,mlx:Q},R={custom:{letter:"+",color:"#94a3b8",bg:"rgba(148,163,184,0.12)"}};function Z({brand:t,size:e=18,className:l}){const i=P[t];if(i)return s.jsx("img",{src:i,alt:"","aria-hidden":"true",draggable:!1,className:g("shrink-0 object-contain select-none",l),style:{width:e,height:e}});const c=R[t];if(!c)return null;const o=c.letter.length>1;return s.jsx("span",{"aria-hidden":"true",className:g("inline-flex shrink-0 items-center justify-center rounded-md font-semibold tracking-tight select-none",l),style:{width:e,height:e,background:c.bg,color:c.color,fontSize:Math.round(e*(o?.42:.55)),lineHeight:1,letterSpacing:o?"-0.02em":"normal"},children:c.letter})}export{Z as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as e}from"./react-vendor-DTcmqLiz.js";import{a as I,k as P,S as z}from"./index-
|
|
1
|
+
import{r,j as e}from"./react-vendor-DTcmqLiz.js";import{a as I,k as P,S as z}from"./index-DEXOVIim.js";function W({initialPath:x,maxHeight:j=420,minHeight:N=200,onSelect:p,compact:l,t:o}){const[y,k]=r.useState(""),[h,m]=r.useState(""),[g,w]=r.useState([]),[i,S]=r.useState(""),[C,$]=r.useState(!1),[D,B]=r.useState([]),[E,c]=r.useState(!1),[u,d]=r.useState(""),a=r.useCallback(async t=>{c(!0),d("");try{const s=await I.lsDir(t);if(!s.ok){d(s.error||o("modal.cannotRead")),c(!1);return}k(s.path),m(s.path),w(s.dirs),S(s.parent),$(s.isGit);const G=s.path.split("/").filter(Boolean);let v="";B(G.map(b=>(v+="/"+b,{label:b,path:v}))),p?.(s.path,s.isGit)}catch{d(o("modal.loadFailed"))}finally{c(!1)}},[o,p]);r.useEffect(()=>{x!==void 0&&a(x||void 0)},[]);const n=l?"text-[11px]":"text-xs",f=l?"py-[5px]":"py-[7px]";return e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-1 ${l?"text-[10px]":"text-[11px]"} font-mono text-fg-4 mb-2 flex-wrap`,children:[e.jsx("span",{className:"cursor-pointer hover:text-fg-2 transition-colors",onClick:()=>a("/"),children:"~"}),D.map((t,s)=>e.jsxs("span",{children:[e.jsx("span",{className:"text-fg-6",children:"/"}),e.jsx("span",{className:"cursor-pointer hover:text-fg-2 transition-colors",onClick:()=>a(t.path),children:t.label})]},s)),C&&e.jsx(P,{variant:"accent",className:"ml-1 !text-[9px] !py-0 !px-1.5",children:"git"})]}),e.jsxs("div",{className:"relative",children:[!l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 h-5 rounded-t-lg",style:{background:"linear-gradient(to bottom, var(--th-panel-alt), rgba(0, 0, 0, 0))"}}),e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-10 h-5 rounded-b-lg",style:{background:"linear-gradient(to top, var(--th-panel-alt), rgba(0, 0, 0, 0))"}})]}),e.jsx("div",{className:"border border-edge rounded-lg overflow-y-auto overscroll-contain scroll-smooth bg-panel-alt",style:{maxHeight:j,minHeight:N,scrollbarGutter:"stable"},children:E?e.jsx("div",{className:`${n} text-fg-5 p-4 text-center flex items-center justify-center gap-2`,children:e.jsx(z,{className:"h-3 w-3 text-fg-5"})}):u?e.jsx("div",{className:`${n} text-red-500/70 p-4`,children:u}):e.jsxs(e.Fragment,{children:[i&&i!==y&&e.jsxs("div",{className:`flex items-center gap-2 px-3 ${f} cursor-pointer hover:bg-panel transition-colors border-b border-edge`,onClick:()=>a(i),children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",className:"text-fg-5 shrink-0",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}),e.jsx("span",{className:`${n} text-fg-4`,children:".."})]}),g.length===0&&!i&&e.jsx("div",{className:`${n} text-fg-5 p-4 text-center`,children:o("modal.emptyDir")}),g.map(t=>e.jsxs("div",{className:`flex items-center gap-2 px-3 ${f} cursor-pointer hover:bg-panel transition-colors`,onClick:()=>a(t.path),children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t.name===".git"?"var(--th-primary)":"currentColor",strokeWidth:"1.8",className:"text-fg-5 shrink-0",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),e.jsx("span",{className:`${n} text-fg-3`,children:t.name})]},t.path))]})})]}),e.jsx("div",{className:"mt-2",children:e.jsx("input",{className:`w-full rounded-lg border border-edge bg-inset px-2.5 py-1.5 ${n} font-mono text-fg outline-none placeholder:text-fg-5 focus:border-edge-h transition-colors`,placeholder:o("modal.manualInput"),value:h,onChange:t=>m(t.target.value),onKeyDown:t=>{t.key==="Enter"&&a(h)}})})]})}export{W as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as e}from"./react-vendor-DTcmqLiz.js";import{u as G,T as ge,m as ve,c as T,a as _,o as Q,S as O,B as z}from"./index-DEXOVIim.js";import{B as je}from"./BrandIcon-DSj09eUd.js";import{M as q,a as K,I as P}from"./Modal-CoNLEvWc.js";import"./router-Cav8lq-m.js";function a(s,t,n){return s==="zh-CN"?t:n}function le(s,t){return t.type==="mcp-oauth"?a(s,"OAuth","OAuth"):t.type==="credentials"?a(s,"API Key","API Key"):a(s,"无需配置","No auth")}const be={github:{hex:"#24292f",letter:"GH"},atlassian:{hex:"#0052cc",letter:"A"},notion:{hex:"#111827",letter:"N"},linear:{hex:"#5e6ad2",letter:"L"},sentry:{hex:"#362d59",letter:"S"},cloudflare:{hex:"#f6821f",letter:"CF"},gamma:{hex:"#9f2eff",letter:"G"},huggingface:{hex:"#ff9d00",letter:"HF"},slack:{hex:"#4a154b",letter:"S"},lark:{hex:"#00d6b9",letter:"L"},feishu:{hex:"#00d6b9",letter:"F"},stripe:{hex:"#635bff",letter:"S"},perplexity:{hex:"#20b8cd",letter:"P"},brave:{hex:"#fb542b",letter:"B"},filesystem:{hex:"#64748b",letter:"FS"},fetch:{hex:"#0ea5e9",letter:"F"},memory:{hex:"#a855f7",letter:"M"},time:{hex:"#10b981",letter:"T"},sqlite:{hex:"#0369a1",letter:"SQ"},postgres:{hex:"#336791",letter:"PG"}},ye={hex:"#6b7280"};function W(s,t){const n=(s||"").toLowerCase(),i=be[n]||ye,l=i.letter||(t||"").replace(/[^a-zA-Z0-9]/g,"").slice(0,2).toUpperCase()||"?";return{hex:i.hex,letter:l}}function E(s,t){const n=s.replace("#",""),i=n.length===3?n.split("").map(u=>u+u).join(""):n.padEnd(6,"0").slice(0,6),l=parseInt(i.slice(0,2),16),c=parseInt(i.slice(2,4),16),x=parseInt(i.slice(4,6),16);return`rgba(${l}, ${c}, ${x}, ${t})`}function X(s,t,n=[]){const[i,l]=o.useState(()=>{try{const p=localStorage.getItem(s);return p?JSON.parse(p):null}catch{return null}}),[c,x]=o.useState(!1),u=o.useRef(!0);o.useEffect(()=>()=>{u.current=!1},[]);const h=o.useCallback(async()=>{x(!0);try{const p=await t();if(!u.current)return;l(p);try{localStorage.setItem(s,JSON.stringify(p))}catch{}}finally{u.current&&x(!1)}},[s,...n]);return o.useEffect(()=>{h()},[h]),{data:i,loading:c,refresh:h}}const U=()=>e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),Z=({size:s=12})=>e.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),Ne=({size:s=12})=>e.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),e.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}),ie=({size:s=12})=>e.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),ke=({size:s=12})=>e.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),oe=new Set(["claude","codex","gemini","telegram","feishu","weixin","playwright","vscode","cursor","windsurf","finder"]),we={github:"logos:github-icon",atlassian:"logos:atlassian",notion:"logos:notion-icon",linear:"logos:linear-icon",sentry:"logos:sentry-icon",cloudflare:"logos:cloudflare-icon","cloudflare-docs":"logos:cloudflare-icon","cloudflare-bindings":"logos:cloudflare-icon","cloudflare-observability":"logos:cloudflare-icon",slack:"logos:slack-icon",lark:"icon-park:lark",feishu:"icon-park:lark",stripe:"logos:stripe",perplexity:"logos:perplexity-icon",brave:"logos:brave","brave-search":"logos:brave",huggingface:"logos:hugging-face-icon",postgres:"logos:postgresql",postgresql:"logos:postgresql",sqlite:"logos:sqlite",vercel:"logos:vercel-icon",netlify:"logos:netlify-icon",supabase:"logos:supabase-icon",heroku:"logos:heroku-icon",docker:"logos:docker-icon",pnpm:"logos:pnpm",aws:"logos:aws","google-cloud":"logos:google-cloud",googlecloud:"logos:google-cloud",amazonwebservices:"logos:aws"},Ce=new Set(["stripe"]);function Se(s,t){if(t)return t;if(!s||oe.has(s))return;const n=we[s];if(n)return`https://api.iconify.design/${n}.svg`}function D({iconSlug:s,iconUrl:t,name:n,size:i=32,className:l}){const{hex:c,letter:x}=W(s,n),[u,h]=o.useState(!1),p=Se(s,t),j=s&&oe.has(s),d=j||!!p&&!u,f=!!s&&Ce.has(s),m=Math.round(i*(f?.92:.76));return d?e.jsxs("div",{className:T("relative flex shrink-0 items-center justify-center overflow-hidden rounded-xl bg-white",l),style:{width:i,height:i,boxShadow:`0 0 0 1px ${E(c,.18)}, 0 4px 12px ${E(c,.14)}`},children:[e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{background:`linear-gradient(135deg, ${E(c,.06)} 0%, transparent 70%)`}}),j?e.jsx(je,{brand:s,size:m}):e.jsx("img",{src:p,alt:"",width:m,height:m,loading:"lazy",decoding:"async",onError:()=>h(!0),className:"relative"})]}):e.jsxs("div",{className:T("relative flex shrink-0 items-center justify-center overflow-hidden rounded-xl font-semibold text-white",l),style:{width:i,height:i,background:`linear-gradient(135deg, ${E(c,1)} 0%, ${E(c,.82)} 100%)`,boxShadow:`0 1px 0 rgba(255,255,255,0.08) inset, 0 6px 14px ${E(c,.28)}`,fontSize:Math.max(10,Math.round(i*.36)),letterSpacing:x.length>1?"-0.02em":0},children:[e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(circle at 30% 20%, rgba(255,255,255,0.22), transparent 55%)"}}),e.jsx("span",{className:"relative",children:x})]})}function Ie({state:s,locale:t}){return s==="ready"?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold text-[var(--th-ok)]",style:{background:"color-mix(in oklab, var(--th-ok) 12%, transparent)"},children:[e.jsx(Z,{size:10}),a(t,"已连接","Connected")]}):s==="disabled"?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-edge bg-inset/60 px-2 py-0.5 text-[10px] font-medium text-fg-5",children:[e.jsx(Ne,{size:10}),a(t,"已停用","Paused")]}):s==="needs_auth"?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold text-[var(--th-warn)]",style:{background:"color-mix(in oklab, var(--th-warn) 12%, transparent)"},children:[e.jsx(ie,{size:10}),a(t,"待授权","Needs auth")]}):s==="unhealthy"?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold text-[var(--th-err)]",style:{background:"color-mix(in oklab, var(--th-err) 12%, transparent)"},children:[e.jsx(ke,{size:10}),a(t,"异常","Unhealthy")]}):null}function ze({open:s,onClose:t,locale:n,item:i,initial:l,onSubmit:c}){const[x,u]=o.useState({}),[h,p]=o.useState(!1);if(o.useEffect(()=>{if(s&&i&&i.auth.type==="credentials"){const d={};for(const f of i.auth.fields)d[f.key]=l?.[f.key]||"";u(d)}},[s,i,l]),!i||i.auth.type!=="credentials")return null;const j=i.auth.fields.some(d=>d.required&&!(x[d.key]||"").trim()),b=async()=>{p(!0);try{await c(x)}finally{p(!1)}};return e.jsxs(q,{open:s,onClose:t,children:[e.jsx(K,{title:a(n,`配置 ${i.name}`,`Configure ${i.name}`),description:n==="zh-CN"?i.descriptionZh:i.description,onClose:t}),e.jsxs("div",{className:"space-y-3",children:[i.auth.fields.map(d=>e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:[n==="zh-CN"?d.labelZh:d.label,d.required&&e.jsx("span",{className:"ml-1 text-err",children:"*"})]}),d.helpUrl&&e.jsxs("a",{href:d.helpUrl,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 text-[11px] text-primary hover:text-primary/80",children:[a(n,"获取","Get one")," ",e.jsx(U,{})]})]}),e.jsx(P,{value:x[d.key]||"",onChange:f=>u({...x,[d.key]:f.target.value}),type:d.secret?"password":"text",placeholder:d.placeholder,className:"font-mono text-[12px]"})]},d.key)),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-edge pt-3",children:[e.jsx(z,{variant:"ghost",onClick:t,children:a(n,"取消","Cancel")}),e.jsx(z,{variant:"primary",disabled:h||j,onClick:b,children:h?e.jsx(O,{}):a(n,"保存并启用","Save & Enable")})]})]})]})}function Me({open:s,onClose:t,locale:n,scope:i,workdir:l,onAdded:c}){const x=G(g=>g.toast),[u,h]=o.useState(""),[p,j]=o.useState("stdio"),[b,d]=o.useState("npx"),[f,m]=o.useState(""),[S,$]=o.useState(""),[A,I]=o.useState([]),[M,y]=o.useState(!1);o.useEffect(()=>{s&&(h(""),j("stdio"),d("npx"),m(""),$(""),I([]))},[s]);const C=async()=>{if(u.trim()){y(!0);try{const g={};for(const{k:w,v:L}of A)w.trim()&&(g[w.trim()]=L);const N=p==="http"?{type:"http",url:S.trim(),enabled:!0,...Object.keys(g).length?{headers:g}:{}}:{type:"stdio",command:b.trim(),args:f.trim()?f.trim().split(/\s+/):[],enabled:!0,...Object.keys(g).length?{env:g}:{}};await _.addCustomMcp(u.trim(),N,i,l),x(a(n,`${u} 已添加`,`${u} added`),!0),c(),t()}catch(g){x(g?.message||"Failed",!1)}finally{y(!1)}}};return e.jsxs(q,{open:s,onClose:t,wide:!0,children:[e.jsx(K,{title:a(n,"添加自定义 MCP 服务","Add Custom MCP Server"),description:a(n,"不在推荐列表中的自定义服务。","For servers not in the recommended catalog."),onClose:t}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:a(n,"名称","Name")}),e.jsx(P,{value:u,onChange:g=>h(g.target.value),placeholder:"my-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:a(n,"传输","Transport")}),e.jsx("div",{className:"flex gap-1.5",children:["stdio","http"].map(g=>e.jsx("button",{onClick:()=>j(g),className:T("flex-1 rounded-md border px-3 py-1.5 text-[12px] font-medium transition-colors",p===g?"border-primary/40 bg-primary/10 text-primary":"border-edge bg-inset/50 text-fg-4 hover:bg-inset"),children:g},g))})]})]}),p==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:a(n,"命令","Command")}),e.jsx(P,{value:b,onChange:g=>d(g.target.value),className:"font-mono",placeholder:"npx"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:a(n,"参数","Arguments")}),e.jsx(P,{value:f,onChange:g=>m(g.target.value),className:"font-mono",placeholder:"-y @example/server"})]})]}):e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:"URL"}),e.jsx(P,{value:S,onChange:g=>$(g.target.value),className:"font-mono",placeholder:"https://example.com/mcp"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:p==="http"?a(n,"Headers","Headers"):a(n,"环境变量","Env")}),e.jsxs("button",{className:"text-[11px] font-medium text-primary hover:text-primary/80",onClick:()=>I([...A,{k:"",v:""}]),children:["+ ",a(n,"添加","Add")]})]}),A.length>0&&e.jsx("div",{className:"space-y-1 rounded-md border border-edge bg-inset/40 p-2",children:A.map((g,N)=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(P,{className:"w-2/5 !h-7 !text-[12px] font-mono",value:g.k,onChange:w=>{const L=[...A];L[N]={...L[N],k:w.target.value},I(L)},placeholder:"KEY"}),e.jsx(P,{className:"flex-1 !h-7 !text-[12px] font-mono",value:g.v,onChange:w=>{const L=[...A];L[N]={...L[N],v:w.target.value},I(L)},type:/token|secret|key|bearer/i.test(g.k)?"password":"text",placeholder:"value"}),e.jsx("button",{className:"shrink-0 rounded p-1 text-fg-5 hover:text-err",onClick:()=>I(A.filter((w,L)=>L!==N)),children:e.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},N))})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-edge pt-3",children:[e.jsx(z,{variant:"ghost",onClick:t,children:a(n,"取消","Cancel")}),e.jsx(z,{variant:"primary",disabled:!u.trim()||M,onClick:C,children:M?e.jsx(O,{}):a(n,"添加","Add")})]})]})]})}function Le({open:s,onClose:t,locale:n,scope:i,workdir:l,onInstalled:c}){const x=G(m=>m.toast),[u,h]=o.useState(""),[p,j]=o.useState(""),[b,d]=o.useState(!1);o.useEffect(()=>{s&&(h(""),j(""))},[s]);const f=async()=>{if(u.trim()){d(!0);try{const m=await _.installSkill(u.trim(),i==="global",p.trim()||void 0,l);m.ok?(x(a(n,"技能安装成功","Skill installed"),!0),c(),t()):x(m.error||"Failed",!1)}catch(m){x(m?.message||"Failed",!1)}finally{d(!1)}}};return e.jsxs(q,{open:s,onClose:t,children:[e.jsx(K,{title:a(n,"安装自定义技能","Install Custom Skill"),description:a(n,"通过 npx skills add 从 GitHub 仓库安装。","Installs via npx skills add from a GitHub repo."),onClose:t}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:a(n,"GitHub 来源","GitHub Source")}),e.jsx(P,{value:u,onChange:m=>h(m.target.value),placeholder:"owner/repo",className:"font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:a(n,"指定技能(可选)","Specific skill (optional)")}),e.jsx(P,{value:p,onChange:m=>j(m.target.value),placeholder:a(n,"留空安装全部","Leave empty for all")})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-edge pt-3",children:[e.jsx(z,{variant:"ghost",onClick:t,children:a(n,"取消","Cancel")}),e.jsx(z,{variant:"primary",disabled:!u.trim()||b,onClick:f,children:b?e.jsx(O,{}):a(n,"安装","Install")})]})]})]})}function _e(s,t){return new Promise(n=>{const i=window.open(s,"pikiclaw_mcp_oauth","width=640,height=780,noopener=no");if(!i){n(!1);return}let l=!1;const c=h=>{l||(l=!0,window.removeEventListener("message",x),clearInterval(u),n(h))},x=h=>{const p=h.data;if(!(!p||p.type!=="mcp-oauth")&&!(t&&p.state!==t)){c(!!p.ok);try{i.close()}catch{}}};window.addEventListener("message",x);const u=setInterval(()=>{i.closed&&c(!1)},500)})}function ae({item:s,locale:t,busy:n,index:i,onPrimary:l,onRemove:c,onReauth:x,onReconfigure:u}){const{hex:h}=W(s.iconSlug,s.name),p=(()=>{switch(s.state){case"ready":return a(t,"停用","Pause");case"unhealthy":return a(t,"停用","Pause");case"disabled":return a(t,"启用","Enable");case"needs_auth":return s.auth.type==="mcp-oauth"?a(t,"授权","Authorize"):a(t,"配置","Configure");default:return a(t,"启用","Enable")}})(),j={background:`linear-gradient(140deg, ${E(h,.05)} 0%, ${E(h,.01)} 60%, transparent 100%)`,borderColor:E(h,.18),animationDelay:`${Math.min(i,8)*40}ms`};return e.jsxs("div",{className:T("group relative overflow-hidden rounded-xl border p-4","transition-[transform,box-shadow,border-color] duration-200","hover:-translate-y-0.5 hover:shadow-[0_12px_28px_rgba(15,23,42,0.09)]","animate-in-up"),style:j,children:[e.jsx("div",{className:"pointer-events-none absolute -right-12 -top-12 h-32 w-32 rounded-full opacity-40 blur-2xl transition-opacity duration-300 group-hover:opacity-60",style:{background:E(h,.35)}}),e.jsxs("div",{className:"relative flex items-start gap-3",children:[e.jsx(D,{iconSlug:s.iconSlug,iconUrl:s.iconUrl,name:s.name,size:36}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"truncate text-[14px] font-semibold text-fg",children:s.name}),s.homepage&&e.jsx("a",{href:s.homepage,target:"_blank",rel:"noreferrer",className:"text-fg-5 hover:text-fg-3 transition-colors",children:e.jsx(U,{})})]}),e.jsx("div",{className:"mt-0.5 line-clamp-2 text-[12px] leading-snug text-fg-4",children:t==="zh-CN"?s.descriptionZh:s.description})]}),e.jsx(Ie,{state:s.state,locale:t})]}),e.jsxs("div",{className:"relative mt-3 flex items-center justify-between border-t border-edge/60 pt-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-fg-5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:h,opacity:.8}}),le(t,s.auth)]}),e.jsxs("div",{className:"flex items-center gap-1",children:[s.installed&&s.state!=="needs_auth"&&x&&e.jsx(z,{variant:"ghost",size:"sm",onClick:x,disabled:n,children:a(t,"重新授权","Re-auth")}),s.installed&&s.state!=="needs_auth"&&u&&e.jsx(z,{variant:"ghost",size:"sm",onClick:u,disabled:n,children:a(t,"编辑","Edit")}),e.jsx(z,{variant:s.state==="disabled"||s.state==="needs_auth"?"primary":"ghost",size:"sm",onClick:l,disabled:n,children:n?e.jsx(O,{}):p}),s.installed&&c&&e.jsx(z,{variant:"ghost",size:"sm",onClick:c,disabled:n,className:"hover:!text-err",children:a(t,"移除","Remove")})]})]})]})}function re({item:s,locale:t,busy:n,index:i,onPrimary:l}){const c=s.auth.type==="none"?a(t,"一键启用","One-click enable"):a(t,"授权并启用","Authorize & enable");return e.jsxs("div",{className:T("group relative flex flex-col gap-3 rounded-xl border border-edge bg-panel-alt p-4","transition-[transform,box-shadow,border-color] duration-200","hover:-translate-y-0.5 hover:border-edge-h hover:shadow-[0_12px_28px_rgba(15,23,42,0.09)]","animate-in-up"),style:{animationDelay:`${Math.min(i,12)*30}ms`},children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(D,{iconSlug:s.iconSlug,iconUrl:s.iconUrl,name:s.name,size:32}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"truncate text-[13.5px] font-semibold text-fg",children:s.name}),s.homepage&&e.jsx("a",{href:s.homepage,target:"_blank",rel:"noreferrer",className:"text-fg-5 hover:text-fg-3 transition-colors",children:e.jsx(U,{})})]}),e.jsx("div",{className:"mt-0.5 line-clamp-2 text-[12px] leading-snug text-fg-4",children:t==="zh-CN"?s.descriptionZh:s.description})]})]}),e.jsxs("div",{className:"mt-auto flex items-center justify-between",children:[e.jsx("span",{className:"inline-flex items-center gap-1 text-[11px] text-fg-5",children:le(t,s.auth)}),e.jsx(z,{variant:"outline",size:"sm",onClick:l,disabled:n,className:"group-hover:border-edge-h",children:n?e.jsx(O,{}):c})]})]})}function $e(s,t){const n=s.installedNames.length;if(typeof s.totalCount=="number"){const i=s.partial?`${s.totalCount}+`:String(s.totalCount);return t==="zh-CN"?`${n} / ${i} 已安装`:`${n} / ${i} installed`}return n>0?t==="zh-CN"?`${n} 已安装`:`${n} installed`:a(t,"未安装","Not installed")}function Ae({item:s,locale:t,animationDelay:n,onClick:i}){const{hex:l}=W(void 0,s.name);return e.jsxs("button",{type:"button",onClick:i,className:"animate-in-up group relative flex min-h-[112px] w-full flex-col overflow-hidden rounded-2xl border border-edge/70 bg-panel p-4 text-left transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_12px_28px_rgba(15,23,42,0.09)] focus-visible:outline-none focus-visible:shadow-[0_0_0_4px_var(--th-glow-a)]",style:{background:`linear-gradient(135deg, ${E(l,.06)} 0%, ${E(l,.02)} 100%), var(--th-panel)`,animationDelay:n},children:[e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute -right-10 -top-10 h-28 w-28 rounded-full opacity-60",style:{background:`radial-gradient(closest-side, ${E(l,.18)}, transparent 70%)`}}),e.jsxs("div",{className:"relative flex items-start gap-3",children:[e.jsx(D,{iconUrl:s.iconUrl,name:s.name,size:36}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"truncate text-[13px] font-semibold text-fg",children:s.name}),s.homepage&&e.jsx("a",{href:s.homepage,target:"_blank",rel:"noreferrer",onClick:c=>c.stopPropagation(),className:"text-fg-5 transition-colors hover:text-primary",children:e.jsx(U,{})})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold text-[var(--th-ok)] shrink-0",style:{background:"color-mix(in oklab, var(--th-ok) 12%, transparent)"},children:[e.jsx(Z,{size:10}),$e(s,t)]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[11.5px] text-fg-5",children:s.source}),e.jsx("div",{className:"mt-1 line-clamp-2 text-[11.5px] text-fg-4",children:t==="zh-CN"?s.descriptionZh:s.description})]})]}),e.jsxs("div",{className:"relative mt-auto pt-3 flex items-center justify-between text-[10.5px] text-fg-5",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[s.stars!==void 0&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 font-medium text-fg-4",children:[e.jsx(ee,{size:10}),se(s.stars)]}),s.pushedAt&&e.jsx("span",{children:ce(s.pushedAt,t)})]}),e.jsx("span",{className:"text-fg-5 group-hover:text-primary transition-colors",children:a(t,"管理 →","Manage →")})]})]})}function Ee({item:s,locale:t,animationDelay:n,onClick:i}){const{hex:l}=W(void 0,s.name);return e.jsxs("button",{type:"button",onClick:i,className:"animate-in-up group relative flex min-h-[112px] w-full flex-col overflow-hidden rounded-2xl border border-edge/60 bg-panel p-4 text-left transition-all duration-200 hover:-translate-y-0.5 hover:border-edge hover:shadow-[0_12px_28px_rgba(15,23,42,0.07)] focus-visible:outline-none focus-visible:shadow-[0_0_0_4px_var(--th-glow-a)]",style:{animationDelay:n},children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(D,{iconUrl:s.iconUrl,name:s.name,size:32}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13px] font-semibold text-fg",children:s.name}),s.homepage&&e.jsx("a",{href:s.homepage,target:"_blank",rel:"noreferrer",onClick:c=>c.stopPropagation(),className:"text-fg-5 transition-colors hover:text-primary",children:e.jsx(U,{})})]}),e.jsx("div",{className:"mt-0.5 line-clamp-2 text-[11.5px] text-fg-4",children:t==="zh-CN"?s.descriptionZh:s.description})]})]}),e.jsxs("div",{className:"mt-auto pt-3 flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-2 text-[11px] text-fg-5",children:[s.stars!==void 0&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 font-medium text-fg-4",children:[e.jsx(ee,{size:10}),se(s.stars)]}),typeof s.totalCount=="number"&&e.jsxs("span",{children:["· ",s.partial?`${s.totalCount}+`:s.totalCount," skills"]})]}),e.jsx("span",{className:"inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-[11px] font-semibold transition-colors group-hover:text-primary",style:{background:`${E(l,.08)}`,color:l},children:a(t,"查看 →","Browse →")})]})]})}function Re({item:s,open:t,onClose:n,onChanged:i,locale:l,scope:c,workdir:x,installedSkills:u}){const h=G(v=>v.toast),[p,j]=o.useState(null),[b,d]=o.useState(!1),[f,m]=o.useState(null),[S,$]=o.useState(!1),[A,I]=o.useState(null),[M,y]=o.useState(null),[C,g]=o.useState("");o.useEffect(()=>{if(!t||!s)return;let v=!1;return d(!0),m(null),g(""),(async()=>{try{const r=await _.listRepoSkills(s.source);if(v)return;r.ok?(j(r.skills),$(!!r.partial)):(m(r.error||"failed to list"),j([]))}catch(r){if(v)return;m(r?.message||"failed"),j([])}finally{v||d(!1)}})(),()=>{v=!0}},[t,s?.source]);const N=o.useMemo(()=>{const v=new Set,r=c==="global"?"global":"project";for(const k of u)k.scope===r&&v.add(k.name.toLowerCase());return v},[u,c]),w=o.useMemo(()=>{const v=p||[],r=C.trim().toLowerCase();return r?v.filter(k=>k.name.toLowerCase().includes(r)):v},[p,C]),L=o.useMemo(()=>p?p.filter(v=>N.has(v.name.toLowerCase())).length:0,[p,N]),R=o.useCallback(async v=>{if(s){I(v);try{const r=await _.installSkill(s.source,c==="global",v,x);r.ok?(h(a(l,`${v} 已安装`,`${v} installed`),!0),i()):h(r.error||"Failed",!1)}catch(r){h(r?.message||"Failed",!1)}finally{I(null)}}},[s,c,x,l,h,i]),F=o.useCallback(async v=>{I(v);try{const r=await _.removeExtensionSkill(v,c==="global",x);r.ok?(h(a(l,`${v} 已移除`,`${v} removed`),!0),i()):h(r.error||"Failed",!1)}catch(r){h(r?.message||"Failed",!1)}finally{I(null)}},[c,x,l,h,i]),V=o.useCallback(async()=>{if(s){y("install");try{const v=await _.installSkill(s.source,c==="global",void 0,x);v.ok?(h(a(l,"全部安装完成","All skills installed"),!0),i()):h(v.error||"Failed",!1)}catch(v){h(v?.message||"Failed",!1)}finally{y(null)}}},[s,c,x,l,h,i]),Y=o.useCallback(async()=>{if(!(!s||!p)){y("remove");try{const v=p.map(r=>r.name).filter(r=>N.has(r.toLowerCase()));for(const r of v)await _.removeExtensionSkill(r,c==="global",x);h(a(l,"已移除该集合下的全部技能","Removed all skills from this collection"),!0),i()}catch(v){h(v?.message||"Failed",!1)}finally{y(null)}}},[s,p,N,c,x,l,h,i]);return s?e.jsxs(q,{open:t,onClose:n,wide:!0,children:[e.jsx(K,{title:s.name,description:l==="zh-CN"?s.descriptionZh:s.description,onClose:n}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(D,{iconUrl:s.iconUrl,name:s.name,size:44}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-semibold text-fg",children:[s.name,s.homepage&&e.jsx("a",{href:s.homepage,target:"_blank",rel:"noreferrer",className:"text-fg-5 hover:text-primary",children:e.jsx(U,{})})]}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-[11.5px] text-fg-4",children:[e.jsx("span",{className:"truncate text-fg-5",children:s.source}),s.stars!==void 0&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-fg-5",children:[e.jsx(ee,{size:10}),se(s.stars)]}),s.pushedAt&&e.jsxs("span",{className:"text-fg-5",children:["· ",ce(s.pushedAt,l)]})]})]})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"text-[12px] font-semibold text-fg-3",children:[a(l,"该集合下的技能","Skills in this collection"),p&&e.jsxs("span",{className:"ml-2 text-[11px] font-normal text-fg-5",children:[L," / ",S?`${p.length}+`:p.length," ",a(l,"已安装","installed")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"outline",size:"sm",onClick:V,disabled:M!==null||b,children:M==="install"?e.jsx(O,{}):a(l,"全部安装","Install all")}),L>0&&e.jsx(z,{variant:"ghost",size:"sm",onClick:Y,disabled:M!==null,className:"hover:!text-err",children:M==="remove"?e.jsx(O,{}):a(l,"全部移除","Remove all")})]})]}),p&&p.length>6&&e.jsx(P,{type:"text",value:C,onChange:v=>g(v.target.value),placeholder:a(l,"搜索技能…","Search skills…"),className:"w-full"}),b?e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx(O,{})}):f?e.jsxs("div",{className:"rounded-lg border border-edge/70 bg-panel/60 p-3 text-[12px] text-fg-4",children:[a(l,"无法从 GitHub 拉取技能列表(可能是网络或速率限制)。你仍可以使用上方的「全部安装」按钮一次性安装该集合。",'Could not list skills from GitHub (network or rate-limit). You can still use "Install all" to grab the whole collection.'),e.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-fg-5",children:f})]}):w.length===0?e.jsx("div",{className:"rounded-lg border border-edge/70 bg-panel/60 p-3 text-center text-[12px] text-fg-5",children:C?a(l,"没有匹配的技能","No matching skills"):a(l,"该集合暂无可识别的技能","No discoverable skills in this collection")}):e.jsx("div",{className:"max-h-[60vh] overflow-y-auto rounded-lg border border-edge/70 bg-panel/40",children:w.map((v,r)=>{const k=N.has(v.name.toLowerCase()),B=A===v.name;return e.jsxs("div",{className:T("flex items-center justify-between gap-3 px-3 py-2 text-[12px]",r>0&&"border-t border-edge/40"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[k&&e.jsx(Z,{size:12}),e.jsx("span",{className:T("truncate font-medium",k?"text-[var(--th-ok)]":"text-fg-2"),children:v.name})]}),v.description&&e.jsx("div",{className:"mt-0.5 line-clamp-1 text-[11px] text-fg-5",children:v.description})]}),k?e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{F(v.name)},disabled:B||M!==null,className:"hover:!text-err",children:B?e.jsx(O,{}):a(l,"移除","Remove")}):e.jsx(z,{variant:"outline",size:"sm",onClick:()=>{R(v.name)},disabled:B||M!==null,children:B?e.jsx(O,{}):a(l,"安装","Install")})]},v.name)})}),S&&e.jsx("div",{className:"text-[11px] text-fg-5",children:a(l,"仓库内技能数量较多,仅显示前 1000 个。可使用上方搜索或直接打开仓库浏览全部。","Showing the first 1000 skills. Use search or open the repo on GitHub for the full list.")})]})]})]}):null}const ee=({size:s=12})=>e.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})});function se(s){return s>=1e4?`${(s/1e3).toFixed(1).replace(/\.0$/,"")}k`:s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}function ce(s,t){const n=Date.parse(s);if(!Number.isFinite(n))return"";const i=Date.now()-n,l=1440*60*1e3,c=Math.max(1,Math.floor(i/l));if(c<30)return t==="zh-CN"?`${c} 天前`:`${c}d ago`;const x=Math.floor(c/30);if(x<12)return t==="zh-CN"?`${x} 个月前`:`${x}mo ago`;const u=Math.floor(x/12);return t==="zh-CN"?`${u} 年前`:`${u}y ago`}const H={dev:{zh:"开发工具",en:"Development",order:0},productivity:{zh:"生产力",en:"Productivity",order:1},communication:{zh:"协作沟通",en:"Communication",order:2},data:{zh:"数据",en:"Data",order:3},search:{zh:"搜索",en:"Search",order:4},utility:{zh:"工具",en:"Utility",order:5},custom:{zh:"自定义",en:"Custom",order:6}};function Be(s){const t=new Map;for(const n of s){const i=t.get(n.category)||[];i.push(n),t.set(n.category,i)}return[...t.entries()].sort((n,i)=>(H[n[0]]?.order??99)-(H[i[0]]?.order??99)).map(([n,i])=>({key:n,items:i}))}function de({scope:s,workdir:t,locale:n,onOpenBrowserSetup:i}){const l=G(r=>r.toast),c=`pikiclaw.mcp.catalog.${s}.${t||""}`,{data:x,loading:u,refresh:h}=X(c,async()=>(await _.getMcpCatalog(t,s)).items||[],[t,s]),[p,j]=o.useState(""),[b,d]=o.useState(null),[f,m]=o.useState(!1),[S,$]=o.useState(null),A=x||[],I=o.useMemo(()=>A.filter(r=>!r.installed||r.scope===s||!r.scope),[A,s]),M=o.useMemo(()=>{if(!p.trim())return I;const r=p.trim().toLowerCase();return I.filter(k=>k.name.toLowerCase().includes(r)||k.description.toLowerCase().includes(r)||k.descriptionZh.includes(r)||k.id.toLowerCase().includes(r))},[I,p]),y=o.useMemo(()=>M.filter(r=>r.isBuiltin),[M]),C=o.useMemo(()=>M.filter(r=>!r.isBuiltin&&(r.state==="ready"||r.state==="unhealthy")),[M]),g=o.useMemo(()=>Be(M.filter(r=>!r.isBuiltin&&r.state!=="ready"&&r.state!=="unhealthy")),[M]),N=o.useCallback(async(r,k)=>{if(r.isRecommended){$(r.id);try{const B=await _.installMcp(r.id,s,k,t,!0);if(!B.ok)throw new Error(B.error||"install failed");return await h(),B.enabled??!1}catch(B){return l(B?.message||"Failed",!1),!1}finally{$(null)}}},[s,t,h,l]),w=o.useCallback(async r=>{$(r.id);try{if(!r.installed){const ne=await _.installMcp(r.id,s,void 0,t,!1);if(!ne.ok)throw new Error(ne.error||"install failed")}const k=await _.startMcpOAuth(r.id);if(!k.ok||!k.authUrl||!k.state)throw new Error(k.error||"oauth start failed");await _e(k.authUrl,k.state)?(await _.toggleMcp(r.id,!0,s,t),l(a(n,`${r.name} 授权成功`,`${r.name} authorized`),!0)):l(a(n,"授权未完成","Authorization not completed"),!1),await h()}catch(k){l(k?.message||"OAuth failed",!1)}finally{$(null)}},[s,t,n,l,h]),L=o.useCallback(async(r,k)=>{if(r.installedKey){$(r.id);try{await _.toggleMcp(r.installedKey,k,r.scope==="workspace"?"workspace":"global",t),await h()}catch(B){l(B?.message||"Failed",!1)}finally{$(null)}}},[t,h,l]),R=o.useCallback(async r=>{if(r.installedKey){$(r.id);try{await _.removeMcp(r.installedKey,r.scope==="workspace"?"workspace":"global",r.isRecommended?r.id:void 0,t),await h()}catch(k){l(k?.message||"Failed",!1)}finally{$(null)}}},[t,h,l]),F=o.useCallback(async r=>{if(!b)return;await N(b,r)!==!1&&d(null)},[b,N]),V=o.useCallback(r=>{if(r.state==="ready"||r.state==="unhealthy"){L(r,!1);return}if(r.state==="disabled"){L(r,!0);return}if(r.state==="needs_auth"){if(r.auth.type==="mcp-oauth"){w(r);return}if(r.auth.type==="credentials"){d(r);return}}},[L,w]),Y=o.useCallback(r=>{if(r.state==="disabled"){L(r,!0);return}if(r.state==="needs_auth"){if(r.auth.type==="mcp-oauth"){w(r);return}if(r.auth.type==="credentials"){d(r);return}}if(r.auth.type==="mcp-oauth"){w(r);return}if(r.auth.type==="credentials"){d(r);return}N(r)},[w,N,L]),v=u&&!x;return e.jsxs("section",{children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Q,{children:"MCP Servers"}),!u&&e.jsxs("span",{className:"text-[11px] text-fg-5",children:[C.length," ",a(n,"在用","in use")," · ",I.length-C.length-y.length," ",a(n,"可添加","available")]}),u&&e.jsx(O,{className:"h-3 w-3"})]}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-fg-5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{value:p,onChange:r=>j(r.target.value),placeholder:a(n,"搜索...","Search..."),className:"h-7 w-52 rounded-md border border-edge bg-inset/50 pl-7 pr-2.5 text-[12px] text-fg outline-none placeholder:text-fg-5/50 focus:border-primary/30 focus:bg-inset"})]})})]}),v?e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx(O,{})}):e.jsxs("div",{className:"space-y-5",children:[y.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--th-accent,#7c3aed)]"}),a(n,"内置(pikiclaw 优化)","Built-in (optimized by pikiclaw)")]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:y.map((r,k)=>r.installed?e.jsx(ae,{item:r,locale:n,busy:S===r.id,index:k,onPrimary:()=>V(r),onReconfigure:r.id==="pikiclaw-browser"?i:void 0},r.id):e.jsx(re,{item:r,locale:n,busy:S===r.id,index:k,onPrimary:()=>Y(r)},r.id))})]}),C.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--th-ok)]"}),a(n,"在用","In use")]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:C.map((r,k)=>e.jsx(ae,{item:r,locale:n,busy:S===r.id,index:k,onPrimary:()=>V(r),onRemove:()=>{R(r)},onReauth:r.auth.type==="mcp-oauth"?()=>{w(r)}:void 0,onReconfigure:r.auth.type==="credentials"?()=>d(r):void 0},r.id))})]}),g.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.16em] text-fg-5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-fg-5"}),C.length===0?a(n,"推荐的服务","Recommended services"):a(n,"更多可选","More options")]}),e.jsx("div",{className:"space-y-4",children:g.map(r=>e.jsx(Oe,{groupKey:r.key,locale:n,children:e.jsx("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:r.items.map((k,B)=>e.jsx(re,{item:k,locale:n,busy:S===k.id,index:B,onPrimary:()=>Y(k)},k.id))})},r.key))})]}),y.length===0&&C.length===0&&g.length===0&&e.jsx(te,{title:a(n,"没有匹配的服务","No matching services"),subtitle:a(n,"试试别的关键词","Try a different search term")})]}),e.jsx("div",{className:"mt-3 flex justify-end",children:e.jsxs("button",{className:"text-[12px] text-fg-4 hover:text-fg-2 transition-colors",onClick:()=>m(!0),children:["+ ",a(n,"添加自定义 MCP","Add custom MCP")]})}),e.jsx(ze,{open:!!b,onClose:()=>d(null),locale:n,item:b,initial:b?.config?.env||b?.config?.headers,onSubmit:F}),e.jsx(Me,{open:f,onClose:()=>m(!1),locale:n,scope:s,workdir:t,onAdded:h})]})}function Oe({groupKey:s,locale:t,children:n}){const i=H[s],l=i?a(t,i.zh,i.en):s;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5 text-[11px] font-medium text-fg-5",children:l}),n]})}function te({title:s,subtitle:t}){return e.jsxs("div",{className:"rounded-xl border border-dashed border-edge py-10 text-center",children:[e.jsx("div",{className:"text-[13px] font-medium text-fg-3",children:s}),t&&e.jsx("div",{className:"mt-1 text-[12px] text-fg-5",children:t})]})}function xe({scope:s,workdir:t,locale:n}){const i=`pikiclaw.skills.catalog.${s}.${t||""}`,{data:l,loading:c,refresh:x}=X(i,async()=>{const y=await _.getSkillsCatalog(t,s);return{items:y.items||[],installed:y.installed||[]}},[t,s]),[u,h]=o.useState(!1),[p,j]=o.useState(null),b=l?.items||[],d=l?.installed||[],f=o.useMemo(()=>{const y=s==="global"?"global":"project";return d.filter(C=>C.scope===y)},[d,s]),m=o.useMemo(()=>b.filter(y=>y.installedNames.length>0),[b]),S=o.useMemo(()=>b.filter(y=>y.installedNames.length===0),[b]),$=o.useMemo(()=>{const y=new Map;for(const C of S){const g=C.category;y.has(g)||y.set(g,[]),y.get(g).push(C)}return[...y.entries()].sort(([C],[g])=>(H[C]?.order??99)-(H[g]?.order??99))},[S]),A=p&&b.find(y=>y.id===p)||null,I=c&&!l,M=f.length;return e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Q,{children:"Skills"}),!c&&e.jsxs("span",{className:"text-[11px] text-fg-5",children:[M," ",a(n,"已安装","installed")," · ",S.length," ",a(n,"可用","available")]}),c&&e.jsx(O,{className:"h-3 w-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{x()},children:c?a(n,"刷新中…","Refreshing…"):a(n,"刷新","Refresh")}),e.jsxs(z,{variant:"outline",size:"sm",onClick:()=>h(!0),children:["+ ",a(n,"从 GitHub 安装","Install from GitHub")]})]})]}),I?e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx(O,{})}):b.length===0?e.jsx(te,{title:a(n,"暂无可用的技能包","No skill packs available"),subtitle:a(n,"从 GitHub 导入一个开始使用","Import from GitHub to get started")}):e.jsxs(e.Fragment,{children:[m.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-semibold text-fg-3",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-[var(--th-ok)]"}),a(n,"已安装","Installed")]}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:m.map((y,C)=>e.jsx(Ae,{item:y,locale:n,animationDelay:`${Math.min(C,12)*30}ms`,onClick:()=>j(y.id)},y.id))})]}),S.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-semibold text-fg-3",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-fg-5/50"}),a(n,"推荐","Available")]}),$.map(([y,C])=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-[0.06em] text-fg-5",children:n==="zh-CN"?H[y]?.zh||y:H[y]?.en||y}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:C.map((g,N)=>e.jsx(Ee,{item:g,locale:n,animationDelay:`${Math.min(N,12)*30}ms`,onClick:()=>j(g.id)},g.id))})]},y))]})]}),e.jsx(Re,{item:A,open:!!A,onClose:()=>j(null),onChanged:()=>{x()},locale:n,scope:s,workdir:t,installedSkills:d}),e.jsx(Le,{open:u,onClose:()=>h(!1),locale:n,scope:s,workdir:t,onInstalled:x})]})}const J={dev:{zh:"研发工具",en:"Developer",order:1},cloud:{zh:"云与部署",en:"Cloud",order:2},data:{zh:"数据后端",en:"Data",order:3},commerce:{zh:"商业支付",en:"Commerce",order:4},social:{zh:"社交通讯",en:"Social",order:5},content:{zh:"内容创作",en:"Content",order:6}};function ue({state:s,locale:t}){return s==="ready"?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold text-[var(--th-ok)]",style:{background:"color-mix(in oklab, var(--th-ok) 12%, transparent)"},children:[e.jsx(Z,{size:10}),a(t,"已登录","Signed in")]}):s==="installed_not_auth"?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold text-amber-600 dark:text-amber-400",style:{background:"color-mix(in oklab, #f59e0b 14%, transparent)"},children:[e.jsx(ie,{size:10}),a(t,"待登录","Sign-in needed")]}):s==="not_installed"?e.jsx("span",{className:"inline-flex items-center gap-1 rounded-full border border-edge bg-inset/60 px-2 py-0.5 text-[10px] font-medium text-fg-5",children:a(t,"未安装","Not installed")}):e.jsx("span",{className:"inline-flex items-center gap-1 rounded-full border border-edge bg-inset/60 px-2 py-0.5 text-[10px] font-medium text-fg-5",children:"..."})}function he({chunks:s,running:t,emptyHint:n}){const i=o.useRef(null);o.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[s.length]);const l=s.join("");return e.jsx("div",{ref:i,className:"relative h-56 overflow-auto rounded-xl border border-edge/60 bg-[#0b0f16] p-3 font-mono text-[11.5px] leading-[1.55] text-[#cdd6f4] scrollbar-thin",style:{boxShadow:"0 1px 0 rgba(255,255,255,0.03) inset"},children:l?e.jsx("pre",{className:"whitespace-pre-wrap break-words",children:l}):e.jsx("div",{className:"flex h-full items-center justify-center text-[#6c7086]",children:t?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(O,{})," ",n||"Starting…"]}):n||"No output yet"})})}function Pe({cli:s,locale:t,onInstalled:n}){const[i,l]=o.useState([]),[c,x]=o.useState(!1),[u,h]=o.useState(null),[p,j]=o.useState(null),[b,d]=o.useState(null),f=o.useRef(null),m=o.useCallback(()=>{try{f.current?.close()}catch{}f.current=null},[]);o.useEffect(()=>m,[m]);const S=o.useCallback(async()=>{l([]),j(null),d(null),x(!0);try{const I=await _.startCliInstall(s.id);if(!I.ok||!I.sessionId)throw new Error(I.error||"start failed");h(I.sessionId);const M=new EventSource(`/api/extensions/cli/auth/stream?sessionId=${encodeURIComponent(I.sessionId)}`);f.current=M,M.onmessage=y=>{try{const C=JSON.parse(y.data);C.type==="output"?l(g=>g.length>400?[...g.slice(-400),C.chunk]:[...g,C.chunk]):C.type==="error"?j(C.message||"error"):C.type==="done"&&(x(!1),d(!!C.ok),m(),C.ok&&n())}catch{}},M.addEventListener("close",()=>{x(!1),m()}),M.onerror=()=>{c&&j(a(t,"连接中断","Stream disconnected"))}}catch(I){x(!1),j(I?.message||"failed to start install")}},[s.id,m,t,n,c]),$=o.useCallback(async()=>{if(u)try{await _.cancelCliAuth(u)}catch{}m(),x(!1)},[u,m]);if(!s.autoInstall)return null;const A=c||i.length>0||b!==null;return e.jsxs("div",{className:"space-y-3 rounded-lg border border-edge/70 bg-panel/60 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[12px] text-fg-3",children:a(t,`通过 ${s.autoInstall.label} 直接在本机自动安装,无需复制命令。`,`Run the ${s.autoInstall.label} install locally — no copy-paste needed.`)}),c?e.jsx(z,{variant:"outline",size:"sm",onClick:$,children:a(t,"中止","Abort")}):e.jsx(z,{variant:"primary",size:"sm",onClick:S,disabled:b===!0,children:b===!0?a(t,"已安装","Installed"):b===!1?a(t,"重试安装","Retry install"):a(t,"一键安装","Auto-install")})]}),A&&e.jsx(he,{chunks:i,running:c,emptyHint:a(t,"安装进度将在此显示","Install output will appear here")}),p&&e.jsx("div",{className:"text-[12px] text-[var(--th-err)]",children:p}),b===!1&&!p&&e.jsx("div",{className:"text-[12px] text-[var(--th-err)]",children:a(t,"安装未成功,请查看上方输出排查。","Install did not complete — check the output above.")})]})}function Te({cliId:s,locale:t,hint:n,commands:i,onSignedIn:l,onCancel:c}){const[x,u]=o.useState(!1),[h,p]=o.useState(null),[j,b]=o.useState(null),d=o.useCallback(async()=>{u(!0),p(null),b(null);try{const f=await _.refreshCli(s);if(!f.ok){b(f.error||a(t,"检测失败","Detection failed"));return}if(f.status?.state==="ready"){l();return}const m=i.length;p(m>1?a(t,`尚未检测到登录。请依次完成上面 ${m} 步后再重试 —— 任一步漏掉都不会算授权成功。`,`Not signed in yet. Run all ${m} steps above in order — sign-in only counts as successful after every step completes.`):a(t,"尚未检测到登录,请先在终端完成上述命令。","Not signed in yet — finish the command above in your terminal first."))}catch(f){b(f?.message||"failed")}finally{u(!1)}},[s,t,l,i.length]);return e.jsxs("div",{className:"space-y-3",children:[n&&e.jsx("div",{className:"text-[12px] leading-relaxed text-fg-4",children:n}),e.jsx(pe,{commands:i,locale:t}),j&&e.jsx("div",{className:"text-[12px] text-[var(--th-err)]",children:j}),h&&!j&&e.jsx("div",{className:"text-[12px] text-fg-4",children:h}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"primary",size:"sm",onClick:d,disabled:x,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[x&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",style:{animationDuration:"0.9s"},"aria-hidden":"true",children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),e.jsx("span",{children:x?a(t,"检测中…","Checking…"):a(t,"重新检测状态","Re-check status")})]})}),e.jsx(z,{variant:"ghost",size:"sm",onClick:c,disabled:x,children:a(t,"关闭","Close")})]})]})}function Ue({cli:s,locale:t,onSignedIn:n,onCancel:i}){const[l,c]=o.useState([]),[x,u]=o.useState(!1),[h,p]=o.useState(null),[j,b]=o.useState(null),[d,f]=o.useState(null),m=o.useRef(null),S=o.useCallback(()=>{try{m.current?.close()}catch{}m.current=null},[]);o.useEffect(()=>S,[S]);const $=o.useCallback(async()=>{c([]),f(null),b(null),u(!0);try{const N=await _.startCliAuth(s.id);if(!N.ok||!N.sessionId)throw new Error(N.error||"start failed");p(N.sessionId);const w=new EventSource(`/api/extensions/cli/auth/stream?sessionId=${encodeURIComponent(N.sessionId)}`);m.current=w,w.onmessage=L=>{try{const R=JSON.parse(L.data);R.type==="output"?c(F=>F.length>400?[...F.slice(-400),R.chunk]:[...F,R.chunk]):R.type==="status"?b(R.status.state==="ready"?a(t,"已检测到登录成功","Sign-in detected"):a(t,"等待授权完成…","Waiting for authorization…")):R.type==="error"?f(R.message||"error"):R.type==="done"&&(u(!1),S(),R.ok&&n())}catch{}},w.addEventListener("close",()=>{u(!1),S()}),w.onerror=()=>{x&&f(a(t,"连接中断","Stream disconnected"))}}catch(N){u(!1),f(N?.message||"failed to start sign-in")}},[s.id,S,t,n,x]),A=o.useCallback(async()=>{if(h)try{await _.cancelCliAuth(h)}catch{}S(),u(!1),i()},[h,S,i]),[I,M]=o.useState({}),[y,C]=o.useState(!1),g=o.useCallback(async()=>{C(!0),f(null);try{const N=await _.applyCliToken(s.id,I);N.ok?n():f(N.error||a(t,"应用凭据失败","Failed to apply credentials"))}catch(N){f(N?.message||"failed")}finally{C(!1)}},[s.id,I,t,n]);if(s.auth.type==="oauth-web"){const N=t==="zh-CN"&&s.auth.loginHintZh||s.auth.loginHint,w=s.auth.manualLoginCommands;return w&&w.length>0?e.jsx(Te,{cliId:s.id,locale:t,hint:N,commands:w,onSignedIn:n,onCancel:i}):e.jsxs("div",{className:"space-y-3",children:[N&&e.jsx("div",{className:"text-[12px] leading-relaxed text-fg-4",children:N}),e.jsx(he,{chunks:l,running:x,emptyHint:a(t,"点击「开始登录」后将在此展示命令行输出",'Click "Start sign-in" to stream CLI output here')}),d&&e.jsx("div",{className:"text-[12px] text-[var(--th-err)]",children:d}),j&&!d&&e.jsx("div",{className:"text-[12px] text-[var(--th-ok)]",children:j}),e.jsx("div",{className:"flex items-center gap-2",children:x?e.jsx(z,{variant:"outline",size:"sm",onClick:A,children:a(t,"中止","Abort")}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"primary",size:"sm",onClick:$,children:a(t,"开始登录","Start sign-in")}),e.jsx(z,{variant:"ghost",size:"sm",onClick:i,children:a(t,"取消","Cancel")})]})})]})}if(s.auth.type==="token"){const N=t==="zh-CN"&&s.auth.loginHintZh||s.auth.loginHint;return e.jsxs("div",{className:"space-y-3",children:[N&&e.jsx("div",{className:"text-[12px] leading-relaxed text-fg-4",children:N}),e.jsx("div",{className:"space-y-2",children:(s.auth.tokenFields||[]).map(w=>e.jsxs("label",{className:"block text-[12px]",children:[e.jsxs("div",{className:"mb-1 text-fg-3",children:[t==="zh-CN"?w.labelZh:w.label,w.required&&e.jsx("span",{className:"ml-1 text-[var(--th-err)]",children:"*"})]}),e.jsx(P,{type:w.secret?"password":"text",value:I[w.key]||"",onChange:L=>M(R=>({...R,[w.key]:L.target.value})),placeholder:w.placeholder||"",className:"w-full"}),w.helpUrl&&e.jsxs("a",{className:"mt-1 inline-block text-[11px] text-primary hover:underline",href:w.helpUrl,target:"_blank",rel:"noreferrer",children:[a(t,"如何获取","How to get this")," ↗"]})]},w.key))}),d&&e.jsx("div",{className:"text-[12px] text-[var(--th-err)]",children:d}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"primary",size:"sm",onClick:g,disabled:y,children:y?a(t,"验证中…","Verifying…"):a(t,"保存并验证","Save & verify")}),e.jsx(z,{variant:"ghost",size:"sm",onClick:i,children:a(t,"取消","Cancel")})]})]})}return null}function pe({commands:s,locale:t}){return e.jsx("div",{className:"space-y-2",children:s.map((n,i)=>e.jsxs("div",{className:"overflow-hidden rounded-lg border border-edge/70 bg-panel/60",children:[n.label&&e.jsx("div",{className:"flex items-center justify-between border-b border-edge/50 bg-panel-alt/40 px-3 py-1 text-[11px] font-medium text-fg-4",children:e.jsx("span",{children:n.label})}),e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 font-mono text-[12px] text-fg-2",children:[e.jsx("span",{className:"mt-[2px] select-none text-fg-5",children:"$"}),e.jsx("code",{className:"min-w-0 flex-1 break-all",children:n.cmd}),e.jsx("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(n.cmd)},className:"shrink-0 rounded px-2 py-0.5 text-[10.5px] text-fg-5 transition-colors hover:bg-panel-h hover:text-fg-2",title:a(t,"复制到剪贴板","Copy to clipboard"),children:a(t,"复制","Copy")})]})]},i))})}function De({cli:s,open:t,onClose:n,onChanged:i,locale:l}){const[c,x]=o.useState(!1),[u,h]=o.useState(!1),[p,j]=o.useState(null);o.useEffect(()=>{t||(x(!1),j(null))},[t]);const b=o.useMemo(()=>s?s.install[s.platform]||[]:[],[s]);if(!s)return null;const d=s.state!=="not_installed",f=s.state==="ready",m=async()=>{h(!0),j(null);try{const S=await _.logoutCli(s.id);S.ok||j(S.error||a(l,"登出失败","Logout failed")),i()}catch(S){j(S?.message||"failed")}finally{h(!1)}};return e.jsxs(q,{open:t,onClose:n,wide:!0,children:[e.jsx(K,{title:s.name,description:l==="zh-CN"?s.descriptionZh:s.description,onClose:n}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(D,{iconSlug:s.iconSlug,iconUrl:s.iconUrl,name:s.name,size:44}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-semibold text-fg",children:[s.name,s.homepage&&e.jsx("a",{href:s.homepage,target:"_blank",rel:"noreferrer",className:"text-fg-5 hover:text-primary",children:e.jsx(U,{})})]}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-[11.5px] text-fg-4",children:[ue({state:s.state,locale:l}),s.version&&e.jsxs("span",{className:"font-mono text-fg-5",children:["v",s.version]}),f&&s.authDetail&&e.jsxs("span",{className:"truncate text-fg-5",children:["· ",s.authDetail]})]})]})]}),!d&&e.jsxs("section",{className:"space-y-3",children:[e.jsx("div",{className:"text-[12px] font-semibold text-fg-3",children:a(l,"安装","Install")}),s.autoInstall&&e.jsx(Pe,{cli:s,locale:l,onInstalled:i}),e.jsx("div",{className:"text-[11.5px] leading-relaxed text-fg-5",children:s.autoInstall?a(l,"或手动复制命令到终端执行。","Or copy a command below and run it in your terminal."):a(l,"复制下面的命令到终端运行。我们不自动代为安装 — 包管理器往往需要 sudo 或交互式确认。","Copy a command below and run it in your terminal. We don't auto-install — package managers often need sudo or interactive confirmation.")}),b.length>0?e.jsx(pe,{commands:b,locale:l}):e.jsx("div",{className:"text-[12px] text-fg-5",children:a(l,"请查看官方文档","Check the official installation docs")}),s.install.docs&&e.jsxs("a",{href:s.install.docs,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[11.5px] text-primary hover:underline",children:[a(l,"查看安装文档","Installation docs")," ↗"]}),e.jsx("div",{className:"pt-2",children:e.jsx(z,{variant:"outline",size:"sm",onClick:i,children:a(l,"我已安装,重新检测","I've installed, re-check")})})]}),d&&s.auth.type!=="none"&&e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-[12px] font-semibold text-fg-3",children:a(l,"登录","Sign in")}),f&&!c&&e.jsx(z,{variant:"ghost",size:"sm",onClick:m,disabled:u,children:u?a(l,"登出中…","Signing out…"):a(l,"登出","Sign out")})]}),p&&e.jsx("div",{className:"text-[11.5px] text-[var(--th-err)]",children:p}),f&&!c?e.jsxs("div",{className:"rounded-lg border border-edge/70 bg-panel/60 p-3 text-[12px] text-fg-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{size:12}),e.jsx("span",{children:a(l,"你已经登录,命令行工具可直接使用。","Already signed in — the CLI is ready to use.")})]}),e.jsx("div",{className:"mt-2",children:e.jsx(z,{variant:"outline",size:"sm",onClick:()=>x(!0),children:a(l,"重新登录","Re-authenticate")})})]}):e.jsx(Ue,{cli:s,locale:l,onSignedIn:()=>{x(!1),i()},onCancel:()=>x(!1)})]}),d&&s.auth.type==="none"&&e.jsx("section",{className:"rounded-lg border border-edge/70 bg-panel/60 p-3 text-[12px] text-fg-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{size:12}),e.jsx("span",{children:a(l,"无需授权 — 可直接使用。","No authentication required — ready to use.")})]})})]})]})}function Fe({item:s,onClick:t,locale:n,animationDelay:i}){const{hex:l}=W(s.iconSlug,s.name);return e.jsxs("button",{type:"button",onClick:t,className:"animate-in-up group relative flex min-h-[112px] w-full flex-col overflow-hidden rounded-2xl border border-edge/70 bg-panel p-4 text-left transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_12px_28px_rgba(15,23,42,0.09)] focus-visible:outline-none focus-visible:shadow-[0_0_0_4px_var(--th-glow-a)]",style:{background:`linear-gradient(135deg, ${E(l,.06)} 0%, ${E(l,.02)} 100%), var(--th-panel)`,animationDelay:i},children:[e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute -right-10 -top-10 h-28 w-28 rounded-full opacity-60",style:{background:`radial-gradient(closest-side, ${E(l,.18)}, transparent 70%)`}}),e.jsxs("div",{className:"relative flex items-start gap-3",children:[e.jsx(D,{iconSlug:s.iconSlug,iconUrl:s.iconUrl,name:s.name,size:36}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-fg",children:s.name}),ue({state:s.state,locale:n})]}),e.jsxs("div",{className:"mt-0.5 truncate text-[11.5px] text-fg-5",children:[s.version?e.jsxs("span",{className:"font-mono",children:["v",s.version]}):null,s.version&&s.authDetail?" · ":null,s.authDetail]}),e.jsx("div",{className:"mt-1 truncate text-[11.5px] text-fg-4",children:n==="zh-CN"?s.descriptionZh:s.description})]})]})]})}function He({item:s,onClick:t,locale:n,animationDelay:i}){const{hex:l}=W(s.iconSlug,s.name),c=s.state==="not_installed"?a(n,"安装","Install"):s.state==="installed_not_auth"?a(n,"登录","Sign in"):a(n,"查看","Details");return e.jsxs("button",{type:"button",onClick:t,className:"animate-in-up group relative flex min-h-[112px] w-full flex-col overflow-hidden rounded-2xl border border-edge/60 bg-panel p-4 text-left transition-all duration-200 hover:-translate-y-0.5 hover:border-edge hover:shadow-[0_12px_28px_rgba(15,23,42,0.07)] focus-visible:outline-none focus-visible:shadow-[0_0_0_4px_var(--th-glow-a)]",style:{animationDelay:i},children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(D,{iconSlug:s.iconSlug,iconUrl:s.iconUrl,name:s.name,size:32}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13px] font-semibold text-fg",children:s.name}),s.homepage&&e.jsx("a",{href:s.homepage,target:"_blank",rel:"noreferrer",onClick:x=>x.stopPropagation(),className:"text-fg-5 transition-colors hover:text-primary",children:e.jsx(U,{})})]}),e.jsx("div",{className:"mt-0.5 truncate text-[11.5px] text-fg-4",children:n==="zh-CN"?s.descriptionZh:s.description})]})]}),e.jsxs("div",{className:"mt-auto pt-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-[11px] text-fg-5",children:s.auth.type==="oauth-web"?a(n,"浏览器授权","OAuth"):s.auth.type==="token"?a(n,"Token","Token"):a(n,"免配置","No auth")}),e.jsx("span",{className:"inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-[11px] font-semibold transition-colors group-hover:text-primary",style:{background:`${E(l,.08)}`,color:l},children:c})]})]})}function me({locale:s,scope:t}){const{data:n,loading:i,refresh:l}=X("pikiclaw:cli:catalog",async()=>{const d=await _.getCliCatalog();if(!d.ok)throw new Error(d.error||"failed");return d.items||[]},[]),[c,x]=o.useState(null),u=o.useMemo(()=>{const d=n||[];return d},[n,t]),h=c&&u.find(d=>d.id===c)||null,p=u.filter(d=>d.state==="ready"),j=u.filter(d=>d.state!=="ready"),b=o.useMemo(()=>{const d=new Map;for(const f of j){const m=f.category;d.has(m)||d.set(m,[]),d.get(m).push(f)}return[...d.entries()].sort(([f],[m])=>(J[f]?.order??99)-(J[m]?.order??99))},[j]);return e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Q,{children:a(s,"CLI 工具","CLI Tools")}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-fg-5",children:[e.jsxs("span",{children:[p.length," ",a(s,"已登录","signed in")," · ",j.length," ",a(s,"可用","available")]}),e.jsx("button",{type:"button",onClick:()=>{l()},className:"rounded px-2 py-0.5 text-fg-5 transition-colors hover:bg-panel-h hover:text-fg-2",children:i?a(s,"刷新中…","Refreshing…"):a(s,"刷新","Refresh")})]})]}),t==="workspace"&&e.jsx("div",{className:"rounded-lg border border-edge/60 bg-inset/40 px-3 py-2 text-[11.5px] text-fg-4",children:a(s,"CLI 工具安装于机器层面,项目视图下同样可见。","CLI tools are installed machine-wide and are shown here for convenience.")}),p.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-semibold text-fg-3",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-[var(--th-ok)]"}),a(s,"已登录","Signed in")]}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:p.map((d,f)=>e.jsx(Fe,{item:d,locale:s,animationDelay:`${Math.min(f,12)*30}ms`,onClick:()=>x(d.id)},d.id))})]}),j.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-semibold text-fg-3",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-fg-5/50"}),a(s,"推荐工具","Available")]}),b.map(([d,f])=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-[0.06em] text-fg-5",children:s==="zh-CN"?J[d]?.zh||d:J[d]?.en||d}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:f.map((m,S)=>e.jsx(He,{item:m,locale:s,animationDelay:`${Math.min(S,12)*30}ms`,onClick:()=>x(m.id)},m.id))})]},d))]}),!i&&u.length===0&&e.jsx(te,{title:a(s,"暂无可用 CLI","No CLI tools available"),subtitle:a(s,"稍后再试,或重启一下服务。","Try again later, or restart the service.")}),e.jsx(De,{cli:h,open:!!h,onClose:()=>x(null),onChanged:()=>{l()},locale:s})]})}function fe({active:s,onChange:t,locale:n,counts:i}){const l=[{id:"mcp",labelZh:"MCP 服务",labelEn:"MCP",icon:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("circle",{cx:"4",cy:"5",r:"1.6"}),e.jsx("circle",{cx:"20",cy:"5",r:"1.6"}),e.jsx("circle",{cx:"4",cy:"19",r:"1.6"}),e.jsx("circle",{cx:"20",cy:"19",r:"1.6"}),e.jsx("path",{d:"M6 6 l4 4 M18 6 l-4 4 M6 18 l4 -4 M18 18 l-4 -4"})]})},{id:"cli",labelZh:"命令行",labelEn:"CLI",icon:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 17 l5 -5 -5 -5"}),e.jsx("path",{d:"M12 19 h8"})]})},{id:"skill",labelZh:"技能包",labelEn:"Skills",icon:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 2 l3 7 h7 l-5.5 4.5 2 7.5 L12 17 l-6.5 4 2 -7.5 L2 9 h7 z"})})}];return e.jsx(ge,{className:"w-fit bg-panel/80 backdrop-blur",children:l.map(c=>e.jsxs(ve,{active:s===c.id,onClick:()=>t(c.id),className:"gap-1.5 px-3.5",children:[e.jsx("span",{className:"shrink-0",children:c.icon}),e.jsx("span",{children:n==="zh-CN"?c.labelZh:c.labelEn}),i?.[c.id]!==void 0&&e.jsx("span",{className:T("ml-1 inline-flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] font-semibold",s===c.id?"bg-primary/12 text-primary":"bg-inset/70 text-fg-5"),children:i[c.id]})]},c.id))})}function Ve({onOpenBrowserSetup:s}){const t=G(u=>u.locale),i=G(u=>u.state)?.config?.workdir||"",[l,c]=o.useState(()=>{try{const u=localStorage.getItem("pikiclaw:extensions:tab");return u==="mcp"||u==="cli"||u==="skill"?u:"mcp"}catch{return"mcp"}}),x=o.useCallback(u=>{c(u);try{localStorage.setItem("pikiclaw:extensions:tab",u)}catch{}},[]);return e.jsxs("div",{className:"animate-in space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.jsx("div",{className:"space-y-1",children:e.jsx("div",{className:"text-[13px] leading-relaxed text-fg-4",children:a(t,"管理一次授权即可全局复用的服务与工具。项目专属的扩展请在工作台侧栏配置。","One-time authorization, use everywhere. Project-specific extensions live in the Workbench sidebar.")})}),e.jsx(fe,{active:l,onChange:x,locale:t})]}),e.jsxs("div",{className:"animate-in-fade",children:[l==="mcp"&&e.jsx("div",{className:"space-y-7",children:e.jsx(de,{scope:"global",workdir:i,locale:t,onOpenBrowserSetup:s})}),l==="cli"&&e.jsx(me,{locale:t,scope:"global"}),l==="skill"&&e.jsx(xe,{scope:"global",workdir:i,locale:t})]},l)]})}function Ye({workdir:s}){const t=G(c=>c.locale),[n,i]=o.useState(()=>{try{const c=localStorage.getItem("pikiclaw:extensions-ws:tab");return c==="mcp"||c==="cli"||c==="skill"?c:"mcp"}catch{return"mcp"}}),l=o.useCallback(c=>{i(c);try{localStorage.setItem("pikiclaw:extensions-ws:tab",c)}catch{}},[]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsx("div",{className:"text-[13px] leading-relaxed text-fg-4",children:a(t,"仅对当前工作区生效 — 依赖项目目录的本地服务和专属技能包。","Scoped to this workspace — local services that depend on project context and project-specific skill packs.")}),e.jsx(fe,{active:n,onChange:l,locale:t})]}),e.jsxs("div",{className:"animate-in-fade",children:[n==="mcp"&&e.jsx(de,{scope:"workspace",workdir:s,locale:t}),n==="cli"&&e.jsx(me,{locale:t,scope:"workspace"}),n==="skill"&&e.jsx(xe,{scope:"workspace",workdir:s,locale:t})]},n)]})}export{Ve as ExtensionsTab,Ye as WorkspaceExtensionsBody};
|