pikiclaw 0.3.39 → 0.3.41
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/dashboard/dist/assets/{AgentTab-DmKQYVz1.js → AgentTab-BFG_wBIC.js} +1 -1
- package/dashboard/dist/assets/{BrandIcon-KSnFdk62.js → BrandIcon-CmIkwB4h.js} +1 -1
- package/dashboard/dist/assets/{DirBrowser-BqA8ssEC.js → DirBrowser-BzqSOCzY.js} +1 -1
- package/dashboard/dist/assets/{ExtensionsTab-B86en9KI.js → ExtensionsTab-GyHiQaZK.js} +1 -1
- package/dashboard/dist/assets/{IMAccessTab-6L_l5Y5A.js → IMAccessTab-CO_5ztrR.js} +1 -1
- package/dashboard/dist/assets/{Modal-Dk3jQZ_G.js → Modal-Cx6r2XJQ.js} +1 -1
- package/dashboard/dist/assets/{Modals-BoS_lRW5.js → Modals-BnORfmhY.js} +1 -1
- package/dashboard/dist/assets/{Select-CCtTUA2O.js → Select-DLAvmM_i.js} +1 -1
- package/dashboard/dist/assets/{SessionPanel-DA6GsYqZ.js → SessionPanel-D2kHNUr3.js} +1 -1
- package/dashboard/dist/assets/{SystemTab-BQV-kjCS.js → SystemTab-BkgF1WI4.js} +1 -1
- package/dashboard/dist/assets/index-B_sC2ppg.js +5 -0
- package/dashboard/dist/assets/index-DZy1Xu_H.js +19 -0
- package/dashboard/dist/assets/{shared-CVa9npgA.js → shared-C-0W57w0.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/agent/drivers/claude.js +57 -0
- package/dist/agent/drivers/codex.js +7 -1
- package/dist/agent/handover.js +130 -0
- package/dist/agent/index.js +3 -1
- package/dist/agent/session.js +25 -11
- package/dist/bot/bot.js +146 -66
- package/dist/bot/commands.js +24 -4
- package/dist/dashboard/routes/sessions.js +8 -2
- package/dist/dashboard/session-control.js +104 -2
- package/package.json +1 -1
- package/dashboard/dist/assets/index-BS_RBT-T.js +0 -5
- package/dashboard/dist/assets/index-C-Dh421o.js +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,b as Oe}from"./react-vendor-DTcmqLiz.js";import{c as Q,u as V,k as D,a as G,B as z,S as Z,b as De,g as te,E as Ne}from"./index-BS_RBT-T.js";import{B as ee}from"./BrandIcon-KSnFdk62.js";import{M as ue,a as me,L as K,I as X}from"./Modal-Dk3jQZ_G.js";import{S as ie}from"./Select-CCtTUA2O.js";import{A as ye,S as $e}from"./shared-CVa9npgA.js";import"./router-Cav8lq-m.js";function we(n,t){return!!(n&&t instanceof Node&&n.contains(t))}function He(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 Fe({value:n,options:t,onChange:a,className:s,placeholder:l="—",disabled:r=!1,searchPlaceholder:d="Search models...",noMatchesText:j="No matches",currentLabel:k="Current"}){const o=t.find(f=>f.value===n),c=t.length<=1,[u,N]=i.useState(!1),[A,w]=i.useState(""),[S,E]=i.useState(null),B=i.useRef(null),R=i.useRef(null),v=i.useRef(null);i.useEffect(()=>{if(!u)return;const f=T=>{we(B.current,T.target)||we(R.current,T.target)||N(!1)},L=T=>{T.key==="Escape"&&N(!1)};return document.addEventListener("mousedown",f),document.addEventListener("keydown",L),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",L)}},[u]),i.useEffect(()=>{u||w("")},[u]),i.useEffect(()=>{if(u){const f=window.setTimeout(()=>v.current?.focus(),0);return()=>window.clearTimeout(f)}},[u]),i.useLayoutEffect(()=>{if(!u)return;const f=()=>{const L=B.current;if(!L)return;const T=L.getBoundingClientRect(),M=window.innerHeight-T.bottom-12,I=T.top-12,P=M<280&&I>M,F=Math.max(220,Math.min(360,P?I:M));E({left:T.left,top:P?Math.max(12,T.top-F-8):T.bottom+8,width:T.width,maxHeight:F})};return f(),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),()=>{window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0)}},[u]);const g=i.useMemo(()=>A.trim().toLowerCase().split(/\s+/).filter(Boolean),[A]),h=i.useMemo(()=>t.filter(f=>f.value!==n&&He(f,g)),[t,n,g]);if(c)return e.jsx("div",{className:Q("flex h-9 w-full items-center rounded-md border border-edge bg-panel-alt px-3 text-[13px] text-fg-5 shadow-none",r&&"cursor-not-allowed",s),children:e.jsx("span",{className:Q("truncate",!o&&"text-fg-6"),children:o?.label||l})});const y=f=>{r||(a(f),N(!1))},C=(f,L)=>e.jsxs("button",{type:"button",role:"option","aria-selected":L,onClick:()=>y(f.value),className:Q("flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left text-[13px] transition-colors duration-200",L?"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.jsx("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:f.label}),f.meta&&e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-5",children:f.meta})]})}),L&&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"})})]},f.value),$=u&&S?Oe.createPortal(e.jsxs("div",{ref:R,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:S.left,top:S.top,width:S.width,maxHeight:S.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:v,type:"text",value:A,onChange:f=>w(f.target.value),placeholder:d,spellCheck:!1,autoComplete:"off",className:Q("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:[o&&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:k}),C(o,!0),e.jsx("div",{className:"my-1.5 border-t border-edge"})]}),h.length>0?h.map(f=>C(f,!1)):e.jsx("div",{className:"px-3 py-3 text-center text-[12px] text-fg-5",children:j})]})]}),document.body):null;return e.jsxs("div",{ref:B,className:Q("relative",s),children:[e.jsxs("button",{type:"button",disabled:r,"aria-haspopup":"listbox","aria-expanded":u,onClick:()=>N(f=>!f),className:Q("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",u&&"border-control-border-h bg-control-h shadow-[0_0_0_4px_var(--th-glow-a)]"),children:[e.jsx("span",{className:Q("min-w-0 flex-1 truncate",!o&&"text-fg-5"),children:o?.label||l}),e.jsx("span",{className:Q("pointer-events-none absolute inset-y-0 right-3 flex items-center text-fg-4 transition-transform duration-200",u&&"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"})})})]}),$]})}const le=[{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 Ue(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 he={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 Ce(n,t){return t==="zh-CN"?he[n].zh:he[n].en}async function fe(n){return(await fetch(n)).json()}async function se(n,t,a){return(await fetch(t,{method:n,headers:{"Content-Type":"application/json"},body:a?JSON.stringify(a):void 0})).json()}function Ee(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==="1234"?"lmstudio":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:l,template:r,boundAgents:d=[]}=n,j=!!l,k=l?Ee(l):r?.id??"custom",o=l?.name??(r?a==="zh-CN"?r.name.zh:r.name.en:""),c=r?a==="zh-CN"?r.blurb.zh:r.blurb.en:"",u=l?.validation?.state??null,N=()=>{if(!l)return null;if(u==="ready"){const w=l.validation?.modelCount;return e.jsx(D,{variant:"ok",children:w!=null?t.modelsAvailable(w):t.validationReady})}return u==="invalid"?e.jsx(D,{variant:"err",children:t.validationInvalid}):u==="error"?e.jsx(D,{variant:"warn",children:t.validationError}):e.jsx(D,{variant:"warn",children:t.validationUnvalidated})},A=()=>j&&d.length>0?e.jsxs("div",{className:"flex items-center gap-1.5 text-[11.5px] text-fg-5",children:[e.jsx("span",{className:"shrink-0",children:t.boundN(d.length)}),e.jsx("div",{className:"flex items-center gap-0.5",children:d.slice(0,4).map(w=>e.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full border border-edge bg-panel",title:w,children:e.jsx(ee,{brand:w,size:10})},w))})]}):j&&l.validation?.detail&&u!=="ready"?e.jsx("div",{className:"truncate text-[11.5px] leading-relaxed text-fg-4",title:l.validation.detail,children:l.validation.detail}):e.jsx("div",{className:"truncate text-[11.5px] leading-relaxed text-fg-5",title:c,children:c});return e.jsxs("button",{type:"button",onClick:()=>s(n),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(ee,{brand:k,size:32}),N()]}),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:o}),e.jsx("div",{className:"mt-1",children:A()})]})]})}function ge(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 _e({open:n,copy:t,locale:a,initial:s,initialTemplateName:l,existingProvider:r,onClose:d,onSaved:j,onRemove:k}){const[o,c]=i.useState(()=>s||ge(le[0],a)),[u,N]=i.useState(!1),[A,w]=i.useState(null);i.useEffect(()=>{n&&(c(s||ge(le[0],a)),w(null))},[n,s,a]);const S=!!r,E=!!l||S,B=i.useCallback(async()=>{w(null),N(!0);try{const v=o.credMode==="env"?{source:"env",varName:o.envVar.trim()}:o.credMode==="command"?{source:"command",argv:o.cmdLine.trim().split(/\s+/).filter(Boolean)}:null;let g;if(S&&r){const y={name:o.name.trim()||r.name,baseURL:o.baseURL.trim()};o.credMode==="paste"&&o.apiKey?y.apiKey=o.apiKey:v&&(y.credentialRef=v);const C=await se("PATCH",`/api/models/providers/${r.id}`,y);if(!C.ok){w(C.error||"Failed to update provider");return}g=r.id}else{const y={kind:o.kind,name:o.name.trim()||`${Ce(o.kind,a)}`,baseURL:o.baseURL.trim()};o.credMode==="paste"?y.apiKey=o.apiKey:v&&(y.credentialRef=v);const C=await se("POST","/api/models/providers",y);if(!C.ok||!C.provider){w(C.error||"Failed to create provider");return}g=C.provider.id}const h=await se("POST",`/api/models/providers/${g}/validate`);if(j(),h.validation&&h.validation.state!=="ready"){w(`${t.validationInvalid}: ${h.validation.detail}`);return}d()}catch(v){w(v?.message||String(v))}finally{N(!1)}},[o,S,r,a,j,d,t.validationInvalid]),R=!u&&o.name.trim().length>0&&o.baseURL.trim().length>0&&(o.credMode!=="paste"||(S?!0:o.apiKey.length>0))&&(o.credMode!=="env"||o.envVar.trim().length>0)&&(o.credMode!=="command"||o.cmdLine.trim().length>0);return e.jsxs(ue,{open:n,onClose:d,children:[e.jsx(me,{title:S?t.modalEditTitle:t.modalAddTitle,description:S?t.modalEditHint:t.modalAddHint(l||null),onClose:d}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(K,{children:t.fieldName}),e.jsx(X,{value:o.name,onChange:v=>c(g=>({...g,name:v.target.value})),placeholder:t.fieldNamePlaceholder})]}),E?e.jsxs("div",{children:[e.jsx(K,{children:t.fieldBaseURL}),e.jsx(X,{value:o.baseURL,onChange:v=>c(g=>({...g,baseURL:v.target.value})),placeholder:"https://…"})]}):e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(K,{children:t.fieldKind}),e.jsx(ie,{value:o.kind,options:Object.keys(he).map(v=>({value:v,label:Ce(v,a)})),onChange:v=>c(g=>({...g,kind:v}))})]}),e.jsxs("div",{children:[e.jsx(K,{children:t.fieldBaseURL}),e.jsx(X,{value:o.baseURL,onChange:v=>c(g=>({...g,baseURL:v.target.value})),placeholder:"https://…"})]})]}),e.jsxs("div",{children:[e.jsx(K,{children:t.fieldCredentialSource}),e.jsx(ie,{value:o.credMode,options:[{value:"paste",label:t.credPaste},{value:"env",label:t.credEnv},{value:"command",label:t.credCommand}],onChange:v=>c(g=>({...g,credMode:v}))})]}),o.credMode==="paste"&&e.jsxs("div",{children:[e.jsx(K,{children:t.fieldApiKey}),e.jsx(X,{type:"password",value:o.apiKey,onChange:v=>c(g=>({...g,apiKey:v.target.value})),placeholder:S?"••••••••":"sk-…"}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children:t.fieldApiKeyHint})]}),o.credMode==="env"&&e.jsxs("div",{children:[e.jsx(K,{children:t.fieldEnvVar}),e.jsx(X,{value:o.envVar,onChange:v=>c(g=>({...g,envVar:v.target.value})),placeholder:"OPENROUTER_API_KEY"})]}),o.credMode==="command"&&e.jsxs("div",{children:[e.jsx(K,{children:t.fieldCommand}),e.jsx(X,{value:o.cmdLine,onChange:v=>c(g=>({...g,cmdLine:v.target.value})),placeholder:"op read op://Personal/OpenRouter/key"})]}),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:"mt-6 flex items-center justify-between gap-2 border-t border-edge pt-4",children:[e.jsx("div",{children:S&&k&&e.jsx("button",{type:"button",onClick:()=>{k()},className:"text-[12px] text-fg-5 transition hover:text-[var(--th-err)]",children:t.remove})}),e.jsx(ye,{primary:{label:u?t.saving:t.save,onClick:B,disabled:!R},secondary:{label:t.cancel,onClick:d}})]})]})}function Le(){const[n,t]=i.useState([]),[a,s]=i.useState([]),[l,r]=i.useState({}),d=i.useCallback(async()=>{const[k,o,c]=await Promise.all([fe("/api/models/providers"),fe("/api/models/profiles"),fe("/api/models/agents")]);t(k.providers||[]),s(o.profiles||[]);const u={};for(const N of c.bindings||[])u[N.agent]=N.activeProfileId;r(u)},[]),j=i.useCallback(async(k,o)=>{await se("POST",`/api/models/agents/${k}/active`,{profileId:o}),await d()},[d]);return i.useEffect(()=>{d()},[d]),{providers:n,profiles:a,bindings:l,reload:d,setActiveProfile:j}}function ke(n){return n.replace(/\/+$/,"").replace(/^http:\/\/localhost(?=[:/]|$)/i,"http://127.0.0.1").replace(/^https:\/\/localhost(?=[:/]|$)/i,"https://127.0.0.1")}function Me(n,t){const a=ke(n.baseURL);return t.some(s=>ke(s.openAIBaseURL)===a)}function Ke({snapshot:n,localBackends:t}={}){const a=Le(),s=n??a,{providers:l,profiles:r,bindings:d,reload:j}=s,k=t??[],o=V(h=>h.locale),c=i.useMemo(()=>Ue(o),[o]);V(h=>h.toast);const[u,N]=i.useState(null),A=i.useMemo(()=>{const h=new Map,y=new Map(r.map(C=>[C.id,C]));for(const[C,$]of Object.entries(d)){if(!$)continue;const f=y.get($);f&&(h.has(f.providerId)||h.set(f.providerId,[]),h.get(f.providerId).push(C))}return h},[d,r]),w=i.useCallback(async h=>{confirm(c.removeConfirm)&&(await se("DELETE",`/api/models/providers/${h.id}`),await j())},[c,j]),S=i.useMemo(()=>{if(!u||u.kind!=="edit")return null;const{provider:h}=u;return{name:h.name,kind:h.kind,baseURL:h.baseURL,credMode:"paste",apiKey:"",envVar:le.find(y=>y.kind===h.kind)?.envVar||"API_KEY",cmdLine:"op read op://Personal/Provider/key"}},[u]),E=i.useMemo(()=>!u||u.kind!=="add"?null:ge(u.template,o),[u,o]),B=u&&u.kind==="add"&&u.template.id!=="custom"?o==="zh-CN"?u.template.name.zh:u.template.name.en:null,R=i.useMemo(()=>{const h=new Map;for(const y of l){const C=Ee(y);h.has(C)||h.set(C,y)}return h},[l]),v=i.useMemo(()=>{const h=l.filter(f=>!Me(f,k)),y=new Set,C=[];for(const f of le){if(f.id==="custom")continue;const L=R.get(f.id);L&&!Me(L,k)?(y.add(L.id),C.push({template:f,provider:L,boundAgents:A.get(L.id)??[]})):C.push({template:f})}for(const f of h)y.has(f.id)||C.push({provider:f,boundAgents:A.get(f.id)??[]});const $=le.find(f=>f.id==="custom");return $&&C.push({template:$}),C},[l,R,k,A]),g=i.useCallback(h=>{if(h.provider){N({kind:"edit",provider:h.provider});return}h.template&&N({kind:"add",template:h.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:v.map((h,y)=>e.jsx(ze,{desc:h,copy:c,locale:o,onPick:g},h.provider?.id??`tpl-${h.template?.id??y}`))}),u&&e.jsx(_e,{open:!0,copy:c,locale:o,initial:u.kind==="edit"?S:E,initialTemplateName:B,existingProvider:u.kind==="edit"?u.provider:void 0,onClose:()=>N(null),onSaved:j,onRemove:u.kind==="edit"?async()=>{await w(u.provider),N(null)}:void 0})]})}const Ve=4;function Ge(n){return n==="zh-CN"?{sectionLabel:"接入本地后端",hostLabel:"本机",hostUnknown:"检测中…",refresh:"刷新",refreshing:"刷新中…",loadFailed:"加载失败",tileStatusDetected:"已运行",tileStatusNotDetected:"未检测到",tileStatusConnected:"已接入",tileBadgeReadyToConnect:"可接入",tileBadgeConnectedWithModels:t=>`可用 ${t} 个模型`,tileBlurbOllama:"本地一键拉取开源模型,OpenAI 兼容端口",tileBlurbLmstudio:"可视化加载 GGUF 模型,零配置 OpenAI 端口",tileNotDetectedHint:"未在本机检测到,点击查看安装与接入流程",tileInstalledModels:t=>`已下载 ${t} 个模型`,modalTitle:t=>`接入 ${t}`,modalDescription:t=>`按顺序完成 3 步:检测后端、安装/校验模型、接入到智能体。完成后 ${t} 会作为一个供应商出现在上方模型供应商列表中。`,stepStatus:"后端状态",stepModels:"模型",stepConnect:"接入智能体",statusRunning:"已运行",statusNotRunning:"未在本机检测到此后端",statusRecheck:"重新检测",statusRechecking:"检测中…",statusInstallHint:t=>`安装并启动 ${t},然后点击重新检测。`,statusHomepageCta:"官网",modelsInstalledHeader:t=>`已安装(${t})`,modelsInstalledEmpty:"尚未下载任何模型。",modelsRecommendedHeader:"推荐安装",modelsBackendOffline:"启动后端后即可在此安装和管理模型。",fitOk:"推荐",fitTight:"勉强可跑",fitNoGo:"内存不足",modelInstalledBadge:"已安装",pullCta:"下载",pullInProgress:"下载中",pullCancel:"取消",pullStatusManifest:"获取清单…",pullStatusVerifying:"校验中…",pullStatusWriting:"写入中…",pullStatusDone:"下载完成",pullFailed:"下载失败",pullCommandHint:"LM Studio 没有 HTTP 拉取接口,请在终端执行:",copyCommand:"复制命令",copied:"已复制",connectCta:"接入",connecting:"接入中…",connectedBadge:"已接入",connectHint:"接入后会作为一个供应商出现在「模型供应商」中,并可绑定到任意智能体卡片。",connectAvailableHint:"后端已就绪,可立即接入。即使尚未下载模型,也可以稍后再来下载。",connectNeedsBackend:"请先启动后端后再接入。",closeBtn:"完成",cancelBtn:"取消",toastConnected:"已接入,可在智能体卡片选择该供应商",toastAlreadyConnected:"此后端已接入",toastConnectFailed:"接入失败",toastPulled:"模型已下载"}:{sectionLabel:"Connect local backend",hostLabel:"This Mac",hostUnknown:"Detecting…",refresh:"Refresh",refreshing:"Refreshing…",loadFailed:"Failed to load local backends",tileStatusDetected:"Running",tileStatusNotDetected:"Not detected",tileStatusConnected:"Connected",tileBadgeReadyToConnect:"Ready to connect",tileBadgeConnectedWithModels:t=>`${t} models available`,tileBlurbOllama:"One-click open-source models, OpenAI-compatible endpoint",tileBlurbLmstudio:"Visual GGUF loader, zero-config OpenAI endpoint",tileNotDetectedHint:"Not detected on this machine — click to see install + connect steps",tileInstalledModels:t=>`${t} models pulled`,modalTitle:t=>`Connect ${t}`,modalDescription:t=>`Walk through 3 steps: detect the backend, install/verify models, connect to agents. After connecting, ${t} appears as a provider in the Model Providers list above.`,stepStatus:"Backend status",stepModels:"Models",stepConnect:"Connect to agents",statusRunning:"Running",statusNotRunning:"Backend not detected on this machine",statusRecheck:"Re-check",statusRechecking:"Checking…",statusInstallHint:t=>`Install and launch ${t}, then click Re-check.`,statusHomepageCta:"Homepage",modelsInstalledHeader:t=>`Installed (${t})`,modelsInstalledEmpty:"No models pulled yet.",modelsRecommendedHeader:"Recommended",modelsBackendOffline:"Launch the backend to install or manage models here.",fitOk:"Recommended",fitTight:"Tight fit",fitNoGo:"Not enough RAM",modelInstalledBadge:"Installed",pullCta:"Download",pullInProgress:"Downloading",pullCancel:"Cancel",pullStatusManifest:"Fetching manifest…",pullStatusVerifying:"Verifying…",pullStatusWriting:"Writing manifest…",pullStatusDone:"Download complete",pullFailed:"Download failed",pullCommandHint:"LM Studio has no HTTP pull API; run this in a terminal:",copyCommand:"Copy",copied:"Copied",connectCta:"Connect",connecting:"Connecting…",connectedBadge:"Connected",connectHint:"Once connected, this backend appears as a provider in Model Providers above and can be bound to any agent card.",connectAvailableHint:"Backend is ready. You can connect now and pull models later.",connectNeedsBackend:"Start the backend first, then connect.",closeBtn:"Done",cancelBtn:"Cancel",toastConnected:"Connected — pick it in any agent's Provider dropdown",toastAlreadyConnected:"Backend is already connected",toastConnectFailed:"Connect failed",toastPulled:"Model downloaded"}}function xe(n,t){return n===null?"tight":n>=t+Ve?"ok":n>=t?"tight":"no-go"}function We(n,t){return n==="ollama"&&t.ollamaTag?`ollama pull ${t.ollamaTag}`:n==="lmstudio"&&t.lmstudioId?`lms get ${t.lmstudioId}`:null}function Ye(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==="ollama"?!!a.ollamaTag:!!a.lmstudioId)}function ve(n,t){const a=t.id==="ollama"?n.ollamaTag:n.lmstudioId;if(!a)return null;const s=a.split(":")[0].toLowerCase();for(const l of t.models)if(l.id.toLowerCase().startsWith(s))return l.id;return null}const Re={status:"idle",fraction:null,phase:"",error:null};function Qe(n,t){if(n.error)return{phase:n.error,fraction:null};const a=(n.status||"").toLowerCase();return a.startsWith("pulling manifest")?{phase:t.pullStatusManifest,fraction:null}:a.startsWith("verifying")?{phase:t.pullStatusVerifying,fraction:null}:a.startsWith("writing")?{phase:t.pullStatusWriting,fraction:null}:a==="success"?{phase:t.pullStatusDone,fraction:1}:a.startsWith("downloading")&&typeof n.total=="number"&&typeof n.completed=="number"&&n.total>0?{phase:`${Math.round(n.completed/n.total*100)}%`,fraction:n.completed/n.total}:{phase:n.status||"",fraction:null}}function Pe(){const[n,t]=i.useState([]),[a,s]=i.useState([]),[l,r]=i.useState(!0),[d,j]=i.useState(null),k=i.useCallback(async()=>{r(!0),j(null);try{const o=await G.probeLocalModels();if(!o.ok)throw new Error(o.error||"Failed to load local backends");t(o.backends||[]),s(o.catalog||[])}catch(o){j(o?.message||String(o))}finally{r(!1)}},[]);return i.useEffect(()=>{k()},[k]),{backends:n,catalog:a,loading:l,error:d,refresh:k}}function Je({backend:n,copy:t,onClick:a}){const s=!!n.existingProviderId,l=n.id==="ollama"?t.tileBlurbOllama:t.tileBlurbLmstudio,r=s?e.jsx(D,{variant:"ok",children:n.models.length>0?t.tileBadgeConnectedWithModels(n.models.length):t.tileStatusConnected}):n.detected?e.jsx(D,{variant:"warn",children:t.tileBadgeReadyToConnect}):null,d=n.detected?`${n.version?`v${n.version} · `:""}${t.tileInstalledModels(n.models.length)}`:l;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(ee,{brand:n.id,size:32}),r]}),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 pe({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 Xe({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 et({entry:n,backend:t,totalRamGb:a,pull:s,copy:l,locale:r,onStartPull:d,onCancelPull:j,onCopyHint:k}){const o=xe(a,n.minRamGb),c=r==="zh-CN"?n.descriptionZh:n.description,u=ve(n,t),N=t.id==="ollama",A=We(t.id,n);let w="none";return!u&&o!=="no-go"&&(N&&t.detected&&n.ollamaTag?w="pull":N&&!t.detected?w="wait":!N&&A&&(w="lm-copy")),e.jsx("div",{className:"rounded-md border border-edge bg-panel-alt px-3 py-2.5",children:e.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",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}),o==="ok"&&e.jsx(D,{variant:"ok",children:l.fitOk}),o==="tight"&&e.jsx(D,{variant:"warn",children:l.fitTight}),o==="no-go"&&e.jsx(D,{variant:"err",children:l.fitNoGo}),u&&e.jsx(D,{variant:"accent",children:l.modelInstalledBadge})]}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-fg-4",children:c}),e.jsxs("div",{className:"mt-1 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:r==="zh-CN"?"模型主页":"Model card"})]}),(s.status==="running"||s.status==="error")&&e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-fg-4",children:[e.jsx("span",{children:s.status==="error"?`${l.pullFailed}: ${s.error}`:s.phase}),s.status==="running"&&e.jsx("button",{type:"button",onClick:()=>j(n),className:"text-[11px] text-fg-5 underline-offset-2 hover:text-fg-3 hover:underline",children:l.pullCancel})]}),e.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-panel",children:e.jsx("div",{className:s.status==="error"?"h-full bg-rose-500/70":"h-full bg-accent",style:{width:s.fraction!==null?`${Math.max(2,Math.round(s.fraction*100))}%`:"12%",transition:"width 200ms linear",animation:s.fraction===null&&s.status==="running"?"pulse 1.6s ease-in-out infinite":void 0}})})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 self-start",children:[w==="pull"&&e.jsx(z,{variant:"primary",size:"sm",disabled:s.status==="running",onClick:()=>d(n),children:s.status==="running"?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-3 w-3"})," ",s.phase||l.pullInProgress]}):l.pullCta}),w==="lm-copy"&&A&&e.jsx("button",{type:"button",onClick:()=>k(A),className:"rounded-md border border-edge bg-panel px-2 py-1 font-mono text-[11px] text-fg-3 transition hover:border-edge-strong hover:bg-panel-alt",title:l.copyCommand,children:A}),w==="wait"&&e.jsx("span",{className:"text-[11px] text-fg-5",children:l.connectNeedsBackend})]})]})})}function tt({open:n,backend:t,catalog:a,totalRamGb:s,copy:l,locale:r,busyConnect:d,onClose:j,onConnect:k,onRefresh:o,onStartPull:c,onCancelPull:u,pulls:N,onCopyHint:A}){const[w,S]=i.useState(!1);i.useEffect(()=>{S(!1)},[t?.detected,t?.id]);const E=i.useMemo(()=>t?Ze(t.id,a).sort((g,h)=>{const y=xe(s,g.minRamGb),C=xe(s,h.minRamGb),$=T=>T==="ok"?0:T==="tight"?1:2,f=ve(g,t)?0:1,L=ve(h,t)?0:1;return f!==L?f-L:$(y)-$(C)}):[],[t,a,s]);if(!t)return null;const B=t.id==="ollama",R=!!t.existingProviderId,v=async()=>{S(!0);try{await o()}finally{S(!1)}};return e.jsxs(ue,{open:n,onClose:j,wide:!0,children:[e.jsx(me,{title:l.modalTitle(t.label),description:l.modalDescription(t.label),onClose:j}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{className:"space-y-2",children:[e.jsx(pe,{index:1,label:l.stepStatus,done:t.detected}),e.jsx("div",{className:"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(ee,{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}),t.detected?e.jsx(D,{variant:"ok",children:l.statusRunning}):e.jsx(D,{variant:"muted",children:l.tileStatusNotDetected})]}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children: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.statusInstallHint(t.label)})})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!t.detected&&t.installHint.brewFormula&&e.jsxs("code",{className:"rounded-md border border-edge bg-panel px-2 py-1 text-[11px] text-fg-3",children:["brew install ",t.installHint.brewFormula]}),!t.detected&&e.jsx("a",{href:t.installHint.homepage,target:"_blank",rel:"noreferrer",className:"text-[12px] text-accent underline-offset-2 hover:underline",children:l.statusHomepageCta}),e.jsx(z,{variant:"outline",size:"sm",disabled:w,onClick:()=>{v()},children:w?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-3 w-3"})," ",l.statusRechecking]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"↻"})," ",l.statusRecheck]})})]})]})})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx(pe,{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(g=>e.jsx(Xe,{name:g.id,sizeBytes:g.sizeBytes},g.id))})]}),E.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:E.map(g=>e.jsx(et,{entry:g,backend:t,totalRamGb:s,pull:N[g.id]??Re,copy:l,locale:r,onStartPull:c,onCancelPull:u,onCopyHint:A},g.id))}),!B&&e.jsx("div",{className:"text-[11px] leading-relaxed text-fg-5",children:l.pullCommandHint})]})]}):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.jsxs("section",{className:"space-y-2",children:[e.jsx(pe,{index:3,label:l.stepConnect,done:R}),e.jsx("div",{className:"rounded-md border border-edge bg-panel-alt px-3.5 py-3",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:R?e.jsx(D,{variant:"accent",children:l.connectedBadge}):t.detected?e.jsx(D,{variant:"ok",children:l.statusRunning}):e.jsx(D,{variant:"muted",children:l.tileStatusNotDetected})}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-fg-4",children:R?l.connectHint:t.detected?l.connectAvailableHint:l.connectNeedsBackend})]}),!R&&e.jsx(z,{variant:"primary",size:"sm",disabled:!t.detected||d,onClick:()=>{k(t)},children:d?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-3 w-3"})," ",l.connecting]}):l.connectCta})]})})]})]}),e.jsx("div",{className:"mt-6 border-t border-edge pt-4",children:e.jsx(ye,{primary:{label:l.closeBtn,onClick:j},secondary:R?void 0:{label:l.cancelBtn,onClick:j}})})]})}function nt({snapshot:n,onConnected:t}){const a=V(M=>M.locale),s=V(M=>M.toast),l=V(M=>M.host),r=i.useMemo(()=>Ge(a),[a]),d=Pe(),j=n??d,{backends:k,catalog:o,loading:c,error:u,refresh:N}=j,[A,w]=i.useState(null),[S,E]=i.useState(null),[B,R]=i.useState({}),v=i.useRef({}),g=i.useMemo(()=>k.find(M=>M.id===A)??null,[k,A]),h=i.useCallback(async M=>{E(M.id);try{const I=await G.connectLocalBackend(M.id);if(!I.ok)throw new Error(I.error||r.toastConnectFailed);s(I.alreadyConnected?r.toastAlreadyConnected:r.toastConnected),await N(),t&&await t()}catch(I){s(`${r.toastConnectFailed}: ${I?.message||String(I)}`,!1)}finally{E(null)}},[r,t,N,s]),y=i.useCallback(M=>{navigator.clipboard?.writeText(M),s(r.copied)},[r.copied,s]),C=i.useCallback((M,I)=>{R(P=>({...P,[M]:{...P[M]??Re,...I}}))},[]),$=i.useCallback(async M=>{if(!M.ollamaTag)return;const I=M.id;C(I,{status:"running",fraction:null,phase:r.pullStatusManifest,error:null});const P=G.pullLocalModel("ollama",M.ollamaTag);v.current[I]=P.cancel;let F=!1;try{for await(const m of P.events){if(m.error)throw new Error(m.error);const{phase:p,fraction:O}=Qe(m,r);C(I,{phase:p,fraction:O??null}),m.status==="success"&&(F=!0)}if(F){C(I,{status:"done",fraction:1,phase:r.pullStatusDone,error:null}),s(r.toastPulled),await N();const m=k.find(p=>p.id==="ollama");if(m&&!m.existingProviderId)try{await G.connectLocalBackend("ollama"),await N()}catch{}t&&await t()}else C(I,{status:"error",error:r.pullFailed,fraction:null})}catch(m){const p=m?.name==="AbortError"?r.pullCancel:m?.message||String(m);C(I,{status:"error",error:p,fraction:null})}finally{delete v.current[I]}},[k,r,t,N,s,C]),f=i.useCallback(M=>{const I=v.current[M.id];I&&I()},[]);i.useEffect(()=>()=>{for(const M of Object.values(v.current))try{M()}catch{}},[]);const L=l?.totalMem?l.totalMem/1024**3:null,T=l?`${l.cpuModel||l.arch} · ${Ye(l.totalMem)} RAM`:r.hostUnknown,W=k.length>0?k:[{id:"ollama",label:"Ollama",detected:!1,baseURL:"http://127.0.0.1:11434",openAIBaseURL:"http://127.0.0.1:11434/v1",models:[],existingProviderId:null,installHint:{homepage:"https://ollama.com/download",brewFormula:"ollama"}},{id:"lmstudio",label:"LM Studio",detected:!1,baseURL:"http://127.0.0.1:1234",openAIBaseURL:"http://127.0.0.1:1234/v1",models:[],existingProviderId:null,installHint:{homepage:"https://lmstudio.ai/"}}];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:r.hostLabel}),e.jsx("span",{className:"mx-2 text-fg-6",children:"·"}),e.jsx("span",{className:"text-fg-3",children:T})]}),e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{N()},disabled:c,children:c?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-3 w-3"})," ",r.refreshing]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"↻"})," ",r.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:r.sectionLabel}),e.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:W.map(M=>e.jsx(Je,{backend:M,copy:r,locale:a,onClick:()=>w(M.id)},M.id))})]}),u&&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:u}),e.jsx(tt,{open:A!==null,backend:g,catalog:o,totalRamGb:L,copy:r,locale:a,busyConnect:!!g&&S===g.id,onClose:()=>w(null),onConnect:h,onRefresh:N,onStartPull:$,onCancelPull:f,pulls:B,onCopyHint:y})]})}const ce="__native__",at=["claude","codex","gemini","hermes"];function Ie(n){return n===void 0||!Number.isFinite(n)?null:n===0?"$0":n<.01?`$${n.toFixed(4)}`:n<1?`$${n.toFixed(3)}`:n<10?`$${n.toFixed(2)}`:`$${n.toFixed(1)}`}function lt(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 st(n){if(!n||!Number.isFinite(n))return null;const t=n>32e9?n:n*1e3,a=new Date(t);return Number.isNaN(a.getTime())?null:a.toLocaleDateString(void 0,{year:"numeric",month:"short"})}function it(n){const t=n.id,a=[],s=n.name?.trim();s&&s.toLowerCase()!==n.id.toLowerCase()&&a.push(s);const l=Ie(n.pricePromptUsd),r=Ie(n.priceCompletionUsd);l&&r?a.push(`${l} / ${r} per 1M`):l&&a.push(`${l} prompt / 1M`);const d=lt(n.contextLength);d&&a.push(d);const j=st(n.created);return j&&a.push(j),{label:t,description:a.length?a.join(" · "):void 0}}function rt(n){return n==="hermes"}function ot(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 dt(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 Ae(n,t){const a=n.bindings[t];if(!a)return null;const s=n.profiles.find(r=>r.id===a);if(!s)return null;const l=n.providers.find(r=>r.id===s.providerId);return l?{profileId:s.id,providerId:l.id,providerName:l.name,providerBrand:dt(l),modelId:s.modelId,effort:s.effort||null}:null}function ct(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:"安装中…",modelsTitle:"模型供应商",modelsHint:"接入 BYOK 供应商;接入后可在上方任一智能体卡片的「供应商」下拉中选用。",localTitle:"本地模型",localHint:"在本机检测 Ollama / LM Studio 并按内存推荐合适的开源模型;接入后会作为一个供应商出现在智能体卡片中。",rowProvider:"供应商",rowModel:"模型",rowEffort:"推理强度",providerNative:"官方(CLI 内置认证)",providerNativeFromAgent:"智能体自身配置",effortDefault:"默认",modelLoading:"正在拉取模型列表…",modelEmpty:"该供应商未返回模型列表,请使用自定义输入。",modelCustomToggle:"改为自定义输入",modelListToggle:"从列表选择",modelCustomPlaceholder:"anthropic/claude-sonnet-4",modelSearchPlaceholder:"搜索模型",modelSearchEmpty:"没有匹配的模型",modelCurrentLabel:"当前",saveChanges:"保存",saving:"保存中…",cancel:"撤销",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…",modelsTitle:"Model Providers",modelsHint:"Connect BYOK providers; pick one in any agent card above.",localTitle:"Local Models",localHint:"Detect Ollama / LM Studio 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",saveChanges:"Save",saving:"Saving…",cancel:"Reset",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 ut(n,t){const a=n.filter(l=>l.installed);return(a.length?a:n).map(l=>({value:l.agent,label:`${te(l.agent).label} · ${l.installed?l.version||t.installed:t.notInstalled}`}))}function mt(n){return n.nativeSelectedModel?n.nativeSelectedModel:n.nativeConfig?.model?n.nativeConfig.model:n.models.length?n.models[0].id:""}function Se(n,t){n({defaultAgent:t.defaultAgent,agents:t.agents})}function ft(n,t,a){if(a)return{providerId:a.providerId,modelId:a.modelId,effort:a.effort||"",modelMode:"list"};const s=t?.nativeConfig||null;return{providerId:ce,modelId:s?.model||t?.selectedModel||"",effort:s?.effort||t?.selectedEffort||"",modelMode:"list"}}function pt(n,t){return n.providerId===t.providerId&&n.modelId.trim()===t.modelId.trim()&&(n.effort||"")===(t.effort||"")}function ht({agentId:n,agentStatus:t,boundInfo:a,copy:s,layer:l,toast:r,onSaved:d}){const j=rt(n),k=t.nativeConfig||null,o=i.useMemo(()=>ft(n,t,a),[n,t,a]),[c,u]=i.useState(o),[N,A]=i.useState(!1),[w,S]=i.useState(null);i.useEffect(()=>{u(o),S(null)},[o]);const E=c.providerId===ce,B=E&&j,[R,v]=i.useState([]),[g,h]=i.useState(!1),[y,C]=i.useState(null);i.useEffect(()=>{if(E){v([]),C(null),h(!1);return}let m=!1;return h(!0),C(null),fetch(`/api/models/providers/${c.providerId}/models`).then(p=>p.json()).then(p=>{m||(p.ok?p.modelInfos&&p.modelInfos.length?v(p.modelInfos):v((p.models||[]).map(O=>({id:O}))):(C(p.error||"Failed to load models"),v([])))}).catch(p=>{m||(C(p?.message||String(p)),v([]))}).finally(()=>{m||h(!1)}),()=>{m=!0}},[c.providerId,E]);const $=i.useMemo(()=>R.map(m=>m.id),[R]),f=i.useMemo(()=>t.models.map(m=>m.id),[t]),L=E?f:$;i.useEffect(()=>{if(!g){if(E){c.modelMode==="custom"&&u(m=>({...m,modelMode:"list"}));return}L.length===0&&c.modelMode==="list"&&u(m=>({...m,modelMode:"custom"}))}},[L,g,c.modelMode,E]);const T=i.useMemo(()=>{const m=j?`${s.providerNativeFromAgent}${k?.provider?` · ${k.provider}`:""}`:s.providerNative,p=[{value:ce,label:m}];for(const O of l.providers)p.push({value:O.id,label:O.name});return p},[j,k,l.providers,s.providerNative,s.providerNativeFromAgent]),W=i.useMemo(()=>{const m=Ne[n]||Ne.claude;return[{value:"",label:s.effortDefault},...m.map(p=>({value:p,label:p}))]},[n,s.effortDefault]),M=i.useMemo(()=>{let m;return E?m=t.models.map(p=>{const O=p.alias?.toLowerCase().replace(/[\s_-]/g,""),Y=p.id.toLowerCase().replace(/[\s_-]/g,""),U=p.alias&&O!==Y;return{value:p.id,label:p.id,description:U?p.alias:void 0}}):m=R.map(p=>({value:p.id,...it(p)})),c.modelMode==="list"&&c.modelId&&!m.some(p=>p.value===c.modelId)&&m.unshift({value:c.modelId,label:c.modelId}),m},[E,t.models,R,c.modelMode,c.modelId]),I=!pt(c,o),P=!N&&I&&(B||!!c.modelId.trim()),F=i.useCallback(async()=>{S(null),A(!0);try{const m=c.effort||null,p=c.modelId.trim();if(E){const O=l.bindings[n],Y=O?l.profiles.find(U=>U.id===O):null;if(O&&await l.setActiveProfile(n,null),Y&&await fetch(`/api/models/profiles/${Y.id}`,{method:"DELETE"}),!j){const U={agent:n};if(p&&p!==(t.selectedModel||"")&&(U.model=p),m!==(t.selectedEffort||null)&&(U.effort=m),Object.keys(U).length>1){const q=await G.updateRuntimeAgent(U);if(!q.ok)throw new Error(q.error||"Failed to update agent")}}}else{const O=l.providers.find(_=>_.id===c.providerId);if(!O)throw new Error("Provider not found");const Y=te(n),U=l.bindings[n],q=U?l.profiles.find(_=>_.id===U):null,re={providerId:O.id,modelId:p,effort:m,name:`${Y.label} · ${O.name}`};let ne=q?.id;if(q){const _=await fetch(`/api/models/profiles/${q.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}).then(ae=>ae.json());if(!_.ok)throw new Error(_.error||"Failed to update profile")}else{const _=await fetch("/api/models/profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}).then(ae=>ae.json());if(!_.ok)throw new Error(_.error||"Failed to create profile");ne=_.profile?.id}ne&&await l.setActiveProfile(n,ne)}await Promise.resolve(d()),r(s.saved)}catch(m){const p=m?.message||String(m);S(p),r(`${s.configError}: ${p}`,!1)}finally{A(!1)}},[n,t,s,c,j,E,l,d,r]);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx(K,{className:"!mb-1 text-[11px]",children:s.rowProvider}),e.jsx(ie,{value:c.providerId,options:T,onChange:m=>u(p=>{if(m===p.providerId)return p;const O={...p,providerId:m,modelId:"",modelMode:"list"};return m===ce&&(O.modelId=mt(t),O.effort=t.nativeSelectedEffort||t.nativeConfig?.effort||""),O})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-baseline justify-between gap-2",children:[e.jsx(K,{className:"!mb-0 text-[11px]",children:s.rowModel}),!B&&!E&&e.jsx("button",{type:"button",onClick:()=>u(m=>({...m,modelMode:m.modelMode==="list"?"custom":"list"})),className:"text-[10px] text-fg-5 underline-offset-2 transition hover:text-fg-3 hover:underline",children:c.modelMode==="list"?s.modelCustomToggle:s.modelListToggle})]}),B?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:k?.model||s.noModel})}):c.modelMode==="list"?g&&!E?e.jsxs("div",{className:"flex h-9 items-center gap-2 rounded-md border border-control-border bg-control px-3 text-[13px] text-fg-5",children:[e.jsx(Z,{className:"h-3.5 w-3.5"}),s.modelLoading]}):e.jsx(Fe,{value:c.modelId,options:M,onChange:m=>u(p=>({...p,modelId:m})),placeholder:L.length?"—":s.modelEmpty,searchPlaceholder:s.modelSearchPlaceholder,noMatchesText:s.modelSearchEmpty,currentLabel:s.modelCurrentLabel}):e.jsx(X,{value:c.modelId,onChange:m=>u(p=>({...p,modelId:m.target.value})),placeholder:s.modelCustomPlaceholder})]}),e.jsxs("div",{children:[e.jsx(K,{className:"!mb-1 text-[11px]",children:s.rowEffort}),B?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:k?.effort||s.effortDefault})}):e.jsx(ie,{value:c.effort,options:W,onChange:m=>u(p=>({...p,effort:m}))})]})]}),B&&e.jsx("div",{className:"text-[11px] leading-relaxed text-fg-5",children:s.externalNativeNote(k?.configPath||"")}),(w||y)&&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:w||y}),I&&e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>u(o),disabled:N,children:s.cancel}),e.jsx(z,{variant:"primary",size:"sm",disabled:!P,onClick:()=>{F()},children:N?s.saving:s.saveChanges})]})]})}function gt(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,l=s?.provider||null;return{providerBrand:ot(l),providerLabel:a.rowSummaryNative,modelText:n.nativeSelectedModel||s?.model||n.selectedModel||a.rowSummaryNoModel,effortText:n.nativeSelectedEffort||s?.effort||n.selectedEffort||a.rowSummaryNoEffort}}function xt({agent:n,copy:t,t:a,installing:s,onInstall:l,updatingAgent:r,checkingAgent:d,onUpdate:j,onCheckUpdate:k,onEdit:o,loading:c=!1,boundInfo:u}){const N=te(n.agent),A=N.advantageKey?a(N.advantageKey):"",w=n.installed?gt(n,u,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:A||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(ee,{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:N.label}),n.isDefault&&e.jsx(D,{variant:"accent",children:t.defaultBadge}),c?e.jsxs(D,{variant:"muted",children:[e.jsx(Z,{className:"h-3 w-3"})," ",a("status.loading")]}):n.installed?e.jsx(D,{variant:"ok",children:t.installed}):e.jsx(D,{variant:"muted",children:t.notInstalled}),n.installed&&n.updateAvailable&&e.jsx(D,{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]})]}),w?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(ee,{brand:w.providerBrand,size:11}),e.jsx("span",{className:"text-fg-3",children:w.providerLabel})]}),e.jsx("span",{className:"text-fg-6","aria-hidden":"true",children:"·"}),e.jsx("span",{className:"font-mono text-fg-3",children:w.modelText}),e.jsx("span",{className:"text-fg-6","aria-hidden":"true",children:"·"}),e.jsx("span",{children:w.effortText})]}):A?e.jsx("div",{className:"mt-0.5 truncate text-[11px] text-fg-5",children:A}):null]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[c&&e.jsx("div",{className:"inline-flex h-7 items-center gap-2 px-2 text-[11px] text-fg-5",children:e.jsx(Z,{className:"h-3 w-3"})}),!c&&!n.installed&&e.jsx(z,{variant:"primary",size:"sm",disabled:s,onClick:()=>l(n),children:s?t.installing:t.install}),!c&&n.installed&&n.updateAvailable&&e.jsx(z,{variant:"outline",size:"sm",disabled:r,onClick:()=>j(n),children:r?t.updating:t.update}),!c&&n.installed&&!n.updateAvailable&&e.jsx(z,{variant:"ghost",size:"icon",disabled:d,onClick:()=>k(n),title:t.checkUpdate,"aria-label":t.checkUpdate,className:"h-7 w-7",children:d?e.jsx(Z,{className:"h-3 w-3"}):e.jsx("span",{"aria-hidden":"true",children:"↻"})}),!c&&n.installed&&e.jsx(z,{variant:"outline",size:"sm",onClick:()=>o(n),children:t.configure})]})]}),!c&&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]}),!c&&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 Mt(){const n=V(x=>x.locale),t=V(x=>x.toast),a=V(x=>x.agentStatus),s=V(x=>x.setAgentStatus),l=V(x=>x.refreshAgentStatus),r=i.useMemo(()=>De(n),[n]),d=i.useMemo(()=>ct(n),[n]),j=Le(),k=Pe(),[o,c]=i.useState(a?{defaultAgent:a.defaultAgent,agents:a.agents}:null),[u,N]=i.useState(!a),[A,w]=i.useState(null),[S,E]=i.useState(!1),[B,R]=i.useState(null),[v,g]=i.useState(!1),[h,y]=i.useState("codex"),[C,$]=i.useState(null),[f,L]=i.useState(null),[T,W]=i.useState(null),M=i.useRef(!!a);i.useEffect(()=>{a&&(Se(c,a),M.current||(M.current=!0,N(!1)))},[a]);const I=i.useCallback(x=>{Se(c,x),s(x)},[s]),P=i.useCallback(async()=>{M.current||N(!0);try{const x=await G.getAgentStatus();return I(x),w(null),M.current=!0,x}catch(x){const b=x instanceof Error?x.message:d.loadFailed;return w(b),M.current||t(b,!1),null}finally{N(!1)}},[I,d.loadFailed,t]);i.useEffect(()=>{a?l():P()},[]);const F=i.useMemo(()=>{const x=o?.agents||[],b=new Map(x.map(H=>[H.agent,H]));return at.map(H=>{const je=b.get(H);if(je)return je;const Te=te(H);return{agent:H,label:Te.label,installed:!1,version:void 0,installCommand:void 0,selectedModel:null,selectedEffort:null,isDefault:o?.defaultAgent===H,models:[],usage:null}})},[o]),m=o?.defaultAgent||"codex",p=F.find(x=>x.agent===m)||null,Y=F.filter(x=>x.installed).length>0,U=ut(F,d),q=i.useCallback(async x=>{E(!0);try{const b=await G.updateRuntimeAgent(x);if(!b.ok)throw new Error(b.error||r("config.applyFailed"));return I(b),b}catch(b){const H=b instanceof Error?b.message:r("config.applyFailed");return t(H,!1),P(),null}finally{E(!1)}},[I,P,r,t]);i.useEffect(()=>{v&&y(m)},[m,v]);const re=i.useCallback(async()=>{if(h===m){g(!1);return}await q({defaultAgent:h})&&(t(d.defaultsSaved),g(!1))},[d.defaultsSaved,m,h,t,q]),ne=i.useCallback(async x=>{if(!B){R(x.agent);try{const b=await G.installAgent(x.agent);if(!b.ok)throw new Error(b.error||r("config.agentInstallFailed"));I(b),t(r("config.agentInstalled"))}catch(b){const H=b instanceof Error?b.message:r("config.agentInstallFailed");t(H,!1),P()}finally{R(b=>b===x.agent?null:b)}}},[I,B,P,r,t]),_=i.useCallback(async x=>{if(!C){$(x.agent);try{const b=await G.updateAgent(x.agent);if(!b.ok)throw new Error(b.error||r("config.agentInstallFailed"));I(b),t(d.upToDate)}catch(b){const H=b instanceof Error?b.message:d.updateFailed;t(H,!1),P()}finally{$(b=>b===x.agent?null:b)}}},[I,d.updateFailed,d.upToDate,P,r,t,C]),ae=i.useCallback(async x=>{if(!f){L(x.agent);try{const b=await G.checkAgentUpdate(x.agent);if(!b.ok)throw new Error(b.error||d.loadFailed);I(b)}catch(b){const H=b instanceof Error?b.message:d.loadFailed;t(H,!1),P()}finally{L(b=>b===x.agent?null:b)}}},[I,f,d.loadFailed,P,t]),oe=u&&!o,Be=oe?r("status.loading"):p?te(p.agent).label:d.notInstalled;oe?r("status.loading"):p?.installed?d.installed:d.notInstalled;const be=i.useCallback(async()=>{await j.reload(),await P()},[j,P]),J=T?F.find(x=>x.agent===T)??null:null,de=J?te(J.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}),oe?e.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-fg-5",children:[e.jsx(Z,{className:"h-3 w-3"}),e.jsx("span",{children:d.defaultAgent})]}):e.jsxs("button",{type:"button",onClick:()=>g(!0),disabled:S||!Y,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(ee,{brand:m,size:14}),e.jsx("span",{className:"font-semibold text-fg-2",children:Be}),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:F.map(x=>e.jsx(xt,{agent:x,copy:d,t:r,installing:B===x.agent,loading:oe,onInstall:ne,updatingAgent:C===x.agent,checkingAgent:f===x.agent,onUpdate:_,onCheckUpdate:ae,onEdit:b=>W(b.agent),boundInfo:Ae(j,x.agent)},x.agent))})]}),A&&e.jsx($e,{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:A}),e.jsx(z,{variant:"outline",size:"sm",onClick:()=>{P()},children:r("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.modelsTitle}),e.jsx("div",{className:"mt-0.5 text-[13px] leading-relaxed text-fg-4",children:d.modelsHint})]})}),e.jsx(Ke,{snapshot:j,localBackends:k.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(nt,{snapshot:k,onConnected:be})]}),e.jsx(ue,{open:!!J,onClose:()=>W(null),wide:!0,children:J&&de&&e.jsxs(e.Fragment,{children:[e.jsx(me,{title:d.configModalTitle(de.label),description:de.advantageKey?r(de.advantageKey):void 0,onClose:()=>W(null)}),e.jsx(ht,{agentId:J.agent,agentStatus:J,boundInfo:Ae(j,J.agent),copy:d,layer:j,toast:t,onSaved:async()=>{await be(),W(null)}})]})}),e.jsxs(ue,{open:v,onClose:()=>g(!1),children:[e.jsx(me,{title:d.defaultsEditTitle,description:d.defaultsEditHint,onClose:()=>g(!1)}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(K,{children:d.defaultAgent}),e.jsx(ie,{value:h,options:U,onChange:x=>y(x),disabled:S||!Y,placeholder:d.notInstalled})]})}),e.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[e.jsx(z,{variant:"ghost",onClick:()=>g(!1),children:r("modal.cancel")}),e.jsx(z,{variant:"primary",disabled:S||h===m,onClick:()=>{re()},children:r(S?"config.validating":"modal.save")})]})]})]})}export{Mt as AgentTab,Mt as default};
|
|
1
|
+
import{r as i,j as e,b as Oe}from"./react-vendor-DTcmqLiz.js";import{c as Q,u as V,k as D,a as G,B as z,S as Z,b as De,g as te,E as Ne}from"./index-B_sC2ppg.js";import{B as ee}from"./BrandIcon-CmIkwB4h.js";import{M as ue,a as me,L as K,I as X}from"./Modal-Cx6r2XJQ.js";import{S as ie}from"./Select-DLAvmM_i.js";import{A as ye,S as $e}from"./shared-C-0W57w0.js";import"./router-Cav8lq-m.js";function we(n,t){return!!(n&&t instanceof Node&&n.contains(t))}function He(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 Fe({value:n,options:t,onChange:a,className:s,placeholder:l="—",disabled:r=!1,searchPlaceholder:d="Search models...",noMatchesText:j="No matches",currentLabel:k="Current"}){const o=t.find(f=>f.value===n),c=t.length<=1,[u,N]=i.useState(!1),[A,w]=i.useState(""),[S,E]=i.useState(null),B=i.useRef(null),R=i.useRef(null),v=i.useRef(null);i.useEffect(()=>{if(!u)return;const f=T=>{we(B.current,T.target)||we(R.current,T.target)||N(!1)},L=T=>{T.key==="Escape"&&N(!1)};return document.addEventListener("mousedown",f),document.addEventListener("keydown",L),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",L)}},[u]),i.useEffect(()=>{u||w("")},[u]),i.useEffect(()=>{if(u){const f=window.setTimeout(()=>v.current?.focus(),0);return()=>window.clearTimeout(f)}},[u]),i.useLayoutEffect(()=>{if(!u)return;const f=()=>{const L=B.current;if(!L)return;const T=L.getBoundingClientRect(),M=window.innerHeight-T.bottom-12,I=T.top-12,P=M<280&&I>M,F=Math.max(220,Math.min(360,P?I:M));E({left:T.left,top:P?Math.max(12,T.top-F-8):T.bottom+8,width:T.width,maxHeight:F})};return f(),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),()=>{window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0)}},[u]);const g=i.useMemo(()=>A.trim().toLowerCase().split(/\s+/).filter(Boolean),[A]),h=i.useMemo(()=>t.filter(f=>f.value!==n&&He(f,g)),[t,n,g]);if(c)return e.jsx("div",{className:Q("flex h-9 w-full items-center rounded-md border border-edge bg-panel-alt px-3 text-[13px] text-fg-5 shadow-none",r&&"cursor-not-allowed",s),children:e.jsx("span",{className:Q("truncate",!o&&"text-fg-6"),children:o?.label||l})});const y=f=>{r||(a(f),N(!1))},C=(f,L)=>e.jsxs("button",{type:"button",role:"option","aria-selected":L,onClick:()=>y(f.value),className:Q("flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left text-[13px] transition-colors duration-200",L?"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.jsx("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:f.label}),f.meta&&e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-5",children:f.meta})]})}),L&&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"})})]},f.value),$=u&&S?Oe.createPortal(e.jsxs("div",{ref:R,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:S.left,top:S.top,width:S.width,maxHeight:S.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:v,type:"text",value:A,onChange:f=>w(f.target.value),placeholder:d,spellCheck:!1,autoComplete:"off",className:Q("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:[o&&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:k}),C(o,!0),e.jsx("div",{className:"my-1.5 border-t border-edge"})]}),h.length>0?h.map(f=>C(f,!1)):e.jsx("div",{className:"px-3 py-3 text-center text-[12px] text-fg-5",children:j})]})]}),document.body):null;return e.jsxs("div",{ref:B,className:Q("relative",s),children:[e.jsxs("button",{type:"button",disabled:r,"aria-haspopup":"listbox","aria-expanded":u,onClick:()=>N(f=>!f),className:Q("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",u&&"border-control-border-h bg-control-h shadow-[0_0_0_4px_var(--th-glow-a)]"),children:[e.jsx("span",{className:Q("min-w-0 flex-1 truncate",!o&&"text-fg-5"),children:o?.label||l}),e.jsx("span",{className:Q("pointer-events-none absolute inset-y-0 right-3 flex items-center text-fg-4 transition-transform duration-200",u&&"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"})})})]}),$]})}const le=[{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 Ue(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 he={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 Ce(n,t){return t==="zh-CN"?he[n].zh:he[n].en}async function fe(n){return(await fetch(n)).json()}async function se(n,t,a){return(await fetch(t,{method:n,headers:{"Content-Type":"application/json"},body:a?JSON.stringify(a):void 0})).json()}function Ee(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==="1234"?"lmstudio":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:l,template:r,boundAgents:d=[]}=n,j=!!l,k=l?Ee(l):r?.id??"custom",o=l?.name??(r?a==="zh-CN"?r.name.zh:r.name.en:""),c=r?a==="zh-CN"?r.blurb.zh:r.blurb.en:"",u=l?.validation?.state??null,N=()=>{if(!l)return null;if(u==="ready"){const w=l.validation?.modelCount;return e.jsx(D,{variant:"ok",children:w!=null?t.modelsAvailable(w):t.validationReady})}return u==="invalid"?e.jsx(D,{variant:"err",children:t.validationInvalid}):u==="error"?e.jsx(D,{variant:"warn",children:t.validationError}):e.jsx(D,{variant:"warn",children:t.validationUnvalidated})},A=()=>j&&d.length>0?e.jsxs("div",{className:"flex items-center gap-1.5 text-[11.5px] text-fg-5",children:[e.jsx("span",{className:"shrink-0",children:t.boundN(d.length)}),e.jsx("div",{className:"flex items-center gap-0.5",children:d.slice(0,4).map(w=>e.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full border border-edge bg-panel",title:w,children:e.jsx(ee,{brand:w,size:10})},w))})]}):j&&l.validation?.detail&&u!=="ready"?e.jsx("div",{className:"truncate text-[11.5px] leading-relaxed text-fg-4",title:l.validation.detail,children:l.validation.detail}):e.jsx("div",{className:"truncate text-[11.5px] leading-relaxed text-fg-5",title:c,children:c});return e.jsxs("button",{type:"button",onClick:()=>s(n),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(ee,{brand:k,size:32}),N()]}),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:o}),e.jsx("div",{className:"mt-1",children:A()})]})]})}function ge(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 _e({open:n,copy:t,locale:a,initial:s,initialTemplateName:l,existingProvider:r,onClose:d,onSaved:j,onRemove:k}){const[o,c]=i.useState(()=>s||ge(le[0],a)),[u,N]=i.useState(!1),[A,w]=i.useState(null);i.useEffect(()=>{n&&(c(s||ge(le[0],a)),w(null))},[n,s,a]);const S=!!r,E=!!l||S,B=i.useCallback(async()=>{w(null),N(!0);try{const v=o.credMode==="env"?{source:"env",varName:o.envVar.trim()}:o.credMode==="command"?{source:"command",argv:o.cmdLine.trim().split(/\s+/).filter(Boolean)}:null;let g;if(S&&r){const y={name:o.name.trim()||r.name,baseURL:o.baseURL.trim()};o.credMode==="paste"&&o.apiKey?y.apiKey=o.apiKey:v&&(y.credentialRef=v);const C=await se("PATCH",`/api/models/providers/${r.id}`,y);if(!C.ok){w(C.error||"Failed to update provider");return}g=r.id}else{const y={kind:o.kind,name:o.name.trim()||`${Ce(o.kind,a)}`,baseURL:o.baseURL.trim()};o.credMode==="paste"?y.apiKey=o.apiKey:v&&(y.credentialRef=v);const C=await se("POST","/api/models/providers",y);if(!C.ok||!C.provider){w(C.error||"Failed to create provider");return}g=C.provider.id}const h=await se("POST",`/api/models/providers/${g}/validate`);if(j(),h.validation&&h.validation.state!=="ready"){w(`${t.validationInvalid}: ${h.validation.detail}`);return}d()}catch(v){w(v?.message||String(v))}finally{N(!1)}},[o,S,r,a,j,d,t.validationInvalid]),R=!u&&o.name.trim().length>0&&o.baseURL.trim().length>0&&(o.credMode!=="paste"||(S?!0:o.apiKey.length>0))&&(o.credMode!=="env"||o.envVar.trim().length>0)&&(o.credMode!=="command"||o.cmdLine.trim().length>0);return e.jsxs(ue,{open:n,onClose:d,children:[e.jsx(me,{title:S?t.modalEditTitle:t.modalAddTitle,description:S?t.modalEditHint:t.modalAddHint(l||null),onClose:d}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(K,{children:t.fieldName}),e.jsx(X,{value:o.name,onChange:v=>c(g=>({...g,name:v.target.value})),placeholder:t.fieldNamePlaceholder})]}),E?e.jsxs("div",{children:[e.jsx(K,{children:t.fieldBaseURL}),e.jsx(X,{value:o.baseURL,onChange:v=>c(g=>({...g,baseURL:v.target.value})),placeholder:"https://…"})]}):e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(K,{children:t.fieldKind}),e.jsx(ie,{value:o.kind,options:Object.keys(he).map(v=>({value:v,label:Ce(v,a)})),onChange:v=>c(g=>({...g,kind:v}))})]}),e.jsxs("div",{children:[e.jsx(K,{children:t.fieldBaseURL}),e.jsx(X,{value:o.baseURL,onChange:v=>c(g=>({...g,baseURL:v.target.value})),placeholder:"https://…"})]})]}),e.jsxs("div",{children:[e.jsx(K,{children:t.fieldCredentialSource}),e.jsx(ie,{value:o.credMode,options:[{value:"paste",label:t.credPaste},{value:"env",label:t.credEnv},{value:"command",label:t.credCommand}],onChange:v=>c(g=>({...g,credMode:v}))})]}),o.credMode==="paste"&&e.jsxs("div",{children:[e.jsx(K,{children:t.fieldApiKey}),e.jsx(X,{type:"password",value:o.apiKey,onChange:v=>c(g=>({...g,apiKey:v.target.value})),placeholder:S?"••••••••":"sk-…"}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children:t.fieldApiKeyHint})]}),o.credMode==="env"&&e.jsxs("div",{children:[e.jsx(K,{children:t.fieldEnvVar}),e.jsx(X,{value:o.envVar,onChange:v=>c(g=>({...g,envVar:v.target.value})),placeholder:"OPENROUTER_API_KEY"})]}),o.credMode==="command"&&e.jsxs("div",{children:[e.jsx(K,{children:t.fieldCommand}),e.jsx(X,{value:o.cmdLine,onChange:v=>c(g=>({...g,cmdLine:v.target.value})),placeholder:"op read op://Personal/OpenRouter/key"})]}),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:"mt-6 flex items-center justify-between gap-2 border-t border-edge pt-4",children:[e.jsx("div",{children:S&&k&&e.jsx("button",{type:"button",onClick:()=>{k()},className:"text-[12px] text-fg-5 transition hover:text-[var(--th-err)]",children:t.remove})}),e.jsx(ye,{primary:{label:u?t.saving:t.save,onClick:B,disabled:!R},secondary:{label:t.cancel,onClick:d}})]})]})}function Le(){const[n,t]=i.useState([]),[a,s]=i.useState([]),[l,r]=i.useState({}),d=i.useCallback(async()=>{const[k,o,c]=await Promise.all([fe("/api/models/providers"),fe("/api/models/profiles"),fe("/api/models/agents")]);t(k.providers||[]),s(o.profiles||[]);const u={};for(const N of c.bindings||[])u[N.agent]=N.activeProfileId;r(u)},[]),j=i.useCallback(async(k,o)=>{await se("POST",`/api/models/agents/${k}/active`,{profileId:o}),await d()},[d]);return i.useEffect(()=>{d()},[d]),{providers:n,profiles:a,bindings:l,reload:d,setActiveProfile:j}}function ke(n){return n.replace(/\/+$/,"").replace(/^http:\/\/localhost(?=[:/]|$)/i,"http://127.0.0.1").replace(/^https:\/\/localhost(?=[:/]|$)/i,"https://127.0.0.1")}function Me(n,t){const a=ke(n.baseURL);return t.some(s=>ke(s.openAIBaseURL)===a)}function Ke({snapshot:n,localBackends:t}={}){const a=Le(),s=n??a,{providers:l,profiles:r,bindings:d,reload:j}=s,k=t??[],o=V(h=>h.locale),c=i.useMemo(()=>Ue(o),[o]);V(h=>h.toast);const[u,N]=i.useState(null),A=i.useMemo(()=>{const h=new Map,y=new Map(r.map(C=>[C.id,C]));for(const[C,$]of Object.entries(d)){if(!$)continue;const f=y.get($);f&&(h.has(f.providerId)||h.set(f.providerId,[]),h.get(f.providerId).push(C))}return h},[d,r]),w=i.useCallback(async h=>{confirm(c.removeConfirm)&&(await se("DELETE",`/api/models/providers/${h.id}`),await j())},[c,j]),S=i.useMemo(()=>{if(!u||u.kind!=="edit")return null;const{provider:h}=u;return{name:h.name,kind:h.kind,baseURL:h.baseURL,credMode:"paste",apiKey:"",envVar:le.find(y=>y.kind===h.kind)?.envVar||"API_KEY",cmdLine:"op read op://Personal/Provider/key"}},[u]),E=i.useMemo(()=>!u||u.kind!=="add"?null:ge(u.template,o),[u,o]),B=u&&u.kind==="add"&&u.template.id!=="custom"?o==="zh-CN"?u.template.name.zh:u.template.name.en:null,R=i.useMemo(()=>{const h=new Map;for(const y of l){const C=Ee(y);h.has(C)||h.set(C,y)}return h},[l]),v=i.useMemo(()=>{const h=l.filter(f=>!Me(f,k)),y=new Set,C=[];for(const f of le){if(f.id==="custom")continue;const L=R.get(f.id);L&&!Me(L,k)?(y.add(L.id),C.push({template:f,provider:L,boundAgents:A.get(L.id)??[]})):C.push({template:f})}for(const f of h)y.has(f.id)||C.push({provider:f,boundAgents:A.get(f.id)??[]});const $=le.find(f=>f.id==="custom");return $&&C.push({template:$}),C},[l,R,k,A]),g=i.useCallback(h=>{if(h.provider){N({kind:"edit",provider:h.provider});return}h.template&&N({kind:"add",template:h.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:v.map((h,y)=>e.jsx(ze,{desc:h,copy:c,locale:o,onPick:g},h.provider?.id??`tpl-${h.template?.id??y}`))}),u&&e.jsx(_e,{open:!0,copy:c,locale:o,initial:u.kind==="edit"?S:E,initialTemplateName:B,existingProvider:u.kind==="edit"?u.provider:void 0,onClose:()=>N(null),onSaved:j,onRemove:u.kind==="edit"?async()=>{await w(u.provider),N(null)}:void 0})]})}const Ve=4;function Ge(n){return n==="zh-CN"?{sectionLabel:"接入本地后端",hostLabel:"本机",hostUnknown:"检测中…",refresh:"刷新",refreshing:"刷新中…",loadFailed:"加载失败",tileStatusDetected:"已运行",tileStatusNotDetected:"未检测到",tileStatusConnected:"已接入",tileBadgeReadyToConnect:"可接入",tileBadgeConnectedWithModels:t=>`可用 ${t} 个模型`,tileBlurbOllama:"本地一键拉取开源模型,OpenAI 兼容端口",tileBlurbLmstudio:"可视化加载 GGUF 模型,零配置 OpenAI 端口",tileNotDetectedHint:"未在本机检测到,点击查看安装与接入流程",tileInstalledModels:t=>`已下载 ${t} 个模型`,modalTitle:t=>`接入 ${t}`,modalDescription:t=>`按顺序完成 3 步:检测后端、安装/校验模型、接入到智能体。完成后 ${t} 会作为一个供应商出现在上方模型供应商列表中。`,stepStatus:"后端状态",stepModels:"模型",stepConnect:"接入智能体",statusRunning:"已运行",statusNotRunning:"未在本机检测到此后端",statusRecheck:"重新检测",statusRechecking:"检测中…",statusInstallHint:t=>`安装并启动 ${t},然后点击重新检测。`,statusHomepageCta:"官网",modelsInstalledHeader:t=>`已安装(${t})`,modelsInstalledEmpty:"尚未下载任何模型。",modelsRecommendedHeader:"推荐安装",modelsBackendOffline:"启动后端后即可在此安装和管理模型。",fitOk:"推荐",fitTight:"勉强可跑",fitNoGo:"内存不足",modelInstalledBadge:"已安装",pullCta:"下载",pullInProgress:"下载中",pullCancel:"取消",pullStatusManifest:"获取清单…",pullStatusVerifying:"校验中…",pullStatusWriting:"写入中…",pullStatusDone:"下载完成",pullFailed:"下载失败",pullCommandHint:"LM Studio 没有 HTTP 拉取接口,请在终端执行:",copyCommand:"复制命令",copied:"已复制",connectCta:"接入",connecting:"接入中…",connectedBadge:"已接入",connectHint:"接入后会作为一个供应商出现在「模型供应商」中,并可绑定到任意智能体卡片。",connectAvailableHint:"后端已就绪,可立即接入。即使尚未下载模型,也可以稍后再来下载。",connectNeedsBackend:"请先启动后端后再接入。",closeBtn:"完成",cancelBtn:"取消",toastConnected:"已接入,可在智能体卡片选择该供应商",toastAlreadyConnected:"此后端已接入",toastConnectFailed:"接入失败",toastPulled:"模型已下载"}:{sectionLabel:"Connect local backend",hostLabel:"This Mac",hostUnknown:"Detecting…",refresh:"Refresh",refreshing:"Refreshing…",loadFailed:"Failed to load local backends",tileStatusDetected:"Running",tileStatusNotDetected:"Not detected",tileStatusConnected:"Connected",tileBadgeReadyToConnect:"Ready to connect",tileBadgeConnectedWithModels:t=>`${t} models available`,tileBlurbOllama:"One-click open-source models, OpenAI-compatible endpoint",tileBlurbLmstudio:"Visual GGUF loader, zero-config OpenAI endpoint",tileNotDetectedHint:"Not detected on this machine — click to see install + connect steps",tileInstalledModels:t=>`${t} models pulled`,modalTitle:t=>`Connect ${t}`,modalDescription:t=>`Walk through 3 steps: detect the backend, install/verify models, connect to agents. After connecting, ${t} appears as a provider in the Model Providers list above.`,stepStatus:"Backend status",stepModels:"Models",stepConnect:"Connect to agents",statusRunning:"Running",statusNotRunning:"Backend not detected on this machine",statusRecheck:"Re-check",statusRechecking:"Checking…",statusInstallHint:t=>`Install and launch ${t}, then click Re-check.`,statusHomepageCta:"Homepage",modelsInstalledHeader:t=>`Installed (${t})`,modelsInstalledEmpty:"No models pulled yet.",modelsRecommendedHeader:"Recommended",modelsBackendOffline:"Launch the backend to install or manage models here.",fitOk:"Recommended",fitTight:"Tight fit",fitNoGo:"Not enough RAM",modelInstalledBadge:"Installed",pullCta:"Download",pullInProgress:"Downloading",pullCancel:"Cancel",pullStatusManifest:"Fetching manifest…",pullStatusVerifying:"Verifying…",pullStatusWriting:"Writing manifest…",pullStatusDone:"Download complete",pullFailed:"Download failed",pullCommandHint:"LM Studio has no HTTP pull API; run this in a terminal:",copyCommand:"Copy",copied:"Copied",connectCta:"Connect",connecting:"Connecting…",connectedBadge:"Connected",connectHint:"Once connected, this backend appears as a provider in Model Providers above and can be bound to any agent card.",connectAvailableHint:"Backend is ready. You can connect now and pull models later.",connectNeedsBackend:"Start the backend first, then connect.",closeBtn:"Done",cancelBtn:"Cancel",toastConnected:"Connected — pick it in any agent's Provider dropdown",toastAlreadyConnected:"Backend is already connected",toastConnectFailed:"Connect failed",toastPulled:"Model downloaded"}}function xe(n,t){return n===null?"tight":n>=t+Ve?"ok":n>=t?"tight":"no-go"}function We(n,t){return n==="ollama"&&t.ollamaTag?`ollama pull ${t.ollamaTag}`:n==="lmstudio"&&t.lmstudioId?`lms get ${t.lmstudioId}`:null}function Ye(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==="ollama"?!!a.ollamaTag:!!a.lmstudioId)}function ve(n,t){const a=t.id==="ollama"?n.ollamaTag:n.lmstudioId;if(!a)return null;const s=a.split(":")[0].toLowerCase();for(const l of t.models)if(l.id.toLowerCase().startsWith(s))return l.id;return null}const Re={status:"idle",fraction:null,phase:"",error:null};function Qe(n,t){if(n.error)return{phase:n.error,fraction:null};const a=(n.status||"").toLowerCase();return a.startsWith("pulling manifest")?{phase:t.pullStatusManifest,fraction:null}:a.startsWith("verifying")?{phase:t.pullStatusVerifying,fraction:null}:a.startsWith("writing")?{phase:t.pullStatusWriting,fraction:null}:a==="success"?{phase:t.pullStatusDone,fraction:1}:a.startsWith("downloading")&&typeof n.total=="number"&&typeof n.completed=="number"&&n.total>0?{phase:`${Math.round(n.completed/n.total*100)}%`,fraction:n.completed/n.total}:{phase:n.status||"",fraction:null}}function Pe(){const[n,t]=i.useState([]),[a,s]=i.useState([]),[l,r]=i.useState(!0),[d,j]=i.useState(null),k=i.useCallback(async()=>{r(!0),j(null);try{const o=await G.probeLocalModels();if(!o.ok)throw new Error(o.error||"Failed to load local backends");t(o.backends||[]),s(o.catalog||[])}catch(o){j(o?.message||String(o))}finally{r(!1)}},[]);return i.useEffect(()=>{k()},[k]),{backends:n,catalog:a,loading:l,error:d,refresh:k}}function Je({backend:n,copy:t,onClick:a}){const s=!!n.existingProviderId,l=n.id==="ollama"?t.tileBlurbOllama:t.tileBlurbLmstudio,r=s?e.jsx(D,{variant:"ok",children:n.models.length>0?t.tileBadgeConnectedWithModels(n.models.length):t.tileStatusConnected}):n.detected?e.jsx(D,{variant:"warn",children:t.tileBadgeReadyToConnect}):null,d=n.detected?`${n.version?`v${n.version} · `:""}${t.tileInstalledModels(n.models.length)}`:l;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(ee,{brand:n.id,size:32}),r]}),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 pe({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 Xe({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 et({entry:n,backend:t,totalRamGb:a,pull:s,copy:l,locale:r,onStartPull:d,onCancelPull:j,onCopyHint:k}){const o=xe(a,n.minRamGb),c=r==="zh-CN"?n.descriptionZh:n.description,u=ve(n,t),N=t.id==="ollama",A=We(t.id,n);let w="none";return!u&&o!=="no-go"&&(N&&t.detected&&n.ollamaTag?w="pull":N&&!t.detected?w="wait":!N&&A&&(w="lm-copy")),e.jsx("div",{className:"rounded-md border border-edge bg-panel-alt px-3 py-2.5",children:e.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",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}),o==="ok"&&e.jsx(D,{variant:"ok",children:l.fitOk}),o==="tight"&&e.jsx(D,{variant:"warn",children:l.fitTight}),o==="no-go"&&e.jsx(D,{variant:"err",children:l.fitNoGo}),u&&e.jsx(D,{variant:"accent",children:l.modelInstalledBadge})]}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-fg-4",children:c}),e.jsxs("div",{className:"mt-1 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:r==="zh-CN"?"模型主页":"Model card"})]}),(s.status==="running"||s.status==="error")&&e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-fg-4",children:[e.jsx("span",{children:s.status==="error"?`${l.pullFailed}: ${s.error}`:s.phase}),s.status==="running"&&e.jsx("button",{type:"button",onClick:()=>j(n),className:"text-[11px] text-fg-5 underline-offset-2 hover:text-fg-3 hover:underline",children:l.pullCancel})]}),e.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-panel",children:e.jsx("div",{className:s.status==="error"?"h-full bg-rose-500/70":"h-full bg-accent",style:{width:s.fraction!==null?`${Math.max(2,Math.round(s.fraction*100))}%`:"12%",transition:"width 200ms linear",animation:s.fraction===null&&s.status==="running"?"pulse 1.6s ease-in-out infinite":void 0}})})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 self-start",children:[w==="pull"&&e.jsx(z,{variant:"primary",size:"sm",disabled:s.status==="running",onClick:()=>d(n),children:s.status==="running"?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-3 w-3"})," ",s.phase||l.pullInProgress]}):l.pullCta}),w==="lm-copy"&&A&&e.jsx("button",{type:"button",onClick:()=>k(A),className:"rounded-md border border-edge bg-panel px-2 py-1 font-mono text-[11px] text-fg-3 transition hover:border-edge-strong hover:bg-panel-alt",title:l.copyCommand,children:A}),w==="wait"&&e.jsx("span",{className:"text-[11px] text-fg-5",children:l.connectNeedsBackend})]})]})})}function tt({open:n,backend:t,catalog:a,totalRamGb:s,copy:l,locale:r,busyConnect:d,onClose:j,onConnect:k,onRefresh:o,onStartPull:c,onCancelPull:u,pulls:N,onCopyHint:A}){const[w,S]=i.useState(!1);i.useEffect(()=>{S(!1)},[t?.detected,t?.id]);const E=i.useMemo(()=>t?Ze(t.id,a).sort((g,h)=>{const y=xe(s,g.minRamGb),C=xe(s,h.minRamGb),$=T=>T==="ok"?0:T==="tight"?1:2,f=ve(g,t)?0:1,L=ve(h,t)?0:1;return f!==L?f-L:$(y)-$(C)}):[],[t,a,s]);if(!t)return null;const B=t.id==="ollama",R=!!t.existingProviderId,v=async()=>{S(!0);try{await o()}finally{S(!1)}};return e.jsxs(ue,{open:n,onClose:j,wide:!0,children:[e.jsx(me,{title:l.modalTitle(t.label),description:l.modalDescription(t.label),onClose:j}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{className:"space-y-2",children:[e.jsx(pe,{index:1,label:l.stepStatus,done:t.detected}),e.jsx("div",{className:"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(ee,{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}),t.detected?e.jsx(D,{variant:"ok",children:l.statusRunning}):e.jsx(D,{variant:"muted",children:l.tileStatusNotDetected})]}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-fg-5",children: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.statusInstallHint(t.label)})})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!t.detected&&t.installHint.brewFormula&&e.jsxs("code",{className:"rounded-md border border-edge bg-panel px-2 py-1 text-[11px] text-fg-3",children:["brew install ",t.installHint.brewFormula]}),!t.detected&&e.jsx("a",{href:t.installHint.homepage,target:"_blank",rel:"noreferrer",className:"text-[12px] text-accent underline-offset-2 hover:underline",children:l.statusHomepageCta}),e.jsx(z,{variant:"outline",size:"sm",disabled:w,onClick:()=>{v()},children:w?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-3 w-3"})," ",l.statusRechecking]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"↻"})," ",l.statusRecheck]})})]})]})})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx(pe,{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(g=>e.jsx(Xe,{name:g.id,sizeBytes:g.sizeBytes},g.id))})]}),E.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:E.map(g=>e.jsx(et,{entry:g,backend:t,totalRamGb:s,pull:N[g.id]??Re,copy:l,locale:r,onStartPull:c,onCancelPull:u,onCopyHint:A},g.id))}),!B&&e.jsx("div",{className:"text-[11px] leading-relaxed text-fg-5",children:l.pullCommandHint})]})]}):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.jsxs("section",{className:"space-y-2",children:[e.jsx(pe,{index:3,label:l.stepConnect,done:R}),e.jsx("div",{className:"rounded-md border border-edge bg-panel-alt px-3.5 py-3",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:R?e.jsx(D,{variant:"accent",children:l.connectedBadge}):t.detected?e.jsx(D,{variant:"ok",children:l.statusRunning}):e.jsx(D,{variant:"muted",children:l.tileStatusNotDetected})}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-fg-4",children:R?l.connectHint:t.detected?l.connectAvailableHint:l.connectNeedsBackend})]}),!R&&e.jsx(z,{variant:"primary",size:"sm",disabled:!t.detected||d,onClick:()=>{k(t)},children:d?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-3 w-3"})," ",l.connecting]}):l.connectCta})]})})]})]}),e.jsx("div",{className:"mt-6 border-t border-edge pt-4",children:e.jsx(ye,{primary:{label:l.closeBtn,onClick:j},secondary:R?void 0:{label:l.cancelBtn,onClick:j}})})]})}function nt({snapshot:n,onConnected:t}){const a=V(M=>M.locale),s=V(M=>M.toast),l=V(M=>M.host),r=i.useMemo(()=>Ge(a),[a]),d=Pe(),j=n??d,{backends:k,catalog:o,loading:c,error:u,refresh:N}=j,[A,w]=i.useState(null),[S,E]=i.useState(null),[B,R]=i.useState({}),v=i.useRef({}),g=i.useMemo(()=>k.find(M=>M.id===A)??null,[k,A]),h=i.useCallback(async M=>{E(M.id);try{const I=await G.connectLocalBackend(M.id);if(!I.ok)throw new Error(I.error||r.toastConnectFailed);s(I.alreadyConnected?r.toastAlreadyConnected:r.toastConnected),await N(),t&&await t()}catch(I){s(`${r.toastConnectFailed}: ${I?.message||String(I)}`,!1)}finally{E(null)}},[r,t,N,s]),y=i.useCallback(M=>{navigator.clipboard?.writeText(M),s(r.copied)},[r.copied,s]),C=i.useCallback((M,I)=>{R(P=>({...P,[M]:{...P[M]??Re,...I}}))},[]),$=i.useCallback(async M=>{if(!M.ollamaTag)return;const I=M.id;C(I,{status:"running",fraction:null,phase:r.pullStatusManifest,error:null});const P=G.pullLocalModel("ollama",M.ollamaTag);v.current[I]=P.cancel;let F=!1;try{for await(const m of P.events){if(m.error)throw new Error(m.error);const{phase:p,fraction:O}=Qe(m,r);C(I,{phase:p,fraction:O??null}),m.status==="success"&&(F=!0)}if(F){C(I,{status:"done",fraction:1,phase:r.pullStatusDone,error:null}),s(r.toastPulled),await N();const m=k.find(p=>p.id==="ollama");if(m&&!m.existingProviderId)try{await G.connectLocalBackend("ollama"),await N()}catch{}t&&await t()}else C(I,{status:"error",error:r.pullFailed,fraction:null})}catch(m){const p=m?.name==="AbortError"?r.pullCancel:m?.message||String(m);C(I,{status:"error",error:p,fraction:null})}finally{delete v.current[I]}},[k,r,t,N,s,C]),f=i.useCallback(M=>{const I=v.current[M.id];I&&I()},[]);i.useEffect(()=>()=>{for(const M of Object.values(v.current))try{M()}catch{}},[]);const L=l?.totalMem?l.totalMem/1024**3:null,T=l?`${l.cpuModel||l.arch} · ${Ye(l.totalMem)} RAM`:r.hostUnknown,W=k.length>0?k:[{id:"ollama",label:"Ollama",detected:!1,baseURL:"http://127.0.0.1:11434",openAIBaseURL:"http://127.0.0.1:11434/v1",models:[],existingProviderId:null,installHint:{homepage:"https://ollama.com/download",brewFormula:"ollama"}},{id:"lmstudio",label:"LM Studio",detected:!1,baseURL:"http://127.0.0.1:1234",openAIBaseURL:"http://127.0.0.1:1234/v1",models:[],existingProviderId:null,installHint:{homepage:"https://lmstudio.ai/"}}];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:r.hostLabel}),e.jsx("span",{className:"mx-2 text-fg-6",children:"·"}),e.jsx("span",{className:"text-fg-3",children:T})]}),e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{N()},disabled:c,children:c?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-3 w-3"})," ",r.refreshing]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"↻"})," ",r.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:r.sectionLabel}),e.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:W.map(M=>e.jsx(Je,{backend:M,copy:r,locale:a,onClick:()=>w(M.id)},M.id))})]}),u&&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:u}),e.jsx(tt,{open:A!==null,backend:g,catalog:o,totalRamGb:L,copy:r,locale:a,busyConnect:!!g&&S===g.id,onClose:()=>w(null),onConnect:h,onRefresh:N,onStartPull:$,onCancelPull:f,pulls:B,onCopyHint:y})]})}const ce="__native__",at=["claude","codex","gemini","hermes"];function Ie(n){return n===void 0||!Number.isFinite(n)?null:n===0?"$0":n<.01?`$${n.toFixed(4)}`:n<1?`$${n.toFixed(3)}`:n<10?`$${n.toFixed(2)}`:`$${n.toFixed(1)}`}function lt(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 st(n){if(!n||!Number.isFinite(n))return null;const t=n>32e9?n:n*1e3,a=new Date(t);return Number.isNaN(a.getTime())?null:a.toLocaleDateString(void 0,{year:"numeric",month:"short"})}function it(n){const t=n.id,a=[],s=n.name?.trim();s&&s.toLowerCase()!==n.id.toLowerCase()&&a.push(s);const l=Ie(n.pricePromptUsd),r=Ie(n.priceCompletionUsd);l&&r?a.push(`${l} / ${r} per 1M`):l&&a.push(`${l} prompt / 1M`);const d=lt(n.contextLength);d&&a.push(d);const j=st(n.created);return j&&a.push(j),{label:t,description:a.length?a.join(" · "):void 0}}function rt(n){return n==="hermes"}function ot(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 dt(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 Ae(n,t){const a=n.bindings[t];if(!a)return null;const s=n.profiles.find(r=>r.id===a);if(!s)return null;const l=n.providers.find(r=>r.id===s.providerId);return l?{profileId:s.id,providerId:l.id,providerName:l.name,providerBrand:dt(l),modelId:s.modelId,effort:s.effort||null}:null}function ct(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:"安装中…",modelsTitle:"模型供应商",modelsHint:"接入 BYOK 供应商;接入后可在上方任一智能体卡片的「供应商」下拉中选用。",localTitle:"本地模型",localHint:"在本机检测 Ollama / LM Studio 并按内存推荐合适的开源模型;接入后会作为一个供应商出现在智能体卡片中。",rowProvider:"供应商",rowModel:"模型",rowEffort:"推理强度",providerNative:"官方(CLI 内置认证)",providerNativeFromAgent:"智能体自身配置",effortDefault:"默认",modelLoading:"正在拉取模型列表…",modelEmpty:"该供应商未返回模型列表,请使用自定义输入。",modelCustomToggle:"改为自定义输入",modelListToggle:"从列表选择",modelCustomPlaceholder:"anthropic/claude-sonnet-4",modelSearchPlaceholder:"搜索模型",modelSearchEmpty:"没有匹配的模型",modelCurrentLabel:"当前",saveChanges:"保存",saving:"保存中…",cancel:"撤销",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…",modelsTitle:"Model Providers",modelsHint:"Connect BYOK providers; pick one in any agent card above.",localTitle:"Local Models",localHint:"Detect Ollama / LM Studio 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",saveChanges:"Save",saving:"Saving…",cancel:"Reset",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 ut(n,t){const a=n.filter(l=>l.installed);return(a.length?a:n).map(l=>({value:l.agent,label:`${te(l.agent).label} · ${l.installed?l.version||t.installed:t.notInstalled}`}))}function mt(n){return n.nativeSelectedModel?n.nativeSelectedModel:n.nativeConfig?.model?n.nativeConfig.model:n.models.length?n.models[0].id:""}function Se(n,t){n({defaultAgent:t.defaultAgent,agents:t.agents})}function ft(n,t,a){if(a)return{providerId:a.providerId,modelId:a.modelId,effort:a.effort||"",modelMode:"list"};const s=t?.nativeConfig||null;return{providerId:ce,modelId:s?.model||t?.selectedModel||"",effort:s?.effort||t?.selectedEffort||"",modelMode:"list"}}function pt(n,t){return n.providerId===t.providerId&&n.modelId.trim()===t.modelId.trim()&&(n.effort||"")===(t.effort||"")}function ht({agentId:n,agentStatus:t,boundInfo:a,copy:s,layer:l,toast:r,onSaved:d}){const j=rt(n),k=t.nativeConfig||null,o=i.useMemo(()=>ft(n,t,a),[n,t,a]),[c,u]=i.useState(o),[N,A]=i.useState(!1),[w,S]=i.useState(null);i.useEffect(()=>{u(o),S(null)},[o]);const E=c.providerId===ce,B=E&&j,[R,v]=i.useState([]),[g,h]=i.useState(!1),[y,C]=i.useState(null);i.useEffect(()=>{if(E){v([]),C(null),h(!1);return}let m=!1;return h(!0),C(null),fetch(`/api/models/providers/${c.providerId}/models`).then(p=>p.json()).then(p=>{m||(p.ok?p.modelInfos&&p.modelInfos.length?v(p.modelInfos):v((p.models||[]).map(O=>({id:O}))):(C(p.error||"Failed to load models"),v([])))}).catch(p=>{m||(C(p?.message||String(p)),v([]))}).finally(()=>{m||h(!1)}),()=>{m=!0}},[c.providerId,E]);const $=i.useMemo(()=>R.map(m=>m.id),[R]),f=i.useMemo(()=>t.models.map(m=>m.id),[t]),L=E?f:$;i.useEffect(()=>{if(!g){if(E){c.modelMode==="custom"&&u(m=>({...m,modelMode:"list"}));return}L.length===0&&c.modelMode==="list"&&u(m=>({...m,modelMode:"custom"}))}},[L,g,c.modelMode,E]);const T=i.useMemo(()=>{const m=j?`${s.providerNativeFromAgent}${k?.provider?` · ${k.provider}`:""}`:s.providerNative,p=[{value:ce,label:m}];for(const O of l.providers)p.push({value:O.id,label:O.name});return p},[j,k,l.providers,s.providerNative,s.providerNativeFromAgent]),W=i.useMemo(()=>{const m=Ne[n]||Ne.claude;return[{value:"",label:s.effortDefault},...m.map(p=>({value:p,label:p}))]},[n,s.effortDefault]),M=i.useMemo(()=>{let m;return E?m=t.models.map(p=>{const O=p.alias?.toLowerCase().replace(/[\s_-]/g,""),Y=p.id.toLowerCase().replace(/[\s_-]/g,""),U=p.alias&&O!==Y;return{value:p.id,label:p.id,description:U?p.alias:void 0}}):m=R.map(p=>({value:p.id,...it(p)})),c.modelMode==="list"&&c.modelId&&!m.some(p=>p.value===c.modelId)&&m.unshift({value:c.modelId,label:c.modelId}),m},[E,t.models,R,c.modelMode,c.modelId]),I=!pt(c,o),P=!N&&I&&(B||!!c.modelId.trim()),F=i.useCallback(async()=>{S(null),A(!0);try{const m=c.effort||null,p=c.modelId.trim();if(E){const O=l.bindings[n],Y=O?l.profiles.find(U=>U.id===O):null;if(O&&await l.setActiveProfile(n,null),Y&&await fetch(`/api/models/profiles/${Y.id}`,{method:"DELETE"}),!j){const U={agent:n};if(p&&p!==(t.selectedModel||"")&&(U.model=p),m!==(t.selectedEffort||null)&&(U.effort=m),Object.keys(U).length>1){const q=await G.updateRuntimeAgent(U);if(!q.ok)throw new Error(q.error||"Failed to update agent")}}}else{const O=l.providers.find(_=>_.id===c.providerId);if(!O)throw new Error("Provider not found");const Y=te(n),U=l.bindings[n],q=U?l.profiles.find(_=>_.id===U):null,re={providerId:O.id,modelId:p,effort:m,name:`${Y.label} · ${O.name}`};let ne=q?.id;if(q){const _=await fetch(`/api/models/profiles/${q.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}).then(ae=>ae.json());if(!_.ok)throw new Error(_.error||"Failed to update profile")}else{const _=await fetch("/api/models/profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}).then(ae=>ae.json());if(!_.ok)throw new Error(_.error||"Failed to create profile");ne=_.profile?.id}ne&&await l.setActiveProfile(n,ne)}await Promise.resolve(d()),r(s.saved)}catch(m){const p=m?.message||String(m);S(p),r(`${s.configError}: ${p}`,!1)}finally{A(!1)}},[n,t,s,c,j,E,l,d,r]);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx(K,{className:"!mb-1 text-[11px]",children:s.rowProvider}),e.jsx(ie,{value:c.providerId,options:T,onChange:m=>u(p=>{if(m===p.providerId)return p;const O={...p,providerId:m,modelId:"",modelMode:"list"};return m===ce&&(O.modelId=mt(t),O.effort=t.nativeSelectedEffort||t.nativeConfig?.effort||""),O})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-baseline justify-between gap-2",children:[e.jsx(K,{className:"!mb-0 text-[11px]",children:s.rowModel}),!B&&!E&&e.jsx("button",{type:"button",onClick:()=>u(m=>({...m,modelMode:m.modelMode==="list"?"custom":"list"})),className:"text-[10px] text-fg-5 underline-offset-2 transition hover:text-fg-3 hover:underline",children:c.modelMode==="list"?s.modelCustomToggle:s.modelListToggle})]}),B?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:k?.model||s.noModel})}):c.modelMode==="list"?g&&!E?e.jsxs("div",{className:"flex h-9 items-center gap-2 rounded-md border border-control-border bg-control px-3 text-[13px] text-fg-5",children:[e.jsx(Z,{className:"h-3.5 w-3.5"}),s.modelLoading]}):e.jsx(Fe,{value:c.modelId,options:M,onChange:m=>u(p=>({...p,modelId:m})),placeholder:L.length?"—":s.modelEmpty,searchPlaceholder:s.modelSearchPlaceholder,noMatchesText:s.modelSearchEmpty,currentLabel:s.modelCurrentLabel}):e.jsx(X,{value:c.modelId,onChange:m=>u(p=>({...p,modelId:m.target.value})),placeholder:s.modelCustomPlaceholder})]}),e.jsxs("div",{children:[e.jsx(K,{className:"!mb-1 text-[11px]",children:s.rowEffort}),B?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:k?.effort||s.effortDefault})}):e.jsx(ie,{value:c.effort,options:W,onChange:m=>u(p=>({...p,effort:m}))})]})]}),B&&e.jsx("div",{className:"text-[11px] leading-relaxed text-fg-5",children:s.externalNativeNote(k?.configPath||"")}),(w||y)&&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:w||y}),I&&e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>u(o),disabled:N,children:s.cancel}),e.jsx(z,{variant:"primary",size:"sm",disabled:!P,onClick:()=>{F()},children:N?s.saving:s.saveChanges})]})]})}function gt(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,l=s?.provider||null;return{providerBrand:ot(l),providerLabel:a.rowSummaryNative,modelText:n.nativeSelectedModel||s?.model||n.selectedModel||a.rowSummaryNoModel,effortText:n.nativeSelectedEffort||s?.effort||n.selectedEffort||a.rowSummaryNoEffort}}function xt({agent:n,copy:t,t:a,installing:s,onInstall:l,updatingAgent:r,checkingAgent:d,onUpdate:j,onCheckUpdate:k,onEdit:o,loading:c=!1,boundInfo:u}){const N=te(n.agent),A=N.advantageKey?a(N.advantageKey):"",w=n.installed?gt(n,u,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:A||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(ee,{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:N.label}),n.isDefault&&e.jsx(D,{variant:"accent",children:t.defaultBadge}),c?e.jsxs(D,{variant:"muted",children:[e.jsx(Z,{className:"h-3 w-3"})," ",a("status.loading")]}):n.installed?e.jsx(D,{variant:"ok",children:t.installed}):e.jsx(D,{variant:"muted",children:t.notInstalled}),n.installed&&n.updateAvailable&&e.jsx(D,{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]})]}),w?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(ee,{brand:w.providerBrand,size:11}),e.jsx("span",{className:"text-fg-3",children:w.providerLabel})]}),e.jsx("span",{className:"text-fg-6","aria-hidden":"true",children:"·"}),e.jsx("span",{className:"font-mono text-fg-3",children:w.modelText}),e.jsx("span",{className:"text-fg-6","aria-hidden":"true",children:"·"}),e.jsx("span",{children:w.effortText})]}):A?e.jsx("div",{className:"mt-0.5 truncate text-[11px] text-fg-5",children:A}):null]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[c&&e.jsx("div",{className:"inline-flex h-7 items-center gap-2 px-2 text-[11px] text-fg-5",children:e.jsx(Z,{className:"h-3 w-3"})}),!c&&!n.installed&&e.jsx(z,{variant:"primary",size:"sm",disabled:s,onClick:()=>l(n),children:s?t.installing:t.install}),!c&&n.installed&&n.updateAvailable&&e.jsx(z,{variant:"outline",size:"sm",disabled:r,onClick:()=>j(n),children:r?t.updating:t.update}),!c&&n.installed&&!n.updateAvailable&&e.jsx(z,{variant:"ghost",size:"icon",disabled:d,onClick:()=>k(n),title:t.checkUpdate,"aria-label":t.checkUpdate,className:"h-7 w-7",children:d?e.jsx(Z,{className:"h-3 w-3"}):e.jsx("span",{"aria-hidden":"true",children:"↻"})}),!c&&n.installed&&e.jsx(z,{variant:"outline",size:"sm",onClick:()=>o(n),children:t.configure})]})]}),!c&&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]}),!c&&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 Mt(){const n=V(x=>x.locale),t=V(x=>x.toast),a=V(x=>x.agentStatus),s=V(x=>x.setAgentStatus),l=V(x=>x.refreshAgentStatus),r=i.useMemo(()=>De(n),[n]),d=i.useMemo(()=>ct(n),[n]),j=Le(),k=Pe(),[o,c]=i.useState(a?{defaultAgent:a.defaultAgent,agents:a.agents}:null),[u,N]=i.useState(!a),[A,w]=i.useState(null),[S,E]=i.useState(!1),[B,R]=i.useState(null),[v,g]=i.useState(!1),[h,y]=i.useState("codex"),[C,$]=i.useState(null),[f,L]=i.useState(null),[T,W]=i.useState(null),M=i.useRef(!!a);i.useEffect(()=>{a&&(Se(c,a),M.current||(M.current=!0,N(!1)))},[a]);const I=i.useCallback(x=>{Se(c,x),s(x)},[s]),P=i.useCallback(async()=>{M.current||N(!0);try{const x=await G.getAgentStatus();return I(x),w(null),M.current=!0,x}catch(x){const b=x instanceof Error?x.message:d.loadFailed;return w(b),M.current||t(b,!1),null}finally{N(!1)}},[I,d.loadFailed,t]);i.useEffect(()=>{a?l():P()},[]);const F=i.useMemo(()=>{const x=o?.agents||[],b=new Map(x.map(H=>[H.agent,H]));return at.map(H=>{const je=b.get(H);if(je)return je;const Te=te(H);return{agent:H,label:Te.label,installed:!1,version:void 0,installCommand:void 0,selectedModel:null,selectedEffort:null,isDefault:o?.defaultAgent===H,models:[],usage:null}})},[o]),m=o?.defaultAgent||"codex",p=F.find(x=>x.agent===m)||null,Y=F.filter(x=>x.installed).length>0,U=ut(F,d),q=i.useCallback(async x=>{E(!0);try{const b=await G.updateRuntimeAgent(x);if(!b.ok)throw new Error(b.error||r("config.applyFailed"));return I(b),b}catch(b){const H=b instanceof Error?b.message:r("config.applyFailed");return t(H,!1),P(),null}finally{E(!1)}},[I,P,r,t]);i.useEffect(()=>{v&&y(m)},[m,v]);const re=i.useCallback(async()=>{if(h===m){g(!1);return}await q({defaultAgent:h})&&(t(d.defaultsSaved),g(!1))},[d.defaultsSaved,m,h,t,q]),ne=i.useCallback(async x=>{if(!B){R(x.agent);try{const b=await G.installAgent(x.agent);if(!b.ok)throw new Error(b.error||r("config.agentInstallFailed"));I(b),t(r("config.agentInstalled"))}catch(b){const H=b instanceof Error?b.message:r("config.agentInstallFailed");t(H,!1),P()}finally{R(b=>b===x.agent?null:b)}}},[I,B,P,r,t]),_=i.useCallback(async x=>{if(!C){$(x.agent);try{const b=await G.updateAgent(x.agent);if(!b.ok)throw new Error(b.error||r("config.agentInstallFailed"));I(b),t(d.upToDate)}catch(b){const H=b instanceof Error?b.message:d.updateFailed;t(H,!1),P()}finally{$(b=>b===x.agent?null:b)}}},[I,d.updateFailed,d.upToDate,P,r,t,C]),ae=i.useCallback(async x=>{if(!f){L(x.agent);try{const b=await G.checkAgentUpdate(x.agent);if(!b.ok)throw new Error(b.error||d.loadFailed);I(b)}catch(b){const H=b instanceof Error?b.message:d.loadFailed;t(H,!1),P()}finally{L(b=>b===x.agent?null:b)}}},[I,f,d.loadFailed,P,t]),oe=u&&!o,Be=oe?r("status.loading"):p?te(p.agent).label:d.notInstalled;oe?r("status.loading"):p?.installed?d.installed:d.notInstalled;const be=i.useCallback(async()=>{await j.reload(),await P()},[j,P]),J=T?F.find(x=>x.agent===T)??null:null,de=J?te(J.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}),oe?e.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-fg-5",children:[e.jsx(Z,{className:"h-3 w-3"}),e.jsx("span",{children:d.defaultAgent})]}):e.jsxs("button",{type:"button",onClick:()=>g(!0),disabled:S||!Y,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(ee,{brand:m,size:14}),e.jsx("span",{className:"font-semibold text-fg-2",children:Be}),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:F.map(x=>e.jsx(xt,{agent:x,copy:d,t:r,installing:B===x.agent,loading:oe,onInstall:ne,updatingAgent:C===x.agent,checkingAgent:f===x.agent,onUpdate:_,onCheckUpdate:ae,onEdit:b=>W(b.agent),boundInfo:Ae(j,x.agent)},x.agent))})]}),A&&e.jsx($e,{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:A}),e.jsx(z,{variant:"outline",size:"sm",onClick:()=>{P()},children:r("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.modelsTitle}),e.jsx("div",{className:"mt-0.5 text-[13px] leading-relaxed text-fg-4",children:d.modelsHint})]})}),e.jsx(Ke,{snapshot:j,localBackends:k.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(nt,{snapshot:k,onConnected:be})]}),e.jsx(ue,{open:!!J,onClose:()=>W(null),wide:!0,children:J&&de&&e.jsxs(e.Fragment,{children:[e.jsx(me,{title:d.configModalTitle(de.label),description:de.advantageKey?r(de.advantageKey):void 0,onClose:()=>W(null)}),e.jsx(ht,{agentId:J.agent,agentStatus:J,boundInfo:Ae(j,J.agent),copy:d,layer:j,toast:t,onSaved:async()=>{await be(),W(null)}})]})}),e.jsxs(ue,{open:v,onClose:()=>g(!1),children:[e.jsx(me,{title:d.defaultsEditTitle,description:d.defaultsEditHint,onClose:()=>g(!1)}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(K,{children:d.defaultAgent}),e.jsx(ie,{value:h,options:U,onChange:x=>y(x),disabled:S||!Y,placeholder:d.notInstalled})]})}),e.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[e.jsx(z,{variant:"ghost",onClick:()=>g(!1),children:r("modal.cancel")}),e.jsx(z,{variant:"primary",disabled:S||h===m,onClick:()=>{re()},children:r(S?"config.validating":"modal.save")})]})]})]})}export{Mt as AgentTab,Mt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./react-vendor-DTcmqLiz.js";import{c as g}from"./index-BS_RBT-T.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",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-B_sC2ppg.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",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 +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-B_sC2ppg.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};
|