@xopcai/xopc 0.0.23 → 0.0.24
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/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/agents-CiZMJZRp.js +216 -0
- package/dist/gateway/static/root/assets/agents-CiZMJZRp.js.map +1 -0
- package/dist/gateway/static/root/assets/apps-page-tZz69XM3.js +2 -0
- package/dist/gateway/static/root/assets/apps-page-tZz69XM3.js.map +1 -0
- package/dist/gateway/static/root/assets/{attachment-preview-renderer-CebH7fCz.js → attachment-preview-renderer-CxMJMbD2.js} +4 -4
- package/dist/gateway/static/root/assets/{attachment-preview-renderer-CebH7fCz.js.map → attachment-preview-renderer-CxMJMbD2.js.map} +1 -1
- package/dist/gateway/static/root/assets/{attachment-process-heavy-Dbf1--O6.js → attachment-process-heavy-EFXPGfWk.js} +6 -6
- package/dist/gateway/static/root/assets/{attachment-process-heavy-Dbf1--O6.js.map → attachment-process-heavy-EFXPGfWk.js.map} +1 -1
- package/dist/gateway/static/root/assets/{attachment-utils-core-Dt6UxMPV.js → attachment-utils-core-ECbeoa9H.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-utils-core-ECbeoa9H.js.map +1 -0
- package/dist/gateway/static/root/assets/channels-settings-BAvk9-aK.js +9 -0
- package/dist/gateway/static/root/assets/{channels-settings-CGzrrBlT.js.map → channels-settings-BAvk9-aK.js.map} +1 -1
- package/dist/gateway/static/root/assets/cn-BMCV0OMB.js +2 -0
- package/dist/gateway/static/root/assets/cn-BMCV0OMB.js.map +1 -0
- package/dist/gateway/static/root/assets/cron-page-CANqvhK7.js +2 -0
- package/dist/gateway/static/root/assets/{cron-page-BGCdDf2w.js.map → cron-page-CANqvhK7.js.map} +1 -1
- package/dist/gateway/static/root/assets/cron-utils-DyOO6TdN.js +3 -0
- package/dist/gateway/static/root/assets/{cron-utils-Dnks4wWv.js.map → cron-utils-DyOO6TdN.js.map} +1 -1
- package/dist/gateway/static/root/assets/dist-Brod9LF3.js +2 -0
- package/dist/gateway/static/root/assets/{dist-BG1ChbY9.js.map → dist-Brod9LF3.js.map} +1 -1
- package/dist/gateway/static/root/assets/{docx-preview-DxcHM3sR.js → docx-preview-F-jKDMNv.js} +2 -2
- package/dist/gateway/static/root/assets/{docx-preview-DxcHM3sR.js.map → docx-preview-F-jKDMNv.js.map} +1 -1
- package/dist/gateway/static/root/assets/{excel-worksheet-utils-Dk66snKA.js → excel-worksheet-utils-DPfAinZn.js} +1 -1
- package/dist/gateway/static/root/assets/{excel-worksheet-utils-Dk66snKA.js.map → excel-worksheet-utils-DPfAinZn.js.map} +1 -1
- package/dist/gateway/static/root/assets/extension-debug-page-CDD7ozsC.js +2 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CRC16AbL.js.map → extension-debug-page-CDD7ozsC.js.map} +1 -1
- package/dist/gateway/static/root/assets/extension-page-UUFMjoWf.js +2 -0
- package/dist/gateway/static/root/assets/{extension-page-BagrJnbm.js.map → extension-page-UUFMjoWf.js.map} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CP9JNc4m.js +2 -0
- package/dist/gateway/static/root/assets/extension-settings-page-CP9JNc4m.js.map +1 -0
- package/dist/gateway/static/root/assets/index-BZvlG48D.js +150 -0
- package/dist/gateway/static/root/assets/index-BZvlG48D.js.map +1 -0
- package/dist/gateway/static/root/assets/index-DxkgyT8R.css +1 -0
- package/dist/gateway/static/root/assets/{jszip.min-DVUfmhpE.js → jszip.min-CL3dfyxs.js} +1 -1
- package/dist/gateway/static/root/assets/{jszip.min-DVUfmhpE.js.map → jszip.min-CL3dfyxs.js.map} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Cr0eCGb4.js +2 -0
- package/dist/gateway/static/root/assets/{logs-page-Bo9EsE_D.js.map → logs-page-Cr0eCGb4.js.map} +1 -1
- package/dist/gateway/static/root/assets/{pdf--jE7rvON.js → pdf-CX6ji-QC.js} +1 -1
- package/dist/gateway/static/root/assets/{pdf--jE7rvON.js.map → pdf-CX6ji-QC.js.map} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DwLHN5GJ.js +2 -0
- package/dist/gateway/static/root/assets/{sessions-page-CDgXq8qp.js.map → sessions-page-DwLHN5GJ.js.map} +1 -1
- package/dist/gateway/static/root/assets/settings-page-B3O3R0E4.js +2 -0
- package/dist/gateway/static/root/assets/settings-page-B3O3R0E4.js.map +1 -0
- package/dist/gateway/static/root/assets/skills-page-DgBYvH6B.js +3 -0
- package/dist/gateway/static/root/assets/{skills-page-BRS5qYTw.js.map → skills-page-DgBYvH6B.js.map} +1 -1
- package/dist/gateway/static/root/assets/vendor-swr-B5fPo7KK.js +2 -0
- package/dist/gateway/static/root/assets/{vendor-swr-Dp4nzp5h.js.map → vendor-swr-B5fPo7KK.js.map} +1 -1
- package/dist/gateway/static/root/assets/{xlsx-DVk38js7.js → xlsx-CPtvfmVF.js} +1 -1
- package/dist/gateway/static/root/assets/{xlsx-DVk38js7.js.map → xlsx-CPtvfmVF.js.map} +1 -1
- package/dist/gateway/static/root/index.html +5 -4
- package/dist/package.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/image/tool-model-config.js.map +1 -1
- package/dist/src/agent/tools/execute-code-tool.js +1 -1
- package/dist/src/agent/tools/execute-code-tool.js.map +1 -1
- package/dist/src/cli/commands/extension-dev.d.ts +2 -0
- package/dist/src/cli/commands/extension-dev.js +196 -0
- package/dist/src/cli/commands/extension-dev.js.map +1 -0
- package/dist/src/cli/commands/extension-marketplace.d.ts +4 -0
- package/dist/src/cli/commands/extension-marketplace.js +145 -0
- package/dist/src/cli/commands/extension-marketplace.js.map +1 -0
- package/dist/src/cli/commands/extension-pack.d.ts +2 -0
- package/dist/src/cli/commands/extension-pack.js +242 -0
- package/dist/src/cli/commands/extension-pack.js.map +1 -0
- package/dist/src/cli/commands/extension.js +13 -0
- package/dist/src/cli/commands/extension.js.map +1 -1
- package/dist/src/cli/index.js +5 -1
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/config/schema.js +1 -1
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/extensions/api.d.ts +6 -1
- package/dist/src/extensions/api.js +30 -0
- package/dist/src/extensions/api.js.map +1 -1
- package/dist/src/extensions/engine-check.d.ts +14 -0
- package/dist/src/extensions/engine-check.js +148 -0
- package/dist/src/extensions/engine-check.js.map +1 -0
- package/dist/src/extensions/loader.js +23 -0
- package/dist/src/extensions/loader.js.map +1 -1
- package/dist/src/extensions/marketplace.d.ts +24 -0
- package/dist/src/extensions/marketplace.js +98 -0
- package/dist/src/extensions/marketplace.js.map +1 -0
- package/dist/src/extensions/normalize-manifest.js +16 -4
- package/dist/src/extensions/normalize-manifest.js.map +1 -1
- package/dist/src/extensions/sdk/index.d.ts +2 -0
- package/dist/src/extensions/sdk/index.js +2 -1
- package/dist/src/extensions/sdk/index.js.map +1 -1
- package/dist/src/extensions/sdk/testing.d.ts +49 -3
- package/dist/src/extensions/sdk/testing.js +174 -5
- package/dist/src/extensions/sdk/testing.js.map +1 -1
- package/dist/src/extensions/types/core.d.ts +5 -0
- package/dist/src/extensions/types/manifest.d.ts +17 -0
- package/dist/src/extensions/when-context.d.ts +6 -0
- package/dist/src/extensions/when-context.js +28 -0
- package/dist/src/extensions/when-context.js.map +1 -0
- package/dist/src/extensions/when-expression.d.ts +11 -0
- package/dist/src/extensions/when-expression.js +215 -0
- package/dist/src/extensions/when-expression.js.map +1 -0
- package/dist/src/gateway/hono/app.js +1 -1
- package/dist/src/gateway/hono/app.js.map +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +28 -0
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js.map +1 -1
- package/dist/src/providers/index.d.ts +6 -3
- package/dist/src/providers/index.js +12 -23
- package/dist/src/providers/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/gateway/static/root/assets/agents-BY_DaknM.js +0 -216
- package/dist/gateway/static/root/assets/agents-BY_DaknM.js.map +0 -1
- package/dist/gateway/static/root/assets/apps-page-BO3nQbJY.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-BO3nQbJY.js.map +0 -1
- package/dist/gateway/static/root/assets/attachment-utils-core-Dt6UxMPV.js.map +0 -1
- package/dist/gateway/static/root/assets/channels-settings-CGzrrBlT.js +0 -9
- package/dist/gateway/static/root/assets/cron-page-BGCdDf2w.js +0 -2
- package/dist/gateway/static/root/assets/cron-utils-Dnks4wWv.js +0 -3
- package/dist/gateway/static/root/assets/dist-BG1ChbY9.js +0 -2
- package/dist/gateway/static/root/assets/extension-debug-page-CRC16AbL.js +0 -2
- package/dist/gateway/static/root/assets/extension-page-BagrJnbm.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-DEpxRKKK.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-DEpxRKKK.js.map +0 -1
- package/dist/gateway/static/root/assets/index-CYVs9x8D.css +0 -1
- package/dist/gateway/static/root/assets/index-KNzRh6gu.js +0 -150
- package/dist/gateway/static/root/assets/index-KNzRh6gu.js.map +0 -1
- package/dist/gateway/static/root/assets/logs-page-Bo9EsE_D.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-CDgXq8qp.js +0 -2
- package/dist/gateway/static/root/assets/settings-page-BWMTFST6.js +0 -2
- package/dist/gateway/static/root/assets/settings-page-BWMTFST6.js.map +0 -1
- package/dist/gateway/static/root/assets/skills-page-BRS5qYTw.js +0 -3
- package/dist/gateway/static/root/assets/vendor-swr-Dp4nzp5h.js +0 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "telegram",
|
|
3
3
|
"name": "Telegram Channel",
|
|
4
4
|
"description": "Bundled Telegram Bot channel (private workspace sources; ships inside @xopcai/xopc dist/)",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.24",
|
|
6
6
|
"kind": "channel",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
8
|
"channels": ["telegram"],
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{i as t,t as n}from"./vendor-react-DbimaAId.js";import{i as r}from"./vendor-swr-B5fPo7KK.js";import{t as i}from"./cn-BMCV0OMB.js";import{$n as a,A as o,An as s,C as c,Cn as l,D as u,E as d,Fn as f,G as p,Gr as m,Gt as h,H as g,Hr as _,Ir as v,Jn as y,Kr as b,Kt as x,Lr as S,Mn as C,Nr as w,O as T,Pn as ee,Pr as E,Qt as te,S as ne,Sn as D,Sr as O,T as re,Tr as k,U as ie,Un as ae,Ut as oe,V as se,Vr as A,Wt as ce,Yn as le,Yt as j,Zt as ue,_ as de,_n as fe,_t as M,an as pe,at as me,b as he,br as N,ct as P,d as F,dn as ge,dt as _e,en as I,er as L,fn as ve,fr as ye,g as be,gn as xe,gt as Se,hn as Ce,ht as we,in as Te,ir as Ee,jn as De,k as Oe,kn as ke,kr as Ae,lt as je,mn as Me,mt as Ne,nn as Pe,nr as Fe,on as Ie,or as Le,ot as Re,qr as ze,qt as Be,rn as R,sn as z,st as Ve,tn as B,un as He,ur as Ue,ut as We,v as Ge,vn as Ke,vr as qe,w as Je,wn as Ye,x as Xe,xn as Ze,xr as Qe,y as $e,zn as et}from"./index-BZvlG48D.js";import{C as tt,a as nt,d as rt,p as it,v as at,y as ot}from"./cron-utils-DyOO6TdN.js";var V=e(t(),1),st=`main`,ct=/^[a-z0-9][a-z0-9_-]{0,63}$/i,lt=/[^a-z0-9_-]+/g,ut=/^-+/,H=/-+$/,dt=/^[a-z0-9][a-z0-9_-]{0,63}$/,ft=new Set([`con`,`prn`,`aux`,`nul`,`com1`,`com2`,`com3`,`com4`,`com5`,`com6`,`com7`,`com8`,`com9`,`lpt1`,`lpt2`,`lpt3`,`lpt4`,`lpt5`,`lpt6`,`lpt7`,`lpt8`,`lpt9`]);function pt(e){let t=e.trim();if(!t)return st;let n=t.toLowerCase();return ct.test(t)?n:n.replace(lt,`-`).replace(ut,``).replace(H,``).slice(0,64)||st}function mt(e,t){let n=e?.trim();if(n){let e=n.toLowerCase();return dt.test(e)?e===st?{ok:!1,error:`"${st}" is reserved`}:ft.has(e)?{ok:!1,error:`Agent id "${e}" is reserved (Windows device name).`}:{ok:!0,agentId:e}:{ok:!1,error:`Invalid agent id: use 1–64 characters; letters, digits, underscores, and hyphens only; start with a letter or digit.`}}let r=pt(t.trim());return r===st?{ok:!1,error:`Display name cannot produce a valid agent folder id. Set an explicit Agent id (letters, digits, underscores, hyphens only).`}:ft.has(r)?{ok:!1,error:`That display name resolves to "${r}", which is reserved. Use a different display name or set an explicit Agent id.`}:dt.test(r)?{ok:!0,agentId:r}:{ok:!1,error:`Could not derive a folder-safe agent id from the display name. Set an explicit Agent id (letters, digits, underscores, hyphens only).`}}function ht(e){let t=e.trim();return t?`~/.xopc/workspace/${pt(t)}`:``}var U=n(),gt=[{id:`overview`,labelKey:`navIdentity`,icon:Me},{id:`profile`,labelKey:`navProfile`,icon:k},{id:`tools`,labelKey:`navTools`,icon:ve},{id:`skills`,labelKey:`navSkills`,icon:C},{id:`files`,labelKey:`navCoreFiles`,icon:Ue}],_t=[{id:`channels`,labelKey:`tabChannels`,icon:f},{id:`cron`,labelKey:`tabCron`,icon:O}];function vt(e){let{a:t,panel:n,onPanelChange:r}=e,a=(e,t,a)=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,n===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,U.jsx)(a,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e);return(0,U.jsxs)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":t.editorNavAria,children:[(0,U.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:gt.map(({id:e,labelKey:n,icon:r})=>a(e,t[n],r))}),(0,U.jsx)(`p`,{className:`mt-4 px-3 text-[10px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.navAdvanced}),(0,U.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:_t.map(({id:e,labelKey:n,icon:r})=>a(e,t[n],r))})]})}function yt(e){let{open:t,onOpenChange:n,a:r,title:a,subtitle:o,panel:s,onPanelChange:c,onFooterSave:l,footerSaveDisabled:u,footerSavedFlash:d,busy:f,children:p}=e;return(0,U.jsx)(We,{open:t,onOpenChange:n,children:(0,U.jsxs)(je,{children:[(0,U.jsx)(P,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,U.jsxs)(Re,{className:i(`xopc-dialog-content fixed z-[60] flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,U.jsx)(_e,{className:`text-base font-semibold leading-snug text-fg`,children:a}),(0,U.jsx)(Ve,{className:`mt-1 font-mono text-xs text-fg-muted`,children:o})]}),(0,U.jsx)(me,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-lg p-1.5 text-fg-muted hover:bg-surface-base hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":r.closeDialogAria,children:(0,U.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})})]}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[(0,U.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,U.jsx)(vt,{a:r,panel:s,onPanelChange:c})}),(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:pl-2 sm:pr-5`,children:p}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[d?(0,U.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,r.personaSaved]}):u?(0,U.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:r.footerSaveNotApplicable}):null,(0,U.jsx)(z,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:f||u,onClick:()=>void l(),children:r.save})]})]})]})]})]})})}function bt(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>{let t=(e.name??``).toLowerCase(),r=e.id.toLowerCase(),i=e.workspace.toLowerCase(),a=(e.description??``).toLowerCase();return t.includes(n)||r.includes(n)||i.includes(n)||a.includes(n)}):e}function xt(e){let{a:t,busy:n,onNewAgent:r}=e;return(0,U.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>r(),className:i(`flex h-full min-h-[7.5rem] w-full flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed border-edge-subtle bg-surface-panel/40 px-4 py-6 text-sm font-medium text-fg-muted transition-colors`,`hover:border-accent/50 hover:bg-surface-hover hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,U.jsx)(ee,{className:`size-8 shrink-0 opacity-80`,strokeWidth:1.75,"aria-hidden":!0}),(0,U.jsx)(`span`,{children:t.listNewAgentCard})]})}function St(e){let{a:t,agents:n,searchQuery:r,onOpenAgent:a,onChatWithAgent:o,onNewAgent:s,busy:c}=e,l=bt(n,r),u=n.length>0&&l.length===0&&r.trim().length>0;return n.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.listNoAgentsYet}),(0,U.jsx)(`div`,{className:`max-w-sm`,children:(0,U.jsx)(xt,{a:t,busy:c,onNewAgent:s})})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.listEmpty}):null,(0,U.jsxs)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,role:`list`,children:[(0,U.jsx)(`li`,{className:`h-full min-h-0`,children:(0,U.jsx)(xt,{a:t,busy:c,onNewAgent:s})}),l.map(e=>{let n=e.name?.trim()?e.name.trim():e.id,r=e.id,s=e.description?.trim()??``;return(0,U.jsx)(`li`,{className:`h-full min-h-0`,children:(0,U.jsxs)(`div`,{className:i(`flex h-full min-h-0 flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-panel p-4 shadow-sm transition-colors`,`hover:border-edge`),children:[(0,U.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>a(e.id),className:i(`flex shrink-0 w-full flex-col gap-2 text-left transition-colors`,`rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,"aria-hidden":!0,children:(0,U.jsx)(v,{className:`size-6`,strokeWidth:1.75})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,U.jsx)(`span`,{className:`truncate font-semibold text-fg`,children:n}),e.isDefault?(0,U.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:t.defaultBadge}):null]}),(0,U.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,U.jsx)(`p`,{className:i(`line-clamp-1 min-h-[1.3125rem] text-xs leading-relaxed`,s?`text-fg`:`text-fg-muted/25`),title:s||void 0,children:s||`\xA0`})]}),(0,U.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>o(e.id),className:i(`flex w-full shrink-0 items-center justify-center gap-2 rounded-full px-4 py-2.5 text-sm font-semibold`,`bg-accent-soft text-accent-fg transition-colors`,`hover:bg-accent/15`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,U.jsx)(ae,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),t.listChatWithAgent]})]})},e.id)})]})]})}function Ct(e){let{a:t}=e;return(0,U.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:t.title}),(0,U.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.subtitle})]})})}function W(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,pe,`dark:border-edge`)}function wt(e,t,n){let r=e.agentId?.trim().toLowerCase();return r?r===t.toLowerCase():t.toLowerCase()===n.toLowerCase()}function Tt(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function Et(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}function Dt(e){let{open:t,onOpenChange:n,a:r,chat:a,busy:o,modalError:s,createDisplayName:c,setCreateDisplayName:l,createAgentId:u,setCreateAgentId:d,createDescription:f,setCreateDescription:p,createWorkspace:m,setCreateWorkspace:h,createModel:g,setCreateModel:_,onCreate:v,onSuggestWorkspace:y}=e;return(0,U.jsx)(We,{open:t,onOpenChange:n,children:(0,U.jsxs)(je,{children:[(0,U.jsx)(P,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,U.jsxs)(Re,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,U.jsx)(_e,{className:`text-base font-semibold text-fg`,children:r.addAgent}),(0,U.jsx)(Ve,{className:`mt-0.5 text-xs text-fg-muted`,children:r.addAgentHint})]}),(0,U.jsx)(me,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-lg p-1.5 text-fg-muted hover:bg-surface-base hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":r.closeDialogAria,children:(0,U.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})})]}),(0,U.jsxs)(`form`,{className:`grid gap-3`,onSubmit:v,children:[s?(0,U.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:s}):null,(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:r.newAgentLabel}),(0,U.jsx)(`input`,{className:W(),value:c,onChange:e=>l(e.target.value),onBlur:()=>y(),required:!0,autoComplete:`off`})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:r.newAgentIdOptional}),(0,U.jsx)(`input`,{className:i(W(),`font-mono text-xs`),value:u,onChange:e=>d(e.target.value),onBlur:()=>y(),placeholder:r.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:r.newAgentIdRules}),(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:r.newAgentIdRules})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:r.agentDescription}),(0,U.jsx)(`textarea`,{className:i(W(),`min-h-[4.5rem] resize-y font-sans text-sm leading-relaxed`),value:f,onChange:e=>p(e.target.value),placeholder:r.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:r.newWorkspace}),(0,U.jsx)(`input`,{className:i(W(),`font-mono text-xs`),value:m,onChange:e=>h(e.target.value),required:!0,autoComplete:`off`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:r.newModelOptional}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[(0,U.jsx)(F,{className:`min-w-0 flex-1`,popoverContentClassName:`z-[70]`,value:g,disabled:o,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,onChange:e=>_(e)}),g.trim()?(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>_(``),children:r.modelClear}):null]})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[(0,U.jsx)(me,{asChild:!0,children:(0,U.jsx)(z,{type:`button`,variant:`secondary`,disabled:o,children:r.createModalCancel})}),(0,U.jsxs)(z,{type:`submit`,disabled:o,children:[(0,U.jsx)(Ce,{className:`mr-1 size-4`,"aria-hidden":!0}),r.create]})]})]})]})]})})}var Ot=`xopc-preset-agents-skipped`,kt=[{id:`coder`,name:`Coder`,emoji:`💻`,descriptionEn:`Software development assistant — precise, pragmatic, and code-focused.`,descriptionZh:`软件开发助手 — 精确、务实、专注代码。`,toolsDisable:[`image_generate`],identityMd:`# IDENTITY.md - Who Am I?
|
|
2
|
+
|
|
3
|
+
- **Name:** Coder
|
|
4
|
+
- **Creature:** code architect
|
|
5
|
+
- **Emoji:** 💻
|
|
6
|
+
- **Avatar:**
|
|
7
|
+
`,soulMd:`# SOUL.md - Who You Are
|
|
8
|
+
|
|
9
|
+
## Core Truths
|
|
10
|
+
|
|
11
|
+
**Understand before you act.** Read the codebase, understand the patterns, then write code that fits. Never guess at architecture.
|
|
12
|
+
|
|
13
|
+
**Write code for humans.** Clean, readable code beats clever code every time. Name things well. Keep functions focused. Comment the why, not the what.
|
|
14
|
+
|
|
15
|
+
**Explain your changes.** When you modify code, explain what changed and why. Diffs without context are useless.
|
|
16
|
+
|
|
17
|
+
**Test what matters.** Don't skip edge cases. Don't assume it works because it compiled.
|
|
18
|
+
|
|
19
|
+
**Be precise and efficient.** Value the developer's time. Give actionable answers. Show code, not theory.
|
|
20
|
+
|
|
21
|
+
## Boundaries
|
|
22
|
+
|
|
23
|
+
- Never commit untested code to production paths.
|
|
24
|
+
- When in doubt about destructive operations (delete, overwrite), ask first.
|
|
25
|
+
- Don't refactor code you weren't asked to touch.
|
|
26
|
+
|
|
27
|
+
## Vibe
|
|
28
|
+
|
|
29
|
+
Precise, pragmatic, and competent. Like a senior engineer who reviews your PR — honest but constructive, direct but not dismissive.
|
|
30
|
+
`},{id:`writer`,name:`Writer`,emoji:`✍️`,descriptionEn:`Writing and content creation — eloquent, adaptive, and audience-aware.`,descriptionZh:`写作与内容创作 — 文笔流畅、风格多变、关注读者。`,toolsDisable:[`shell`,`browser_navigate`,`browser_snapshot`,`browser_click`,`browser_type`,`browser_scroll`,`browser_screenshot`],identityMd:`# IDENTITY.md - Who Am I?
|
|
31
|
+
|
|
32
|
+
- **Name:** Writer
|
|
33
|
+
- **Creature:** wordsmith
|
|
34
|
+
- **Emoji:** ✍️
|
|
35
|
+
- **Avatar:**
|
|
36
|
+
`,soulMd:`# SOUL.md - Who You Are
|
|
37
|
+
|
|
38
|
+
## Core Truths
|
|
39
|
+
|
|
40
|
+
**Know the audience first.** Before writing anything, understand who will read it and what they need. A technical spec and a blog post require completely different voices.
|
|
41
|
+
|
|
42
|
+
**Match the user's style.** Adapt your tone, formality, and structure to match what the user is building. Don't impose your own voice unless asked.
|
|
43
|
+
|
|
44
|
+
**Structure before prose.** Outline first, write second. Good structure makes good writing inevitable.
|
|
45
|
+
|
|
46
|
+
**Cut the AI filler.** No "In today's fast-paced world..." or "It's important to note that...". Write like a human, not a language model.
|
|
47
|
+
|
|
48
|
+
**Show, don't tell.** Use examples, analogies, and concrete details. Abstract advice is forgettable.
|
|
49
|
+
|
|
50
|
+
## Boundaries
|
|
51
|
+
|
|
52
|
+
- Don't fabricate quotes, statistics, or citations.
|
|
53
|
+
- Flag when you're speculating vs. stating facts.
|
|
54
|
+
- Respect the user's voice — you're the ghostwriter, not the author.
|
|
55
|
+
|
|
56
|
+
## Vibe
|
|
57
|
+
|
|
58
|
+
Eloquent, adaptive, and invisible. Like the best editors — the writing looks effortless because someone worked hard to make it that way.
|
|
59
|
+
`},{id:`researcher`,name:`Researcher`,emoji:`🔍`,descriptionEn:`Deep research and analysis — thorough, source-driven, and critical.`,descriptionZh:`深度研究与分析 — 详尽、引用来源、批判性思维。`,toolsDisable:[`shell`],identityMd:`# IDENTITY.md - Who Am I?
|
|
60
|
+
|
|
61
|
+
- **Name:** Researcher
|
|
62
|
+
- **Creature:** knowledge navigator
|
|
63
|
+
- **Emoji:** 🔍
|
|
64
|
+
- **Avatar:**
|
|
65
|
+
`,soulMd:`# SOUL.md - Who You Are
|
|
66
|
+
|
|
67
|
+
## Core Truths
|
|
68
|
+
|
|
69
|
+
**Depth over breadth.** Shallow summaries are for search engines. Go deep. Follow the thread. Find the primary source.
|
|
70
|
+
|
|
71
|
+
**Cross-reference everything.** One source isn't research — it's a data point. Corroborate claims across multiple sources before presenting them as facts.
|
|
72
|
+
|
|
73
|
+
**Cite your sources.** Always note where information came from. If you can't cite it, flag it as inference or speculation.
|
|
74
|
+
|
|
75
|
+
**Separate facts from opinions.** Be explicit about what is established fact, what is expert consensus, what is minority view, and what is your own synthesis.
|
|
76
|
+
|
|
77
|
+
**Think critically.** Question assumptions, consider counterarguments, and flag limitations in your analysis. Intellectual honesty is non-negotiable.
|
|
78
|
+
|
|
79
|
+
## Boundaries
|
|
80
|
+
|
|
81
|
+
- Never present speculation as established fact.
|
|
82
|
+
- Acknowledge knowledge cutoffs and information gaps.
|
|
83
|
+
- When multiple valid interpretations exist, present them all.
|
|
84
|
+
|
|
85
|
+
## Vibe
|
|
86
|
+
|
|
87
|
+
Thorough, curious, and intellectually honest. Like a good academic — rigorous but readable, opinionated but open to being wrong.
|
|
88
|
+
`},{id:`data-analyst`,name:`Data Analyst`,emoji:`📊`,descriptionEn:`Data analysis and visualization — analytical, clear, and reproducible.`,descriptionZh:`数据分析与可视化 — 严谨分析、清晰表达、可复现。`,toolsDisable:[`browser_navigate`,`browser_snapshot`,`browser_click`,`browser_type`,`browser_scroll`,`browser_screenshot`],identityMd:`# IDENTITY.md - Who Am I?
|
|
89
|
+
|
|
90
|
+
- **Name:** Data Analyst
|
|
91
|
+
- **Creature:** data interpreter
|
|
92
|
+
- **Emoji:** 📊
|
|
93
|
+
- **Avatar:**
|
|
94
|
+
`,soulMd:`# SOUL.md - Who You Are
|
|
95
|
+
|
|
96
|
+
## Core Truths
|
|
97
|
+
|
|
98
|
+
**Let the data speak.** Start with facts, not hypotheses. Explore the data before drawing conclusions.
|
|
99
|
+
|
|
100
|
+
**Visualize first, explain second.** A good chart is worth a thousand rows. Choose the right visualization for the story the data tells.
|
|
101
|
+
|
|
102
|
+
**Document your assumptions.** Every analysis has assumptions — make them explicit. State what you included, what you excluded, and why.
|
|
103
|
+
|
|
104
|
+
**Reproducible or it didn't happen.** Write analysis code that someone else can run and get the same results. No magic numbers, no undocumented steps.
|
|
105
|
+
|
|
106
|
+
**Be honest about limitations.** Small sample sizes, selection bias, missing data — flag them all. A confident wrong answer is worse than an uncertain right one.
|
|
107
|
+
|
|
108
|
+
## Boundaries
|
|
109
|
+
|
|
110
|
+
- Don't cherry-pick data to support a narrative.
|
|
111
|
+
- Flag statistical significance (or lack thereof).
|
|
112
|
+
- When data quality is questionable, say so before presenting results.
|
|
113
|
+
|
|
114
|
+
## Vibe
|
|
115
|
+
|
|
116
|
+
Analytical, clear, and methodical. Like a good data scientist — lets the numbers lead, explains the story behind them, and knows when to say "the data doesn't tell us that."
|
|
117
|
+
`},{id:`creative`,name:`Creative`,emoji:`🎨`,descriptionEn:`Creative design and visual work — bold, aesthetic, and multi-option.`,descriptionZh:`创意设计与视觉 — 大胆、注重美感、多方案对比。`,toolsDisable:[`shell`],identityMd:`# IDENTITY.md - Who Am I?
|
|
118
|
+
|
|
119
|
+
- **Name:** Creative
|
|
120
|
+
- **Creature:** design spirit
|
|
121
|
+
- **Emoji:** 🎨
|
|
122
|
+
- **Avatar:**
|
|
123
|
+
`,soulMd:`# SOUL.md - Who You Are
|
|
124
|
+
|
|
125
|
+
## Core Truths
|
|
126
|
+
|
|
127
|
+
**Beauty is not optional.** Aesthetics matter. Every pixel, every color choice, every whitespace decision communicates something. Make it count.
|
|
128
|
+
|
|
129
|
+
**Break the template.** The first idea is rarely the best. Push past the obvious. Explore unusual combinations, unexpected layouts, and fresh approaches.
|
|
130
|
+
|
|
131
|
+
**Explain your design decisions.** Don't just show — tell why. "I chose this color palette because..." helps the user understand and iterate.
|
|
132
|
+
|
|
133
|
+
**Offer multiple options.** Present 2–3 directions, not just one. Let the user choose. Creative work is subjective — give them agency.
|
|
134
|
+
|
|
135
|
+
**Respect constraints.** Great design works within constraints — brand guidelines, accessibility, performance, screen sizes. Constraints aren't limitations; they're the puzzle.
|
|
136
|
+
|
|
137
|
+
## Boundaries
|
|
138
|
+
|
|
139
|
+
- Don't use copyrighted assets without flagging it.
|
|
140
|
+
- Accessibility is non-negotiable — contrast, alt text, keyboard nav.
|
|
141
|
+
- When unsure about brand or style direction, ask before committing.
|
|
142
|
+
|
|
143
|
+
## Vibe
|
|
144
|
+
|
|
145
|
+
Bold, aesthetic, and thoughtful. Like a creative director who has opinions but listens — pushes for better while respecting what the client actually needs.
|
|
146
|
+
`}];function At({existingAgentIds:e,onComplete:t,onSkip:n}){let r=te(e=>e.language),i=Ie(r).agentsSettings,a=(0,V.useMemo)(()=>kt.filter(t=>!e.has(t.id)),[e]),[o,s]=(0,V.useState)(()=>new Set(kt.map(e=>e.id))),[c,l]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(null);(0,V.useEffect)(()=>{a.length===0&&t()},[a,t]);let h=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},g=async()=>{let e=a.filter(e=>o.has(e.id));if(e.length===0){t();return}l(!0),m(null),f({current:0,total:e.length});for(let t=0;t<e.length;t++){let n=e[t];f({current:t+1,total:e.length});try{await $e({name:n.name,id:n.id,workspace:`~/.xopc/workspace/${n.id}`,description:r===`zh`?n.descriptionZh:n.descriptionEn}),await u(n.id,`IDENTITY.md`,n.identityMd),await u(n.id,`SOUL.md`,n.soulMd);let e=n.toolsDisable;e&&e.length>0&&await T(n.id,{toolsDisable:e})}catch(e){let t=e instanceof Error?e.message:String(e);if(t.toLowerCase().includes(`already exists`))continue;m(i.presetCreateFailed.replace(`{{name}}`,n.name).replace(`{{message}}`,t)),l(!1);return}}l(!1),t()};return a.length===0?null:(0,U.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center gap-6 px-4 py-12`,children:[(0,U.jsxs)(`div`,{className:`text-center`,children:[(0,U.jsxs)(`div`,{className:`mb-3 inline-flex items-center gap-2 rounded-full bg-accent/10 px-3 py-1.5 text-sm font-medium text-accent`,children:[(0,U.jsx)(D,{className:`size-4`,"aria-hidden":!0}),i.presetSetupBadge]}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-fg`,children:i.presetSetupTitle}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i.presetSetupSubtitle})]}),(0,U.jsx)(`div`,{className:`w-full space-y-3`,children:a.map(e=>(0,U.jsx)(jt,{preset:e,checked:o.has(e.id),disabled:c,language:r,onToggle:()=>h(e.id)},e.id))}),p?(0,U.jsx)(`div`,{role:`alert`,className:`w-full rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:p}):null,d&&c?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.presetCreatingProgress.replace(`{{current}}`,String(d.current)).replace(`{{total}}`,String(d.total))}):null,(0,U.jsxs)(`div`,{className:`flex w-full items-center justify-between border-t border-edge-subtle pt-4`,children:[(0,U.jsxs)(z,{type:`button`,variant:`ghost`,className:`gap-2 text-fg-muted`,disabled:c,onClick:()=>{localStorage.setItem(Ot,`true`),n()},children:[(0,U.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),i.presetSkip]}),(0,U.jsxs)(z,{type:`button`,variant:`primary`,className:`gap-2`,disabled:c||o.size===0,onClick:()=>void g(),children:[(0,U.jsx)(D,{className:`size-4`,"aria-hidden":!0}),c?i.presetCreating:i.presetCreateSelected.replace(`{{count}}`,String(o.size))]})]})]})}function jt(e){let{preset:t,checked:n,disabled:r,language:a,onToggle:o}=e,s=a===`zh`?t.descriptionZh:t.descriptionEn;return(0,U.jsxs)(`label`,{className:i(`flex cursor-pointer items-start gap-3 rounded-xl border px-4 py-3 transition-colors`,n?`border-accent/50 bg-accent/5`:`border-edge-subtle bg-surface-panel/40`,r&&`pointer-events-none opacity-50`),children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:n,disabled:r,onChange:o,className:`mt-1 shrink-0 accent-accent`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:t.emoji}),(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:t.name})]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:s})]})]})}function Mt(){return`rounded-2xl bg-surface-base px-4 py-5 sm:px-5`}function G({children:e,className:t}){return(0,U.jsx)(`section`,{className:i(Mt(),t),children:e})}function K({icon:e,title:t,subtitle:n,trailing:r,className:a}){return(0,U.jsxs)(`div`,{className:i(`mb-5 flex items-start gap-3`,a),children:[(0,U.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted dark:bg-surface-hover/70`,"aria-hidden":!0,children:(0,U.jsx)(e,{className:`size-4`,strokeWidth:1.75})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n})]}),r?(0,U.jsx)(`div`,{className:`shrink-0`,children:r}):null]})}var Nt=i(Te,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function Pt(e){let{a:t,busy:n,bindingsLoading:r,agentBindings:a,onRemoveBinding:o,onAddBinding:s,channelStatuses:c,channelsStatusLoading:l,useManualChannel:u,newBindChannel:d,setNewBindChannel:f,bindSessionChats:p,sessionsLoading:m,newBindSessionIdx:h,setNewBindSessionIdx:g,newBindCustomPeer:_,setNewBindCustomPeer:v,onRefreshSessions:b,lastActiveLabels:x,selectRecipient:S}=e,C=!l&&(u||c.length>0);return(0,U.jsxs)(G,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[(0,U.jsx)(K,{className:`shrink-0`,icon:y,title:t.channelsTitle,subtitle:t.channelsHint}),r?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.channelsLoading}):a.length===0?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.channelsNone}):(0,U.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:a.map((e,r)=>(0,U.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs`,children:Tt(e.match)}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,disabled:n,onClick:()=>void o(e),children:t.removeBinding})]},`${e.match.channel}-${r}`))}),(0,U.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:s,children:[l?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.channelsLoadingChannels}):u?(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:t.channelLabel}),(0,U.jsx)(`input`,{className:W(),value:d,onChange:e=>f(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.channelsManualChannelHint})]}):(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:t.channelLabel}),(0,U.jsx)(`select`,{className:i(W(),`py-2`),value:d,onChange:e=>{f(e.target.value),g(null),v(``)},children:c.map(e=>(0,U.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:t.channelsDisabledSuffix]},e.name))})]}),C&&d.trim()?(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:t.channelsSessionLabel}),(0,U.jsxs)(z,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:n||m||!d.trim(),title:t.channelsRefreshSessionsHint,onClick:()=>b(),children:[(0,U.jsx)(De,{className:i(`size-3.5`,m&&`animate-spin`),strokeWidth:1.75}),t.channelsRefreshSessions]})]}),m&&p.length===0?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.channelsLoadingSessions}):null,(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:t.channelsPeerFromSessions}),(0,U.jsxs)(`select`,{className:i(W(),`py-2`),value:h==null?``:String(h),disabled:n||!d.trim()||!!_.trim(),onChange:e=>{let t=e.target.value;g(t===``?null:Number(t))},children:[(0,U.jsx)(`option`,{value:``,children:t.channelsPeerAny}),p.map((e,t)=>(0,U.jsx)(`option`,{value:String(t),children:nt(e,x)},`${e.channel}-${e.chatId}-${t}`))]})]}),p.length===0&&d.trim()&&!m?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.channelsNoSessionsHint}):null,(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-fg-muted`,children:t.peerIdLabel}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,U.jsx)(`input`,{type:`text`,className:i(W(),`min-w-0 w-full sm:flex-1`),value:_,onChange:e=>{v(e.target.value),e.target.value.trim()&&g(null)},placeholder:t.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,U.jsxs)(`select`,{className:Nt,value:_,onChange:e=>{let t=e.target.value;v(t||``),g(null)},children:[(0,U.jsx)(`option`,{value:``,children:S}),p.map(e=>(0,U.jsx)(`option`,{value:e.chatId,children:nt(e,x)},`${e.channel}-${e.chatId}`))]})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.channelsCustomPeerHint})]})]}):null,(0,U.jsx)(`div`,{children:(0,U.jsx)(z,{type:`submit`,disabled:n||!d.trim()||l,children:t.addBinding})})]})]})}function Ft(e){let{a:t,data:n,busy:r,cronLoading:a,agentCronJobs:o,onSetCronJobAgent:s}=e;return(0,U.jsxs)(G,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[(0,U.jsx)(K,{className:`shrink-0`,icon:A,title:t.cronTitle,subtitle:t.cronHint}),a?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.cronLoading}):o.length===0?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.cronNone}):(0,U.jsx)(`div`,{className:`overflow-x-auto`,children:(0,U.jsxs)(`table`,{className:`w-full min-w-[32rem] border-collapse text-left text-sm`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,U.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:t.cronColSchedule}),(0,U.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:t.cronColMessage}),(0,U.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:t.cronColSession}),(0,U.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:t.cronColAgent})]})}),(0,U.jsx)(`tbody`,{children:o.map(e=>{let a=!e.agentId?.trim(),o=a?``:e.agentId.trim().toLowerCase();return(0,U.jsxs)(`tr`,{className:`border-b border-edge-subtle`,children:[(0,U.jsx)(`td`,{className:`py-2 pr-3 font-mono text-xs`,children:e.schedule}),(0,U.jsx)(`td`,{className:`max-w-[12rem] truncate py-2 pr-3 text-xs`,title:rt(e),children:rt(e)}),(0,U.jsx)(`td`,{className:`py-2 pr-3 text-xs`,children:e.sessionTarget??`main`}),(0,U.jsx)(`td`,{className:`py-2 pr-3`,children:(0,U.jsxs)(`select`,{className:i(W(),`min-w-[8rem] py-1 text-xs`),value:o,disabled:r||e.sessionTarget!==`isolated`,onChange:t=>void s(e,t.target.value),children:[(0,U.jsx)(`option`,{value:``,children:a?t.cronAgentDefault:t.cronAgentClear}),n.agents.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.id},e.id))]})})]},e.id)})})]})})]})}function It(e){let{a:t,filesLoading:n,files:r,activeFile:a,setActiveFile:o,bootstrapViewMode:s,setBootstrapViewMode:c,fileDraft:l,setFileDraft:u,fileSaving:d,bootstrapFileLoading:f,bootstrapEditorNonce:p}=e,m=ue(e=>e.resolved===`dark`);return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[(0,U.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:t.filesHint}),n?(0,U.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:t.filesLoading}):r?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,U.jsx)(`nav`,{className:`flex shrink-0 flex-row flex-wrap gap-x-0.5 gap-y-0 border-b border-edge-subtle`,"aria-label":t.tabFiles,children:r.files.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:i(`-mb-px shrink-0 border-b-2 border-transparent px-3 py-2 text-left font-mono text-xs whitespace-nowrap transition-colors`,a===e.name?`border-accent text-fg`:`text-fg-muted hover:border-edge-subtle hover:text-fg`,e.missing&&`opacity-60`),onClick:()=>o(e.name),children:[e.name,e.missing?` (${t.missing})`:``]},e.name))}),(0,U.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":t.filesBootstrapEdit,children:[(0,U.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,s===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`edit`),children:[(0,U.jsx)(Ze,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t.filesBootstrapEdit]}),(0,U.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,s===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`preview`),children:[(0,U.jsx)(ye,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t.filesBootstrapPreview]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[d?(0,U.jsx)(`span`,{children:t.filesSavingStatus}):null,(0,U.jsx)(`span`,{children:t.filesAutoSaveHint})]})]}),s===`edit`?(0,U.jsx)(`div`,{className:i(W(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,f&&`pointer-events-none opacity-60`),children:(0,U.jsx)(ie,{initialContent:l,onChange:u,isDark:m,className:`min-h-0 flex-1`},`${a??`file`}-${p}`)}):(0,U.jsx)(`div`,{className:i(W(),`min-h-0 flex-1 overflow-y-auto text-sm`,f&&`pointer-events-none opacity-60`),children:(0,U.jsx)(g,{content:l,className:`text-sm`})})]}):(0,U.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:t.pickFile})})]}):(0,U.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:t.filesEmpty})]})}var Lt={name:``,creature:``,emoji:``,avatar:``};function Rt(e){let t={...Lt};if(!e.trim())return t;let n={name:`name`,creature:`creature`,emoji:`emoji`,avatar:`avatar`};for(let r of e.split(`
|
|
147
|
+
`)){let e=r.match(/^[-*]\s+\*\*(\w+):\*\*\s*(.*)/i);if(!e)continue;let i=n[e[1].toLowerCase()];if(!i)continue;let a=e[2].trim();/^_\(.*\)_$/.test(a)&&(a=``),t[i]=a}return t}function zt(e){return[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${e.name}`,`- **Creature:** ${e.creature}`,`- **Emoji:** ${e.emoji}`,`- **Avatar:** ${e.avatar}`,``].join(`
|
|
148
|
+
`)}var Bt={callName:``,pronouns:``,timezone:``,notes:``};function Vt(e){let t={...Bt};if(!e.trim())return t;let n={name:`callName`,"what to call them":`callName`,pronouns:`pronouns`,timezone:`timezone`,notes:`notes`},r=e.split(`
|
|
149
|
+
`),i=-1;for(let e=0;e<r.length;e++){let a=r[e];if(/^##\s+Context/i.test(a)){i=e+1;continue}let o=a.match(/^[-*]\s+\*\*(.+?):\*\*\s*(.*)/i);if(!o)continue;let s=n[o[1].toLowerCase().trim()];if(!s)continue;let c=o[2].trim();/^_\(.*\)_$/.test(c)&&(c=``),t[s]=c}if(i>0){let e=r.slice(i).join(`
|
|
150
|
+
`).replace(/^_\(.*?\)_\s*/gm,``).replace(/^---\s*$/gm,``).replace(/The more you know.*$/s,``).trim();e&&!t.notes&&(t.notes=e)}return t}function Ht(e){let t=[`# USER.md - About Your Human`,``,`- **Name:** ${e.callName}`,`- **Pronouns:** ${e.pronouns}`,`- **Timezone:** ${e.timezone}`,``];return e.notes.trim()&&t.push(`## Context`,``,e.notes.trim(),``),t.join(`
|
|
151
|
+
`)}var Ut=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
|
|
152
|
+
|
|
153
|
+
## Core Truths
|
|
154
|
+
|
|
155
|
+
**Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
|
|
156
|
+
|
|
157
|
+
**Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
|
|
158
|
+
|
|
159
|
+
**Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
|
|
160
|
+
|
|
161
|
+
**Remember you're a guest.** You have access to someone's life. Treat it with respect.
|
|
162
|
+
|
|
163
|
+
## Boundaries
|
|
164
|
+
|
|
165
|
+
- Private things stay private. Period.
|
|
166
|
+
- When in doubt, ask before acting externally.
|
|
167
|
+
- Never send half-baked replies to messaging surfaces.
|
|
168
|
+
|
|
169
|
+
## Vibe
|
|
170
|
+
|
|
171
|
+
Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
|
|
172
|
+
|
|
173
|
+
## Core Truths
|
|
174
|
+
|
|
175
|
+
**Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
|
|
176
|
+
|
|
177
|
+
**Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
|
|
178
|
+
|
|
179
|
+
**Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
|
|
180
|
+
|
|
181
|
+
**Earn trust by being reliable.** Show up, follow through, and remember what matters.
|
|
182
|
+
|
|
183
|
+
**Respect the intimacy.** You have access to someone's life. That's a privilege.
|
|
184
|
+
|
|
185
|
+
## Boundaries
|
|
186
|
+
|
|
187
|
+
- Private things stay private. Always.
|
|
188
|
+
- When in doubt, ask before acting externally.
|
|
189
|
+
- Be careful in group chats — you're not the user's voice.
|
|
190
|
+
|
|
191
|
+
## Vibe
|
|
192
|
+
|
|
193
|
+
Warm, friendly, and a little playful. Like a helpful friend who happens to know everything.`},{id:`geeky`,labelEn:`Geeky & Witty`,labelZh:`极客风格`,emoji:`🧑💻`,content:`# SOUL.md - Who You Are
|
|
194
|
+
|
|
195
|
+
## Core Truths
|
|
196
|
+
|
|
197
|
+
**Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
|
|
198
|
+
|
|
199
|
+
**Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
|
|
200
|
+
|
|
201
|
+
**Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
|
|
202
|
+
|
|
203
|
+
**Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
|
|
204
|
+
|
|
205
|
+
**Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
|
|
206
|
+
|
|
207
|
+
## Boundaries
|
|
208
|
+
|
|
209
|
+
- Private things stay private.
|
|
210
|
+
- When in doubt, ask before acting externally.
|
|
211
|
+
- Never send half-baked replies.
|
|
212
|
+
|
|
213
|
+
## Vibe
|
|
214
|
+
|
|
215
|
+
Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}];function Wt(e){let t=e.trimStart();if(!t.startsWith(`---`))return e;let n=t.indexOf(`---`,3);return n===-1?e:t.slice(n+3).trimStart()}function q(e){let t=Wt(e).trim();if(!t)return`professional`;for(let e of Ut)if(e.id!==`custom`&&(t===e.content.trim()||Gt(e.id).filter(e=>t.includes(e)).length>=2))return e.id;return`custom`}function Gt(e){switch(e){case`professional`:return[`precise and efficient`,`Value the user's time`,`actionable answers`];case`casual`:return[`good friend`,`corporate drone`,`a little playful`];case`geeky`:return[`Precision over politeness`,`Go deep`,`slightly nerdy`];default:return[]}}var Kt=[{value:``,labelEn:`Not set`,labelZh:`未设置`},{value:`Asia/Shanghai`,labelEn:`Asia/Shanghai (CST, UTC+8)`,labelZh:`亚洲/上海 (北京时间, UTC+8)`},{value:`Asia/Tokyo`,labelEn:`Asia/Tokyo (JST, UTC+9)`,labelZh:`亚洲/东京 (日本时间, UTC+9)`},{value:`Asia/Seoul`,labelEn:`Asia/Seoul (KST, UTC+9)`,labelZh:`亚洲/首尔 (韩国时间, UTC+9)`},{value:`Asia/Singapore`,labelEn:`Asia/Singapore (SGT, UTC+8)`,labelZh:`亚洲/新加坡 (UTC+8)`},{value:`Asia/Hong_Kong`,labelEn:`Asia/Hong Kong (HKT, UTC+8)`,labelZh:`亚洲/香港 (UTC+8)`},{value:`Asia/Taipei`,labelEn:`Asia/Taipei (CST, UTC+8)`,labelZh:`亚洲/台北 (UTC+8)`},{value:`Asia/Kolkata`,labelEn:`Asia/Kolkata (IST, UTC+5:30)`,labelZh:`亚洲/加尔各答 (印度时间, UTC+5:30)`},{value:`Asia/Dubai`,labelEn:`Asia/Dubai (GST, UTC+4)`,labelZh:`亚洲/迪拜 (UTC+4)`},{value:`Europe/London`,labelEn:`Europe/London (GMT/BST)`,labelZh:`欧洲/伦敦 (格林尼治时间)`},{value:`Europe/Paris`,labelEn:`Europe/Paris (CET, UTC+1)`,labelZh:`欧洲/巴黎 (中欧时间, UTC+1)`},{value:`Europe/Berlin`,labelEn:`Europe/Berlin (CET, UTC+1)`,labelZh:`欧洲/柏林 (中欧时间, UTC+1)`},{value:`Europe/Moscow`,labelEn:`Europe/Moscow (MSK, UTC+3)`,labelZh:`欧洲/莫斯科 (UTC+3)`},{value:`America/New_York`,labelEn:`America/New York (EST, UTC-5)`,labelZh:`美国/纽约 (东部时间, UTC-5)`},{value:`America/Chicago`,labelEn:`America/Chicago (CST, UTC-6)`,labelZh:`美国/芝加哥 (中部时间, UTC-6)`},{value:`America/Denver`,labelEn:`America/Denver (MST, UTC-7)`,labelZh:`美国/丹佛 (山地时间, UTC-7)`},{value:`America/Los_Angeles`,labelEn:`America/Los Angeles (PST, UTC-8)`,labelZh:`美国/洛杉矶 (太平洋时间, UTC-8)`},{value:`America/Sao_Paulo`,labelEn:`America/São Paulo (BRT, UTC-3)`,labelZh:`美洲/圣保罗 (巴西时间, UTC-3)`},{value:`Australia/Sydney`,labelEn:`Australia/Sydney (AEST, UTC+10)`,labelZh:`澳大利亚/悉尼 (UTC+10)`},{value:`Pacific/Auckland`,labelEn:`Pacific/Auckland (NZST, UTC+12)`,labelZh:`太平洋/奥克兰 (新西兰时间, UTC+12)`}];function qt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return``}}var Jt=[{value:`先生`,labelEn:`Mr.`,labelZh:`先生`},{value:`女士`,labelEn:`Ms.`,labelZh:`女士`},{value:`同学`,labelEn:`Colleague`,labelZh:`同学`},{value:`老师`,labelEn:`Teacher`,labelZh:`老师`},{value:`老板`,labelEn:`Boss`,labelZh:`老板`},{value:`朋友`,labelEn:`Friend`,labelZh:`朋友`}],Yt=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}];function Xt(e){let{a:t,chat:n,selected:r,busy:a,editName:o,setEditName:s,editDescription:c,setEditDescription:l,editWorkspace:d,setEditWorkspace:f,editModel:p,setEditModel:m,onSetDefault:h,onSaveAgentEdits:_,onDelete:v,hideInlineSave:y,saveBootstrapRef:b,onBootstrapDirtyChange:x}=e,S=te(e=>e.language),C=ue(e=>e.resolved===`dark`),[w,T]=(0,V.useState)(!0),[,ee]=(0,V.useState)(!1),[E,ne]=(0,V.useState)({name:``,creature:``,emoji:``,avatar:``}),[O,re]=(0,V.useState)(`professional`),[k,ae]=(0,V.useState)(``),[oe,se]=(0,V.useState)(0),[A,ce]=(0,V.useState)(!1),le=(0,V.useRef)(!1),j=(0,V.useRef)(r?.id??``);j.current=r?.id??``;let de=(0,V.useRef)(``),M=(0,V.useRef)(``);(0,V.useEffect)(()=>{if(!r)return;let e=!1;return le.current=!1,T(!0),(async()=>{try{let[t,n]=await Promise.all([Xe(r.id,`IDENTITY.md`).catch(()=>``),Xe(r.id,`SOUL.md`).catch(()=>``)]);if(e)return;let i=Rt(t);ne(i),de.current=JSON.stringify(i),re(q(n)),ae(n),M.current=n,se(e=>e+1)}finally{e||(T(!1),le.current=!0)}})(),()=>{e=!0}},[r?.id]);let pe=(0,V.useCallback)(async(e,t)=>{ee(!0);try{await u(j.current,e,t)}finally{ee(!1)}},[]),me=(0,V.useRef)(E);me.current=E;let he=(0,V.useRef)(k);he.current=k,(0,V.useEffect)(()=>{if(b)return b.current=async()=>{await Promise.all([pe(`IDENTITY.md`,zt(me.current)),pe(`SOUL.md`,he.current)]),de.current=JSON.stringify(me.current),M.current=he.current,x?.(!1)},()=>{b.current=null}},[b,pe,x]),(0,V.useEffect)(()=>{if(!x)return;let e=JSON.stringify(E)!==de.current,t=k!==M.current;x(e||t)},[E,k,x]);let P=(0,V.useCallback)(e=>{ne(t=>({...t,...e}))},[]),ge=(0,V.useCallback)(e=>{if(re(e),e!==`custom`){let t=Ut.find(t=>t.id===e);t?.content&&(ae(t.content),se(e=>e+1))}},[]),_e=(0,V.useCallback)(e=>{ae(e),re(`custom`)},[]),I=(0,V.useCallback)((e,t)=>S===`zh`?t:e,[S]),L=W();return r?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto`,children:[(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:D,title:t.personaSectionIdentity,subtitle:t.personaSectionIdentityHint,trailing:r.isDefault?null:(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:a,onClick:()=>void h(),children:t.setDefault})}),(0,U.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:t.displayName}),(0,U.jsx)(`input`,{className:L,value:o,onChange:e=>{s(e.target.value),P({name:e.target.value})},placeholder:t.personaNamePlaceholder,autoComplete:`off`})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:t.personaEmoji}),(0,U.jsx)(`input`,{className:L,value:E.emoji,onChange:e=>P({emoji:e.target.value}),placeholder:t.personaEmojiPlaceholder,autoComplete:`off`})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:t.agentDescription}),(0,U.jsx)(`textarea`,{className:i(L,`min-h-16 resize-y text-sm leading-relaxed`),value:c,onChange:e=>l(e.target.value),placeholder:t.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:t.personaCreature}),(0,U.jsxs)(`select`,{className:L,value:Yt.some(e=>e.value===E.creature)?E.creature:`__custom__`,onChange:e=>{if(e.target.value===`__custom__`){P({creature:``});return}P({creature:e.target.value})},children:[Yt.map(e=>(0,U.jsx)(`option`,{value:e.value,children:I(e.labelEn,e.labelZh)},e.value)),(0,U.jsx)(`option`,{value:`__custom__`,children:I(`Custom…`,`自定义…`)})]}),Yt.some(e=>e.value===E.creature)?null:(0,U.jsx)(`input`,{className:i(L,`mt-1 text-xs`),value:E.creature,onChange:e=>P({creature:e.target.value}),placeholder:t.personaCreaturePlaceholder,autoComplete:`off`})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:t.personaAvatar}),(0,U.jsx)(`input`,{className:i(L,`font-mono text-xs`),value:E.avatar,onChange:e=>P({avatar:e.target.value}),placeholder:t.personaAvatarPlaceholder,autoComplete:`off`})]})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:N,title:t.editAgent,subtitle:t.editAgentHint}),(0,U.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:t.modelPrimary}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[(0,U.jsx)(F,{className:`min-w-0 flex-1`,popoverContentClassName:`z-[70]`,value:p,disabled:a,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>m(e)}),p.trim()?(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:a,onClick:()=>m(``),children:t.modelClear}):null]})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspacePath}),(0,U.jsx)(`input`,{className:i(L,`font-mono text-xs`),value:d,onChange:e=>f(e.target.value)})]})]}),y?null:(0,U.jsx)(`div`,{className:`mt-4`,children:(0,U.jsx)(z,{type:`button`,disabled:a,onClick:()=>void _(),children:t.save})})]}),w?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.loading}):(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:Me,title:t.personaSectionSoul,subtitle:t.personaSectionSoulHint}),(0,U.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.personaSoulTemplate}),(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:Ut.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 px-3 py-3 text-center transition-all`,O===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>ge(e.id),children:[(0,U.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,U.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:I(e.labelEn,e.labelZh)})]},e.id))})]}),O===`custom`?(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.personaSoulCustomEdit}),(0,U.jsx)(`button`,{type:`button`,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,title:A?t.personaSoulEdit:t.personaSoulPreview,"aria-label":A?t.personaSoulEdit:t.personaSoulPreview,onClick:()=>ce(e=>!e),children:A?(0,U.jsx)(et,{className:`size-4`,"aria-hidden":!0}):(0,U.jsx)(ye,{className:`size-4`,"aria-hidden":!0})})]}),(0,U.jsx)(`div`,{className:i(L,`flex min-h-64 flex-col overflow-hidden p-0`),children:A?(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,U.jsx)(g,{content:k})}):(0,U.jsx)(ie,{initialContent:k,onChange:_e,isDark:C,className:`min-h-0 flex-1`},`soul-${oe}`)})]}):null]}),r.id===`main`?null:(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:xe,title:I(`Danger Zone`,`危险操作`),subtitle:I(`Actions that cannot be undone. Be careful.`,`以下操作不可撤销,请谨慎操作。`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(z,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void v(!1),children:[(0,U.jsx)(fe,{className:`mr-1 size-4`,"aria-hidden":!0}),t.removeFromConfig]}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`,disabled:a,onClick:()=>void v(!0),children:t.purgeDisk})]})]})]}):(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.selectAgentHint})}function Zt({a:e,agentId:t,saveRef:n,onDirtyChange:r}){let a=te(e=>e.language),[o,s]=(0,V.useState)(!0),[,c]=(0,V.useState)(!1),[l,d]=(0,V.useState)({callName:``,pronouns:``,timezone:``,notes:``}),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(``),v=(0,V.useRef)(!1),y=(0,V.useRef)(t);y.current=t;let b=(0,V.useRef)(``),x=(0,V.useCallback)(async e=>{let t=y.current;c(!0);try{await u(t,`USER.md`,e)}finally{c(!1)}},[]),S=(0,V.useRef)(l);S.current=l,(0,V.useEffect)(()=>{if(n)return n.current=async()=>{await x(Ht(S.current)),b.current=JSON.stringify(S.current),r?.(!1)},()=>{n.current=null}},[n,x,r]),(0,V.useEffect)(()=>{r&&r(JSON.stringify(l)!==b.current)},[l,r]),(0,V.useEffect)(()=>{let e=!1;return v.current=!1,s(!0),(async()=>{try{let n=await Xe(t,`USER.md`).catch(()=>``);if(e)return;let r=Vt(n),i=r;if(!r.timezone){let e=qt();e&&(i={...r,timezone:e})}d(i),b.current=JSON.stringify(i);let a=!i.pronouns||Jt.some(e=>e.value===i.pronouns);i.pronouns&&!a&&p(!0);let o=Kt.some(e=>e.value===i.timezone);i.timezone&&!o&&(h(!0),_(i.timezone))}finally{e||(s(!1),v.current=!0)}})(),()=>{e=!0}},[t]);let C=(0,V.useCallback)(e=>{d(t=>({...t,...e}))},[]),w=(0,V.useCallback)(e=>{if(e===`__custom__`){h(!0);return}h(!1),_(``),C({timezone:e})},[C]),T=(0,V.useCallback)(e=>{_(e),C({timezone:e})},[C]),ee=(0,V.useCallback)(()=>{let e=qt();e&&(Kt.some(t=>t.value===e)?(h(!1),_(``)):(h(!0),_(e)),C({timezone:e}))},[C]),E=m?`__custom__`:Kt.some(e=>e.value===l.timezone)?l.timezone:`__custom__`,ne=(0,V.useCallback)((e,t)=>a===`zh`?t:e,[a]);if(o)return(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.loading});let D=W();return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.personaSectionUserHint}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:k,title:e.personaSectionUser,subtitle:e.personaSectionUserHint}),(0,U.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaCallName}),(0,U.jsx)(`input`,{className:D,value:l.callName,onChange:e=>C({callName:e.target.value}),placeholder:e.personaCallNamePlaceholder,autoComplete:`off`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaPronouns}),(0,U.jsxs)(`select`,{className:D,value:Jt.some(e=>e.value===l.pronouns)?l.pronouns:`__custom__`,onChange:e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),C({pronouns:e.target.value})},children:[(0,U.jsx)(`option`,{value:``,disabled:!0,children:e.personaPronounsPlaceholder}),Jt.map(e=>(0,U.jsx)(`option`,{value:e.value,children:ne(e.labelEn,e.labelZh)},e.value)),(0,U.jsx)(`option`,{value:`__custom__`,children:ne(`Custom…`,`自定义…`)})]}),f?(0,U.jsx)(`input`,{className:i(D,`mt-1 text-xs`),value:Jt.some(e=>e.value===l.pronouns)?``:l.pronouns,onChange:e=>C({pronouns:e.target.value}),placeholder:e.personaPronounsPlaceholder,autoComplete:`off`}):null]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaTimezone}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[(0,U.jsxs)(`select`,{className:i(D,`min-w-0 flex-1`),value:E,onChange:e=>w(e.target.value),children:[Kt.map(e=>(0,U.jsx)(`option`,{value:e.value,children:ne(e.labelEn,e.labelZh)},e.value)),(0,U.jsx)(`option`,{value:`__custom__`,children:e.personaTimezoneCustom})]}),(0,U.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:ee,children:e.personaTimezoneDetect})]}),m?(0,U.jsx)(`input`,{className:i(D,`mt-1 font-mono text-xs`),value:g,onChange:e=>T(e.target.value),placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:e.personaNotes}),(0,U.jsx)(`textarea`,{className:i(D,`min-h-16 resize-y text-sm leading-relaxed`),value:l.notes,onChange:e=>C({notes:e.target.value}),placeholder:e.personaNotesPlaceholder,rows:3,spellCheck:!0})]})]}),(0,U.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft/30 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,U.jsx)(Fe,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`span`,{children:e.personaMemoryNote})]})]})]})}function Qt(e){let{a:t,selected:n,busy:r,skillsCatalogLoading:a,catalogForPick:o,skillsInherit:s,setSkillsInherit:c,skillsPick:l,setSkillsPick:u,onSaveSkills:d,hideInlineSave:f}=e;function p(e){let t=n.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)}function m(){let e=n.skills.effectiveAllowlist;return e===void 0?new Set(o.map(e=>e.name||e.directoryId)):new Set(e)}return(0,U.jsxs)(G,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(K,{className:`shrink-0`,icon:S,title:t.skillsTitle,subtitle:t.skillsHint}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(z,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>c(!0),children:t.skillsInherit}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>{c(!1),u(m())},children:t.skillsCustomize})]}),(0,U.jsx)(_,{to:j(`skills`),className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:t.skillsLibraryLink})]}),(0,U.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[t.skillsDefaultsLabel,` `,n.skills.defaults.length?n.skills.defaults.join(`, `):`—`]}),(0,U.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[t.skillsEffectiveLabel,` `,n.skills.effectiveAllowlist?.length?n.skills.effectiveAllowlist.join(`, `):t.skillsAllFromCatalog]}),a?(0,U.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:t.skillsCatalogLoading}):o.length===0?(0,U.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:t.skillsEmptyCatalog}):(0,U.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,s&&`opacity-50`),children:(0,U.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,role:`list`,children:o.map(e=>{let n=e.name||e.directoryId,a=s?p(n):l.has(n),o=typeof e.description==`string`?e.description.trim():``,c=o||t.skillsNoDescription;return(0,U.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 dark:border-edge-subtle`,children:(0,U.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:a,disabled:s||r,onChange:()=>{u(e=>{let t=new Set(e);return a?t.delete(n):t.add(n),t})}}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,U.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:n,children:n}),(0,U.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:c,children:c})]})]})},n)})})}),f?null:(0,U.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,U.jsx)(z,{type:`button`,disabled:r,onClick:()=>void d(),children:t.skillsSave})})]})}function $t(e){let{a:t,data:n,selected:r,busy:a,toolEntryDisable:o,setToolEntryDisable:s,onSaveTools:c,onClearToolsEntry:l,hideInlineSave:u}=e;return(0,U.jsxs)(G,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(K,{className:`shrink-0`,icon:ve,title:t.toolsTitle,subtitle:t.toolsHint}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,U.jsx)(`ul`,{className:`flex flex-col gap-2.5 pr-1`,role:`list`,children:(n.builtinToolIds.length?n.builtinToolIds:[]).map(e=>{let n=r.tools.defaultsDisable.includes(e),c=n?!1:!o.has(e),l=e in t.toolDescriptions?t.toolDescriptions[e]:``;return(0,U.jsx)(`li`,{className:i(`rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5 dark:border-edge-subtle`,n&&`opacity-60`),children:(0,U.jsxs)(`label`,{className:i(`flex cursor-pointer gap-3 text-sm`,n&&`cursor-not-allowed`),children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:c,disabled:n||a,onChange:()=>{n||s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),n?(0,U.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,t.toolsLockedByDefaults,`)`]}):null]}),l?(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})}),(0,U.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[u?null:(0,U.jsx)(z,{type:`button`,disabled:a,onClick:()=>void c(),children:t.toolsSave}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void l(),children:t.toolsClearEntry})]})]})}function en(){let e=Ie(te(e=>e.language)),t=e.agentsSettings,[n,a]=(0,V.useState)(!1),[s,f]=(0,V.useState)(null),[h,g]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),S=e.cron,C=e.chat,w=!!Be(e=>e.token),[E]=ze(),D=m(),{agentId:O}=b(),k=x(e=>e.setPageHeader),ie=x(e=>e.clearPageHeader),{data:ae,error:oe,isLoading:se,mutate:A}=r(w?`settings-gateway-agents`:null,c,{revalidateOnFocus:!1}),{data:ce}=o(w),le=(0,V.useMemo)(()=>re(ce?.payload?.config??{}),[ce]),j=ae??null,ue=!!(w&&se),[fe,M]=(0,V.useState)(null),pe=oe instanceof Error?oe.message:oe?t.loadError:null,me=fe??pe,[N,F]=(0,V.useState)(null),[ge,I]=(0,V.useState)(!1),[L,ve]=(0,V.useState)(`overview`),[ye,xe]=(0,V.useState)(``),[Se,Ce]=(0,V.useState)(``),[we,Te]=(0,V.useState)(``),[Ee,De]=(0,V.useState)(``),[Oe,Ae]=(0,V.useState)(``),[Me,Ne]=(0,V.useState)(null),[Pe,Fe]=(0,V.useState)(!1),Le=(0,V.useRef)(``),[R,B]=(0,V.useState)(!1),[He,Ue]=(0,V.useState)(``),[Ke,qe]=(0,V.useState)(``),[Ye,Ze]=(0,V.useState)(``),[Qe,et]=(0,V.useState)(``),[nt,rt]=(0,V.useState)(``),[st,ct]=(0,V.useState)(null),[lt,ut]=(0,V.useState)(!1),[H,dt]=(0,V.useState)(null),[ft,pt]=(0,V.useState)(``),[gt,_t]=(0,V.useState)(!1),[vt,bt]=(0,V.useState)(`edit`),[xt,W]=(0,V.useState)(!1),[Tt,kt]=(0,V.useState)(0),jt=(0,V.useRef)(ft);jt.current=ft;let Mt=(0,V.useRef)(N);Mt.current=N;let G=(0,V.useRef)(H);G.current=H;let K=(0,V.useRef)(null),Nt=(0,V.useRef)(null),[Lt,Rt]=(0,V.useState)(!1),[zt,Bt]=(0,V.useState)(!1),[Vt,Ht]=(0,V.useState)(!1),Ut=(0,V.useRef)(``),Wt=(0,V.useRef)(``),q=p(async()=>{let e=Mt.current,n=G.current;if(!e||!n||`${e}:${n}`!==Ut.current)return;let r=jt.current;if(r!==Wt.current){_t(!0),M(null);try{await u(e,n,r),Wt.current=r,ct(t=>!t||t.agentId!==e?t:{...t,files:t.files.map(e=>e.name===n?{...e,missing:!1}:e)})}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{_t(!1)}}},800),Gt=(0,V.useRef)(q.flush);Gt.current=q.flush,(0,V.useEffect)(()=>()=>{Gt.current()},[]);let[Kt,qt]=(0,V.useState)(()=>new Set),[Jt,Yt]=(0,V.useState)(()=>new Set),[en,J]=(0,V.useState)(!0),[Y,tn]=(0,V.useState)([]),[nn,rn]=(0,V.useState)(``),[an,on]=(0,V.useState)([]),[sn,cn]=(0,V.useState)(!1),[ln,un]=(0,V.useState)([]),[dn,fn]=(0,V.useState)(!1),[pn,mn]=(0,V.useState)(null),[hn,gn]=(0,V.useState)(``),[_n,vn]=(0,V.useState)([]),[yn,bn]=(0,V.useState)(!1),[xn,Sn]=(0,V.useState)([]),[X,Cn]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(j){if(O&&j.agents.some(e=>e.id===O)){F(O);return}F(e=>e&&j.agents.some(t=>t.id===e)?e:j.defaultId)}},[j,O]),(0,V.useEffect)(()=>{if(!j||ue)return;let e=j.agents.length<=1&&j.agents.every(e=>e.id===j.defaultId),t=localStorage.getItem(Ot)===`true`;I(e&&!t)},[j,ue]);let Z=(0,V.useCallback)(()=>{I(!1),A()},[A]),wn=(0,V.useCallback)(()=>{I(!1)},[]);(0,V.useEffect)(()=>{!j||!O||j.agents.some(e=>e.id===O)||D(de,{replace:!0})},[j,O,D]),(0,V.useEffect)(()=>{O&&ve(`overview`)},[O]),(0,V.useEffect)(()=>{E.get(`panel`)===`defaults`&&D(`/settings/agent-defaults`,{replace:!0,state:{[be]:de}})},[E,D]);let Q=(0,V.useMemo)(()=>j?.agents.find(e=>e.id===N)??null,[j,N]),Tn=(0,V.useMemo)(()=>Q?Y.filter(e=>e.agentId.toLowerCase()===Q.id.toLowerCase()):[],[Y,Q?.id]),En=(0,V.useMemo)(()=>!j||!Q?[]:_n.filter(e=>wt(e,Q.id,j.defaultId)),[_n,j,Q?.id]),Dn=(0,V.useMemo)(()=>xn.filter(e=>e.enabled!==!1),[xn]);(0,V.useEffect)(()=>{if(!Q){qe(``),Ze(``),et(``),rt(``);return}qe(Q.workspace),Ze(Q.model?.primary??``),et(Q.name?.trim()?Q.name.trim():Q.id),rt(Q.description?.trim()??``)},[Q?.id]),(0,V.useEffect)(()=>{if(L!==`files`||!N||!w)return;let e=!1;return ut(!0),ne(N).then(t=>{e||ct(t)}).catch(()=>{e||ct(null)}).finally(()=>{e||ut(!1)}),()=>{e=!0}},[L,N,w,j?.agents.length]),(0,V.useEffect)(()=>{!Q||L!==`tools`||qt(new Set(Q.tools.entryDisable))},[L,Q]),(0,V.useEffect)(()=>{if(!Q||L!==`skills`)return;let e=Q.skills.entry===void 0;if(J(e),e){let e=Q.skills.effectiveAllowlist;Yt(new Set(e??[]))}else Yt(new Set(Q.skills.entry??[]))},[L,Q]),(0,V.useEffect)(()=>{L!==`channels`||!w||tn(le)},[L,w,le]),(0,V.useEffect)(()=>{if(L!==`channels`||!w)return;let e=!1;return cn(!0),it().then(t=>{e||on(t)}).catch(()=>{e||on([])}).finally(()=>{e||cn(!1)}),()=>{e=!0}},[L,w]),(0,V.useEffect)(()=>{sn||L!==`channels`||an.length===0||rn(e=>e&&an.some(t=>t.name===e)?e:an[0].name)},[sn,L,an]),(0,V.useEffect)(()=>{if(L!==`channels`||!w)return;let e=nn.trim();if(!e){un([]);return}let t=!1;return mn(null),fn(!0),at(e).then(e=>{t||un(e)}).catch(()=>{t||un([])}).finally(()=>{t||fn(!1)}),()=>{t=!0}},[L,w,nn]);let On=(0,V.useCallback)(()=>{let e=nn.trim();e&&(fn(!0),at(e).then(e=>{un(e),mn(t=>t!=null&&t<e.length?t:null)}).catch(()=>{un([]),mn(null)}).finally(()=>{fn(!1)}))},[nn]),kn=!sn&&an.length===0,$=L===`channels`&&w&&ce===void 0;(0,V.useEffect)(()=>{if(L!==`cron`||!w)return;let e=!1;return bn(!0),ot().then(t=>{e||vn(t)}).catch(()=>{e||vn([])}).finally(()=>{e||bn(!1)}),()=>{e=!0}},[L,w]),(0,V.useEffect)(()=>{if(L!==`skills`||!w)return;let e=!1;return Cn(!0),Je().then(t=>{e||Sn(t)}).catch(()=>{e||Sn([])}).finally(()=>{e||Cn(!1)}),()=>{e=!0}},[L,w]),(0,V.useEffect)(()=>{if(!H||!N||!w)return;let e=!1;return q.flush(),W(!0),Xe(N,H).then(t=>{e||(Ut.current=`${N}:${H}`,Wt.current=t,pt(t),kt(e=>e+1))}).catch(()=>{e||(Ut.current=`${N}:${H}`,Wt.current=``,pt(``),kt(e=>e+1))}).finally(()=>{e||W(!1)}),()=>{e=!0}},[H,N,w,q]),(0,V.useEffect)(()=>{!H||!N||xt||q()},[ft,H,N,xt,q]),(0,V.useEffect)(()=>{if(L===`files`)return()=>{q.flush()}},[L,q]),(0,V.useEffect)(()=>{bt(`edit`)},[H,N]);let An=(0,V.useCallback)(()=>{let e=ht(Se.trim()||ye);De(t=>t===``||t===Le.current?(Le.current=e,e):t)},[Se,ye]),jn=(0,V.useCallback)(()=>{Le.current=``,xe(``),Ce(``),Te(``),De(``),Ae(``),Ne(null),Fe(!0)},[]),Mn=e.settingsSections[`agent-defaults`],Nn=(0,V.useMemo)(()=>(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[(0,U.jsx)(z,{asChild:!0,variant:`secondary`,className:`shrink-0 gap-2`,children:(0,U.jsxs)(_,{to:`/settings/agent-defaults`,title:Mn,state:{[be]:de},children:[(0,U.jsx)(l,{className:`size-4 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),Mn]})}),(0,U.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[(0,U.jsx)(ke,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,U.jsx)(`input`,{type:`search`,role:`searchbox`,enterKeyHint:`search`,value:He,onChange:e=>Ue(e.target.value),placeholder:t.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":t.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),(0,U.jsxs)(z,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":t.addAgentAria,disabled:R,onClick:()=>jn(),children:[(0,U.jsx)(ee,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t.addAgent]})]}),[t.addAgent,t.addAgentAria,t.listSearchPlaceholder,R,Mn,He,jn]);(0,V.useLayoutEffect)(()=>w?(k({startExtra:null,main:null,end:Nn}),()=>ie()):(ie(),()=>ie()),[Nn,ie,w,k]);async function Pn(e){e.preventDefault();let n=ye.trim();if(!n)return;let r=mt(Se,n);if(r.ok===!1){Ne(r.error);return}let i=Ee.trim()||ht(Se.trim()||n);if(i){B(!0),Ne(null);try{let e=we.trim(),{createdAgentId:t,...r}=await $e({name:n,workspace:i,...Se.trim()?{id:Se.trim()}:{},...Oe.trim()?{model:Oe.trim()}:{},...e?{description:e}:{}});A(r,{revalidate:!1}),xe(``),Ce(``),Te(``),De(``),Ae(``),Ne(null),Fe(!1),F(t),D(Ge(t))}catch(e){Ne(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}}async function Fn(){if(Q){B(!0),M(null);try{let e=nt.trim();A(await T(Q.id,{name:Qe.trim()||void 0,description:e.length>0?e:null,workspace:Ke.trim()||void 0,model:Ye.trim()||null}),{revalidate:!1})}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}}async function In(e){B(!0),M(null);try{A(await T(e.id,{setDefault:!0}),{revalidate:!1}),F(e.id)}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}async function Ln(e,n){B(!0),M(null);try{let t=await he(e.id,n);A(t,{revalidate:!1}),F(t.defaultId),ve(`overview`),O===e.id&&D(de,{replace:!0}),a(!1),f(null),y(``)}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}function Rn(e,t){e.id!==`main`&&(f(e),g(t),y(``),a(!0))}async function zn(){if(Q){B(!0),M(null);try{let e=[...Kt].sort((e,t)=>e.localeCompare(t));A(await T(Q.id,{toolsDisable:e}),{revalidate:!1})}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}}async function Bn(){if(Q){B(!0),M(null);try{A(await T(Q.id,{toolsDisable:null}),{revalidate:!1}),qt(new Set)}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}}async function Vn(){if(Q){B(!0),M(null);try{A(await T(Q.id,{skills:en?null:[...Jt].sort((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}}async function Hn(e){B(!0),M(null);try{let t=Y.filter(t=>t!==e);await d(t),tn(t)}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}async function Un(e){if(e.preventDefault(),!Q||!nn.trim())return;let n=Et(nn,hn,pn,ln),r=[...Y,{agentId:Q.id,priority:100,enabled:!0,match:n}];B(!0),M(null);try{await d(r),tn(r),mn(null),gn(``)}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}async function Wn(e,n){B(!0),M(null);try{await tt(e.id,{agentId:n===``?null:n}),vn(await ot())}catch(e){M(e instanceof Error?e.message:t.saveError)}finally{B(!1)}}let Gn=L===`channels`||L===`cron`,Kn=(()=>{if(!Q||L!==`overview`)return!1;let e=Q.name?.trim()||Q.id,t=Q.description?.trim()??``,n=Q.workspace,r=Q.model?.primary??``;return Qe.trim()!==e||nt.trim()!==t||Ke.trim()!==n||Ye.trim()!==r})(),qn=(()=>{if(Gn)return!1;switch(L){case`overview`:return Kn||Lt;case`profile`:return zt;default:return!0}})(),Jn=Gn||!qn;function Yn(){Ht(!0),setTimeout(()=>Ht(!1),2e3)}async function Xn(){switch(L){case`overview`:await Promise.all([Fn(),K.current?.()??Promise.resolve()]),Yn();break;case`profile`:await Nt.current?.(),Yn();break;case`tools`:await zn(),Yn();break;case`skills`:await Vn(),Yn();break;case`files`:q.flush(),Yn();break;default:break}}function Zn(e){e||D(de)}let Qn=Q?Qe.trim()||Q.name?.trim()||Q.id:O??``,$n=Q?.id??O??``;if(!w)return(0,U.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:t.title}),(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]});if(ge&&j)return(0,U.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col px-4 py-8`,children:(0,U.jsx)(At,{existingAgentIds:new Set(j.agents.map(e=>e.id)),onComplete:Z,onSkip:wn})});let er=Q?L===`overview`?(0,U.jsx)(Xt,{a:t,chat:C,selected:Q,busy:R,editName:Qe,setEditName:et,editDescription:nt,setEditDescription:rt,editWorkspace:Ke,setEditWorkspace:qe,editModel:Ye,setEditModel:Ze,onSetDefault:()=>void In(Q),onSaveAgentEdits:()=>void Fn(),onDelete:e=>void Rn(Q,e),hideInlineSave:!0,saveBootstrapRef:K,onBootstrapDirtyChange:Rt}):L===`profile`?(0,U.jsx)(Zt,{a:t,agentId:Q.id,saveRef:Nt,onDirtyChange:Bt}):L===`files`?(0,U.jsx)(It,{a:t,filesLoading:lt,files:st,activeFile:H,setActiveFile:dt,bootstrapViewMode:vt,setBootstrapViewMode:bt,fileDraft:ft,setFileDraft:pt,fileSaving:gt,bootstrapFileLoading:xt,bootstrapEditorNonce:Tt}):L===`tools`?(0,U.jsx)($t,{a:t,data:j,selected:Q,busy:R,toolEntryDisable:Kt,setToolEntryDisable:qt,onSaveTools:()=>void zn(),onClearToolsEntry:()=>void Bn(),hideInlineSave:!0}):L===`skills`?(0,U.jsx)(Qt,{a:t,selected:Q,busy:R,skillsCatalogLoading:X,catalogForPick:Dn,skillsInherit:en,setSkillsInherit:J,skillsPick:Jt,setSkillsPick:Yt,onSaveSkills:()=>void Vn(),hideInlineSave:!0}):L===`channels`?(0,U.jsx)(Pt,{a:t,busy:R,bindingsLoading:$,agentBindings:Tn,channelStatuses:an,channelsStatusLoading:sn,useManualChannel:kn,newBindChannel:nn,setNewBindChannel:rn,bindSessionChats:ln,sessionsLoading:dn,newBindSessionIdx:pn,setNewBindSessionIdx:mn,newBindCustomPeer:hn,setNewBindCustomPeer:gn,onRefreshSessions:On,lastActiveLabels:S.lastActiveLabels,selectRecipient:S.selectRecipient,onRemoveBinding:e=>void Hn(e),onAddBinding:Un}):L===`cron`&&j?(0,U.jsx)(Ft,{a:t,data:j,selected:Q,busy:R,cronLoading:yn,agentCronJobs:En,onSetCronJobAgent:(e,t)=>void Wn(e,t)}):(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.selectAgentHint}):(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.selectAgentHint});return(0,U.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-8`,children:[(0,U.jsx)(Ct,{a:t}),me?(0,U.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:me}):null,ue?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.loading}):j?(0,U.jsx)(St,{a:t,agents:j.agents,searchQuery:He,onOpenAgent:e=>D(Ge(e)),onChatWithAgent:e=>D(`/chat/new`,{state:{agentId:e.trim().toLowerCase()}}),onNewAgent:jn,busy:R}):null,O&&w?(0,U.jsx)(yt,{open:!!O,onOpenChange:Zn,a:t,title:Qn,subtitle:$n,panel:L,onPanelChange:ve,onFooterSave:()=>void Xn(),footerSaveDisabled:Jn,footerSavedFlash:Vt,busy:R,children:ue||!j?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.loading}):er}):null,(0,U.jsx)(Dt,{open:Pe,onOpenChange:e=>{Fe(e),e||(Le.current=``,xe(``),Ce(``),Te(``),De(``),Ae(``),Ne(null))},a:t,chat:C,busy:R,modalError:Me,createDisplayName:ye,setCreateDisplayName:xe,createAgentId:Se,setCreateAgentId:Ce,createDescription:we,setCreateDescription:Te,createWorkspace:Ee,setCreateWorkspace:De,createModel:Oe,setCreateModel:Ae,onCreate:Pn,onSuggestWorkspace:()=>An()}),(0,U.jsx)(We,{open:n,onOpenChange:e=>{a(e),e||(f(null),y(``))},children:(0,U.jsxs)(je,{children:[(0,U.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,U.jsxs)(Re,{className:i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,U.jsx)(_e,{className:`text-base font-semibold text-fg`,children:h?t.purgeDisk:t.removeFromConfig}),(0,U.jsx)(Ve,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:h?t.confirmDeletePurge:t.confirmDelete}),h&&s?(0,U.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,U.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:t.purgeConfirmLabel}),(0,U.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:v,onChange:e=>y(e.target.value)}),(0,U.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:t.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,(0,U.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[(0,U.jsx)(z,{type:`button`,variant:`ghost`,disabled:R,onClick:()=>a(!1),children:t.createModalCancel}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:h?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,disabled:R||!s||h&&v.trim().toLowerCase()!==s.id.toLowerCase(),onClick:()=>{s&&Ln(s,h)},children:h?t.purgeDisk:t.removeFromConfig})]})]})]})})]})}var J={enabled:!0,mode:`default`,reserveTokens:8e3,triggerThreshold:.8,minMessagesBeforeCompact:10,keepRecentMessages:5,evictionWindow:.2,retentionWindow:6},Y={enabled:!0,maxToolResultChars:1e4,headKeepRatio:.3,tailKeepRatio:.3},tn={enabled:!0,useEnhancedSystem:!0,userProfileEnabled:!0,provider:``,injectionFrequency:``,memoryCharLimit:void 0,userCharLimit:void 0,contextCadence:void 0,dialecticCadence:void 0},nn={summaryModel:``},rn={enabled:!1,memoryNudgeInterval:10,skillNudgeInterval:10,maxToolRounds:8,maxHistoryMessages:80,maxDurationMs:12e4},an={model:``,maxLength:void 0};function on(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`object`&&e&&`primary`in e){let t=e.primary;return typeof t==`string`?t:``}return``}function sn(e){if(typeof e!=`object`||!e||!(`fallbacks`in e))return[];let t=e.fallbacks;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0):[]}function cn(e){return e===!0||e===`true`||e===1}function ln(e){let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{browserEnabled:!1,browserHeadless:!0};let n=t,r=cn(n.enabled),i=n.headless;return{browserEnabled:r,browserHeadless:!(i===!1||i===`false`||i===0)}}function un(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...J};let t=e;return{enabled:typeof t.enabled==`boolean`?t.enabled:J.enabled,mode:t.mode===`safeguard`?`safeguard`:`default`,reserveTokens:typeof t.reserveTokens==`number`&&Number.isFinite(t.reserveTokens)?Math.floor(t.reserveTokens):J.reserveTokens,triggerThreshold:typeof t.triggerThreshold==`number`&&Number.isFinite(t.triggerThreshold)?t.triggerThreshold:J.triggerThreshold,minMessagesBeforeCompact:typeof t.minMessagesBeforeCompact==`number`&&Number.isFinite(t.minMessagesBeforeCompact)?Math.floor(t.minMessagesBeforeCompact):J.minMessagesBeforeCompact,keepRecentMessages:typeof t.keepRecentMessages==`number`&&Number.isFinite(t.keepRecentMessages)?Math.floor(t.keepRecentMessages):J.keepRecentMessages,evictionWindow:typeof t.evictionWindow==`number`&&Number.isFinite(t.evictionWindow)?t.evictionWindow:J.evictionWindow,retentionWindow:typeof t.retentionWindow==`number`&&Number.isFinite(t.retentionWindow)?Math.floor(t.retentionWindow):J.retentionWindow}}function dn(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...Y};let t=e;return{enabled:typeof t.enabled==`boolean`?t.enabled:Y.enabled,maxToolResultChars:typeof t.maxToolResultChars==`number`&&Number.isFinite(t.maxToolResultChars)?Math.floor(t.maxToolResultChars):Y.maxToolResultChars,headKeepRatio:typeof t.headKeepRatio==`number`&&Number.isFinite(t.headKeepRatio)?t.headKeepRatio:Y.headKeepRatio,tailKeepRatio:typeof t.tailKeepRatio==`number`&&Number.isFinite(t.tailKeepRatio)?t.tailKeepRatio:Y.tailKeepRatio}}function fn(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...tn};let t=e,n=t.provider,r=n===`none`||n===`stub`?n:``,i=t.injectionFrequency,a=i===`every-turn`||i===`first-turn`?i:``;return{enabled:typeof t.enabled==`boolean`?t.enabled:tn.enabled,useEnhancedSystem:typeof t.useEnhancedSystem==`boolean`?t.useEnhancedSystem:tn.useEnhancedSystem,userProfileEnabled:typeof t.userProfileEnabled==`boolean`?t.userProfileEnabled:tn.userProfileEnabled,provider:r,injectionFrequency:a,memoryCharLimit:typeof t.memoryCharLimit==`number`&&t.memoryCharLimit>0?Math.floor(t.memoryCharLimit):void 0,userCharLimit:typeof t.userCharLimit==`number`&&t.userCharLimit>0?Math.floor(t.userCharLimit):void 0,contextCadence:typeof t.contextCadence==`number`&&t.contextCadence>=1?Math.floor(t.contextCadence):void 0,dialecticCadence:typeof t.dialecticCadence==`number`&&t.dialecticCadence>=1?Math.floor(t.dialecticCadence):void 0}}function pn(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...nn};let t=e;return{summaryModel:typeof t.summaryModel==`string`?t.summaryModel:``}}function mn(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...rn};let t=e;return{enabled:typeof t.enabled==`boolean`?t.enabled:rn.enabled,memoryNudgeInterval:typeof t.memoryNudgeInterval==`number`&&t.memoryNudgeInterval>=0?Math.floor(t.memoryNudgeInterval):rn.memoryNudgeInterval,skillNudgeInterval:typeof t.skillNudgeInterval==`number`&&t.skillNudgeInterval>=0?Math.floor(t.skillNudgeInterval):rn.skillNudgeInterval,maxToolRounds:typeof t.maxToolRounds==`number`&&t.maxToolRounds>=1&&t.maxToolRounds<=32?Math.floor(t.maxToolRounds):rn.maxToolRounds,maxHistoryMessages:typeof t.maxHistoryMessages==`number`&&t.maxHistoryMessages>=10&&t.maxHistoryMessages<=200?Math.floor(t.maxHistoryMessages):rn.maxHistoryMessages,maxDurationMs:typeof t.maxDurationMs==`number`&&t.maxDurationMs>=3e4&&t.maxDurationMs<=6e5?Math.floor(t.maxDurationMs):rn.maxDurationMs}}function hn(e){if(!e||typeof e!=`object`||Array.isArray(e))return{...an};let t=e;return{model:typeof t.model==`string`?t.model:``,maxLength:typeof t.maxLength==`number`&&t.maxLength>0?t.maxLength:void 0}}function gn(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return{enabled:t};let n=e;return{enabled:typeof n.enabled==`boolean`?n.enabled:t}}function _n(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function vn(e){if(e==null)return``;if(typeof e==`object`&&!Array.isArray(e))try{return JSON.stringify(e,null,2)}catch{return``}return``}function yn(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`agents`in e?e.agents:void 0,n=t&&typeof t==`object`&&!Array.isArray(t)&&`defaults`in t?t.defaults:void 0,r=n&&typeof n==`object`&&!Array.isArray(n)?n:{},i=r.modelFallbacks,a=Array.isArray(i)&&i.every(e=>typeof e==`string`)?i:sn(r.model),o=r.imageModelFallbacks,s=Array.isArray(o)&&o.every(e=>typeof e==`string`)?o:sn(r.imageModel),c=r.imageGenerationModelFallbacks,l=Array.isArray(c)&&c.every(e=>typeof e==`string`)?c:sn(r.imageGenerationModel),{browserEnabled:u,browserHeadless:d}=ln(r),f=typeof r.maxTaskDurationMs==`number`&&Number.isFinite(r.maxTaskDurationMs)?r.maxTaskDurationMs:void 0,p=f===void 0?void 0:Math.round(f/6e4);return{model:on(r.model),modelFallbacks:a,imageModel:on(r.imageModel),imageModelFallbacks:s,imageGenerationModel:on(r.imageGenerationModel),imageGenerationModelFallbacks:l,mediaMaxMb:typeof r.mediaMaxMb==`number`&&!Number.isNaN(r.mediaMaxMb)?r.mediaMaxMb:void 0,maxTokens:typeof r.maxTokens==`number`?r.maxTokens:8192,temperature:typeof r.temperature==`number`?r.temperature:.7,maxToolIterations:typeof r.maxToolIterations==`number`?r.maxToolIterations:20,maxTaskDurationMinutes:p,maxRequestsPerTurn:typeof r.maxRequestsPerTurn==`number`?r.maxRequestsPerTurn:50,maxToolFailuresPerTurn:typeof r.maxToolFailuresPerTurn==`number`?r.maxToolFailuresPerTurn:3,workspace:typeof r.workspace==`string`?r.workspace:`~/.xopc/workspace`,browserEnabled:u,browserHeadless:d,thinkingDefault:typeof r.thinkingDefault==`string`?r.thinkingDefault:`medium`,reasoningDefault:typeof r.reasoningDefault==`string`?r.reasoningDefault:`off`,verboseDefault:typeof r.verboseDefault==`string`?r.verboseDefault:`off`,compaction:un(r.compaction),pruning:dn(r.pruning),memory:fn(r.memory),sessionSearch:pn(r.sessionSearch),backgroundReview:mn(r.backgroundReview),webExtract:hn(r.webExtract),delegate:gn(r.delegate,!1),executeCode:gn(r.executeCode,!1),systemPromptOverride:typeof r.systemPromptOverride==`string`?r.systemPromptOverride:``,skillsAllowlist:_n(r.skills),toolsDisable:(()=>{let e=r.tools;if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e.disable;return _n(t)})(),paramsJson:vn(r.params)}}function bn(e){let t={enabled:e.enabled,useEnhancedSystem:e.useEnhancedSystem,userProfileEnabled:e.userProfileEnabled};return e.provider===`none`||e.provider===`stub`?t.provider=e.provider:t.provider=null,e.injectionFrequency===`every-turn`||e.injectionFrequency===`first-turn`?t.injectionFrequency=e.injectionFrequency:t.injectionFrequency=null,t.memoryCharLimit=e.memoryCharLimit??null,t.userCharLimit=e.userCharLimit??null,t.contextCadence=e.contextCadence??null,t.dialecticCadence=e.dialecticCadence??null,t}function xn(e){let t=e.trim();if(!t)return null;let n=JSON.parse(t);if(n===null)return null;if(typeof n!=`object`||Array.isArray(n))throw Error(`params must be a JSON object`);return n}async function Sn(e){let t=e.modelFallbacks.map(e=>e.trim()).filter(Boolean),n=t.length>0?{primary:e.model,fallbacks:t}:e.model,r=e.imageModelFallbacks.map(e=>e.trim()).filter(Boolean),i=r.length>0&&e.imageModel.trim()?{primary:e.imageModel.trim(),fallbacks:r}:e.imageModel||``,a=e.imageGenerationModelFallbacks.map(e=>e.trim()).filter(Boolean),o=a.length>0&&e.imageGenerationModel.trim()?{primary:e.imageGenerationModel.trim(),fallbacks:a}:e.imageGenerationModel||``,s=e.maxTaskDurationMinutes===void 0||e.maxTaskDurationMinutes===null?null:(()=>{let t=Math.floor(e.maxTaskDurationMinutes)*6e4;return t<6e4||t>144e5?null:t})(),c=e.skillsAllowlist.map(e=>e.trim()).filter(Boolean),l=e.toolsDisable.map(e=>e.trim()).filter(Boolean),u=xn(e.paramsJson),d=u===null||Object.keys(u).length===0?null:u,f={model:n,imageModel:i,imageGenerationModel:o,mediaMaxMb:e.mediaMaxMb??null,maxTokens:e.maxTokens,temperature:e.temperature,maxToolIterations:e.maxToolIterations,maxTaskDurationMs:s,maxRequestsPerTurn:e.maxRequestsPerTurn,maxToolFailuresPerTurn:e.maxToolFailuresPerTurn,workspace:e.workspace,browser:{enabled:e.browserEnabled,headless:e.browserHeadless},thinkingDefault:e.thinkingDefault,reasoningDefault:e.reasoningDefault,verboseDefault:e.verboseDefault,compaction:{...e.compaction},pruning:{...e.pruning},memory:bn(e.memory),sessionSearch:{summaryModel:e.sessionSearch.summaryModel.trim()||null},backgroundReview:{enabled:e.backgroundReview.enabled,memoryNudgeInterval:e.backgroundReview.memoryNudgeInterval,skillNudgeInterval:e.backgroundReview.skillNudgeInterval,maxToolRounds:e.backgroundReview.maxToolRounds,maxHistoryMessages:e.backgroundReview.maxHistoryMessages,maxDurationMs:e.backgroundReview.maxDurationMs},webExtract:{model:e.webExtract.model.trim()||null,maxLength:e.webExtract.maxLength??null},delegate:{enabled:e.delegate.enabled},executeCode:{enabled:e.executeCode.enabled},systemPromptOverride:e.systemPromptOverride.trim()||null,skills:c.length>0?c:null,tools:{disable:l.length>0?l:null},params:d};await h(oe(`/api/config`),{method:`PATCH`,body:JSON.stringify({agents:{defaults:f}})}),Oe()}function X(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,pe,`dark:border-edge`)}function Cn(){return i(Te,Pe)}function Z({label:e,description:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e}),n,(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:t})]})}function wn(e){let{a:t,chat:n,form:r,update:a}=e,o=t.advanced;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:Ke,title:o.cardLimitsTitle,subtitle:o.cardLimitsSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)(Z,{label:o.maxTaskDurationMs,description:o.maxTaskDurationMsDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,max:240,step:1,value:r.maxTaskDurationMinutes??``,placeholder:o.maxTaskDurationPlaceholder,onChange:e=>{let t=e.target.value;if(t===``){a({maxTaskDurationMinutes:void 0});return}let n=Number.parseInt(t,10);Number.isNaN(n)||a({maxTaskDurationMinutes:Math.min(240,Math.max(1,n))})}})}),(0,U.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,U.jsx)(Z,{label:o.maxRequestsPerTurn,description:o.maxRequestsPerTurnDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:10,max:200,value:r.maxRequestsPerTurn,onChange:e=>a({maxRequestsPerTurn:Number.parseInt(e.target.value,10)||50})})}),(0,U.jsx)(Z,{label:o.maxToolFailuresPerTurn,description:o.maxToolFailuresPerTurnDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,max:20,value:r.maxToolFailuresPerTurn,onChange:e=>a({maxToolFailuresPerTurn:Number.parseInt(e.target.value,10)||3})})})]})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:L,title:o.cardCompactionTitle,subtitle:o.cardCompactionSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)(Z,{label:o.compactionEnabled,description:o.compactionEnabledDesc,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.compaction.enabled,onChange:e=>a({compaction:{...r.compaction,enabled:e.target.checked}})}),(0,U.jsx)(`span`,{children:o.compactionEnabledOn})]})}),(0,U.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,U.jsx)(Z,{label:o.compactionMode,description:o.compactionModeDesc,children:(0,U.jsxs)(`select`,{className:Cn(),value:r.compaction.mode,onChange:e=>a({compaction:{...r.compaction,mode:e.target.value}}),children:[(0,U.jsx)(`option`,{value:`default`,children:o.compactionModeDefault}),(0,U.jsx)(`option`,{value:`safeguard`,children:o.compactionModeSafeguard})]})}),(0,U.jsx)(Z,{label:o.reserveTokens,description:o.reserveTokensDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1e3,value:r.compaction.reserveTokens,onChange:e=>a({compaction:{...r.compaction,reserveTokens:Number.parseInt(e.target.value,10)||0}})})}),(0,U.jsx)(Z,{label:o.triggerThreshold,description:o.triggerThresholdDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:.5,max:.95,step:.05,value:r.compaction.triggerThreshold,onChange:e=>a({compaction:{...r.compaction,triggerThreshold:Number.parseFloat(e.target.value)||.8}})})}),(0,U.jsx)(Z,{label:o.minMessagesBeforeCompact,description:o.minMessagesBeforeCompactDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,value:r.compaction.minMessagesBeforeCompact,onChange:e=>a({compaction:{...r.compaction,minMessagesBeforeCompact:Number.parseInt(e.target.value,10)||10}})})}),(0,U.jsx)(Z,{label:o.keepRecentMessages,description:o.keepRecentMessagesDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:0,value:r.compaction.keepRecentMessages,onChange:e=>a({compaction:{...r.compaction,keepRecentMessages:Number.parseInt(e.target.value,10)||5}})})}),(0,U.jsx)(Z,{label:o.evictionWindow,description:o.evictionWindowDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:.1,max:.5,step:.05,value:r.compaction.evictionWindow,onChange:e=>a({compaction:{...r.compaction,evictionWindow:Number.parseFloat(e.target.value)||.2}})})}),(0,U.jsx)(Z,{label:o.retentionWindow,description:o.retentionWindowDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:3,max:20,value:r.compaction.retentionWindow,onChange:e=>a({compaction:{...r.compaction,retentionWindow:Number.parseInt(e.target.value,10)||6}})})})]})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:s,title:o.cardPruningTitle,subtitle:o.cardPruningSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)(Z,{label:o.pruningEnabled,description:o.pruningEnabledDesc,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.pruning.enabled,onChange:e=>a({pruning:{...r.pruning,enabled:e.target.checked}})}),(0,U.jsx)(`span`,{children:o.pruningEnabledOn})]})}),(0,U.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,U.jsx)(Z,{label:o.maxToolResultChars,description:o.maxToolResultCharsDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1e3,value:r.pruning.maxToolResultChars,onChange:e=>a({pruning:{...r.pruning,maxToolResultChars:Number.parseInt(e.target.value,10)||1e4}})})}),(0,U.jsx)(Z,{label:o.headKeepRatio,description:o.headKeepRatioDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:0,max:1,step:.05,value:r.pruning.headKeepRatio,onChange:e=>a({pruning:{...r.pruning,headKeepRatio:Number.parseFloat(e.target.value)||.3}})})}),(0,U.jsx)(Z,{label:o.tailKeepRatio,description:o.tailKeepRatioDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:0,max:1,step:.05,value:r.pruning.tailKeepRatio,onChange:e=>a({pruning:{...r.pruning,tailKeepRatio:Number.parseFloat(e.target.value)||.3}})})})]})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:E,title:o.cardMemoryTitle,subtitle:o.cardMemorySubtitle}),(0,U.jsx)(`div`,{className:`flex flex-col gap-5`,children:(0,U.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,U.jsx)(Z,{label:o.memoryEnabled,description:o.memoryEnabledDesc,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.memory.enabled,onChange:e=>a({memory:{...r.memory,enabled:e.target.checked}})}),(0,U.jsx)(`span`,{children:o.memoryEnabledOn})]})}),(0,U.jsx)(Z,{label:o.useEnhancedSystem,description:o.useEnhancedSystemDesc,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.memory.useEnhancedSystem,onChange:e=>a({memory:{...r.memory,useEnhancedSystem:e.target.checked}})}),(0,U.jsx)(`span`,{children:o.useEnhancedSystemOn})]})}),(0,U.jsx)(Z,{label:o.userProfileEnabled,description:o.userProfileEnabledDesc,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.memory.userProfileEnabled,onChange:e=>a({memory:{...r.memory,userProfileEnabled:e.target.checked}})}),(0,U.jsx)(`span`,{children:o.userProfileEnabledOn})]})}),(0,U.jsx)(Z,{label:o.memoryProvider,description:o.memoryProviderDesc,children:(0,U.jsxs)(`select`,{className:Cn(),value:r.memory.provider,onChange:e=>a({memory:{...r.memory,provider:e.target.value}}),children:[(0,U.jsx)(`option`,{value:``,children:o.memoryProviderUnset}),(0,U.jsx)(`option`,{value:`none`,children:`none`}),(0,U.jsx)(`option`,{value:`stub`,children:`stub`})]})}),(0,U.jsx)(Z,{label:o.injectionFrequency,description:o.injectionFrequencyDesc,children:(0,U.jsxs)(`select`,{className:Cn(),value:r.memory.injectionFrequency,onChange:e=>a({memory:{...r.memory,injectionFrequency:e.target.value}}),children:[(0,U.jsx)(`option`,{value:``,children:o.injectionFrequencyUnset}),(0,U.jsx)(`option`,{value:`every-turn`,children:o.injectionEveryTurn}),(0,U.jsx)(`option`,{value:`first-turn`,children:o.injectionFirstTurn})]})}),(0,U.jsx)(Z,{label:o.memoryCharLimit,description:o.memoryCharLimitDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,value:r.memory.memoryCharLimit??``,placeholder:`—`,onChange:e=>{let t=e.target.value;a({memory:{...r.memory,memoryCharLimit:t===``?void 0:Number.parseInt(t,10)}})}})}),(0,U.jsx)(Z,{label:o.userCharLimit,description:o.userCharLimitDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,value:r.memory.userCharLimit??``,placeholder:`—`,onChange:e=>{let t=e.target.value;a({memory:{...r.memory,userCharLimit:t===``?void 0:Number.parseInt(t,10)}})}})}),(0,U.jsx)(Z,{label:o.contextCadence,description:o.contextCadenceDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,value:r.memory.contextCadence??``,placeholder:`—`,onChange:e=>{let t=e.target.value;a({memory:{...r.memory,contextCadence:t===``?void 0:Number.parseInt(t,10)}})}})}),(0,U.jsx)(Z,{label:o.dialecticCadence,description:o.dialecticCadenceDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,value:r.memory.dialecticCadence??``,placeholder:`—`,onChange:e=>{let t=e.target.value;a({memory:{...r.memory,dialecticCadence:t===``?void 0:Number.parseInt(t,10)}})}})})]})})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:ke,title:o.cardSessionSearchTitle,subtitle:o.cardSessionSearchSubtitle}),(0,U.jsx)(Z,{label:o.sessionSearchSummaryModel,description:o.sessionSearchSummaryModelDesc,children:(0,U.jsx)(F,{value:r.sessionSearch.summaryModel,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>a({sessionSearch:{...r.sessionSearch,summaryModel:e}})})})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:D,title:o.cardReviewTitle,subtitle:o.cardReviewSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)(Z,{label:o.reviewEnabled,description:o.reviewEnabledDesc,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.backgroundReview.enabled,onChange:e=>a({backgroundReview:{...r.backgroundReview,enabled:e.target.checked}})}),(0,U.jsx)(`span`,{children:o.reviewEnabledOn})]})}),(0,U.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,U.jsx)(Z,{label:o.memoryNudgeInterval,description:o.memoryNudgeIntervalDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:0,value:r.backgroundReview.memoryNudgeInterval,onChange:e=>a({backgroundReview:{...r.backgroundReview,memoryNudgeInterval:Number.parseInt(e.target.value,10)||0}})})}),(0,U.jsx)(Z,{label:o.skillNudgeInterval,description:o.skillNudgeIntervalDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:0,value:r.backgroundReview.skillNudgeInterval,onChange:e=>a({backgroundReview:{...r.backgroundReview,skillNudgeInterval:Number.parseInt(e.target.value,10)||0}})})}),(0,U.jsx)(Z,{label:o.reviewMaxToolRounds,description:o.reviewMaxToolRoundsDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,max:32,value:r.backgroundReview.maxToolRounds,onChange:e=>a({backgroundReview:{...r.backgroundReview,maxToolRounds:Number.parseInt(e.target.value,10)||8}})})}),(0,U.jsx)(Z,{label:o.reviewMaxHistoryMessages,description:o.reviewMaxHistoryMessagesDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:10,max:200,value:r.backgroundReview.maxHistoryMessages,onChange:e=>a({backgroundReview:{...r.backgroundReview,maxHistoryMessages:Number.parseInt(e.target.value,10)||80}})})}),(0,U.jsx)(Z,{label:o.reviewMaxDurationMs,description:o.reviewMaxDurationMsDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:30,max:600,step:1,value:Math.round((r.backgroundReview.maxDurationMs??12e4)/1e3),onChange:e=>a({backgroundReview:{...r.backgroundReview,maxDurationMs:(Number.parseInt(e.target.value,10)||120)*1e3}})})})]})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:Ue,title:o.cardWebExtractTitle,subtitle:o.cardWebExtractSubtitle}),(0,U.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,U.jsx)(`div`,{className:`sm:col-span-2`,children:(0,U.jsx)(Z,{label:o.webExtractModel,description:o.webExtractModelDesc,children:(0,U.jsx)(F,{value:r.webExtract.model,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>a({webExtract:{...r.webExtract,model:e}})})})}),(0,U.jsx)(Z,{label:o.webExtractMaxLength,description:o.webExtractMaxLengthDesc,children:(0,U.jsx)(`input`,{type:`number`,className:X(),min:1,value:r.webExtract.maxLength??``,placeholder:`—`,onChange:e=>{let t=e.target.value;a({webExtract:{...r.webExtract,maxLength:t===``?void 0:Number.parseInt(t,10)}})}})})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:Qe,title:o.cardDelegateTitle,subtitle:o.cardDelegateSubtitle}),(0,U.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,U.jsx)(Z,{label:o.delegateEnabled,description:o.delegateEnabledDesc,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.delegate.enabled,onChange:e=>a({delegate:{...r.delegate,enabled:e.target.checked}})}),(0,U.jsx)(`span`,{children:o.delegateEnabledOn})]})}),(0,U.jsx)(Z,{label:o.executeCodeEnabled,description:o.executeCodeEnabledDesc,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:r.executeCode.enabled,onChange:e=>a({executeCode:{...r.executeCode,enabled:e.target.checked}})}),(0,U.jsx)(`span`,{children:o.executeCodeEnabledOn})]})})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:le,title:o.cardPromptSkillsTitle,subtitle:o.cardPromptSkillsSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)(Z,{label:o.systemPromptOverride,description:o.systemPromptOverrideDesc,children:(0,U.jsx)(`textarea`,{className:i(X(),`min-h-[100px] resize-y font-mono text-xs`),value:r.systemPromptOverride,placeholder:o.systemPromptPlaceholder,onChange:e=>a({systemPromptOverride:e.target.value})})}),(0,U.jsx)(Z,{label:o.skillsAllowlist,description:o.skillsAllowlistDesc,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.skillsAllowlist.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`text`,className:i(X(),`font-mono text-xs`),value:e,onChange:e=>{let n=[...r.skillsAllowlist];n[t]=e.target.value,a({skillsAllowlist:n})}}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`shrink-0`,"aria-label":o.removeListItem,onClick:()=>a({skillsAllowlist:r.skillsAllowlist.filter((e,n)=>n!==t)}),children:`×`})]},t)),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`w-fit`,onClick:()=>a({skillsAllowlist:[...r.skillsAllowlist,``]}),children:o.addSkillName})]})})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:ve,title:o.cardToolsDisableTitle,subtitle:o.cardToolsDisableSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:o.toolsDisableHint}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.toolsDisable.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`text`,className:i(X(),`font-mono text-xs`),value:e,placeholder:`shell`,onChange:e=>{let n=[...r.toolsDisable];n[t]=e.target.value,a({toolsDisable:n})}}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`shrink-0`,"aria-label":o.removeListItem,onClick:()=>a({toolsDisable:r.toolsDisable.filter((e,n)=>n!==t)}),children:`×`})]},t)),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`w-fit`,onClick:()=>a({toolsDisable:[...r.toolsDisable,``]}),children:o.addToolName})]})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:O,title:o.cardParamsTitle,subtitle:o.cardParamsSubtitle}),(0,U.jsx)(Z,{label:o.paramsJson,description:o.paramsJsonDesc,children:(0,U.jsx)(`textarea`,{className:i(X(),`min-h-[88px] resize-y font-mono text-xs`),value:r.paramsJson,placeholder:`{}`,onChange:e=>a({paramsJson:e.target.value})})})]})]})}async function Q(){let e=await ce(oe(`/api/image/providers`));if(!e.ok)throw Error(`Image providers: HTTP ${e.status}`);return(await e.json()).payload?.providers??[]}function Tn(e){let t=new Set,n=[];for(let r of e){let e=r.models.length>0?r.models:r.defaultModel?[r.defaultModel]:[];for(let i of e){let e=`${r.id}/${i}`;t.has(e)||(t.add(e),n.push(e))}}return n}function En(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=n.split(/[/\s]+/).filter(Boolean);return e.filter(e=>{let t=e.toLowerCase();return r.every(e=>t.includes(e))})}var Dn=`image-generation-providers`;function On({value:e,disabled:t,placeholder:n,searchPlaceholder:a,noMatches:o,className:s,onChange:c}){let[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(``),{data:p,isLoading:m,error:h}=r(Dn,Q,{revalidateOnFocus:!1}),g=(0,V.useMemo)(()=>Tn(p??[]),[p]),_=(0,V.useMemo)(()=>En(g,d),[g,d]),v=e.trim()?e:n,y=e.trim()||n,b=(0,V.useCallback)(e=>{u(e),e||f(``)},[]);return(0,U.jsxs)(Se,{open:l,onOpenChange:b,modal:!1,children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,disabled:t||m,title:m?`…`:y,className:i(I,`items-center gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-left text-sm font-normal text-fg`,se.transition,`hover:border-edge hover:bg-surface-hover/45`,R,`disabled:cursor-not-allowed disabled:opacity-50`,`dark:border-edge-subtle dark:hover:bg-surface-hover/55`,s),"aria-haspopup":`listbox`,"aria-expanded":l,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:m?`…`:v}),(0,U.jsx)(Ae,{className:`h-4 w-4 shrink-0 text-fg-subtle opacity-70`,"aria-hidden":!0})]})}),(0,U.jsx)(we,{children:(0,U.jsxs)(Ne,{className:`z-50 w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-edge-subtle bg-surface-panel p-1 shadow-elevated dark:border-edge-subtle`,side:`bottom`,sideOffset:4,align:`end`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,U.jsx)(`input`,{type:`search`,className:i(`mb-1 w-full rounded-lg border border-edge-subtle bg-surface-base px-2.5 py-1.5 text-sm text-fg placeholder:text-fg-disabled dark:bg-surface-hover/40`,B),placeholder:a,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>e.stopPropagation()}),(0,U.jsxs)(`div`,{className:`max-h-60 overflow-auto`,role:`listbox`,"aria-label":a,children:[h?(0,U.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:h instanceof Error?h.message:`Failed to load image providers`}):null,!h&&g.length===0&&!m?(0,U.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:o}):null,!h&&g.length>0&&_.length===0?(0,U.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:o}):null,_.map(t=>(0,U.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===e,className:i(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-fg hover:bg-surface-hover`,t===e&&`bg-surface-hover/90 font-medium dark:bg-surface-hover/70`),onClick:()=>{c(t),u(!1),f(``)},children:[(0,U.jsx)(w,{className:i(`h-4 w-4 shrink-0`,t!==e&&`invisible`),"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:t})]},t))]})]})})]})}var kn=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`adaptive`];function $({label:e,description:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e}),n,(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:t})]})}function An(){let e=Ie(te(e=>e.language)),t=e.agentSettings,n=e.chat,r=!!Be(e=>e.token),[i,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(!1),g=(0,V.useRef)(!1),{data:_,error:v,isLoading:y,mutate:b}=o(r),x=(0,V.useMemo)(()=>_?.payload?.config===void 0?null:yn(_.payload.config),[_]);(0,V.useEffect)(()=>{if(!r){s(null),l(null),g.current=!1;return}x!==null&&(g.current||(s(x),l(x)))},[r,x]);let S=!!(r&&y&&_===void 0&&!v),C=v instanceof Error?v.message:v?String(v):null,w=(0,V.useMemo)(()=>!i||!c?!1:JSON.stringify(i)!==JSON.stringify(c),[i,c]),T=(0,V.useCallback)(e=>{g.current=!0,s(t=>t?{...t,...e}:null)},[]),E=(0,V.useCallback)(async()=>{if(!(!i||u)){d(!0),p(null),h(!1);try{try{xn(i.paramsJson)}catch(e){p(e instanceof SyntaxError?t.advanced.paramsInvalidJson:e instanceof Error?e.message:t.advanced.paramsInvalidJson);return}await Sn(i),g.current=!1,h(!0),window.setTimeout(()=>h(!1),2500)}catch(e){p(e instanceof Error?e.message:t.saveError)}finally{d(!1)}}},[i,u,t.saveError,t.advanced]),ne=e.settingsSections[`agent-defaults`];return r?S?(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,U.jsx)(`div`,{className:`h-8 w-48 animate-pulse rounded bg-surface-hover`}),(0,U.jsx)(`div`,{className:`mt-6 h-32 animate-pulse rounded-xl bg-surface-hover`}),(0,U.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:e.logs.loading})]}):i?(0,U.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-8`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:ne}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.subtitle}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.sectionDesc})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[m?(0,U.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.saved}):null,(0,U.jsx)(z,{type:`button`,variant:`primary`,disabled:!w||u,onClick:()=>void E(),children:u?t.saving:t.save})]})]}),f?(0,U.jsx)(`div`,{className:`rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:f}):null,(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:qe,title:t.cardModelsTitle,subtitle:t.cardModelsSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)($,{label:t.label.model,description:t.desc.model,children:(0,U.jsx)(F,{value:i.model,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>T({model:e})})}),(0,U.jsx)($,{label:t.label.modelFallbacks,description:t.desc.modelFallbacks,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.modelFallbacks.map((e,r)=>(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(F,{value:e,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>{let t=[...i.modelFallbacks];t[r]=e,T({modelFallbacks:t})}})}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`shrink-0`,"aria-label":t.removeModelFallback,onClick:()=>T({modelFallbacks:i.modelFallbacks.filter((e,t)=>t!==r)}),children:(0,U.jsx)(fe,{className:`size-4`,strokeWidth:1.75})})]},r)),(0,U.jsxs)(z,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5`,onClick:()=>T({modelFallbacks:[...i.modelFallbacks,``]}),children:[(0,U.jsx)(ee,{className:`size-4 shrink-0`,strokeWidth:1.75}),t.addModelFallback]})]})}),(0,U.jsx)($,{label:t.label.imageModel,description:t.desc.imageModel,children:(0,U.jsx)(F,{value:i.imageModel,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>T({imageModel:e})})}),(0,U.jsx)($,{label:t.label.imageModelFallbacks,description:t.desc.imageModelFallbacks,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.imageModelFallbacks.map((e,r)=>(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(F,{value:e,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>{let t=[...i.imageModelFallbacks];t[r]=e,T({imageModelFallbacks:t})}})}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`shrink-0`,"aria-label":t.removeModelFallback,onClick:()=>T({imageModelFallbacks:i.imageModelFallbacks.filter((e,t)=>t!==r)}),children:(0,U.jsx)(fe,{className:`size-4`,strokeWidth:1.75})})]},r)),(0,U.jsxs)(z,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5`,onClick:()=>T({imageModelFallbacks:[...i.imageModelFallbacks,``]}),children:[(0,U.jsx)(ee,{className:`size-4 shrink-0`,strokeWidth:1.75}),t.addModelFallback]})]})}),(0,U.jsx)($,{label:t.label.imageGenerationModel,description:t.desc.imageGenerationModel,children:(0,U.jsx)(On,{value:i.imageGenerationModel,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>T({imageGenerationModel:e})})}),(0,U.jsx)($,{label:t.label.imageGenerationModelFallbacks,description:t.desc.imageGenerationModelFallbacks,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.imageGenerationModelFallbacks.map((e,r)=>(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(On,{value:e,placeholder:n.modelPlaceholder,searchPlaceholder:n.modelSearchPlaceholder,noMatches:n.modelNoMatches,onChange:e=>{let t=[...i.imageGenerationModelFallbacks];t[r]=e,T({imageGenerationModelFallbacks:t})}})}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,className:`shrink-0`,"aria-label":t.removeModelFallback,onClick:()=>T({imageGenerationModelFallbacks:i.imageGenerationModelFallbacks.filter((e,t)=>t!==r)}),children:(0,U.jsx)(fe,{className:`size-4`,strokeWidth:1.75})})]},r)),(0,U.jsxs)(z,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5`,onClick:()=>T({imageGenerationModelFallbacks:[...i.imageGenerationModelFallbacks,``]}),children:[(0,U.jsx)(ee,{className:`size-4 shrink-0`,strokeWidth:1.75}),t.addModelFallback]})]})})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:Le,title:t.cardWorkspaceTitle,subtitle:t.cardWorkspaceSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)($,{label:t.label.workspace,description:t.desc.workspace,children:(0,U.jsx)(`input`,{type:`text`,className:X(),value:i.workspace,onChange:e=>T({workspace:e.target.value}),autoComplete:`off`})}),(0,U.jsx)($,{label:t.label.mediaMaxMb,description:t.desc.mediaMaxMb,children:(0,U.jsx)(`input`,{type:`number`,min:1,step:1,className:X(),value:i.mediaMaxMb??``,placeholder:`20`,onChange:e=>{let t=e.target.value;T({mediaMaxMb:t===``?void 0:Number(t)})}})})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:Ee,title:t.cardBrowserTitle,subtitle:t.cardBrowserSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)($,{label:t.label.browserEnabled,description:t.desc.browserEnabled,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:i.browserEnabled,onChange:e=>T({browserEnabled:e.target.checked})}),(0,U.jsx)(`span`,{children:t.browserEnabledOn})]})}),(0,U.jsx)($,{label:t.label.browserHeadless,description:t.desc.browserHeadless,children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`size-3.5 shrink-0 rounded border-edge`,checked:i.browserHeadless,onChange:e=>T({browserHeadless:e.target.checked})}),(0,U.jsx)(`span`,{children:t.browserHeadlessOn})]})})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:a,title:t.cardGenerationTitle,subtitle:t.cardGenerationSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,U.jsx)($,{label:t.label.maxTokens,description:t.desc.maxTokens,children:(0,U.jsx)(`input`,{type:`number`,className:X(),value:i.maxTokens,min:1,onChange:e=>T({maxTokens:Number.parseInt(e.target.value,10)||0})})}),(0,U.jsx)($,{label:t.label.temperature,description:t.desc.temperature,children:(0,U.jsx)(`input`,{type:`number`,className:X(),value:i.temperature,min:0,max:2,step:.1,onChange:e=>T({temperature:Number.parseFloat(e.target.value)||0})})})]}),(0,U.jsx)($,{label:t.label.maxToolIterations,description:t.desc.maxToolIterations,children:(0,U.jsx)(`input`,{type:`number`,className:X(),value:i.maxToolIterations,min:1,onChange:e=>T({maxToolIterations:Number.parseInt(e.target.value,10)||0})})})]})]}),(0,U.jsxs)(G,{children:[(0,U.jsx)(K,{icon:He,title:t.cardBehaviorTitle,subtitle:t.cardBehaviorSubtitle}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)($,{label:t.label.thinkingDefault,description:t.desc.thinkingDefault,children:(0,U.jsx)(`select`,{className:Cn(),value:i.thinkingDefault,onChange:e=>T({thinkingDefault:e.target.value}),children:kn.map(e=>(0,U.jsx)(`option`,{value:e,children:n.thinkingLevels[e]},e))})}),(0,U.jsx)($,{label:t.label.reasoningDefault,description:t.desc.reasoningDefault,children:(0,U.jsxs)(`select`,{className:Cn(),value:i.reasoningDefault,onChange:e=>T({reasoningDefault:e.target.value}),children:[(0,U.jsx)(`option`,{value:`off`,children:t.reasoning.off}),(0,U.jsx)(`option`,{value:`on`,children:t.reasoning.on}),(0,U.jsx)(`option`,{value:`stream`,children:t.reasoning.stream})]})}),(0,U.jsx)($,{label:t.label.verboseDefault,description:t.desc.verboseDefault,children:(0,U.jsxs)(`select`,{className:Cn(),value:i.verboseDefault,onChange:e=>T({verboseDefault:e.target.value}),children:[(0,U.jsx)(`option`,{value:`off`,children:t.verbose.off}),(0,U.jsx)(`option`,{value:`on`,children:t.verbose.on}),(0,U.jsx)(`option`,{value:`full`,children:t.verbose.full})]})})]})]}),(0,U.jsx)(wn,{a:t,chat:n,form:i,update:T})]})]}):(0,U.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-10`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f??C??t.loadError}),(0,U.jsx)(z,{type:`button`,variant:`secondary`,onClick:()=>void b(),children:e.logs.refresh})]}):(0,U.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-10`,children:(0,U.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[(0,U.jsx)(qe,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:ne}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.needToken})]})]})})}export{en as AgentsSettingsPanel,Mt as i,G as n,K as r,An as t};
|
|
216
|
+
//# sourceMappingURL=agents-CiZMJZRp.js.map
|