nextclaw 0.18.5 → 0.18.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/ui-dist/assets/{chat-DCi1-y8U.js → chat-BxA-mw53.js} +2 -2
- package/ui-dist/assets/{chat-page-CHKwiqPY.js → chat-page-DLFTPfmu.js} +1 -1
- package/ui-dist/assets/{desktop-update-config-gnna2NaS.js → desktop-update-config-CzGi43xw.js} +1 -1
- package/ui-dist/assets/{index-CxzW1dQ9.js → index-CAYF44Dz.js} +2 -2
- package/ui-dist/assets/{runtime-config-page-BuWmH7fe.js → runtime-config-page-B-y_0HIS.js} +1 -1
- package/ui-dist/assets/{sessions-config-page-DZrdd2zT.js → sessions-config-page-CZGqS32n.js} +1 -1
- package/ui-dist/index.html +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,n as r,p as i,u as a}from"./i18n-BnNAQpVM.js";import{At as o,Dt as s,Et as c,St as l,kt as u,mt as d,xt as f,yt as p}from"./api-C51456xV.js";import{c as m,l as h,s as g}from"./chunk-JZWAC4HX-ptDyT_1C.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./dialog-BHcaU6NE.js";import{t as C}from"./createLucideIcon-C_GFKVuW.js";import{b as w,h as T,p as E,y as ee}from"./theme-provider-dHqcWU-j.js";import{A as D,C as te,D as O,E as k,I as A,L as ne,M as re,O as ie,P as ae,S as oe,T as j,_ as se,a as ce,b as M,c as le,d as N,f as ue,g as P,h as de,i as fe,j as pe,k as me,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as F,t as xe,u as Se,v as I,w as Ce,x as we,y as Te}from"./chat-DCi1-y8U.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-DRDejPLk.js";import{i as Ee,n as H,r as De,t as U}from"./provider-scoped-model-input-DeAo2Y65.js";import"./mcp-marketplace-page-C_akqPwv.js";import{t as Oe}from"./play-DeNVUA5C.js";import{t as W}from"./plus-BptLViq1.js";import{t as G}from"./sparkles-CyDTgTM4.js";import{t as K}from"./trash-2-C1cdqL6V.js";import{t as q}from"./notice-card-C9PFAR67.js";import{t as ke}from"./use-viewport-layout-D-pjxsyz.js";import{g as Ae,m as je,n as J,o as Me,p as Ne,r as Y,s as Pe,y as Fe}from"./use-config-DFja1sda.js";import{t as Ie}from"./index-CxzW1dQ9.js";import{t as Le}from"./tag-chip-CVIqyMv7.js";import{t as X}from"./use-confirm-dialog-DvIbSUX3.js";import{t as Re}from"./marketplace-page-DiqqX25V.js";var ze=C(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Be=C(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Z=e(n(),1),Q=i(),$=Z.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(`textarea`,{className:a(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));$.displayName=`Textarea`;var Ve={id:``,displayName:``,description:``,avatar:``,model:``,home:``,runtime:``};function He(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Ue(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=P(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:I(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function We({value:e,disabled:n=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?P(e):``,s=Ue({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?t(`agentsRuntimeUnavailableHelp`):``);return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(V,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:n,children:[(0,Q.jsx)(R,{"aria-label":t(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,Q.jsx)(L,{placeholder:t(`agentsRuntimeSelectPlaceholder`)})}),(0,Q.jsx)(z,{className:`rounded-xl`,children:s.map(e=>(0,Q.jsx)(B,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,Q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function Ge({open:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Q.jsx)(S,{open:e,onOpenChange:a,children:e||t?(0,Q.jsx)(qe,{pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e?`create-open`:`create-closed`):null})}function Ke({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Q.jsx)(S,{open:e!==null,onOpenChange:a,children:e?(0,Q.jsx)(Je,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function qe(e){let{pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:s,onSubmit:c}=e,[l,d]=(0,Z.useState)(Ve);return(0,Q.jsxs)(y,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Q.jsxs)(_,{className:`text-left`,children:[(0,Q.jsx)(b,{children:t(`agentsCreateDialogTitle`)}),(0,Q.jsx)(x,{children:t(`agentsCreateDialogDescription`)})]})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(u,{value:l.id,onChange:e=>d(t=>({...t,id:e.target.value})),placeholder:t(`agentsFormIdPlaceholder`)}),(0,Q.jsx)(u,{value:l.displayName,onChange:e=>d(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Q.jsx)($,{value:l.description,onChange:e=>d(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Q.jsx)(u,{value:l.avatar,onChange:e=>d(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Q.jsx)(u,{value:l.home,onChange:e=>d(t=>({...t,home:e.target.value})),placeholder:t(`agentsFormHomePlaceholder`)}),(0,Q.jsx)(U,{value:l.model,onChange:e=>d(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,Q.jsx)(We,{value:l.runtime,onChange:e=>d(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,Q.jsx)(q,{tone:`warning`,title:t(`agentsCreateDialogHint`),className:`text-xs leading-6`})]})}),(0,Q.jsxs)(v,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Q.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:n,children:t(`cancel`)}),(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>void c(l),disabled:n||l.id.trim().length===0,children:[(0,Q.jsx)(W,{className:`mr-2 h-4 w-4`}),t(`agentsCreateAction`)]})]})]})}function Je(e){let{agent:n,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:s,onOpenChange:c,onSubmit:l}=e,[d,f]=(0,Z.useState)(He(n));return(0,Q.jsxs)(y,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Q.jsxs)(_,{className:`text-left`,children:[(0,Q.jsx)(b,{children:t(`agentsEditDialogTitle`)}),(0,Q.jsx)(x,{children:t(`agentsEditDialogDescription`)})]})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(q,{tone:`warning`,title:t(`agentsEditHomeReadonly`),description:t(`agentsEditHomeReadonlyHint`),children:(0,Q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:n.workspace??`-`})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(u,{value:d.displayName,onChange:e=>f(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Q.jsx)($,{value:d.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Q.jsx)(u,{value:d.avatar,onChange:e=>f(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Q.jsx)(U,{value:d.model,onChange:e=>f(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,Q.jsx)(We,{value:d.runtime,onChange:e=>f(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:s,disabled:r})]})]})}),(0,Q.jsxs)(v,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Q.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>c(!1),disabled:r,children:t(`cancel`)}),(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>l(n.id,d),disabled:r,children:[(0,Q.jsx)(A,{className:`mr-2 h-4 w-4`}),t(`agentsEditSaveAction`)]})]})]})}var Ye=[{strip:`bg-[#efc37a]`,chip:`border-[#f2d7a7] bg-[#fff8eb] text-[#8d5a18]`},{strip:`bg-[#8fd4c0]`,chip:`border-[#bde6da] bg-[#effbf7] text-[#156653]`},{strip:`bg-[#b7c9fb]`,chip:`border-[#d7e2ff] bg-[#f4f7ff] text-[#2d4d8f]`}];function Xe(e,t){return t?{strip:`bg-[#e6b765]`,chip:`border-[#f2d19c] bg-[#fff8ec] text-[#90550d]`}:Ye[e%Ye.length]}function Ze(e){let{agentCount:n,onCreate:r}=e;return(0,Q.jsxs)(`section`,{className:`relative overflow-hidden rounded-[28px] border border-[#f0d6aa] bg-[linear-gradient(135deg,#fff7ea_0%,#fff9f1_32%,#f2fbff_100%)] px-5 py-5 sm:px-6`,children:[(0,Q.jsx)(`div`,{className:`absolute inset-y-0 right-0 w-[46%] bg-[radial-gradient(circle_at_top_right,rgba(255,215,163,0.52),transparent_54%)]`}),(0,Q.jsx)(`div`,{className:`absolute -bottom-10 left-8 h-32 w-32 rounded-full bg-[#ffe6c0]/55 blur-3xl`}),(0,Q.jsxs)(`div`,{className:`relative grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px] xl:items-center`,children:[(0,Q.jsxs)(`div`,{className:`max-w-3xl space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-white/70 bg-white/80 px-3 py-1 text-[11px] font-semibold tracking-[0.16em] text-[#9b6118]`,children:[(0,Q.jsx)(G,{className:`h-3.5 w-3.5`}),t(`agentsHeroEyebrow`)]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`h1`,{className:`max-w-2xl text-[30px] font-semibold leading-tight tracking-[-0.05em] text-[#2f2212] sm:text-[38px]`,children:t(`agentsHeroTitle`)}),(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-[#6d5841] sm:text-[15px] sm:leading-7`,children:t(`agentsHeroDescription`)})]}),(0,Q.jsx)(`div`,{className:`pt-1`,children:(0,Q.jsxs)(`div`,{className:`inline-flex items-center gap-3 rounded-2xl border border-[#f2d5a4] bg-white/82 px-3 py-2 text-[#7a4d12] shadow-[0_14px_30px_rgba(167,117,47,0.07)]`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.14em]`,children:t(`agentsOverviewTotal`)}),(0,Q.jsx)(`span`,{className:`text-xl font-semibold tracking-[-0.04em] text-[#1f2937]`,children:n})]})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3`,children:[(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`h-10 rounded-2xl px-5 text-sm font-semibold`,onClick:r,children:[(0,Q.jsx)(W,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]}),(0,Q.jsx)(q,{title:t(`agentsCreateDialogHint`),className:`border-white/70 bg-white/72 text-xs leading-6 shadow-[0_18px_40px_rgba(167,117,47,0.08)]`})]})]})]})}function Qe(e){let{agent:n,index:r,runtimeOptions:i,defaultRuntimeLabel:s,updatePending:c,deletePending:u,onStartChat:d,onEdit:p,onDelete:m}=e,h=Xe(r,!!n.builtIn),g=n.runtime?.trim()||n.engine?.trim()||``,_=g?i.find(e=>e.value===P(g))?.label??I(g):s;return(0,Q.jsxs)(f,{className:`overflow-hidden border border-gray-200 bg-white shadow-sm transition-shadow duration-200 hover:shadow-md`,children:[(0,Q.jsx)(`div`,{className:a(`h-1.5 w-full`,h.strip)}),(0,Q.jsxs)(l,{className:`flex h-full flex-col gap-4 px-4 py-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(ae,{agentId:n.id,displayName:n.displayName,avatarUrl:n.avatarUrl,className:`h-11 w-11 shrink-0`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1 pt-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`truncate text-lg font-semibold tracking-[-0.03em] text-[#1f2937]`,children:n.displayName?.trim()||n.id}),n.builtIn?(0,Q.jsxs)(Le,{tone:`warning`,className:a(`gap-1`,h.chip),children:[(0,Q.jsx)(Be,{className:`h-3 w-3`}),t(`agentsCardBuiltInTag`)]}):null]}),(0,Q.jsxs)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-[#94a3b8]`,children:[`@`,n.id]})]})]}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-[#64748b]`,children:n.description?.trim()||(n.builtIn?t(`agentsCardBuiltInSummary`):t(`agentsCardCustomSummary`))}),(0,Q.jsxs)(`div`,{className:`mt-auto flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Q.jsx)(G,{className:`h-3.5 w-3.5`}),t(`agentsCardRuntimeLabel`)]}),(0,Q.jsx)(`div`,{className:`mt-1.5 text-sm leading-6 text-[#475569]`,children:_})]}),(0,Q.jsxs)(`div`,{className:`border-t border-gray-100 pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),t(`agentsCardHomeLabel`)]}),(0,Q.jsx)(`div`,{className:`mt-1.5 break-all text-sm leading-6 text-[#475569]`,children:n.workspace??`-`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`h-9 rounded-xl px-4`,onClick:d,children:[(0,Q.jsx)(T,{className:`mr-2 h-4 w-4`}),t(`agentsCardStartChat`)]}),(0,Q.jsxs)(o,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:p,disabled:c,children:[(0,Q.jsx)(A,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsEditAction`)]}),n.builtIn?null:(0,Q.jsxs)(o,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:m,disabled:u,children:[(0,Q.jsx)(K,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsRemoveAction`)]})]})]})]})]})}function $e(){let e=m(),n=M(),r=J(),i=Y(),a=F(),c=we(),u=te(),d=oe(),[p,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),v=N(e=>e.setSnapshot),y=(0,Z.useMemo)(()=>n.data?.agents??[],[n.data?.agents]),b=(0,Z.useMemo)(()=>[...y].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[y]),x=(0,Z.useMemo)(()=>H({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),S=(0,Z.useMemo)(()=>de(a.data?.options??[]),[a.data?.options]),C=(0,Z.useMemo)(()=>P(a.data?.defaultType??`native`),[a.data?.defaultType]),w=(0,Z.useMemo)(()=>S.find(e=>e.value===C)?.label??I(C),[C,S]),T=async e=>{await c.mutateAsync({data:{id:e.id,...e.displayName.trim()?{displayName:e.displayName.trim()}:{},...e.description.trim()?{description:e.description.trim()}:{},...e.avatar.trim()?{avatar:e.avatar.trim()}:{},...e.home.trim()?{home:e.home.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{},...e.runtime.trim()?{runtime:e.runtime.trim()}:{}}}),h(!1)},E=e=>{_(e)},O=async(e,t)=>{await u.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),_(null)},k=t=>{v({selectedAgentId:t.id,selectedSessionKey:null}),D.getState().setSnapshot({pendingSessionType:se(t,C),pendingProjectRoot:null,pendingProjectRootSessionKey:null}),e(`/chat`)};return(0,Q.jsxs)(s,{className:`space-y-5`,children:[(0,Q.jsx)(Ze,{agentCount:y.length,onCreate:()=>h(!0)}),(0,Q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:n.isLoading?(0,Q.jsx)(f,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,Q.jsx)(l,{className:`py-14 text-center text-sm text-gray-500`,children:t(`agentsLoading`)})}):b.length===0?(0,Q.jsx)(f,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,Q.jsxs)(l,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,Q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,Q.jsx)(ee,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,Q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:t(`agentsEmpty`)}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:t(`agentsEmptyDescription`)}),(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>h(!0),children:[(0,Q.jsx)(W,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]})]})}):b.map((e,t)=>(0,Q.jsx)(Qe,{agent:e,index:t,runtimeOptions:S,defaultRuntimeLabel:w,updatePending:u.isPending,deletePending:d.isPending,onStartChat:()=>k(e),onEdit:()=>E(e),onDelete:()=>d.mutate({agentId:e.id})},e.id))}),(0,Q.jsx)(Ge,{open:p,pending:c.isPending,providerCatalog:x,runtimeOptions:S,defaultRuntime:C,onOpenChange:h,onSubmit:T}),(0,Q.jsx)(Ke,{agent:g,pending:u.isPending,providerCatalog:x,runtimeOptions:S,defaultRuntime:C,onOpenChange:e=>{!e&&!u.isPending&&_(null)},onSubmit:O})]})}function et(e){return r(e??void 0)}function tt(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:r(new Date(e))}function nt(e){if(typeof e!=`number`||!Number.isFinite(e))return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function rt(e){let t=e.schedule;return t.kind===`cron`?t.expr?`cron ${t.expr}`:`cron`:t.kind===`every`?`every ${nt(t.everyMs)}`:t.kind===`at`?`at ${tt(t.atMs)}`:`-`}function it(e){return e.payload.deliver?`${e.payload.channel??`-`}:${e.payload.to??`-`}`:`-`}function at(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.channel??``,e.payload.to??``].join(` `).toLowerCase().includes(n):!0}function ot(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function st(e){let{job:n,onDelete:r,onRun:i,onToggle:s}=e;return(0,Q.jsx)(f,{className:`border border-gray-200`,children:(0,Q.jsx)(l,{className:`pt-5 pb-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:n.name||n.id}),(0,Q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:n.id}),(0,Q.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,n.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:n.enabled?t(`enabled`):t(`disabled`)}),n.deleteAfterRun?(0,Q.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:t(`cronOneShot`)}):null]}),(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronScheduleLabel`),`: `,rt(n)]}),(0,Q.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:n.payload.message}),(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronDeliverTo`),`: `,it(n)]})]}),(0,Q.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronNextRun`),`:`]}),` `,et(n.state.nextRunAt)]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastRun`),`:`]}),` `,et(n.state.lastRunAt)]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastStatus`),`:`]}),` `,n.state.lastStatus??`-`]}),n.state.lastError?(0,Q.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:n.state.lastError}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,Q.jsxs)(o,{variant:`subtle`,size:`sm`,onClick:()=>i(n),className:`gap-1`,children:[(0,Q.jsx)(Oe,{className:`h-3.5 w-3.5`}),t(`cronRunNow`)]}),(0,Q.jsxs)(o,{variant:n.enabled?`outline`:`primary`,size:`sm`,onClick:()=>s(n),className:`gap-1`,children:[(0,Q.jsx)(ze,{className:`h-3.5 w-3.5`}),n.enabled?t(`cronDisable`):t(`cronEnable`)]}),(0,Q.jsxs)(o,{variant:`destructive`,size:`sm`,onClick:()=>r(n),className:`gap-1`,children:[(0,Q.jsx)(K,{className:`h-3.5 w-3.5`}),t(`delete`)]})]})]})})})}function ct(){let[e,n]=(0,Z.useState)(``),[r,i]=(0,Z.useState)(`all`),l=Me({all:!0}),d=Pe(),f=Fe(),p=Ae(),{confirm:m,ConfirmDialog:h}=X(),g=(0,Z.useMemo)(()=>(l.data?.jobs??[]).filter(t=>at(t,e)).filter(e=>ot(e,r)),[l.data,e,r]),_=async e=>{await m({title:`${t(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:t(`delete`)})&&d.mutate({id:e.id})},v=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronEnableConfirm`)}?`:`${t(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:n?`default`:`destructive`,confirmLabel:t(n?`cronEnable`:`cronDisable`)})&&f.mutate({id:e.id,enabled:n})},y=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronRunForceConfirm`)}?`:`${t(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:t(`cronRunNow`)})&&p.mutate({id:e.id,force:n})};return(0,Q.jsxs)(s,{fullHeight:!0,children:[(0,Q.jsx)(c,{title:t(`cronPageTitle`),description:t(`cronPageDescription`),actions:(0,Q.jsx)(o,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>l.refetch(),children:(0,Q.jsx)(E,{className:a(`h-4 w-4`,l.isFetching&&`animate-spin`)})})}),(0,Q.jsx)(`div`,{className:`mb-6`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,Q.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,Q.jsx)(u,{value:e,onChange:e=>n(e.target.value),placeholder:t(`cronSearchPlaceholder`),className:`pl-9`}),(0,Q.jsx)(w,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,Q.jsx)(`div`,{className:`min-w-[180px]`,children:(0,Q.jsxs)(V,{value:r,onValueChange:e=>i(e),children:[(0,Q.jsx)(R,{className:`w-full`,children:(0,Q.jsx)(L,{placeholder:t(`cronStatusLabel`)})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{value:`all`,children:t(`cronStatusAll`)}),(0,Q.jsx)(B,{value:`enabled`,children:t(`cronStatusEnabled`)}),(0,Q.jsx)(B,{value:`disabled`,children:t(`cronStatusDisabled`)})]})]})}),(0,Q.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[t(`cronTotalLabel`),`: `,l.data?.total??0,` / `,g.length]})]})}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:l.isLoading?(0,Q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronLoading`)}):g.length===0?(0,Q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronEmpty`)}):(0,Q.jsx)(`div`,{className:`space-y-4`,children:g.map(e=>(0,Q.jsx)(st,{job:e,onDelete:_,onRun:y,onToggle:v},e.id))})}),(0,Q.jsx)(h,{})]})}function lt(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,Z.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,Z.useEffect)(()=>{a.current=r},[r,a])}function ut({view:e,confirmDialog:t}){let{isMobile:n}=ke();return(0,Q.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,Q.jsx)(Se,{}),e===`chat`?n?(0,Q.jsx)(Ie,{}):(0,Q.jsx)(ge,{}):(0,Q.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,Q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Q.jsx)(ct,{})})}):e===`agents`?(0,Q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Q.jsx)($e,{})})}):(0,Q.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,Q.jsx)(Re,{forcedType:`skills`})})})}),t]})}function dt(e,t){return e.filter(e=>ye(e,t))}function ft(e){let{config:t,meta:n}=e;return(0,Z.useMemo)(()=>{let e=H({meta:n,config:t,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=De(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:Ee(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n])}function pt(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,Z.useMemo)(()=>xe({sessions:t,selectedSessionKey:n,sessionType:r}),[n,r,t]),recentSessionPreferredThinking:(0,Z.useMemo)(()=>_e({sessions:t,selectedSessionKey:n,sessionType:r}),[n,r,t])}}function mt(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,Z.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,Z.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,Z.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function ht(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function gt(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=J(),u=Y(),d=je({limit:200}),f=F(),p=Ne({sessionId:a,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),m=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess),h=ft({config:l.data,meta:u.data}),g=(0,Z.useMemo)(()=>d.data?.sessions??[],[d.data?.sessions]),_=(0,Z.useMemo)(()=>Ce(g),[g]),v=(0,Z.useMemo)(()=>dt(_,i),[_,i]),y=(0,Z.useMemo)(()=>_.find(e=>e.key===a)??null,[_,a]),b=(0,Z.useMemo)(()=>p.data?.records??[],[p.data?.records]),x=Te({selectedSession:y,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:f.data}),S=(0,Z.useMemo)(()=>ht({modelOptions:h,supportedModels:x.selectedSessionTypeOption?.supportedModels}),[h,x.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:C,recentSessionPreferredThinking:w}=pt({sessions:_,sessionKey:a,sessionType:x.selectedSessionType}),{supportedThinkingLevels:T,defaultThinkingLevel:E}=mt({currentSelectedModel:t,modelOptions:S});return be({modelOptions:S,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredModel:y?.preferredModel,fallbackPreferredModel:x.selectedSessionTypeOption?.recommendedModel??C,defaultModel:x.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),fe({supportedThinkingLevels:T,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredThinking:y?.preferredThinking??null,fallbackPreferredThinking:w??null,defaultThinkingLevel:E,setSelectedThinkingLevel:c}),{configQuery:l,configMetaQuery:u,sessionsQuery:d,sessionTypesQuery:f,sessionSkillsQuery:p,isProviderStateResolved:m,modelOptions:S,sessionSummaries:g,sessions:v,skillRecords:b,selectedSession:y,...x}}function _t(e){return e.parentSessionKey?e.sessionSummaries.map(j).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function vt(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?ue(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,Z.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?j(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??I(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,Z.useMemo)(()=>_t({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function yt(e){(0,Z.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?ue(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function bt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function xt(e){let t={};e.model?.trim()&&(t.model=e.model.trim(),t.preferred_model=e.model.trim()),e.thinkingLevel?.trim()&&(t.thinking=e.thinkingLevel.trim(),t.preferred_thinking=e.thinkingLevel.trim()),e.sessionType?.trim()&&(t.session_type=e.sessionType.trim(),t.runtime=e.sessionType.trim()),e.agentId?.trim()&&(t.agent_id=e.agentId.trim());let n=O(e.projectRoot);n&&(t.project_root=n);let r=bt(e.requestedSkills);r.length>0&&(t.requested_skill_refs=r);let i=e.composerNodes?me(e.composerNodes):[];return i.length>0&&(t[ie]=i),t}function St(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function Ct(e){let t=N(e=>e.snapshot.query),n=N(e=>e.snapshot.selectedSessionKey),r=N(e=>e.snapshot.draftSessionKey),i=N(e=>e.snapshot.selectedAgentId),a=D(e=>e.snapshot.pendingSessionType),o=D(e=>e.snapshot.pendingProjectRoot),s=D(e=>e.snapshot.pendingProjectRootSessionKey),c=D(e=>e.snapshot.selectedModel),l=d(),u=M(),{confirm:f,ConfirmDialog:p}=X(),_=g(),v=m(),{sessionId:y}=h(),b=(0,Z.useRef)(null),x=(0,Z.useRef)(n),S=(0,Z.useMemo)(()=>ve(y),[y]),C=S??n??r,w=o!==null&&s===C,T=gt({query:t,sessionKey:C,projectRootOverride:w?o:void 0,currentSelectedModel:c,pendingSessionType:a,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:i,pendingProjectRoot:o,pendingProjectRootSessionKey:s,runtimeAvailability:l,agentsQuery:u,confirm:f,ConfirmDialog:p,location:_,navigate:v,threadRef:b,selectedSessionKeyRef:x,routeSessionKey:S,sessionKey:C,hasSessionProjectRootOverride:w,agent:he(C),...T}}function wt(e){let t=Ct(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,runtimeAvailability:o,selectedAgentId:s,selectedSession:c,selectedSessionType:l,sessionKey:u,sessionSummaries:d,sessionTypeOptions:f}=t,m=i?a:c?.projectRoot??null,h=i?k(m):c?.projectName??k(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=o.phase===`ready`&&le(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:c?.agentId??s}],y=vt({sessionKey:u,selectedSession:c,selectedAgentId:s,availableAgents:v,parentSessionId:c?.parentSessionId??null,sessionSummaries:d,selectedSessionType:l,sessionTypeOptions:f});return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||n.isRunning,isAwaitingAssistantOutput:n.isRunning,canStopCurrentRun:n.isRunning,stopDisabledReason:n.isRunning?null:`__preparing__`,lastSendError:o.isBlocked?null:o.phase===`ready`?_:p.getDisplayMessage(_),...y}}function Tt(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKey:o,selectedSessionKeyRef:s,sessionKey:c}=e;(0,Z.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if(e.sessionKey!==c)return;let o=xt({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),s=re({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(s)try{await t.send(s)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===c&&await t.streamRun()},resetStreamState:()=>{s.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,o,a?.projectRoot,s,c])}function Et(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r,selectedSessionKey:i}=e;(0,Z.useEffect)(()=>{!r||!St({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||D.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r,i])}function Dt(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,Z.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function Ot(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,Z.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function kt({view:e}){let[t]=(0,Z.useState)(()=>new ce),n=wt(t);return Tt(n),Et(n),Dt(n),Ot(n),lt({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),yt({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,Q.jsx)(pe,{presenter:t,children:(0,Q.jsx)(ut,{view:e,confirmDialog:(0,Q.jsx)(n.ConfirmDialog,{})})})}function At({view:e}){return(0,Q.jsx)(kt,{view:e})}export{At as ChatPage};
|
|
1
|
+
import{_ as e,i as t,m as n,n as r,p as i,u as a}from"./i18n-BnNAQpVM.js";import{At as o,Dt as s,Et as c,St as l,kt as u,mt as d,xt as f,yt as p}from"./api-C51456xV.js";import{c as m,l as h,s as g}from"./chunk-JZWAC4HX-ptDyT_1C.js";import{a as _,i as v,n as y,o as b,r as x,t as S}from"./dialog-BHcaU6NE.js";import{t as C}from"./createLucideIcon-C_GFKVuW.js";import{b as w,h as T,p as E,y as ee}from"./theme-provider-dHqcWU-j.js";import{A as D,C as te,D as O,E as k,I as A,L as ne,M as re,O as ie,P as ae,S as oe,T as j,_ as se,a as ce,b as M,c as le,d as N,f as ue,g as P,h as de,i as fe,j as pe,k as me,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as F,t as xe,u as Se,v as I,w as Ce,x as we,y as Te}from"./chat-BxA-mw53.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-DRDejPLk.js";import{i as Ee,n as H,r as De,t as U}from"./provider-scoped-model-input-DeAo2Y65.js";import"./mcp-marketplace-page-C_akqPwv.js";import{t as Oe}from"./play-DeNVUA5C.js";import{t as W}from"./plus-BptLViq1.js";import{t as G}from"./sparkles-CyDTgTM4.js";import{t as K}from"./trash-2-C1cdqL6V.js";import{t as q}from"./notice-card-C9PFAR67.js";import{t as ke}from"./use-viewport-layout-D-pjxsyz.js";import{g as Ae,m as je,n as J,o as Me,p as Ne,r as Y,s as Pe,y as Fe}from"./use-config-DFja1sda.js";import{t as Ie}from"./index-CAYF44Dz.js";import{t as Le}from"./tag-chip-CVIqyMv7.js";import{t as X}from"./use-confirm-dialog-DvIbSUX3.js";import{t as Re}from"./marketplace-page-DiqqX25V.js";var ze=C(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Be=C(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Z=e(n(),1),Q=i(),$=Z.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(`textarea`,{className:a(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));$.displayName=`Textarea`;var Ve={id:``,displayName:``,description:``,avatar:``,model:``,home:``,runtime:``};function He(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Ue(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=P(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:I(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function We({value:e,disabled:n=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?P(e):``,s=Ue({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?t(`agentsRuntimeUnavailableHelp`):``);return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(V,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:n,children:[(0,Q.jsx)(R,{"aria-label":t(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,Q.jsx)(L,{placeholder:t(`agentsRuntimeSelectPlaceholder`)})}),(0,Q.jsx)(z,{className:`rounded-xl`,children:s.map(e=>(0,Q.jsx)(B,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,Q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function Ge({open:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Q.jsx)(S,{open:e,onOpenChange:a,children:e||t?(0,Q.jsx)(qe,{pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e?`create-open`:`create-closed`):null})}function Ke({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Q.jsx)(S,{open:e!==null,onOpenChange:a,children:e?(0,Q.jsx)(Je,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function qe(e){let{pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:s,onSubmit:c}=e,[l,d]=(0,Z.useState)(Ve);return(0,Q.jsxs)(y,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Q.jsxs)(_,{className:`text-left`,children:[(0,Q.jsx)(b,{children:t(`agentsCreateDialogTitle`)}),(0,Q.jsx)(x,{children:t(`agentsCreateDialogDescription`)})]})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(u,{value:l.id,onChange:e=>d(t=>({...t,id:e.target.value})),placeholder:t(`agentsFormIdPlaceholder`)}),(0,Q.jsx)(u,{value:l.displayName,onChange:e=>d(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Q.jsx)($,{value:l.description,onChange:e=>d(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Q.jsx)(u,{value:l.avatar,onChange:e=>d(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Q.jsx)(u,{value:l.home,onChange:e=>d(t=>({...t,home:e.target.value})),placeholder:t(`agentsFormHomePlaceholder`)}),(0,Q.jsx)(U,{value:l.model,onChange:e=>d(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,Q.jsx)(We,{value:l.runtime,onChange:e=>d(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,Q.jsx)(q,{tone:`warning`,title:t(`agentsCreateDialogHint`),className:`text-xs leading-6`})]})}),(0,Q.jsxs)(v,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Q.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:n,children:t(`cancel`)}),(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>void c(l),disabled:n||l.id.trim().length===0,children:[(0,Q.jsx)(W,{className:`mr-2 h-4 w-4`}),t(`agentsCreateAction`)]})]})]})}function Je(e){let{agent:n,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:s,onOpenChange:c,onSubmit:l}=e,[d,f]=(0,Z.useState)(He(n));return(0,Q.jsxs)(y,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Q.jsxs)(_,{className:`text-left`,children:[(0,Q.jsx)(b,{children:t(`agentsEditDialogTitle`)}),(0,Q.jsx)(x,{children:t(`agentsEditDialogDescription`)})]})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(q,{tone:`warning`,title:t(`agentsEditHomeReadonly`),description:t(`agentsEditHomeReadonlyHint`),children:(0,Q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:n.workspace??`-`})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(u,{value:d.displayName,onChange:e=>f(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Q.jsx)($,{value:d.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Q.jsx)(u,{value:d.avatar,onChange:e=>f(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Q.jsx)(U,{value:d.model,onChange:e=>f(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,Q.jsx)(We,{value:d.runtime,onChange:e=>f(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:s,disabled:r})]})]})}),(0,Q.jsxs)(v,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Q.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>c(!1),disabled:r,children:t(`cancel`)}),(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>l(n.id,d),disabled:r,children:[(0,Q.jsx)(A,{className:`mr-2 h-4 w-4`}),t(`agentsEditSaveAction`)]})]})]})}var Ye=[{strip:`bg-[#efc37a]`,chip:`border-[#f2d7a7] bg-[#fff8eb] text-[#8d5a18]`},{strip:`bg-[#8fd4c0]`,chip:`border-[#bde6da] bg-[#effbf7] text-[#156653]`},{strip:`bg-[#b7c9fb]`,chip:`border-[#d7e2ff] bg-[#f4f7ff] text-[#2d4d8f]`}];function Xe(e,t){return t?{strip:`bg-[#e6b765]`,chip:`border-[#f2d19c] bg-[#fff8ec] text-[#90550d]`}:Ye[e%Ye.length]}function Ze(e){let{agentCount:n,onCreate:r}=e;return(0,Q.jsxs)(`section`,{className:`relative overflow-hidden rounded-[28px] border border-[#f0d6aa] bg-[linear-gradient(135deg,#fff7ea_0%,#fff9f1_32%,#f2fbff_100%)] px-5 py-5 sm:px-6`,children:[(0,Q.jsx)(`div`,{className:`absolute inset-y-0 right-0 w-[46%] bg-[radial-gradient(circle_at_top_right,rgba(255,215,163,0.52),transparent_54%)]`}),(0,Q.jsx)(`div`,{className:`absolute -bottom-10 left-8 h-32 w-32 rounded-full bg-[#ffe6c0]/55 blur-3xl`}),(0,Q.jsxs)(`div`,{className:`relative grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px] xl:items-center`,children:[(0,Q.jsxs)(`div`,{className:`max-w-3xl space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-white/70 bg-white/80 px-3 py-1 text-[11px] font-semibold tracking-[0.16em] text-[#9b6118]`,children:[(0,Q.jsx)(G,{className:`h-3.5 w-3.5`}),t(`agentsHeroEyebrow`)]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`h1`,{className:`max-w-2xl text-[30px] font-semibold leading-tight tracking-[-0.05em] text-[#2f2212] sm:text-[38px]`,children:t(`agentsHeroTitle`)}),(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-[#6d5841] sm:text-[15px] sm:leading-7`,children:t(`agentsHeroDescription`)})]}),(0,Q.jsx)(`div`,{className:`pt-1`,children:(0,Q.jsxs)(`div`,{className:`inline-flex items-center gap-3 rounded-2xl border border-[#f2d5a4] bg-white/82 px-3 py-2 text-[#7a4d12] shadow-[0_14px_30px_rgba(167,117,47,0.07)]`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.14em]`,children:t(`agentsOverviewTotal`)}),(0,Q.jsx)(`span`,{className:`text-xl font-semibold tracking-[-0.04em] text-[#1f2937]`,children:n})]})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3`,children:[(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`h-10 rounded-2xl px-5 text-sm font-semibold`,onClick:r,children:[(0,Q.jsx)(W,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]}),(0,Q.jsx)(q,{title:t(`agentsCreateDialogHint`),className:`border-white/70 bg-white/72 text-xs leading-6 shadow-[0_18px_40px_rgba(167,117,47,0.08)]`})]})]})]})}function Qe(e){let{agent:n,index:r,runtimeOptions:i,defaultRuntimeLabel:s,updatePending:c,deletePending:u,onStartChat:d,onEdit:p,onDelete:m}=e,h=Xe(r,!!n.builtIn),g=n.runtime?.trim()||n.engine?.trim()||``,_=g?i.find(e=>e.value===P(g))?.label??I(g):s;return(0,Q.jsxs)(f,{className:`overflow-hidden border border-gray-200 bg-white shadow-sm transition-shadow duration-200 hover:shadow-md`,children:[(0,Q.jsx)(`div`,{className:a(`h-1.5 w-full`,h.strip)}),(0,Q.jsxs)(l,{className:`flex h-full flex-col gap-4 px-4 py-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(ae,{agentId:n.id,displayName:n.displayName,avatarUrl:n.avatarUrl,className:`h-11 w-11 shrink-0`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1 pt-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`truncate text-lg font-semibold tracking-[-0.03em] text-[#1f2937]`,children:n.displayName?.trim()||n.id}),n.builtIn?(0,Q.jsxs)(Le,{tone:`warning`,className:a(`gap-1`,h.chip),children:[(0,Q.jsx)(Be,{className:`h-3 w-3`}),t(`agentsCardBuiltInTag`)]}):null]}),(0,Q.jsxs)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-[#94a3b8]`,children:[`@`,n.id]})]})]}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-[#64748b]`,children:n.description?.trim()||(n.builtIn?t(`agentsCardBuiltInSummary`):t(`agentsCardCustomSummary`))}),(0,Q.jsxs)(`div`,{className:`mt-auto flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Q.jsx)(G,{className:`h-3.5 w-3.5`}),t(`agentsCardRuntimeLabel`)]}),(0,Q.jsx)(`div`,{className:`mt-1.5 text-sm leading-6 text-[#475569]`,children:_})]}),(0,Q.jsxs)(`div`,{className:`border-t border-gray-100 pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),t(`agentsCardHomeLabel`)]}),(0,Q.jsx)(`div`,{className:`mt-1.5 break-all text-sm leading-6 text-[#475569]`,children:n.workspace??`-`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`h-9 rounded-xl px-4`,onClick:d,children:[(0,Q.jsx)(T,{className:`mr-2 h-4 w-4`}),t(`agentsCardStartChat`)]}),(0,Q.jsxs)(o,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:p,disabled:c,children:[(0,Q.jsx)(A,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsEditAction`)]}),n.builtIn?null:(0,Q.jsxs)(o,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:m,disabled:u,children:[(0,Q.jsx)(K,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsRemoveAction`)]})]})]})]})]})}function $e(){let e=m(),n=M(),r=J(),i=Y(),a=F(),c=we(),u=te(),d=oe(),[p,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),v=N(e=>e.setSnapshot),y=(0,Z.useMemo)(()=>n.data?.agents??[],[n.data?.agents]),b=(0,Z.useMemo)(()=>[...y].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[y]),x=(0,Z.useMemo)(()=>H({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),S=(0,Z.useMemo)(()=>de(a.data?.options??[]),[a.data?.options]),C=(0,Z.useMemo)(()=>P(a.data?.defaultType??`native`),[a.data?.defaultType]),w=(0,Z.useMemo)(()=>S.find(e=>e.value===C)?.label??I(C),[C,S]),T=async e=>{await c.mutateAsync({data:{id:e.id,...e.displayName.trim()?{displayName:e.displayName.trim()}:{},...e.description.trim()?{description:e.description.trim()}:{},...e.avatar.trim()?{avatar:e.avatar.trim()}:{},...e.home.trim()?{home:e.home.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{},...e.runtime.trim()?{runtime:e.runtime.trim()}:{}}}),h(!1)},E=e=>{_(e)},O=async(e,t)=>{await u.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),_(null)},k=t=>{v({selectedAgentId:t.id,selectedSessionKey:null}),D.getState().setSnapshot({pendingSessionType:se(t,C),pendingProjectRoot:null,pendingProjectRootSessionKey:null}),e(`/chat`)};return(0,Q.jsxs)(s,{className:`space-y-5`,children:[(0,Q.jsx)(Ze,{agentCount:y.length,onCreate:()=>h(!0)}),(0,Q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:n.isLoading?(0,Q.jsx)(f,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,Q.jsx)(l,{className:`py-14 text-center text-sm text-gray-500`,children:t(`agentsLoading`)})}):b.length===0?(0,Q.jsx)(f,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,Q.jsxs)(l,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,Q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,Q.jsx)(ee,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,Q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:t(`agentsEmpty`)}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:t(`agentsEmptyDescription`)}),(0,Q.jsxs)(o,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>h(!0),children:[(0,Q.jsx)(W,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]})]})}):b.map((e,t)=>(0,Q.jsx)(Qe,{agent:e,index:t,runtimeOptions:S,defaultRuntimeLabel:w,updatePending:u.isPending,deletePending:d.isPending,onStartChat:()=>k(e),onEdit:()=>E(e),onDelete:()=>d.mutate({agentId:e.id})},e.id))}),(0,Q.jsx)(Ge,{open:p,pending:c.isPending,providerCatalog:x,runtimeOptions:S,defaultRuntime:C,onOpenChange:h,onSubmit:T}),(0,Q.jsx)(Ke,{agent:g,pending:u.isPending,providerCatalog:x,runtimeOptions:S,defaultRuntime:C,onOpenChange:e=>{!e&&!u.isPending&&_(null)},onSubmit:O})]})}function et(e){return r(e??void 0)}function tt(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:r(new Date(e))}function nt(e){if(typeof e!=`number`||!Number.isFinite(e))return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function rt(e){let t=e.schedule;return t.kind===`cron`?t.expr?`cron ${t.expr}`:`cron`:t.kind===`every`?`every ${nt(t.everyMs)}`:t.kind===`at`?`at ${tt(t.atMs)}`:`-`}function it(e){return e.payload.deliver?`${e.payload.channel??`-`}:${e.payload.to??`-`}`:`-`}function at(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.channel??``,e.payload.to??``].join(` `).toLowerCase().includes(n):!0}function ot(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function st(e){let{job:n,onDelete:r,onRun:i,onToggle:s}=e;return(0,Q.jsx)(f,{className:`border border-gray-200`,children:(0,Q.jsx)(l,{className:`pt-5 pb-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:n.name||n.id}),(0,Q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:n.id}),(0,Q.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,n.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:n.enabled?t(`enabled`):t(`disabled`)}),n.deleteAfterRun?(0,Q.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:t(`cronOneShot`)}):null]}),(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronScheduleLabel`),`: `,rt(n)]}),(0,Q.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:n.payload.message}),(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronDeliverTo`),`: `,it(n)]})]}),(0,Q.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronNextRun`),`:`]}),` `,et(n.state.nextRunAt)]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastRun`),`:`]}),` `,et(n.state.lastRunAt)]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastStatus`),`:`]}),` `,n.state.lastStatus??`-`]}),n.state.lastError?(0,Q.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:n.state.lastError}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,Q.jsxs)(o,{variant:`subtle`,size:`sm`,onClick:()=>i(n),className:`gap-1`,children:[(0,Q.jsx)(Oe,{className:`h-3.5 w-3.5`}),t(`cronRunNow`)]}),(0,Q.jsxs)(o,{variant:n.enabled?`outline`:`primary`,size:`sm`,onClick:()=>s(n),className:`gap-1`,children:[(0,Q.jsx)(ze,{className:`h-3.5 w-3.5`}),n.enabled?t(`cronDisable`):t(`cronEnable`)]}),(0,Q.jsxs)(o,{variant:`destructive`,size:`sm`,onClick:()=>r(n),className:`gap-1`,children:[(0,Q.jsx)(K,{className:`h-3.5 w-3.5`}),t(`delete`)]})]})]})})})}function ct(){let[e,n]=(0,Z.useState)(``),[r,i]=(0,Z.useState)(`all`),l=Me({all:!0}),d=Pe(),f=Fe(),p=Ae(),{confirm:m,ConfirmDialog:h}=X(),g=(0,Z.useMemo)(()=>(l.data?.jobs??[]).filter(t=>at(t,e)).filter(e=>ot(e,r)),[l.data,e,r]),_=async e=>{await m({title:`${t(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:t(`delete`)})&&d.mutate({id:e.id})},v=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronEnableConfirm`)}?`:`${t(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:n?`default`:`destructive`,confirmLabel:t(n?`cronEnable`:`cronDisable`)})&&f.mutate({id:e.id,enabled:n})},y=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronRunForceConfirm`)}?`:`${t(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:t(`cronRunNow`)})&&p.mutate({id:e.id,force:n})};return(0,Q.jsxs)(s,{fullHeight:!0,children:[(0,Q.jsx)(c,{title:t(`cronPageTitle`),description:t(`cronPageDescription`),actions:(0,Q.jsx)(o,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>l.refetch(),children:(0,Q.jsx)(E,{className:a(`h-4 w-4`,l.isFetching&&`animate-spin`)})})}),(0,Q.jsx)(`div`,{className:`mb-6`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,Q.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,Q.jsx)(u,{value:e,onChange:e=>n(e.target.value),placeholder:t(`cronSearchPlaceholder`),className:`pl-9`}),(0,Q.jsx)(w,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,Q.jsx)(`div`,{className:`min-w-[180px]`,children:(0,Q.jsxs)(V,{value:r,onValueChange:e=>i(e),children:[(0,Q.jsx)(R,{className:`w-full`,children:(0,Q.jsx)(L,{placeholder:t(`cronStatusLabel`)})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{value:`all`,children:t(`cronStatusAll`)}),(0,Q.jsx)(B,{value:`enabled`,children:t(`cronStatusEnabled`)}),(0,Q.jsx)(B,{value:`disabled`,children:t(`cronStatusDisabled`)})]})]})}),(0,Q.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[t(`cronTotalLabel`),`: `,l.data?.total??0,` / `,g.length]})]})}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:l.isLoading?(0,Q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronLoading`)}):g.length===0?(0,Q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronEmpty`)}):(0,Q.jsx)(`div`,{className:`space-y-4`,children:g.map(e=>(0,Q.jsx)(st,{job:e,onDelete:_,onRun:y,onToggle:v},e.id))})}),(0,Q.jsx)(h,{})]})}function lt(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,Z.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,Z.useEffect)(()=>{a.current=r},[r,a])}function ut({view:e,confirmDialog:t}){let{isMobile:n}=ke();return(0,Q.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,Q.jsx)(Se,{}),e===`chat`?n?(0,Q.jsx)(Ie,{}):(0,Q.jsx)(ge,{}):(0,Q.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,Q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Q.jsx)(ct,{})})}):e===`agents`?(0,Q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Q.jsx)($e,{})})}):(0,Q.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,Q.jsx)(Re,{forcedType:`skills`})})})}),t]})}function dt(e,t){return e.filter(e=>ye(e,t))}function ft(e){let{config:t,meta:n}=e;return(0,Z.useMemo)(()=>{let e=H({meta:n,config:t,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=De(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:Ee(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n])}function pt(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,Z.useMemo)(()=>xe({sessions:t,selectedSessionKey:n,sessionType:r}),[n,r,t]),recentSessionPreferredThinking:(0,Z.useMemo)(()=>_e({sessions:t,selectedSessionKey:n,sessionType:r}),[n,r,t])}}function mt(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,Z.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,Z.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,Z.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function ht(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function gt(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=J(),u=Y(),d=je({limit:200}),f=F(),p=Ne({sessionId:a,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),m=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess),h=ft({config:l.data,meta:u.data}),g=(0,Z.useMemo)(()=>d.data?.sessions??[],[d.data?.sessions]),_=(0,Z.useMemo)(()=>Ce(g),[g]),v=(0,Z.useMemo)(()=>dt(_,i),[_,i]),y=(0,Z.useMemo)(()=>_.find(e=>e.key===a)??null,[_,a]),b=(0,Z.useMemo)(()=>p.data?.records??[],[p.data?.records]),x=Te({selectedSession:y,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:f.data}),S=(0,Z.useMemo)(()=>ht({modelOptions:h,supportedModels:x.selectedSessionTypeOption?.supportedModels}),[h,x.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:C,recentSessionPreferredThinking:w}=pt({sessions:_,sessionKey:a,sessionType:x.selectedSessionType}),{supportedThinkingLevels:T,defaultThinkingLevel:E}=mt({currentSelectedModel:t,modelOptions:S});return be({modelOptions:S,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredModel:y?.preferredModel,fallbackPreferredModel:x.selectedSessionTypeOption?.recommendedModel??C,defaultModel:x.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),fe({supportedThinkingLevels:T,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredThinking:y?.preferredThinking??null,fallbackPreferredThinking:w??null,defaultThinkingLevel:E,setSelectedThinkingLevel:c}),{configQuery:l,configMetaQuery:u,sessionsQuery:d,sessionTypesQuery:f,sessionSkillsQuery:p,isProviderStateResolved:m,modelOptions:S,sessionSummaries:g,sessions:v,skillRecords:b,selectedSession:y,...x}}function _t(e){return e.parentSessionKey?e.sessionSummaries.map(j).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function vt(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?ue(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,Z.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?j(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??I(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,Z.useMemo)(()=>_t({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function yt(e){(0,Z.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?ue(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function bt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function xt(e){let t={};e.model?.trim()&&(t.model=e.model.trim(),t.preferred_model=e.model.trim()),e.thinkingLevel?.trim()&&(t.thinking=e.thinkingLevel.trim(),t.preferred_thinking=e.thinkingLevel.trim()),e.sessionType?.trim()&&(t.session_type=e.sessionType.trim(),t.runtime=e.sessionType.trim()),e.agentId?.trim()&&(t.agent_id=e.agentId.trim());let n=O(e.projectRoot);n&&(t.project_root=n);let r=bt(e.requestedSkills);r.length>0&&(t.requested_skill_refs=r);let i=e.composerNodes?me(e.composerNodes):[];return i.length>0&&(t[ie]=i),t}function St(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function Ct(e){let t=N(e=>e.snapshot.query),n=N(e=>e.snapshot.selectedSessionKey),r=N(e=>e.snapshot.draftSessionKey),i=N(e=>e.snapshot.selectedAgentId),a=D(e=>e.snapshot.pendingSessionType),o=D(e=>e.snapshot.pendingProjectRoot),s=D(e=>e.snapshot.pendingProjectRootSessionKey),c=D(e=>e.snapshot.selectedModel),l=d(),u=M(),{confirm:f,ConfirmDialog:p}=X(),_=g(),v=m(),{sessionId:y}=h(),b=(0,Z.useRef)(null),x=(0,Z.useRef)(n),S=(0,Z.useMemo)(()=>ve(y),[y]),C=S??n??r,w=o!==null&&s===C,T=gt({query:t,sessionKey:C,projectRootOverride:w?o:void 0,currentSelectedModel:c,pendingSessionType:a,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:i,pendingProjectRoot:o,pendingProjectRootSessionKey:s,runtimeAvailability:l,agentsQuery:u,confirm:f,ConfirmDialog:p,location:_,navigate:v,threadRef:b,selectedSessionKeyRef:x,routeSessionKey:S,sessionKey:C,hasSessionProjectRootOverride:w,agent:he(C),...T}}function wt(e){let t=Ct(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,runtimeAvailability:o,selectedAgentId:s,selectedSession:c,selectedSessionType:l,sessionKey:u,sessionSummaries:d,sessionTypeOptions:f}=t,m=i?a:c?.projectRoot??null,h=i?k(m):c?.projectName??k(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=o.phase===`ready`&&le(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:c?.agentId??s}],y=vt({sessionKey:u,selectedSession:c,selectedAgentId:s,availableAgents:v,parentSessionId:c?.parentSessionId??null,sessionSummaries:d,selectedSessionType:l,sessionTypeOptions:f});return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||n.isRunning,isAwaitingAssistantOutput:n.isRunning,canStopCurrentRun:n.isRunning,stopDisabledReason:n.isRunning?null:`__preparing__`,lastSendError:o.isBlocked?null:o.phase===`ready`?_:p.getDisplayMessage(_),...y}}function Tt(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKey:o,selectedSessionKeyRef:s,sessionKey:c}=e;(0,Z.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if(e.sessionKey!==c)return;let o=xt({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),s=re({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(s)try{await t.send(s)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===c&&await t.streamRun()},resetStreamState:()=>{s.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,o,a?.projectRoot,s,c])}function Et(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r,selectedSessionKey:i}=e;(0,Z.useEffect)(()=>{!r||!St({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||D.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r,i])}function Dt(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,Z.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function Ot(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,Z.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function kt({view:e}){let[t]=(0,Z.useState)(()=>new ce),n=wt(t);return Tt(n),Et(n),Dt(n),Ot(n),lt({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),yt({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,Q.jsx)(pe,{presenter:t,children:(0,Q.jsx)(ut,{view:e,confirmDialog:(0,Q.jsx)(n.ConfirmDialog,{})})})}function At({view:e}){return(0,Q.jsx)(kt,{view:e})}export{At as ChatPage};
|
package/ui-dist/assets/{desktop-update-config-gnna2NaS.js → desktop-update-config-CzGi43xw.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,n as r,p as i,u as a}from"./i18n-BnNAQpVM.js";import{At as o,Ct as s,Dt as c,Et as l,Ot as u,St as d,Tt as f,pt as p,wt as m,xt as h}from"./api-C51456xV.js";import{_ as g,p as _}from"./theme-provider-dHqcWU-j.js";import{a as v,i as y,n as b,r as x,t as S}from"./select-DRDejPLk.js";import{t as C}from"./external-link-DP2IJ7AM.js";import{t as w}from"./rotate-cw-F7aThvYj.js";import{n as T,r as E}from"./index-
|
|
1
|
+
import{_ as e,i as t,m as n,n as r,p as i,u as a}from"./i18n-BnNAQpVM.js";import{At as o,Ct as s,Dt as c,Et as l,Ot as u,St as d,Tt as f,pt as p,wt as m,xt as h}from"./api-C51456xV.js";import{_ as g,p as _}from"./theme-provider-dHqcWU-j.js";import{a as v,i as y,n as b,r as x,t as S}from"./select-DRDejPLk.js";import{t as C}from"./external-link-DP2IJ7AM.js";import{t as w}from"./rotate-cw-F7aThvYj.js";import{n as T,r as E}from"./index-CAYF44Dz.js";var D=e(n(),1),O=i(),k={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,"up-to-date":`desktopUpdatesStatusUpToDate`,failed:`desktopUpdatesStatusFailed`};function A({status:e}){return(0,O.jsx)(`span`,{className:a(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,L(e)),children:I(e)})}function j({label:e,value:t}){return(0,O.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,O.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-gray-500`,children:e}),(0,O.jsx)(`p`,{className:`mt-2 text-base font-semibold text-gray-900`,children:t})]})}function M({label:e,help:t,checked:n,disabled:r,onCheckedChange:i}){return(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-xl border border-gray-200 p-4`,children:[(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(u,{children:e}),(0,O.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,O.jsx)(p,{checked:n,disabled:r,onCheckedChange:i})]})}function N(e){return e?.trim()||`-`}function P(e){return e?r(e):`-`}function F(e){return t(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function I(e){return t(k[e]??`desktopUpdatesStatusIdle`)}function L(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function R(){return(0,O.jsxs)(c,{className:`space-y-6`,children:[(0,O.jsx)(l,{title:t(`desktopUpdatesPageTitle`),description:t(`desktopUpdatesPageDescription`)}),(0,O.jsxs)(h,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(f,{children:t(`desktopUpdatesDesktopOnlyTitle`)}),(0,O.jsx)(s,{children:t(`desktopUpdatesDesktopOnlyDescription`)})]}),(0,O.jsx)(d,{children:(0,O.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesDesktopOnlyFutureHint`)})})]})]})}function z(){let{supported:e,initialized:n,busyAction:r,snapshot:i}=E();if((0,D.useEffect)(()=>(T.start(),()=>{T.stop()}),[]),!n)return(0,O.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`loading`)});if(!e||!i)return(0,O.jsx)(R,{});let p=r===`checking`,k=r===`downloading`,I=r===`applying`,L=r===`saving-preferences`,z=r===`switching-channel`,B=i.status===`update-available`&&!k&&!I,V=i.status===`downloaded`&&!I,H=[[t(`desktopUpdatesLauncherVersion`),N(i.launcherVersion)],[t(`desktopUpdatesCurrentBundleVersion`),N(i.currentVersion)],[t(`desktopUpdatesAvailableVersion`),N(i.availableVersion)],[t(`desktopUpdatesLastCheckedAt`),P(i.lastCheckedAt)],[t(`desktopUpdatesCurrentChannel`),F(i.channel)]];return(0,O.jsxs)(c,{className:`space-y-6`,children:[(0,O.jsx)(l,{title:t(`desktopUpdatesPageTitle`),description:t(`desktopUpdatesPageDescription`),actions:(0,O.jsxs)(o,{variant:`outline`,onClick:()=>void T.checkForUpdates(),disabled:p||k||I,children:[(0,O.jsx)(_,{className:a(`mr-2 h-4 w-4`,p&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]})}),(0,O.jsxs)(h,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(f,{children:t(`desktopUpdatesOverviewTitle`)}),(0,O.jsx)(s,{children:t(`desktopUpdatesOverviewDescription`)})]}),(0,O.jsxs)(d,{className:`space-y-5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,O.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:t(`desktopUpdatesStatusLabel`)}),(0,O.jsx)(A,{status:i.status})]}),(0,O.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:H.map(([e,t])=>(0,O.jsx)(j,{label:e,value:t},e))}),i.channel===`beta`?(0,O.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:t(`desktopUpdatesBetaBadgeTitle`)}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:t(`desktopUpdatesBetaBadgeDescription`)})]}):null,i.downloadedVersion?(0,O.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:t(`desktopUpdatesDownloadedBannerTitle`)}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:t(`desktopUpdatesDownloadedBannerDescription`).replace(`{version}`,i.downloadedVersion)})]}):null,i.errorMessage?(0,O.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:i.errorMessage}):null]})]}),(0,O.jsxs)(h,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(f,{children:t(`desktopUpdatesPreferencesTitle`)}),(0,O.jsx)(s,{children:t(`desktopUpdatesPreferencesDescription`)})]}),(0,O.jsxs)(d,{className:`space-y-5`,children:[(0,O.jsx)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(u,{children:t(`desktopUpdatesReleaseChannel`)}),(0,O.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelHelp`)})]}),(0,O.jsxs)(S,{value:i.channel,disabled:z||p||k||I,onValueChange:e=>void T.updateChannel(e),children:[(0,O.jsx)(y,{className:`w-full max-w-sm`,children:(0,O.jsx)(v,{placeholder:t(`desktopUpdatesReleaseChannel`)})}),(0,O.jsxs)(b,{children:[(0,O.jsx)(x,{value:`stable`,children:t(`desktopUpdatesChannelStable`)}),(0,O.jsx)(x,{value:`beta`,children:t(`desktopUpdatesChannelBeta`)})]})]}),(0,O.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,O.jsx)(M,{label:t(`desktopUpdatesAutomaticChecks`),help:t(`desktopUpdatesAutomaticChecksHelp`),checked:i.preferences.automaticChecks,disabled:L||z,onCheckedChange:e=>void T.updatePreferences({automaticChecks:e})}),(0,O.jsx)(M,{label:t(`desktopUpdatesAutoDownload`),help:t(`desktopUpdatesAutoDownloadHelp`),checked:i.preferences.autoDownload,disabled:L||z,onCheckedChange:e=>void T.updatePreferences({autoDownload:e})})]})]}),(0,O.jsxs)(h,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(f,{children:t(`desktopUpdatesActionsTitle`)}),(0,O.jsx)(s,{children:t(`desktopUpdatesActionsDescription`)})]}),(0,O.jsxs)(d,{className:`flex flex-wrap items-center gap-3`,children:[(0,O.jsxs)(o,{variant:`outline`,onClick:()=>void T.checkForUpdates(),disabled:p||k||I,children:[(0,O.jsx)(_,{className:a(`mr-2 h-4 w-4`,p&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]}),(0,O.jsxs)(o,{onClick:()=>void T.downloadUpdate(),disabled:!B,children:[(0,O.jsx)(g,{className:a(`mr-2 h-4 w-4`,k&&`animate-bounce`)}),t(`desktopUpdatesDownloadNow`)]}),(0,O.jsxs)(o,{variant:`secondary`,onClick:()=>void T.applyDownloadedUpdate(),disabled:!V,children:[(0,O.jsx)(w,{className:a(`mr-2 h-4 w-4`,I&&`animate-spin`)}),t(`desktopUpdatesApplyNow`)]}),i.releaseNotesUrl?(0,O.jsxs)(o,{variant:`ghost`,onClick:()=>window.open(i.releaseNotesUrl??``,`_blank`,`noopener,noreferrer`),children:[(0,O.jsx)(C,{className:`mr-2 h-4 w-4`}),t(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{z as DesktopUpdateConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/doc-browser-DYKpRqe-.js","assets/doc-browser-CoKIUCJj.js","assets/i18n-BnNAQpVM.js","assets/createLucideIcon-C_GFKVuW.js","assets/search-DZSNKEGp.js","assets/book-open-B4mOKdz8.js","assets/external-link-DP2IJ7AM.js","assets/plus-BptLViq1.js","assets/x-BjMO7v8q.js","assets/doc-browser-context-Dib9sS83.js","assets/model-config-B0L43HTL.js","assets/api-C51456xV.js","assets/provider-scoped-model-input-DeAo2Y65.js","assets/select-DRDejPLk.js","assets/es2015-BlNhrQUG.js","assets/folder-BPwc278w.js","assets/loader-circle-C6gg2m2a.js","assets/sparkles-CyDTgTM4.js","assets/skeleton-5Mg6vZHN.js","assets/use-config-DFja1sda.js","assets/config-hints-CPNzbMEp.js","assets/chat-page-
|
|
2
|
-
import{_ as e,a as t,h as n,i as r,m as i,p as a,u as o}from"./i18n-BnNAQpVM.js";import{Gt as s,Mt as c,Nt as l,Pt as u,Rt as d,Wt as f,bt as p,ct as m,dt as h,f as g,ut as _,vt as v,yt as y}from"./api-C51456xV.js";import{a as b,c as x,i as S,n as ee,o as te,r as C,s as w,t as T}from"./chunk-JZWAC4HX-ptDyT_1C.js";import{b as ne,c as E,d as D,g as O,h as k,i as A,l as j,m as re,n as ie,o as ae,r as oe,s as M,t as se,u as ce,v as le,y as ue}from"./theme-provider-dHqcWU-j.js";import{n as N}from"./search-DZSNKEGp.js";import{m as de,u as fe}from"./chat-DCi1-y8U.js";import{t as pe}from"./book-open-B4mOKdz8.js";import{k as P,r as F}from"./select-DRDejPLk.js";import{a as I,i as L,n as R,o as z,r as B,s as me,t as he}from"./app-navigation.config-Dve1W20Y.js";import{t as ge}from"./key-round-BQXmPSxD.js";import{h as _e,i as ve,n as ye,r as be,t as xe}from"./app-manager-provider-D_cKqqRG.js";import{t as Se}from"./settings-DjvNMJde.js";import{i as V,n as Ce}from"./doc-browser-context-Dib9sS83.js";import{n as H,r as we,t as Te}from"./doc-browser-CwgI7ipB.js";import{t as U}from"./use-viewport-layout-D-pjxsyz.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ee=n((e=>{var t=s();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),W=e(i(),1),De=Ee(),G=p(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Oe=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}G.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();G.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){G.setState({supported:!0,initialized:!0,busyAction:null}),u.error(`${r(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{G.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(r(`runtimePresenceLaunchAtLoginUnavailable`));G.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return G.setState({supported:!0,initialized:!0,snapshot:n}),u.success(r(`runtimePresenceSaved`)),n}catch(e){throw u.error(`${r(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{G.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:r(`error`)}},K=p(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),ke=new class{constructor(){this.unsubscribe=null,this.start=async()=>{let e=this.getDesktopApi();if(!e){K.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{K.setState({supported:!0,initialized:!0,snapshot:e})}),K.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();K.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){K.setState({supported:!0,initialized:!0}),u.error(`${r(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.unsubscribe?.(),this.unsubscribe=null},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,r(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){u.success(r(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){u.success(r(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??r(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){u.success(r(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&u.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,r(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&u.success(r(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,r(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updatePreferences=async e=>{try{await this.runSnapshotCommand(`saving-preferences`,r(`desktopUpdatesPreferencesFailed`),async t=>await t.updatePreferences(e))}catch{return}},this.updateChannel=async e=>{if(K.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,r(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){u.success(r(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}u.success(r(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let i=this.getDesktopApi();if(!i)throw Error(r(`desktopUpdatesDesktopOnlyDescription`));K.setState({busyAction:e});try{let e=await n(i);return K.setState({snapshot:e}),e}catch(e){throw u.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{K.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:r(`error`),this.getChannelLabel=e=>r(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function q(){let{language:e,setLanguage:n}=H();return{currentLanguage:e,currentLanguageLabel:t.find(t=>t.value===e)?.label??e,languageOptions:t,selectLanguage:(0,W.useCallback)(t=>{e!==t&&(n(t),window.location.reload())},[e,n])}}var J=a();function Ae(){let{currentLanguage:e,currentLanguageLabel:t,languageOptions:n,selectLanguage:i}=q();return(0,J.jsxs)(`section`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,J.jsx)(`div`,{className:`rounded-3xl border border-gray-200/80 bg-white p-5 shadow-card`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,J.jsx)(O,{className:`h-4 w-4`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:r(`language`)}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t})]})]})}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-3xl border border-gray-200/80 bg-white shadow-card`,children:n.map(t=>{let n=t.value===e;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(t.value),className:o(`flex w-full items-center justify-between gap-3 border-b border-gray-100 px-5 py-4 text-left text-sm transition-colors last:border-b-0`,n?`bg-gray-50 text-gray-900`:`text-gray-700 hover:bg-gray-50/70`),"aria-current":n?`true`:void 0,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:t.label}),n?(0,J.jsx)(P,{className:`h-4 w-4 text-gray-700`}):null]},t.value)})})]})}function je({mode:e}){let t=ye(),n=V(),i=_e(),{currentLanguage:a,currentLanguageLabel:s,languageOptions:c,selectLanguage:l}=q(),{theme:u,setTheme:d}=ie(),f=e===`settings`,p=r(D.find(e=>e.value===u)?.labelKey??`themeWarm`),m=i.data?.account.email?.trim(),h=!!i.data?.account.loggedIn,g=e=>{u!==e&&d(e)},_=[{target:`/chat`,label:r(`chat`),icon:k},{target:`/chat/cron`,label:r(`cron`),icon:ne},{target:`/chat/skills`,label:r(`marketplaceFilterSkills`),icon:le},{target:`/agents`,label:r(`agentsPageTitle`),icon:ue}],v=B(r),y=f?v:_,b=f?`compact`:`default`;return(0,J.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[f?(0,J.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,J.jsxs)(C,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,J.jsx)(N,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,J.jsx)(`span`,{className:`truncate`,children:r(`backToMain`)})]}),(0,J.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,J.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r(`settings`)})]})}):(0,J.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,J.jsx)(ce,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,J.jsx)(`ul`,{className:o(f?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:y.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsx)(E,{to:e.target,label:e.label,icon:e.icon,density:b})},e.target))})}),(0,J.jsxs)(`div`,{className:o(`shrink-0 border-t border-[#dde0ea] bg-secondary`,f?`mt-2 pt-3`:`mt-3 pt-3`),children:[f?(0,J.jsx)(M,{onClick:()=>t.accountManager.openAccountPanel(),icon:ge,label:r(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:h?m||r(`remoteAccountEntryConnected`):r(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,J.jsx)(`div`,{className:`mb-2`,children:(0,J.jsx)(E,{to:`/settings`,label:r(`settings`),icon:Se})}),(0,J.jsx)(`div`,{className:`mb-2`,children:(0,J.jsx)(j,{value:u,onValueChange:e=>g(e),icon:re,label:r(`theme`),valueLabel:p,density:b,children:D.map(e=>(0,J.jsx)(F,{value:e.value,className:`text-xs`,children:r(e.labelKey)},e.value))})}),(0,J.jsx)(`div`,{className:`mb-2`,children:(0,J.jsx)(j,{value:a,onValueChange:e=>l(e),icon:O,label:r(`language`),valueLabel:s,density:b,children:c.map(e=>(0,J.jsx)(F,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,J.jsx)(M,{onClick:()=>n.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:pe,label:r(`docBrowserHelp`),density:b})]})]})]})}var Y=(0,W.lazy)(async()=>({default:(await f(async()=>{let{DocBrowser:e}=await import(`./doc-browser-DYKpRqe-.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function Me({pathname:e,isDocBrowserOpen:t,docBrowserMode:n,children:r}){let i=I(e);return(0,J.jsxs)(`div`,{className:`h-screen flex bg-background font-sans text-foreground`,children:[!i&&(0,J.jsx)(je,{mode:`settings`}),(0,J.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,J.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:i?(0,J.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:r}):(0,J.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,J.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:r})})}),t&&n===`docked`?(0,J.jsx)(W.Suspense,{fallback:null,children:(0,J.jsx)(Y,{})}):null]}),t&&n===`floating`?(0,J.jsx)(W.Suspense,{fallback:null,children:(0,J.jsx)(Y,{})}):null]})}function Ne(e,t){if(t===`/settings`)return z(e);let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function Pe(){let{pathname:e}=w(),t=he(r);return(0,J.jsx)(`nav`,{"data-testid":`mobile-bottom-nav`,"aria-label":r(`settings`),className:`shrink-0 border-t border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.25rem)`},children:(0,J.jsx)(`ul`,{className:`grid grid-cols-4 gap-1 px-2 pt-1`,children:t.map(t=>{let n=Ne(e,t.target);return(0,J.jsx)(`li`,{children:(0,J.jsx)(ee,{to:t.target,"aria-current":n?`page`:void 0,className:o(`group flex min-h-[2.875rem] items-center justify-center rounded-xl px-1 py-1 text-[10px] font-medium transition-colors`,n?`text-gray-900`:`text-gray-500 hover:text-gray-800`),children:(0,J.jsxs)(`span`,{"data-testid":n?`mobile-nav-active-indicator`:void 0,className:o(`inline-flex max-w-full min-w-14 flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 transition-colors`,n?`bg-gray-100`:`bg-transparent group-hover:bg-gray-50`),children:[(0,J.jsx)(t.icon,{className:o(`h-3.5 w-3.5`,n?`text-gray-900`:`text-gray-400`)}),(0,J.jsx)(`span`,{className:`max-w-full truncate`,children:t.label})]})})},t.target)})})})}function Fe(){let e=x(),{pathname:t}=w(),n=me(t,r);return(0,J.jsx)(`header`,{"data-testid":`mobile-topbar`,className:`shrink-0 border-b border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.25rem)`},children:(0,J.jsxs)(`div`,{className:`flex min-h-[2.75rem] items-center gap-2 px-3 py-1.5`,children:[n.backTarget?(0,J.jsx)(`button`,{type:`button`,onClick:()=>e(n.backTarget),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200 text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900`,"aria-label":n.backLabel??r(`backToMain`),children:(0,J.jsx)(N,{className:`h-4 w-4`})}):null,(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(`h1`,{className:`truncate text-center text-[15px] font-semibold text-gray-900`,children:n.title})}),n.backTarget?(0,J.jsx)(`div`,{className:`h-8 w-8 shrink-0`,"aria-hidden":`true`}):null]})})}var Ie=(0,W.lazy)(async()=>({default:(await f(async()=>{let{DocBrowser:e}=await import(`./doc-browser-DYKpRqe-.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function Le({pathname:e,isDocBrowserOpen:t,children:n}){let r=I(e),i=!L(e),a=!L(e);return(0,J.jsxs)(`div`,{className:`flex h-screen flex-col bg-background font-sans text-foreground`,children:[i?(0,J.jsx)(Fe,{}):null,(0,J.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden`,children:r?(0,J.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:n}):(0,J.jsx)(`main`,{className:`h-full overflow-auto px-4 py-4 custom-scrollbar`,children:(0,J.jsx)(`div`,{className:`mx-auto max-w-3xl animate-fade-in`,children:n})})}),a?(0,J.jsx)(Pe,{}):null,t?(0,J.jsx)(W.Suspense,{fallback:null,children:(0,J.jsx)(Ie,{displayMode:`fullscreen`})}):null]})}function Re(){let e=R(r);return(0,J.jsx)(`div`,{"data-testid":`mobile-settings-shell`,className:`space-y-3 pb-4`,children:e.map(e=>(0,J.jsxs)(C,{to:e.target,className:({isActive:e})=>o(`flex items-center gap-3 rounded-2xl border border-gray-200/80 bg-white px-4 py-4 shadow-card transition-colors`,e?`border-gray-300 bg-gray-50`:`hover:border-gray-300 hover:bg-gray-50/70`),children:[(0,J.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,J.jsx)(e.icon,{className:`h-4 w-4`})}),(0,J.jsx)(`div`,{className:`min-w-0`,children:(0,J.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.label})})]},e.target))})}function ze(){let{pathname:e}=w(),t=x();return L(e)?(0,J.jsx)(de,{layoutMode:`mobile`,onBackToList:()=>t(`/chat`)}):(0,J.jsx)(fe,{variant:`mobile`})}var Be=`NextClaw`,Ve=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/plugins`,key:`marketplacePluginsPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`desktopUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/sessions`,key:`sessionsPageTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function He(e,t){return e===t||e.startsWith(`${t}/`)}function Ue(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of Ve)if(He(t,e))return r(n);return r(`settings`)}function We(e){return`${Be} - ${Ue(e)}`}function Ge({children:e}){let{isOpen:t,mode:n}=V();we();let{pathname:r}=w(),{language:i}=H(),{isMobile:a}=U();return(0,W.useEffect)(()=>{document.title=We(r)},[r,i]),a?(0,J.jsx)(Le,{pathname:r,isDocBrowserOpen:t,children:e}):(0,J.jsx)(Me,{pathname:r,isDocBrowserOpen:t,docBrowserMode:n,children:e})}function Ke({children:e}){return(0,J.jsx)(Ce,{children:(0,J.jsx)(Ge,{children:e})})}function qe(){let{isMobile:e}=U();return e?(0,J.jsx)(Re,{}):(0,J.jsx)(S,{to:`/model`,replace:!0})}function Je(e){let t=e.trim().toLowerCase();return t?!(t.startsWith(`plugins`)||t.startsWith(`skills`)):!0}function Ye(e,t){t.startsWith(`plugins`)&&(e?.invalidateQueries({queryKey:[`ncp-session-types`]}),e?.invalidateQueries({queryKey:[`marketplace-installed`,`plugin`]}),e?.invalidateQueries({queryKey:[`marketplace-items`]})),t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Xe(e,t){e&&Je(t)&&e.invalidateQueries({queryKey:[`config`]}),Ye(e,t)}function Ze(e){let{queryClient:t,shouldResyncSessions:n,clearShouldResyncSessions:r,markShouldResyncSessions:i,event:a}=e;if(a.type===`connection.open`){y.handleConnectionRestored(),n&&(r(),t?.invalidateQueries({queryKey:[`ncp-sessions`]}));return}if(a.type===`connection.close`||a.type===`connection.error`){y.handleConnectionInterrupted(a.type===`connection.error`?a.payload?.message:null),i();return}if(a.type===`config.updated`){Xe(t,typeof a.payload?.path==`string`?a.payload.path:``);return}if(a.type===`session.run-status`||a.type===`session.summary.upsert`||a.type===`session.summary.delete`){g(t,a);return}a.type===`error`&&console.error(`Realtime transport error:`,a.payload.message)}function Qe(e){let t=(0,W.useRef)(!1);(0,W.useEffect)(()=>m.subscribe(n=>Ze({queryClient:e,shouldResyncSessions:t.current,clearShouldResyncSessions:()=>{t.current=!1},markShouldResyncSessions:()=>{t.current=!0},event:n})),[e])}var $e=(0,W.lazy)(async()=>({default:(await f(async()=>{let{ModelConfig:e}=await import(`./model-config-B0L43HTL.js`);return{ModelConfig:e}},__vite__mapDeps([10,2,11,5,3,12,13,14,15,16,17,9,18,19,20]))).ModelConfig})),X=(0,W.lazy)(async()=>({default:(await f(async()=>{let{ChatPage:e}=await import(`./chat-page-CHKwiqPY.js`);return{ChatPage:e}},__vite__mapDeps([21,2,11,13,14,3,22,23,24,8,25,26,27,28,19,4,5,6,15,29,16,7,30,31,17,32,33,1,9,34,35,18,12,36,37,38,39,40,41,42,43]))).ChatPage})),et=(0,W.lazy)(async()=>({default:(await f(async()=>{let{SearchConfig:e}=await import(`./search-config-DJTm9Fno.js`);return{SearchConfig:e}},__vite__mapDeps([44,2,11,13,14,3,4,6,45,34,46,19]))).SearchConfig})),tt=(0,W.lazy)(async()=>({default:(await f(async()=>{let{ProvidersList:e}=await import(`./providers-list-5_VShcn7.js`);return{ProvidersList:e}},__vite__mapDeps([47,2,11,13,14,3,25,24,4,45,7,32,8,34,35,46,48,49,43,19,20]))).ProvidersList})),nt=(0,W.lazy)(async()=>({default:(await f(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-WJ7d4zMI.js`);return{ChannelsList:e}},__vite__mapDeps([50,2,11,13,14,3,4,5,6,29,51,45,16,52,31,8,34,35,46,49,43,40,19,20]))).ChannelsList})),rt=(0,W.lazy)(async()=>({default:(await f(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-BuWmH7fe.js`);return{RuntimeConfig:e}},__vite__mapDeps([53,2,11,13,14,3,27,25,24,8,28,19,16,41,7,54,55,32,39,48,20]))).RuntimeConfig})),Z=(0,W.lazy)(async()=>({default:(await f(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-gnna2NaS.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([56,2,11,13,14,3,27,25,24,8,28,19,6,54]))).DesktopUpdateConfig})),it=(0,W.lazy)(async()=>({default:(await f(async()=>{let{SecurityConfig:e}=await import(`./api-C51456xV.js`).then(e=>e.lt);return{SecurityConfig:e}},__vite__mapDeps([11,2]))).SecurityConfig})),at=(0,W.lazy)(async()=>({default:(await f(async()=>{let{SessionsConfig:e}=await import(`./sessions-config-page-DZrdd2zT.js`);return{SessionsConfig:e}},__vite__mapDeps([57,2,11,13,14,3,22,23,24,8,25,26,27,28,19,4,5,6,15,29,16,7,30,31,17,32,33,1,9,34,35,18,51,46,38]))).SessionsConfig})),ot=(0,W.lazy)(async()=>({default:(await f(async()=>{let{SecretsConfig:e}=await import(`./secrets-config-DKFeFii1.js`);return{SecretsConfig:e}},__vite__mapDeps([58,2,11,13,14,3,7,55,32,19]))).SecretsConfig})),st=(0,W.lazy)(async()=>({default:(await f(async()=>{let{RemoteAccessPage:e}=await import(`./remote-pzp4oLcL.js`);return{RemoteAccessPage:e}},__vite__mapDeps([59,60,2,11,23,14,24,8,3,45,30,39,49]))).RemoteAccessPage})),ct=(0,W.lazy)(async()=>({default:(await f(async()=>{let{MarketplacePage:e}=await import(`./marketplace-page-0sEdt5sA.js`);return{MarketplacePage:e}},__vite__mapDeps([61,42,2,11,26,13,14,3,24,37,18,28,33,1,4,5,6,7,8,9,38,23,43]))).MarketplacePage})),lt=(0,W.lazy)(async()=>({default:(await f(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-B8vmu9xe.js`);return{McpMarketplacePage:e}},__vite__mapDeps([62,36,2,11,23,14,24,8,3,37,13,18,17,33,1,4,5,6,7,9,38,39,40]))).McpMarketplacePage}));function ut(){return(0,J.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function dt({children:e}){return(0,J.jsx)(W.Suspense,{fallback:(0,J.jsx)(ut,{}),children:e})}function Q(e){return(0,J.jsx)(dt,{children:e})}var ft=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:Q((0,J.jsx)(X,{view:`chat`}))},{path:`/agents`,element:Q((0,J.jsx)(X,{view:`agents`}))},{path:`/skills`,element:Q((0,J.jsx)(X,{view:`skills`}))},{path:`/cron`,element:Q((0,J.jsx)(X,{view:`cron`}))},{path:`/model`,element:Q((0,J.jsx)($e,{}))},{path:`/search`,element:Q((0,J.jsx)(et,{}))},{path:`/providers`,element:Q((0,J.jsx)(tt,{}))},{path:`/channels`,element:Q((0,J.jsx)(nt,{}))},{path:`/runtime`,element:Q((0,J.jsx)(rt,{}))},{path:`/updates`,element:Q((0,J.jsx)(Z,{}))},{path:`/remote`,element:Q((0,J.jsx)(st,{}))},{path:`/security`,element:Q((0,J.jsx)(it,{}))},{path:`/sessions`,element:Q((0,J.jsx)(at,{}))},{path:`/secrets`,element:Q((0,J.jsx)(ot,{}))},{path:`/language`,element:(0,J.jsx)(Ae,{})},{path:`/settings`,element:(0,J.jsx)(qe,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/marketplace/plugins`},{path:`/marketplace/mcp`,element:Q((0,J.jsx)(lt,{}))},{path:`/marketplace/:type`,element:Q((0,J.jsx)(ct,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function pt(e){return`redirectTo`in e?(0,J.jsx)(b,{path:e.path,element:(0,J.jsx)(S,{to:e.redirectTo,replace:!0})},e.path):(0,J.jsx)(b,{path:e.path,element:e.element},e.path)}function mt(){return(0,J.jsx)(te,{children:ft.map(pt)})}function $(){return Qe(c),v(),(0,J.jsxs)(xe,{children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(mt,{})}),(0,J.jsx)(ve,{})]})}function ht(){let e=h(),t=e.isError&&_(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,J.jsx)($,{}):e.data?.enabled&&!e.data.authenticated?(0,J.jsx)(be,{username:e.data.username}):(0,J.jsx)($,{})}function gt(){return(0,W.useEffect)(()=>{oe()},[]),(0,J.jsxs)(d,{client:c,children:[(0,J.jsx)(ht,{}),(0,J.jsx)(A,{}),(0,J.jsx)(ae,{}),(0,J.jsx)(l,{position:`top-right`,richColors:!0})]})}(0,De.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(W.StrictMode,{children:(0,J.jsx)(se,{children:(0,J.jsx)(Te,{children:(0,J.jsx)(T,{children:(0,J.jsx)(gt,{})})})})}));export{G as a,Oe as i,ke as n,K as r,ze as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/doc-browser-DYKpRqe-.js","assets/doc-browser-CoKIUCJj.js","assets/i18n-BnNAQpVM.js","assets/createLucideIcon-C_GFKVuW.js","assets/search-DZSNKEGp.js","assets/book-open-B4mOKdz8.js","assets/external-link-DP2IJ7AM.js","assets/plus-BptLViq1.js","assets/x-BjMO7v8q.js","assets/doc-browser-context-Dib9sS83.js","assets/model-config-B0L43HTL.js","assets/api-C51456xV.js","assets/provider-scoped-model-input-DeAo2Y65.js","assets/select-DRDejPLk.js","assets/es2015-BlNhrQUG.js","assets/folder-BPwc278w.js","assets/loader-circle-C6gg2m2a.js","assets/sparkles-CyDTgTM4.js","assets/skeleton-5Mg6vZHN.js","assets/use-config-DFja1sda.js","assets/config-hints-CPNzbMEp.js","assets/chat-page-DLFTPfmu.js","assets/chat-BxA-mw53.js","assets/dialog-BHcaU6NE.js","assets/dist-DtBFqZ6_.js","assets/popover-B8msg2FQ.js","assets/tooltip-C6VPreZ7.js","assets/theme-provider-dHqcWU-j.js","assets/chunk-JZWAC4HX-ptDyT_1C.js","assets/logos-BcELLmYh.js","assets/refresh-ccw-CeG203yU.js","assets/settings-DjvNMJde.js","assets/trash-2-C1cdqL6V.js","assets/doc-browser-CwgI7ipB.js","assets/use-viewport-layout-D-pjxsyz.js","assets/logo-badge-uB4SwANR.js","assets/mcp-marketplace-page-C_akqPwv.js","assets/use-infinite-scroll-loader-D8h0k-iL.js","assets/use-confirm-dialog-DvIbSUX3.js","assets/notice-card-C9PFAR67.js","assets/tag-chip-CVIqyMv7.js","assets/play-DeNVUA5C.js","assets/marketplace-page-DiqqX25V.js","assets/tabs-custom-C4P7g4vR.js","assets/search-config-DJTm9Fno.js","assets/key-round-BQXmPSxD.js","assets/config-split-page-B3PRA_AV.js","assets/providers-list-5_VShcn7.js","assets/setting-row-BcF6eTW0.js","assets/status-dot-aQU9Mia4.js","assets/channels-list-page-WJ7d4zMI.js","assets/hash-CvcvtMBq.js","assets/message-square-CLVODA23.js","assets/runtime-config-page-B-y_0HIS.js","assets/rotate-cw-F7aThvYj.js","assets/save-7ztImRj7.js","assets/desktop-update-config-CzGi43xw.js","assets/sessions-config-page-CZGqS32n.js","assets/secrets-config-DKFeFii1.js","assets/remote-pzp4oLcL.js","assets/app-manager-provider-D_cKqqRG.js","assets/marketplace-page-0sEdt5sA.js","assets/mcp-marketplace-page-B8vmu9xe.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as e,a as t,h as n,i as r,m as i,p as a,u as o}from"./i18n-BnNAQpVM.js";import{Gt as s,Mt as c,Nt as l,Pt as u,Rt as d,Wt as f,bt as p,ct as m,dt as h,f as g,ut as _,vt as v,yt as y}from"./api-C51456xV.js";import{a as b,c as x,i as S,n as ee,o as te,r as C,s as w,t as T}from"./chunk-JZWAC4HX-ptDyT_1C.js";import{b as ne,c as E,d as D,g as O,h as k,i as A,l as j,m as re,n as ie,o as ae,r as oe,s as M,t as se,u as ce,v as le,y as ue}from"./theme-provider-dHqcWU-j.js";import{n as N}from"./search-DZSNKEGp.js";import{m as de,u as fe}from"./chat-BxA-mw53.js";import{t as pe}from"./book-open-B4mOKdz8.js";import{k as P,r as F}from"./select-DRDejPLk.js";import{a as I,i as L,n as R,o as z,r as B,s as me,t as he}from"./app-navigation.config-Dve1W20Y.js";import{t as ge}from"./key-round-BQXmPSxD.js";import{h as _e,i as ve,n as ye,r as be,t as xe}from"./app-manager-provider-D_cKqqRG.js";import{t as Se}from"./settings-DjvNMJde.js";import{i as V,n as Ce}from"./doc-browser-context-Dib9sS83.js";import{n as H,r as we,t as Te}from"./doc-browser-CwgI7ipB.js";import{t as U}from"./use-viewport-layout-D-pjxsyz.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ee=n((e=>{var t=s();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),W=e(i(),1),De=Ee(),G=p(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Oe=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}G.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();G.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){G.setState({supported:!0,initialized:!0,busyAction:null}),u.error(`${r(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{G.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(r(`runtimePresenceLaunchAtLoginUnavailable`));G.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return G.setState({supported:!0,initialized:!0,snapshot:n}),u.success(r(`runtimePresenceSaved`)),n}catch(e){throw u.error(`${r(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{G.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:r(`error`)}},K=p(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),ke=new class{constructor(){this.unsubscribe=null,this.start=async()=>{let e=this.getDesktopApi();if(!e){K.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{K.setState({supported:!0,initialized:!0,snapshot:e})}),K.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();K.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){K.setState({supported:!0,initialized:!0}),u.error(`${r(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.unsubscribe?.(),this.unsubscribe=null},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,r(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){u.success(r(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){u.success(r(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??r(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){u.success(r(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&u.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,r(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&u.success(r(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,r(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updatePreferences=async e=>{try{await this.runSnapshotCommand(`saving-preferences`,r(`desktopUpdatesPreferencesFailed`),async t=>await t.updatePreferences(e))}catch{return}},this.updateChannel=async e=>{if(K.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,r(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){u.success(r(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}u.success(r(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let i=this.getDesktopApi();if(!i)throw Error(r(`desktopUpdatesDesktopOnlyDescription`));K.setState({busyAction:e});try{let e=await n(i);return K.setState({snapshot:e}),e}catch(e){throw u.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{K.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:r(`error`),this.getChannelLabel=e=>r(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function q(){let{language:e,setLanguage:n}=H();return{currentLanguage:e,currentLanguageLabel:t.find(t=>t.value===e)?.label??e,languageOptions:t,selectLanguage:(0,W.useCallback)(t=>{e!==t&&(n(t),window.location.reload())},[e,n])}}var J=a();function Ae(){let{currentLanguage:e,currentLanguageLabel:t,languageOptions:n,selectLanguage:i}=q();return(0,J.jsxs)(`section`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,J.jsx)(`div`,{className:`rounded-3xl border border-gray-200/80 bg-white p-5 shadow-card`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,J.jsx)(O,{className:`h-4 w-4`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:r(`language`)}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t})]})]})}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-3xl border border-gray-200/80 bg-white shadow-card`,children:n.map(t=>{let n=t.value===e;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(t.value),className:o(`flex w-full items-center justify-between gap-3 border-b border-gray-100 px-5 py-4 text-left text-sm transition-colors last:border-b-0`,n?`bg-gray-50 text-gray-900`:`text-gray-700 hover:bg-gray-50/70`),"aria-current":n?`true`:void 0,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:t.label}),n?(0,J.jsx)(P,{className:`h-4 w-4 text-gray-700`}):null]},t.value)})})]})}function je({mode:e}){let t=ye(),n=V(),i=_e(),{currentLanguage:a,currentLanguageLabel:s,languageOptions:c,selectLanguage:l}=q(),{theme:u,setTheme:d}=ie(),f=e===`settings`,p=r(D.find(e=>e.value===u)?.labelKey??`themeWarm`),m=i.data?.account.email?.trim(),h=!!i.data?.account.loggedIn,g=e=>{u!==e&&d(e)},_=[{target:`/chat`,label:r(`chat`),icon:k},{target:`/chat/cron`,label:r(`cron`),icon:ne},{target:`/chat/skills`,label:r(`marketplaceFilterSkills`),icon:le},{target:`/agents`,label:r(`agentsPageTitle`),icon:ue}],v=B(r),y=f?v:_,b=f?`compact`:`default`;return(0,J.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[f?(0,J.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,J.jsxs)(C,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,J.jsx)(N,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,J.jsx)(`span`,{className:`truncate`,children:r(`backToMain`)})]}),(0,J.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,J.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r(`settings`)})]})}):(0,J.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,J.jsx)(ce,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,J.jsx)(`ul`,{className:o(f?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:y.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsx)(E,{to:e.target,label:e.label,icon:e.icon,density:b})},e.target))})}),(0,J.jsxs)(`div`,{className:o(`shrink-0 border-t border-[#dde0ea] bg-secondary`,f?`mt-2 pt-3`:`mt-3 pt-3`),children:[f?(0,J.jsx)(M,{onClick:()=>t.accountManager.openAccountPanel(),icon:ge,label:r(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:h?m||r(`remoteAccountEntryConnected`):r(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,J.jsx)(`div`,{className:`mb-2`,children:(0,J.jsx)(E,{to:`/settings`,label:r(`settings`),icon:Se})}),(0,J.jsx)(`div`,{className:`mb-2`,children:(0,J.jsx)(j,{value:u,onValueChange:e=>g(e),icon:re,label:r(`theme`),valueLabel:p,density:b,children:D.map(e=>(0,J.jsx)(F,{value:e.value,className:`text-xs`,children:r(e.labelKey)},e.value))})}),(0,J.jsx)(`div`,{className:`mb-2`,children:(0,J.jsx)(j,{value:a,onValueChange:e=>l(e),icon:O,label:r(`language`),valueLabel:s,density:b,children:c.map(e=>(0,J.jsx)(F,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,J.jsx)(M,{onClick:()=>n.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:pe,label:r(`docBrowserHelp`),density:b})]})]})]})}var Y=(0,W.lazy)(async()=>({default:(await f(async()=>{let{DocBrowser:e}=await import(`./doc-browser-DYKpRqe-.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function Me({pathname:e,isDocBrowserOpen:t,docBrowserMode:n,children:r}){let i=I(e);return(0,J.jsxs)(`div`,{className:`h-screen flex bg-background font-sans text-foreground`,children:[!i&&(0,J.jsx)(je,{mode:`settings`}),(0,J.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,J.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:i?(0,J.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:r}):(0,J.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,J.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:r})})}),t&&n===`docked`?(0,J.jsx)(W.Suspense,{fallback:null,children:(0,J.jsx)(Y,{})}):null]}),t&&n===`floating`?(0,J.jsx)(W.Suspense,{fallback:null,children:(0,J.jsx)(Y,{})}):null]})}function Ne(e,t){if(t===`/settings`)return z(e);let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function Pe(){let{pathname:e}=w(),t=he(r);return(0,J.jsx)(`nav`,{"data-testid":`mobile-bottom-nav`,"aria-label":r(`settings`),className:`shrink-0 border-t border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.25rem)`},children:(0,J.jsx)(`ul`,{className:`grid grid-cols-4 gap-1 px-2 pt-1`,children:t.map(t=>{let n=Ne(e,t.target);return(0,J.jsx)(`li`,{children:(0,J.jsx)(ee,{to:t.target,"aria-current":n?`page`:void 0,className:o(`group flex min-h-[2.875rem] items-center justify-center rounded-xl px-1 py-1 text-[10px] font-medium transition-colors`,n?`text-gray-900`:`text-gray-500 hover:text-gray-800`),children:(0,J.jsxs)(`span`,{"data-testid":n?`mobile-nav-active-indicator`:void 0,className:o(`inline-flex max-w-full min-w-14 flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 transition-colors`,n?`bg-gray-100`:`bg-transparent group-hover:bg-gray-50`),children:[(0,J.jsx)(t.icon,{className:o(`h-3.5 w-3.5`,n?`text-gray-900`:`text-gray-400`)}),(0,J.jsx)(`span`,{className:`max-w-full truncate`,children:t.label})]})})},t.target)})})})}function Fe(){let e=x(),{pathname:t}=w(),n=me(t,r);return(0,J.jsx)(`header`,{"data-testid":`mobile-topbar`,className:`shrink-0 border-b border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.25rem)`},children:(0,J.jsxs)(`div`,{className:`flex min-h-[2.75rem] items-center gap-2 px-3 py-1.5`,children:[n.backTarget?(0,J.jsx)(`button`,{type:`button`,onClick:()=>e(n.backTarget),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200 text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900`,"aria-label":n.backLabel??r(`backToMain`),children:(0,J.jsx)(N,{className:`h-4 w-4`})}):null,(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(`h1`,{className:`truncate text-center text-[15px] font-semibold text-gray-900`,children:n.title})}),n.backTarget?(0,J.jsx)(`div`,{className:`h-8 w-8 shrink-0`,"aria-hidden":`true`}):null]})})}var Ie=(0,W.lazy)(async()=>({default:(await f(async()=>{let{DocBrowser:e}=await import(`./doc-browser-DYKpRqe-.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function Le({pathname:e,isDocBrowserOpen:t,children:n}){let r=I(e),i=!L(e),a=!L(e);return(0,J.jsxs)(`div`,{className:`flex h-screen flex-col bg-background font-sans text-foreground`,children:[i?(0,J.jsx)(Fe,{}):null,(0,J.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden`,children:r?(0,J.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:n}):(0,J.jsx)(`main`,{className:`h-full overflow-auto px-4 py-4 custom-scrollbar`,children:(0,J.jsx)(`div`,{className:`mx-auto max-w-3xl animate-fade-in`,children:n})})}),a?(0,J.jsx)(Pe,{}):null,t?(0,J.jsx)(W.Suspense,{fallback:null,children:(0,J.jsx)(Ie,{displayMode:`fullscreen`})}):null]})}function Re(){let e=R(r);return(0,J.jsx)(`div`,{"data-testid":`mobile-settings-shell`,className:`space-y-3 pb-4`,children:e.map(e=>(0,J.jsxs)(C,{to:e.target,className:({isActive:e})=>o(`flex items-center gap-3 rounded-2xl border border-gray-200/80 bg-white px-4 py-4 shadow-card transition-colors`,e?`border-gray-300 bg-gray-50`:`hover:border-gray-300 hover:bg-gray-50/70`),children:[(0,J.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,J.jsx)(e.icon,{className:`h-4 w-4`})}),(0,J.jsx)(`div`,{className:`min-w-0`,children:(0,J.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.label})})]},e.target))})}function ze(){let{pathname:e}=w(),t=x();return L(e)?(0,J.jsx)(de,{layoutMode:`mobile`,onBackToList:()=>t(`/chat`)}):(0,J.jsx)(fe,{variant:`mobile`})}var Be=`NextClaw`,Ve=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/plugins`,key:`marketplacePluginsPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`desktopUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/sessions`,key:`sessionsPageTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function He(e,t){return e===t||e.startsWith(`${t}/`)}function Ue(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of Ve)if(He(t,e))return r(n);return r(`settings`)}function We(e){return`${Be} - ${Ue(e)}`}function Ge({children:e}){let{isOpen:t,mode:n}=V();we();let{pathname:r}=w(),{language:i}=H(),{isMobile:a}=U();return(0,W.useEffect)(()=>{document.title=We(r)},[r,i]),a?(0,J.jsx)(Le,{pathname:r,isDocBrowserOpen:t,children:e}):(0,J.jsx)(Me,{pathname:r,isDocBrowserOpen:t,docBrowserMode:n,children:e})}function Ke({children:e}){return(0,J.jsx)(Ce,{children:(0,J.jsx)(Ge,{children:e})})}function qe(){let{isMobile:e}=U();return e?(0,J.jsx)(Re,{}):(0,J.jsx)(S,{to:`/model`,replace:!0})}function Je(e){let t=e.trim().toLowerCase();return t?!(t.startsWith(`plugins`)||t.startsWith(`skills`)):!0}function Ye(e,t){t.startsWith(`plugins`)&&(e?.invalidateQueries({queryKey:[`ncp-session-types`]}),e?.invalidateQueries({queryKey:[`marketplace-installed`,`plugin`]}),e?.invalidateQueries({queryKey:[`marketplace-items`]})),t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Xe(e,t){e&&Je(t)&&e.invalidateQueries({queryKey:[`config`]}),Ye(e,t)}function Ze(e){let{queryClient:t,shouldResyncSessions:n,clearShouldResyncSessions:r,markShouldResyncSessions:i,event:a}=e;if(a.type===`connection.open`){y.handleConnectionRestored(),n&&(r(),t?.invalidateQueries({queryKey:[`ncp-sessions`]}));return}if(a.type===`connection.close`||a.type===`connection.error`){y.handleConnectionInterrupted(a.type===`connection.error`?a.payload?.message:null),i();return}if(a.type===`config.updated`){Xe(t,typeof a.payload?.path==`string`?a.payload.path:``);return}if(a.type===`session.run-status`||a.type===`session.summary.upsert`||a.type===`session.summary.delete`){g(t,a);return}a.type===`error`&&console.error(`Realtime transport error:`,a.payload.message)}function Qe(e){let t=(0,W.useRef)(!1);(0,W.useEffect)(()=>m.subscribe(n=>Ze({queryClient:e,shouldResyncSessions:t.current,clearShouldResyncSessions:()=>{t.current=!1},markShouldResyncSessions:()=>{t.current=!0},event:n})),[e])}var $e=(0,W.lazy)(async()=>({default:(await f(async()=>{let{ModelConfig:e}=await import(`./model-config-B0L43HTL.js`);return{ModelConfig:e}},__vite__mapDeps([10,2,11,5,3,12,13,14,15,16,17,9,18,19,20]))).ModelConfig})),X=(0,W.lazy)(async()=>({default:(await f(async()=>{let{ChatPage:e}=await import(`./chat-page-DLFTPfmu.js`);return{ChatPage:e}},__vite__mapDeps([21,2,11,13,14,3,22,23,24,8,25,26,27,28,19,4,5,6,15,29,16,7,30,31,17,32,33,1,9,34,35,18,12,36,37,38,39,40,41,42,43]))).ChatPage})),et=(0,W.lazy)(async()=>({default:(await f(async()=>{let{SearchConfig:e}=await import(`./search-config-DJTm9Fno.js`);return{SearchConfig:e}},__vite__mapDeps([44,2,11,13,14,3,4,6,45,34,46,19]))).SearchConfig})),tt=(0,W.lazy)(async()=>({default:(await f(async()=>{let{ProvidersList:e}=await import(`./providers-list-5_VShcn7.js`);return{ProvidersList:e}},__vite__mapDeps([47,2,11,13,14,3,25,24,4,45,7,32,8,34,35,46,48,49,43,19,20]))).ProvidersList})),nt=(0,W.lazy)(async()=>({default:(await f(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-WJ7d4zMI.js`);return{ChannelsList:e}},__vite__mapDeps([50,2,11,13,14,3,4,5,6,29,51,45,16,52,31,8,34,35,46,49,43,40,19,20]))).ChannelsList})),rt=(0,W.lazy)(async()=>({default:(await f(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-B-y_0HIS.js`);return{RuntimeConfig:e}},__vite__mapDeps([53,2,11,13,14,3,27,25,24,8,28,19,16,41,7,54,55,32,39,48,20]))).RuntimeConfig})),Z=(0,W.lazy)(async()=>({default:(await f(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-CzGi43xw.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([56,2,11,13,14,3,27,25,24,8,28,19,6,54]))).DesktopUpdateConfig})),it=(0,W.lazy)(async()=>({default:(await f(async()=>{let{SecurityConfig:e}=await import(`./api-C51456xV.js`).then(e=>e.lt);return{SecurityConfig:e}},__vite__mapDeps([11,2]))).SecurityConfig})),at=(0,W.lazy)(async()=>({default:(await f(async()=>{let{SessionsConfig:e}=await import(`./sessions-config-page-CZGqS32n.js`);return{SessionsConfig:e}},__vite__mapDeps([57,2,11,13,14,3,22,23,24,8,25,26,27,28,19,4,5,6,15,29,16,7,30,31,17,32,33,1,9,34,35,18,51,46,38]))).SessionsConfig})),ot=(0,W.lazy)(async()=>({default:(await f(async()=>{let{SecretsConfig:e}=await import(`./secrets-config-DKFeFii1.js`);return{SecretsConfig:e}},__vite__mapDeps([58,2,11,13,14,3,7,55,32,19]))).SecretsConfig})),st=(0,W.lazy)(async()=>({default:(await f(async()=>{let{RemoteAccessPage:e}=await import(`./remote-pzp4oLcL.js`);return{RemoteAccessPage:e}},__vite__mapDeps([59,60,2,11,23,14,24,8,3,45,30,39,49]))).RemoteAccessPage})),ct=(0,W.lazy)(async()=>({default:(await f(async()=>{let{MarketplacePage:e}=await import(`./marketplace-page-0sEdt5sA.js`);return{MarketplacePage:e}},__vite__mapDeps([61,42,2,11,26,13,14,3,24,37,18,28,33,1,4,5,6,7,8,9,38,23,43]))).MarketplacePage})),lt=(0,W.lazy)(async()=>({default:(await f(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-B8vmu9xe.js`);return{McpMarketplacePage:e}},__vite__mapDeps([62,36,2,11,23,14,24,8,3,37,13,18,17,33,1,4,5,6,7,9,38,39,40]))).McpMarketplacePage}));function ut(){return(0,J.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function dt({children:e}){return(0,J.jsx)(W.Suspense,{fallback:(0,J.jsx)(ut,{}),children:e})}function Q(e){return(0,J.jsx)(dt,{children:e})}var ft=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:Q((0,J.jsx)(X,{view:`chat`}))},{path:`/agents`,element:Q((0,J.jsx)(X,{view:`agents`}))},{path:`/skills`,element:Q((0,J.jsx)(X,{view:`skills`}))},{path:`/cron`,element:Q((0,J.jsx)(X,{view:`cron`}))},{path:`/model`,element:Q((0,J.jsx)($e,{}))},{path:`/search`,element:Q((0,J.jsx)(et,{}))},{path:`/providers`,element:Q((0,J.jsx)(tt,{}))},{path:`/channels`,element:Q((0,J.jsx)(nt,{}))},{path:`/runtime`,element:Q((0,J.jsx)(rt,{}))},{path:`/updates`,element:Q((0,J.jsx)(Z,{}))},{path:`/remote`,element:Q((0,J.jsx)(st,{}))},{path:`/security`,element:Q((0,J.jsx)(it,{}))},{path:`/sessions`,element:Q((0,J.jsx)(at,{}))},{path:`/secrets`,element:Q((0,J.jsx)(ot,{}))},{path:`/language`,element:(0,J.jsx)(Ae,{})},{path:`/settings`,element:(0,J.jsx)(qe,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/marketplace/plugins`},{path:`/marketplace/mcp`,element:Q((0,J.jsx)(lt,{}))},{path:`/marketplace/:type`,element:Q((0,J.jsx)(ct,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function pt(e){return`redirectTo`in e?(0,J.jsx)(b,{path:e.path,element:(0,J.jsx)(S,{to:e.redirectTo,replace:!0})},e.path):(0,J.jsx)(b,{path:e.path,element:e.element},e.path)}function mt(){return(0,J.jsx)(te,{children:ft.map(pt)})}function $(){return Qe(c),v(),(0,J.jsxs)(xe,{children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(mt,{})}),(0,J.jsx)(ve,{})]})}function ht(){let e=h(),t=e.isError&&_(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,J.jsx)($,{}):e.data?.enabled&&!e.data.authenticated?(0,J.jsx)(be,{username:e.data.username}):(0,J.jsx)($,{})}function gt(){return(0,W.useEffect)(()=>{oe()},[]),(0,J.jsxs)(d,{client:c,children:[(0,J.jsx)(ht,{}),(0,J.jsx)(A,{}),(0,J.jsx)(ae,{}),(0,J.jsx)(l,{position:`top-right`,richColors:!0})]})}(0,De.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(W.StrictMode,{children:(0,J.jsx)(se,{children:(0,J.jsx)(Te,{children:(0,J.jsx)(T,{children:(0,J.jsx)(gt,{})})})})}));export{G as a,Oe as i,ke as n,K as r,ze as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,p as r}from"./i18n-BnNAQpVM.js";import{At as i,Ct as a,Dt as o,Et as s,Pt as c,St as l,Tt as u,_t as d,ht as f,kt as p,pt as m,wt as h,xt as g,yt as _}from"./api-C51456xV.js";import{t as v}from"./createLucideIcon-C_GFKVuW.js";import{a as y}from"./theme-provider-dHqcWU-j.js";import{a as b,i as x,n as S,r as C,t as w}from"./select-DRDejPLk.js";import{t as ee}from"./loader-circle-C6gg2m2a.js";import{t as te}from"./play-DeNVUA5C.js";import{t as T}from"./plus-BptLViq1.js";import{t as E}from"./rotate-cw-F7aThvYj.js";import{t as ne}from"./save-7ztImRj7.js";import{t as D}from"./trash-2-C1cdqL6V.js";import{t as O}from"./notice-card-C9PFAR67.js";import{i as k,n as A,w as j}from"./use-config-DFja1sda.js";import{a as M,i as N}from"./index-CxzW1dQ9.js";import{t as P}from"./config-hints-CPNzbMEp.js";import{t as F}from"./setting-row-BcF6eTW0.js";var re=v(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),I=e(n(),1),L=r(),R={healthy:`runtimeControlHealthy`,"starting-service":`runtimeControlStartingService`,"restarting-service":`runtimeControlRestartingService`,"stopping-service":`runtimeControlStoppingService`,"restarting-app":`runtimeControlRestartingApp`,recovering:`runtimeControlRecovering`,failed:`runtimeControlFailed`},z={running:`runtimeControlServiceRunning`,stopped:`runtimeControlServiceStopped`,starting:`runtimeControlServiceStarting`,stopping:`runtimeControlServiceStopping`,restarting:`runtimeControlServiceRestarting`},B={"desktop-embedded":`runtimeControlEnvironmentDesktop`,"managed-local-service":`runtimeControlEnvironmentManagedService`,"self-hosted-web":`runtimeControlEnvironmentSelfHosted`,"shared-web":`runtimeControlEnvironmentSharedWeb`};function V(e){return t(R[e]??`runtimeControlUnavailable`)}function H(e){return t(z[e]??`runtimeControlServiceUnknown`)}function U(e){return t(B[e.environment])}function W(e,t){return t===`start-service`?e?.canStartService:t===`stop-service`?e?.canStopService:e?.canRestartService}function G(e){return e?[{action:`start-service`,capability:e.canStartService,label:t(`runtimeControlStartService`),icon:`play`},{action:`restart-service`,capability:e.canRestartService,label:t(`runtimeControlRestartService`),icon:`rotate`},{action:`stop-service`,capability:e.canStopService,label:t(`runtimeControlStopService`),icon:`square`,variant:`destructive`},{action:`restart-app`,capability:e.canRestartApp,label:t(`runtimeControlRestartApp`),icon:`rotate`,variant:`secondary`}].filter(e=>e.capability.available||!!e.capability.reasonIfUnavailable):[]}function K(e){let{busy:t,icon:n}=e;return t?(0,L.jsx)(ee,{className:`mr-2 h-4 w-4 animate-spin`}):n===`play`?(0,L.jsx)(te,{className:`mr-2 h-4 w-4`}):n===`square`?(0,L.jsx)(re,{className:`mr-2 h-4 w-4`}):(0,L.jsx)(E,{className:`mr-2 h-4 w-4`})}function q(){let{busy:e,busyAction:n,controlView:r,errorMessage:o,pendingRestart:s,visibleLifecycle:d,visibleMessage:p,visibleServiceState:m}=f(),v=G(r??void 0),y=async e=>{let n=W(r,e);if(!n?.available){c.error(n?.reasonIfUnavailable??t(`runtimeControlLoadFailed`));return}if(!(e===`stop-service`&&n.requiresConfirmation&&!window.confirm(t(`runtimeControlStopServiceConfirm`))))try{let t=await _.runRuntimeControlAction(e);c.success(t.message)}catch(e){let n=e instanceof Error?e.message:t(`runtimeControlActionFailed`);c.error(`${t(`runtimeControlActionFailed`)}: ${n}`)}},b=async()=>{if(!r?.canRestartApp.available){c.error(r?.canRestartApp.reasonIfUnavailable??t(`runtimeRestartAppUnavailable`));return}if(window.confirm(t(`runtimeControlRestartAppConfirm`)))try{let e=await _.runRuntimeControlAction(`restart-app`);c.success(e.message)}catch(e){let n=e instanceof Error?e.message:t(`runtimeControlActionFailed`);c.error(`${t(`runtimeControlActionFailed`)}: ${n}`)}};return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:t(`runtimeControlTitle`)}),(0,L.jsx)(a,{children:t(`runtimeControlDescription`)})]}),(0,L.jsxs)(l,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 bg-gray-50 p-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-center md:justify-between`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:H(m)}),(0,L.jsx)(`div`,{className:`text-xs text-gray-500`,children:r?U(r):t(`runtimeControlLoading`)})]}),(0,L.jsx)(`p`,{className:`text-sm text-gray-600`,children:p}),(0,L.jsx)(`div`,{className:`text-xs text-gray-500`,children:V(d)}),r?.managementHint?(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:r.managementHint}):null,o&&!e?(0,L.jsx)(`p`,{className:`text-sm text-amber-700`,children:o}):null]}),s?(0,L.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-amber-200 bg-amber-50 p-4`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium text-amber-900`,children:t(`runtimeControlPendingRestartTitle`)}),(0,L.jsx)(`p`,{className:`text-sm text-amber-800`,children:t(`runtimeControlPendingRestartDescription`)}),s.changedPaths.length>0?(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-amber-700`,children:t(`runtimeControlPendingRestartPaths`)}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.changedPaths.map(e=>(0,L.jsx)(`span`,{className:`rounded-full border border-amber-200 bg-white px-2.5 py-1 text-xs text-amber-800`,children:e},e))})]}):null]}):null,(0,L.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:flex-wrap`,children:v.map(t=>(0,L.jsxs)(i,{type:`button`,variant:t.variant??`default`,onClick:()=>{if(t.action===`restart-app`){b();return}y(t.action)},disabled:!t.capability.available||e,children:[(0,L.jsx)(K,{icon:t.icon,busy:n===t.action}),t.label]},t.action))}),v.filter(e=>!e.capability.available&&e.capability.reasonIfUnavailable).map(e=>(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:e.capability.reasonIfUnavailable},`${e.action}-reason`))]})]})}function J(e){let{description:t,title:n}=e;return(0,L.jsx)(O,{tone:`neutral`,title:n,description:t})}function Y(e){let{children:n}=e;return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:t(`runtimePresenceTitle`)}),(0,L.jsx)(a,{children:t(`runtimePresenceDescription`)})]}),(0,L.jsx)(l,{children:n})]})}function X(){let e=d().runtimeControlView?.environment,n=M(e=>e.supported),r=M(e=>e.initialized),i=M(e=>e.busyAction),a=M(e=>e.snapshot);return(0,I.useEffect)(()=>{if(e===`desktop-embedded`){N.start();return}N.markUnsupported()},[e]),e===`desktop-embedded`?(0,L.jsx)(Y,{children:(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(O,{tone:`neutral`,title:t(`runtimePresenceBehaviorLabel`),description:a?.closeToBackground?t(`runtimePresenceBehaviorBackground`):t(`runtimePresenceBehaviorQuit`),className:`rounded-xl`}),!r||n&&!a?(0,L.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimePresenceLoading`)}):null,a?(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(F,{title:t(`runtimePresenceCloseToBackground`),description:t(`runtimePresenceCloseToBackgroundHelp`),control:(0,L.jsx)(m,{id:`runtime-presence-close-background`,"aria-label":t(`runtimePresenceCloseToBackground`),checked:a.closeToBackground,disabled:i===`saving-preferences`,onCheckedChange:e=>{N.updatePreferences({closeToBackground:e})}})}),(0,L.jsx)(F,{title:t(`runtimePresenceLaunchAtLogin`),description:a.supportsLaunchAtLogin?t(`runtimePresenceLaunchAtLoginHelp`):a.launchAtLoginReason??t(`runtimePresenceLaunchAtLoginUnavailable`),control:(0,L.jsx)(m,{id:`runtime-presence-launch-login`,"aria-label":t(`runtimePresenceLaunchAtLogin`),checked:a.launchAtLogin,disabled:!a.supportsLaunchAtLogin||i===`saving-preferences`,onCheckedChange:e=>{N.updatePreferences({launchAtLogin:e})}})})]}):null]})}):e===`managed-local-service`?(0,L.jsx)(Y,{children:(0,L.jsx)(J,{title:t(`runtimePresenceManagedLocalTitle`),description:t(`runtimePresenceManagedLocalDescription`)})}):e===`self-hosted-web`?(0,L.jsx)(Y,{children:(0,L.jsx)(J,{title:t(`runtimePresenceSelfHostedTitle`),description:t(`runtimePresenceSelfHostedDescription`)})}):e===`shared-web`?(0,L.jsx)(Y,{children:(0,L.jsx)(J,{title:t(`runtimePresenceSharedTitle`),description:t(`runtimePresenceSharedDescription`)})}):(0,L.jsx)(Y,{children:(0,L.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimePresenceLoading`)})})}function ie(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s,{title:t(`runtimePageTitle`),description:t(`runtimePageDescription`)}),(0,L.jsx)(q,{}),(0,L.jsx)(X,{}),(0,L.jsx)(y,{})]})}var Z={wireDialect:`acp`,processScope:`per-session`,command:``,args:[`acp`],env:{},cwd:``,startupTimeoutMs:8e3,probeTimeoutMs:3e3,requestTimeoutMs:12e4};function ae(){return{id:``,default:!1,workspace:``,model:``,runtime:``,contextTokens:void 0,maxToolIterations:void 0}}function oe(){return{agentId:``,match:{channel:``,accountId:``}}}function se(){return{id:``,enabled:!0,label:``,type:`narp-stdio`,config:Z,configText:JSON.stringify(Z,null,2)}}function ce(e){return{id:e.id??``,default:!!e.default,displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,workspace:e.workspace??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:e.contextTokens,maxToolIterations:e.maxToolIterations}}function le(e){return{agentId:e.agentId??``,match:{channel:e.match?.channel??``,accountId:e.match?.accountId??``,peer:e.match?.peer?{kind:e.match.peer.kind,id:e.match.peer.id}:void 0}}}function Q(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:void 0}function ue(e){return{agents:(e.agents.list??[]).map(ce),bindings:(e.bindings??[]).map(le),runtimeEntries:Object.entries(e.agents.runtimes?.entries??{}).map(([e,t])=>({id:e,enabled:t.enabled!==!1,label:t.label??``,type:t.type,config:t.config??{},configText:JSON.stringify(t.config??{},null,2)})),dmScope:e.session?.dmScope??`per-channel-peer`,defaultContextTokens:e.agents.defaults.contextTokens??2e5,defaultEngine:e.agents.defaults.engine??`native`}}function $(e){let t={id:e.id.trim()};e.default&&(t.default=!0),e.displayName?.trim()&&(t.displayName=e.displayName.trim()),e.description?.trim()&&(t.description=e.description.trim()),e.avatar?.trim()&&(t.avatar=e.avatar.trim()),e.workspace?.trim()&&(t.workspace=e.workspace.trim()),e.model?.trim()&&(t.model=e.model.trim());let n=e.runtime?.trim()??e.engine?.trim();return n&&(t.engine=n),typeof e.contextTokens==`number`&&(t.contextTokens=Math.max(1e3,e.contextTokens)),typeof e.maxToolIterations==`number`&&(t.maxToolIterations=e.maxToolIterations),t}function de(e){let n=e.agents.map((e,n)=>{if(!e.id.trim())throw Error(t(`agentIdRequiredError`).replace(`{index}`,String(n)));return $(e)}),r=n.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t);if(r.length>0)throw Error(`${t(`duplicateAgentId`)}: ${r[0]}`);let i=e.bindings.map((n,r)=>{let i=n.agentId.trim(),a=n.match.channel.trim(),o=n.match.accountId?.trim()??``,s=n.match.peer?.kind,c=n.match.peer?.id?.trim()??``;if(!i)throw Error(t(`bindingAgentIdRequired`).replace(`{index}`,String(r)));if(!e.knownAgentIds.has(i))throw Error(`${t(`bindingAgentIdNotFound`).replace(`{index}`,String(r))}: ${i}`);if(!a)throw Error(t(`bindingChannelRequired`).replace(`{index}`,String(r)));let l={agentId:i,match:{channel:a}};if(o&&(l.match.accountId=o),s){if(!c)throw Error(t(`bindingPeerIdRequired`).replace(`{index}`,String(r)));l.match.peer={kind:s,id:c}}return l}),a=e.runtimeEntries.reduce((e,t,n)=>{let r=t.id.trim(),i=t.type.trim();if(!r)throw Error(`Runtime entry id is required at index ${n}.`);if(!i)throw Error(`Runtime entry type is required for "${r}".`);if(e[r])throw Error(`Duplicate runtime entry id: ${r}`);let a=t.configText.trim()?JSON.parse(t.configText):{};if(a&&(typeof a!=`object`||Array.isArray(a)))throw Error(`Runtime entry config for "${r}" must be a JSON object.`);return e[r]={enabled:t.enabled!==!1,...t.label?.trim()?{label:t.label.trim()}:{},type:i,config:a??{}},e},{});return{agents:{defaults:{contextTokens:Math.max(1e3,e.defaultContextTokens),engine:e.defaultEngine.trim()||`native`},list:n,runtimes:{entries:a}},bindings:i,session:{dmScope:e.dmScope}}}function fe(e){return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:e.label??t(`agentList`)}),(0,L.jsx)(a,{children:e.help??t(`agentListHelp`)})]}),(0,L.jsxs)(l,{className:`space-y-3`,children:[e.agents.map((n,r)=>(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,L.jsx)(p,{value:n.id,onChange:t=>e.onUpdateAgent(r,{id:t.target.value}),placeholder:t(`agentIdPlaceholder`)}),(0,L.jsx)(p,{value:n.workspace??``,onChange:t=>e.onUpdateAgent(r,{workspace:t.target.value}),placeholder:t(`workspaceOverridePlaceholder`)}),(0,L.jsx)(p,{value:n.model??``,onChange:t=>e.onUpdateAgent(r,{model:t.target.value}),placeholder:t(`modelOverridePlaceholder`)}),(0,L.jsx)(p,{value:n.runtime??n.engine??``,onChange:t=>e.onUpdateAgent(r,{runtime:t.target.value}),placeholder:e.engineLabel??t(`engineOverridePlaceholder`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:[(0,L.jsx)(p,{type:`number`,min:1e3,step:1e3,value:n.contextTokens??``,onChange:t=>e.onUpdateAgent(r,{contextTokens:Q(t.target.value)}),placeholder:e.contextTokensLabel??t(`contextTokensPlaceholder`)}),(0,L.jsx)(p,{type:`number`,min:1,value:n.maxToolIterations??``,onChange:t=>e.onUpdateAgent(r,{maxToolIterations:Q(t.target.value)}),placeholder:t(`maxToolsPlaceholder`)})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,L.jsx)(m,{checked:!!n.default,onCheckedChange:t=>e.onSetDefaultAgent(r,t)}),(0,L.jsx)(`span`,{children:t(`defaultAgent`)})]}),(0,L.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveAgent(r),children:[(0,L.jsx)(D,{className:`h-4 w-4 mr-1`}),t(`remove`)]})]})]},`${r}-${n.id}`)),(0,L.jsxs)(i,{type:`button`,variant:`outline`,onClick:e.onAddAgent,children:[(0,L.jsx)(T,{className:`h-4 w-4 mr-2`}),t(`addAgent`)]})]})]})}function pe(e){return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:e.label??t(`bindings`)}),(0,L.jsx)(a,{children:e.help??t(`bindingsHelp`)})]}),(0,L.jsxs)(l,{className:`space-y-3`,children:[e.bindings.map((n,r)=>{let a=n.match.peer?.kind??``;return(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,L.jsx)(p,{value:n.agentId,onChange:t=>e.onUpdateBinding(r,{...n,agentId:t.target.value}),placeholder:t(`targetAgentIdPlaceholder`)}),(0,L.jsx)(p,{value:n.match.channel,onChange:t=>e.onUpdateBinding(r,{...n,match:{...n.match,channel:t.target.value}}),placeholder:t(`channelPlaceholder`)}),(0,L.jsx)(p,{value:n.match.accountId??``,onChange:t=>e.onUpdateBinding(r,{...n,match:{...n.match,accountId:t.target.value}}),placeholder:t(`accountIdOptionalPlaceholder`)}),(0,L.jsxs)(w,{value:a||`__none__`,onValueChange:t=>{let i=t===`__none__`?``:t;e.onUpdateBinding(r,i?{...n,match:{...n.match,peer:{kind:i,id:n.match.peer?.id??``}}}:{...n,match:{...n.match,peer:void 0}})},children:[(0,L.jsx)(x,{children:(0,L.jsx)(b,{})}),(0,L.jsxs)(S,{children:[(0,L.jsx)(C,{value:`__none__`,children:t(`peerKindOptional`)}),(0,L.jsx)(C,{value:`direct`,children:`direct`}),(0,L.jsx)(C,{value:`group`,children:`group`}),(0,L.jsx)(C,{value:`channel`,children:`channel`})]})]}),(0,L.jsx)(p,{value:n.match.peer?.id??``,onChange:t=>e.onUpdateBinding(r,{...n,match:{...n.match,peer:a?{kind:a,id:t.target.value}:void 0}}),placeholder:t(`peerIdPlaceholder`)})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveBinding(r),children:[(0,L.jsx)(D,{className:`h-4 w-4 mr-1`}),t(`remove`)]})})]},`${r}-${n.agentId}`)}),(0,L.jsxs)(i,{type:`button`,variant:`outline`,onClick:e.onAddBinding,children:[(0,L.jsx)(T,{className:`h-4 w-4 mr-2`}),t(`addBinding`)]})]})]})}function me(e){return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:e.label??`Runtime Entries`}),(0,L.jsx)(a,{children:e.help??`统一管理可见的 runtime entry 与其配置。`})]}),(0,L.jsxs)(l,{className:`space-y-3`,children:[e.entries.map((t,n)=>(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,L.jsx)(p,{value:t.id,onChange:t=>e.onUpdateEntry(n,{id:t.target.value}),placeholder:`entry id,例如 hermes`}),(0,L.jsx)(p,{value:t.label??``,onChange:t=>e.onUpdateEntry(n,{label:t.target.value}),placeholder:`展示名称,例如 Hermes`}),(0,L.jsx)(p,{value:t.type,onChange:t=>e.onUpdateEntry(n,{type:t.target.value}),placeholder:`runtime type,例如 narp-stdio`}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2`,children:[(0,L.jsx)(`span`,{className:`text-sm text-gray-700`,children:`Enabled`}),(0,L.jsx)(m,{checked:t.enabled!==!1,onCheckedChange:t=>e.onUpdateEntry(n,{enabled:t})})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:`Config JSON`}),(0,L.jsx)(`textarea`,{className:`min-h-32 w-full rounded-md border border-gray-200 px-3 py-2 text-sm font-mono`,value:t.configText,onChange:t=>e.onUpdateEntry(n,{configText:t.target.value}),spellCheck:!1})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(i,{type:`button`,variant:`outline`,onClick:()=>e.onRemoveEntry(n),children:[(0,L.jsx)(D,{className:`mr-2 h-4 w-4`}),`Delete`]})})]},`${n}-${t.id||`runtime-entry`}`)),(0,L.jsxs)(i,{type:`button`,variant:`outline`,onClick:e.onAddEntry,children:[(0,L.jsx)(T,{className:`mr-2 h-4 w-4`}),`Add Runtime Entry`]})]})]})}var he=[{value:`main`,label:`main`},{value:`per-peer`,label:`per-peer`},{value:`per-channel-peer`,label:`per-channel-peer`},{value:`per-account-channel-peer`,label:`per-account-channel-peer`}];function ge(e){return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:e.dmScopeLabel??t(`dmScope`)}),(0,L.jsx)(a,{children:e.dmScopeHelp??t(`dmScopeHelp`)})]}),(0,L.jsxs)(l,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:e.defaultContextTokensLabel??t(`defaultContextTokens`)}),(0,L.jsx)(p,{type:`number`,min:1e3,step:1e3,value:e.defaultContextTokens,onChange:t=>e.onDefaultContextTokensChange(Math.max(1e3,Number.parseInt(t.target.value,10)||1e3))}),(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:e.defaultContextTokensHelp??t(`defaultContextTokensHelp`)})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:e.defaultEngineLabel??t(`defaultEngine`)}),(0,L.jsx)(p,{value:e.defaultEngine,onChange:t=>e.onDefaultEngineChange(t.target.value),placeholder:t(`defaultEnginePlaceholder`)}),(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:e.defaultEngineHelp??t(`defaultEngineHelp`)})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:e.dmScopeLabel??t(`dmScope`)}),(0,L.jsxs)(w,{value:e.dmScope,onValueChange:t=>e.onDmScopeChange(t),children:[(0,L.jsx)(x,{children:(0,L.jsx)(b,{})}),(0,L.jsx)(S,{children:he.map(e=>(0,L.jsx)(C,{value:e.value,children:e.label},e.value))})]})]})]})]})}function _e(e){let n=(0,I.useMemo)(()=>ue(e.config),[e.config]),[r,a]=(0,I.useState)(n.agents),[s,l]=(0,I.useState)(n.bindings),[u,d]=(0,I.useState)(n.runtimeEntries),[f,p]=(0,I.useState)(n.dmScope),[m,h]=(0,I.useState)(n.defaultContextTokens),[g,_]=(0,I.useState)(n.defaultEngine),v=(0,I.useMemo)(()=>{let e=new Set([`main`]);return r.forEach(t=>{let n=t.id.trim();n&&e.add(n)}),e},[r]);return(0,L.jsxs)(o,{className:`space-y-6`,children:[(0,L.jsx)(ie,{}),(0,L.jsx)(ge,{dmScope:f,defaultContextTokens:m,defaultEngine:g,onDmScopeChange:p,onDefaultContextTokensChange:h,onDefaultEngineChange:_,dmScopeLabel:P(`session.dmScope`,e.uiHints)?.label,dmScopeHelp:P(`session.dmScope`,e.uiHints)?.help,defaultContextTokensLabel:P(`agents.defaults.contextTokens`,e.uiHints)?.label,defaultContextTokensHelp:P(`agents.defaults.contextTokens`,e.uiHints)?.help,defaultEngineLabel:P(`agents.defaults.engine`,e.uiHints)?.label,defaultEngineHelp:P(`agents.defaults.engine`,e.uiHints)?.help}),(0,L.jsx)(me,{entries:u,onUpdateEntry:(e,t)=>d(n=>n.map((n,r)=>r===e?{...n,...t}:n)),onRemoveEntry:e=>d(t=>t.filter((t,n)=>n!==e)),onAddEntry:()=>d(e=>[...e,se()]),label:P(`agents.runtimes.entries`,e.uiHints)?.label,help:P(`agents.runtimes.entries`,e.uiHints)?.help}),(0,L.jsx)(fe,{agents:r,onUpdateAgent:(e,t)=>{a(n=>n.map((n,r)=>r===e?{...n,...t}:n))},onRemoveAgent:e=>a(t=>t.filter((t,n)=>n!==e)),onAddAgent:()=>a(e=>[...e,ae()]),onSetDefaultAgent:(e,t)=>a(n=>t?n.map((t,n)=>({...t,default:n===e})):n.map((t,n)=>n===e?{...t,default:!1}:t)),label:P(`agents.list`,e.uiHints)?.label,help:P(`agents.list`,e.uiHints)?.help,contextTokensLabel:P(`agents.list.*.contextTokens`,e.uiHints)?.label,engineLabel:P(`agents.list.*.engine`,e.uiHints)?.label}),(0,L.jsx)(pe,{bindings:s,onUpdateBinding:(e,t)=>{l(n=>n.map((n,r)=>r===e?t:n))},onRemoveBinding:e=>l(t=>t.filter((t,n)=>n!==e)),onAddBinding:()=>l(e=>[...e,oe()]),label:P(`bindings`,e.uiHints)?.label,help:P(`bindings`,e.uiHints)?.help}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(i,{type:`button`,onClick:()=>{try{let t=de({agents:r,bindings:s,runtimeEntries:u,dmScope:f,defaultContextTokens:m,defaultEngine:g,knownAgentIds:v});e.updateRuntime.mutate({data:t})}catch(e){c.error(e instanceof Error?e.message:String(e))}},disabled:e.updateRuntime.isPending,children:[(0,L.jsx)(ne,{className:`h-4 w-4 mr-2`}),e.updateRuntime.isPending?t(`saving`):t(`saveRuntimeSettings`)]})})]})}function ve(){let{data:e,isLoading:n}=A(),{data:r}=k(),i=j();return n||!e?(0,L.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`runtimeLoading`)}):(0,L.jsx)(_e,{config:e,uiHints:r?.uiHints,updateRuntime:i})}export{ve as RuntimeConfig};
|
|
1
|
+
import{_ as e,i as t,m as n,p as r}from"./i18n-BnNAQpVM.js";import{At as i,Ct as a,Dt as o,Et as s,Pt as c,St as l,Tt as u,_t as d,ht as f,kt as p,pt as m,wt as h,xt as g,yt as _}from"./api-C51456xV.js";import{t as v}from"./createLucideIcon-C_GFKVuW.js";import{a as y}from"./theme-provider-dHqcWU-j.js";import{a as b,i as x,n as S,r as C,t as w}from"./select-DRDejPLk.js";import{t as ee}from"./loader-circle-C6gg2m2a.js";import{t as te}from"./play-DeNVUA5C.js";import{t as T}from"./plus-BptLViq1.js";import{t as E}from"./rotate-cw-F7aThvYj.js";import{t as ne}from"./save-7ztImRj7.js";import{t as D}from"./trash-2-C1cdqL6V.js";import{t as O}from"./notice-card-C9PFAR67.js";import{i as k,n as A,w as j}from"./use-config-DFja1sda.js";import{a as M,i as N}from"./index-CAYF44Dz.js";import{t as P}from"./config-hints-CPNzbMEp.js";import{t as F}from"./setting-row-BcF6eTW0.js";var re=v(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),I=e(n(),1),L=r(),R={healthy:`runtimeControlHealthy`,"starting-service":`runtimeControlStartingService`,"restarting-service":`runtimeControlRestartingService`,"stopping-service":`runtimeControlStoppingService`,"restarting-app":`runtimeControlRestartingApp`,recovering:`runtimeControlRecovering`,failed:`runtimeControlFailed`},z={running:`runtimeControlServiceRunning`,stopped:`runtimeControlServiceStopped`,starting:`runtimeControlServiceStarting`,stopping:`runtimeControlServiceStopping`,restarting:`runtimeControlServiceRestarting`},B={"desktop-embedded":`runtimeControlEnvironmentDesktop`,"managed-local-service":`runtimeControlEnvironmentManagedService`,"self-hosted-web":`runtimeControlEnvironmentSelfHosted`,"shared-web":`runtimeControlEnvironmentSharedWeb`};function V(e){return t(R[e]??`runtimeControlUnavailable`)}function H(e){return t(z[e]??`runtimeControlServiceUnknown`)}function U(e){return t(B[e.environment])}function W(e,t){return t===`start-service`?e?.canStartService:t===`stop-service`?e?.canStopService:e?.canRestartService}function G(e){return e?[{action:`start-service`,capability:e.canStartService,label:t(`runtimeControlStartService`),icon:`play`},{action:`restart-service`,capability:e.canRestartService,label:t(`runtimeControlRestartService`),icon:`rotate`},{action:`stop-service`,capability:e.canStopService,label:t(`runtimeControlStopService`),icon:`square`,variant:`destructive`},{action:`restart-app`,capability:e.canRestartApp,label:t(`runtimeControlRestartApp`),icon:`rotate`,variant:`secondary`}].filter(e=>e.capability.available||!!e.capability.reasonIfUnavailable):[]}function K(e){let{busy:t,icon:n}=e;return t?(0,L.jsx)(ee,{className:`mr-2 h-4 w-4 animate-spin`}):n===`play`?(0,L.jsx)(te,{className:`mr-2 h-4 w-4`}):n===`square`?(0,L.jsx)(re,{className:`mr-2 h-4 w-4`}):(0,L.jsx)(E,{className:`mr-2 h-4 w-4`})}function q(){let{busy:e,busyAction:n,controlView:r,errorMessage:o,pendingRestart:s,visibleLifecycle:d,visibleMessage:p,visibleServiceState:m}=f(),v=G(r??void 0),y=async e=>{let n=W(r,e);if(!n?.available){c.error(n?.reasonIfUnavailable??t(`runtimeControlLoadFailed`));return}if(!(e===`stop-service`&&n.requiresConfirmation&&!window.confirm(t(`runtimeControlStopServiceConfirm`))))try{let t=await _.runRuntimeControlAction(e);c.success(t.message)}catch(e){let n=e instanceof Error?e.message:t(`runtimeControlActionFailed`);c.error(`${t(`runtimeControlActionFailed`)}: ${n}`)}},b=async()=>{if(!r?.canRestartApp.available){c.error(r?.canRestartApp.reasonIfUnavailable??t(`runtimeRestartAppUnavailable`));return}if(window.confirm(t(`runtimeControlRestartAppConfirm`)))try{let e=await _.runRuntimeControlAction(`restart-app`);c.success(e.message)}catch(e){let n=e instanceof Error?e.message:t(`runtimeControlActionFailed`);c.error(`${t(`runtimeControlActionFailed`)}: ${n}`)}};return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:t(`runtimeControlTitle`)}),(0,L.jsx)(a,{children:t(`runtimeControlDescription`)})]}),(0,L.jsxs)(l,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 bg-gray-50 p-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-center md:justify-between`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:H(m)}),(0,L.jsx)(`div`,{className:`text-xs text-gray-500`,children:r?U(r):t(`runtimeControlLoading`)})]}),(0,L.jsx)(`p`,{className:`text-sm text-gray-600`,children:p}),(0,L.jsx)(`div`,{className:`text-xs text-gray-500`,children:V(d)}),r?.managementHint?(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:r.managementHint}):null,o&&!e?(0,L.jsx)(`p`,{className:`text-sm text-amber-700`,children:o}):null]}),s?(0,L.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-amber-200 bg-amber-50 p-4`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium text-amber-900`,children:t(`runtimeControlPendingRestartTitle`)}),(0,L.jsx)(`p`,{className:`text-sm text-amber-800`,children:t(`runtimeControlPendingRestartDescription`)}),s.changedPaths.length>0?(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-amber-700`,children:t(`runtimeControlPendingRestartPaths`)}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.changedPaths.map(e=>(0,L.jsx)(`span`,{className:`rounded-full border border-amber-200 bg-white px-2.5 py-1 text-xs text-amber-800`,children:e},e))})]}):null]}):null,(0,L.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:flex-wrap`,children:v.map(t=>(0,L.jsxs)(i,{type:`button`,variant:t.variant??`default`,onClick:()=>{if(t.action===`restart-app`){b();return}y(t.action)},disabled:!t.capability.available||e,children:[(0,L.jsx)(K,{icon:t.icon,busy:n===t.action}),t.label]},t.action))}),v.filter(e=>!e.capability.available&&e.capability.reasonIfUnavailable).map(e=>(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:e.capability.reasonIfUnavailable},`${e.action}-reason`))]})]})}function J(e){let{description:t,title:n}=e;return(0,L.jsx)(O,{tone:`neutral`,title:n,description:t})}function Y(e){let{children:n}=e;return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:t(`runtimePresenceTitle`)}),(0,L.jsx)(a,{children:t(`runtimePresenceDescription`)})]}),(0,L.jsx)(l,{children:n})]})}function X(){let e=d().runtimeControlView?.environment,n=M(e=>e.supported),r=M(e=>e.initialized),i=M(e=>e.busyAction),a=M(e=>e.snapshot);return(0,I.useEffect)(()=>{if(e===`desktop-embedded`){N.start();return}N.markUnsupported()},[e]),e===`desktop-embedded`?(0,L.jsx)(Y,{children:(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(O,{tone:`neutral`,title:t(`runtimePresenceBehaviorLabel`),description:a?.closeToBackground?t(`runtimePresenceBehaviorBackground`):t(`runtimePresenceBehaviorQuit`),className:`rounded-xl`}),!r||n&&!a?(0,L.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimePresenceLoading`)}):null,a?(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(F,{title:t(`runtimePresenceCloseToBackground`),description:t(`runtimePresenceCloseToBackgroundHelp`),control:(0,L.jsx)(m,{id:`runtime-presence-close-background`,"aria-label":t(`runtimePresenceCloseToBackground`),checked:a.closeToBackground,disabled:i===`saving-preferences`,onCheckedChange:e=>{N.updatePreferences({closeToBackground:e})}})}),(0,L.jsx)(F,{title:t(`runtimePresenceLaunchAtLogin`),description:a.supportsLaunchAtLogin?t(`runtimePresenceLaunchAtLoginHelp`):a.launchAtLoginReason??t(`runtimePresenceLaunchAtLoginUnavailable`),control:(0,L.jsx)(m,{id:`runtime-presence-launch-login`,"aria-label":t(`runtimePresenceLaunchAtLogin`),checked:a.launchAtLogin,disabled:!a.supportsLaunchAtLogin||i===`saving-preferences`,onCheckedChange:e=>{N.updatePreferences({launchAtLogin:e})}})})]}):null]})}):e===`managed-local-service`?(0,L.jsx)(Y,{children:(0,L.jsx)(J,{title:t(`runtimePresenceManagedLocalTitle`),description:t(`runtimePresenceManagedLocalDescription`)})}):e===`self-hosted-web`?(0,L.jsx)(Y,{children:(0,L.jsx)(J,{title:t(`runtimePresenceSelfHostedTitle`),description:t(`runtimePresenceSelfHostedDescription`)})}):e===`shared-web`?(0,L.jsx)(Y,{children:(0,L.jsx)(J,{title:t(`runtimePresenceSharedTitle`),description:t(`runtimePresenceSharedDescription`)})}):(0,L.jsx)(Y,{children:(0,L.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimePresenceLoading`)})})}function ie(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s,{title:t(`runtimePageTitle`),description:t(`runtimePageDescription`)}),(0,L.jsx)(q,{}),(0,L.jsx)(X,{}),(0,L.jsx)(y,{})]})}var Z={wireDialect:`acp`,processScope:`per-session`,command:``,args:[`acp`],env:{},cwd:``,startupTimeoutMs:8e3,probeTimeoutMs:3e3,requestTimeoutMs:12e4};function ae(){return{id:``,default:!1,workspace:``,model:``,runtime:``,contextTokens:void 0,maxToolIterations:void 0}}function oe(){return{agentId:``,match:{channel:``,accountId:``}}}function se(){return{id:``,enabled:!0,label:``,type:`narp-stdio`,config:Z,configText:JSON.stringify(Z,null,2)}}function ce(e){return{id:e.id??``,default:!!e.default,displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,workspace:e.workspace??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:e.contextTokens,maxToolIterations:e.maxToolIterations}}function le(e){return{agentId:e.agentId??``,match:{channel:e.match?.channel??``,accountId:e.match?.accountId??``,peer:e.match?.peer?{kind:e.match.peer.kind,id:e.match.peer.id}:void 0}}}function Q(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:void 0}function ue(e){return{agents:(e.agents.list??[]).map(ce),bindings:(e.bindings??[]).map(le),runtimeEntries:Object.entries(e.agents.runtimes?.entries??{}).map(([e,t])=>({id:e,enabled:t.enabled!==!1,label:t.label??``,type:t.type,config:t.config??{},configText:JSON.stringify(t.config??{},null,2)})),dmScope:e.session?.dmScope??`per-channel-peer`,defaultContextTokens:e.agents.defaults.contextTokens??2e5,defaultEngine:e.agents.defaults.engine??`native`}}function $(e){let t={id:e.id.trim()};e.default&&(t.default=!0),e.displayName?.trim()&&(t.displayName=e.displayName.trim()),e.description?.trim()&&(t.description=e.description.trim()),e.avatar?.trim()&&(t.avatar=e.avatar.trim()),e.workspace?.trim()&&(t.workspace=e.workspace.trim()),e.model?.trim()&&(t.model=e.model.trim());let n=e.runtime?.trim()??e.engine?.trim();return n&&(t.engine=n),typeof e.contextTokens==`number`&&(t.contextTokens=Math.max(1e3,e.contextTokens)),typeof e.maxToolIterations==`number`&&(t.maxToolIterations=e.maxToolIterations),t}function de(e){let n=e.agents.map((e,n)=>{if(!e.id.trim())throw Error(t(`agentIdRequiredError`).replace(`{index}`,String(n)));return $(e)}),r=n.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t);if(r.length>0)throw Error(`${t(`duplicateAgentId`)}: ${r[0]}`);let i=e.bindings.map((n,r)=>{let i=n.agentId.trim(),a=n.match.channel.trim(),o=n.match.accountId?.trim()??``,s=n.match.peer?.kind,c=n.match.peer?.id?.trim()??``;if(!i)throw Error(t(`bindingAgentIdRequired`).replace(`{index}`,String(r)));if(!e.knownAgentIds.has(i))throw Error(`${t(`bindingAgentIdNotFound`).replace(`{index}`,String(r))}: ${i}`);if(!a)throw Error(t(`bindingChannelRequired`).replace(`{index}`,String(r)));let l={agentId:i,match:{channel:a}};if(o&&(l.match.accountId=o),s){if(!c)throw Error(t(`bindingPeerIdRequired`).replace(`{index}`,String(r)));l.match.peer={kind:s,id:c}}return l}),a=e.runtimeEntries.reduce((e,t,n)=>{let r=t.id.trim(),i=t.type.trim();if(!r)throw Error(`Runtime entry id is required at index ${n}.`);if(!i)throw Error(`Runtime entry type is required for "${r}".`);if(e[r])throw Error(`Duplicate runtime entry id: ${r}`);let a=t.configText.trim()?JSON.parse(t.configText):{};if(a&&(typeof a!=`object`||Array.isArray(a)))throw Error(`Runtime entry config for "${r}" must be a JSON object.`);return e[r]={enabled:t.enabled!==!1,...t.label?.trim()?{label:t.label.trim()}:{},type:i,config:a??{}},e},{});return{agents:{defaults:{contextTokens:Math.max(1e3,e.defaultContextTokens),engine:e.defaultEngine.trim()||`native`},list:n,runtimes:{entries:a}},bindings:i,session:{dmScope:e.dmScope}}}function fe(e){return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:e.label??t(`agentList`)}),(0,L.jsx)(a,{children:e.help??t(`agentListHelp`)})]}),(0,L.jsxs)(l,{className:`space-y-3`,children:[e.agents.map((n,r)=>(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,L.jsx)(p,{value:n.id,onChange:t=>e.onUpdateAgent(r,{id:t.target.value}),placeholder:t(`agentIdPlaceholder`)}),(0,L.jsx)(p,{value:n.workspace??``,onChange:t=>e.onUpdateAgent(r,{workspace:t.target.value}),placeholder:t(`workspaceOverridePlaceholder`)}),(0,L.jsx)(p,{value:n.model??``,onChange:t=>e.onUpdateAgent(r,{model:t.target.value}),placeholder:t(`modelOverridePlaceholder`)}),(0,L.jsx)(p,{value:n.runtime??n.engine??``,onChange:t=>e.onUpdateAgent(r,{runtime:t.target.value}),placeholder:e.engineLabel??t(`engineOverridePlaceholder`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:[(0,L.jsx)(p,{type:`number`,min:1e3,step:1e3,value:n.contextTokens??``,onChange:t=>e.onUpdateAgent(r,{contextTokens:Q(t.target.value)}),placeholder:e.contextTokensLabel??t(`contextTokensPlaceholder`)}),(0,L.jsx)(p,{type:`number`,min:1,value:n.maxToolIterations??``,onChange:t=>e.onUpdateAgent(r,{maxToolIterations:Q(t.target.value)}),placeholder:t(`maxToolsPlaceholder`)})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,L.jsx)(m,{checked:!!n.default,onCheckedChange:t=>e.onSetDefaultAgent(r,t)}),(0,L.jsx)(`span`,{children:t(`defaultAgent`)})]}),(0,L.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveAgent(r),children:[(0,L.jsx)(D,{className:`h-4 w-4 mr-1`}),t(`remove`)]})]})]},`${r}-${n.id}`)),(0,L.jsxs)(i,{type:`button`,variant:`outline`,onClick:e.onAddAgent,children:[(0,L.jsx)(T,{className:`h-4 w-4 mr-2`}),t(`addAgent`)]})]})]})}function pe(e){return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:e.label??t(`bindings`)}),(0,L.jsx)(a,{children:e.help??t(`bindingsHelp`)})]}),(0,L.jsxs)(l,{className:`space-y-3`,children:[e.bindings.map((n,r)=>{let a=n.match.peer?.kind??``;return(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,L.jsx)(p,{value:n.agentId,onChange:t=>e.onUpdateBinding(r,{...n,agentId:t.target.value}),placeholder:t(`targetAgentIdPlaceholder`)}),(0,L.jsx)(p,{value:n.match.channel,onChange:t=>e.onUpdateBinding(r,{...n,match:{...n.match,channel:t.target.value}}),placeholder:t(`channelPlaceholder`)}),(0,L.jsx)(p,{value:n.match.accountId??``,onChange:t=>e.onUpdateBinding(r,{...n,match:{...n.match,accountId:t.target.value}}),placeholder:t(`accountIdOptionalPlaceholder`)}),(0,L.jsxs)(w,{value:a||`__none__`,onValueChange:t=>{let i=t===`__none__`?``:t;e.onUpdateBinding(r,i?{...n,match:{...n.match,peer:{kind:i,id:n.match.peer?.id??``}}}:{...n,match:{...n.match,peer:void 0}})},children:[(0,L.jsx)(x,{children:(0,L.jsx)(b,{})}),(0,L.jsxs)(S,{children:[(0,L.jsx)(C,{value:`__none__`,children:t(`peerKindOptional`)}),(0,L.jsx)(C,{value:`direct`,children:`direct`}),(0,L.jsx)(C,{value:`group`,children:`group`}),(0,L.jsx)(C,{value:`channel`,children:`channel`})]})]}),(0,L.jsx)(p,{value:n.match.peer?.id??``,onChange:t=>e.onUpdateBinding(r,{...n,match:{...n.match,peer:a?{kind:a,id:t.target.value}:void 0}}),placeholder:t(`peerIdPlaceholder`)})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveBinding(r),children:[(0,L.jsx)(D,{className:`h-4 w-4 mr-1`}),t(`remove`)]})})]},`${r}-${n.agentId}`)}),(0,L.jsxs)(i,{type:`button`,variant:`outline`,onClick:e.onAddBinding,children:[(0,L.jsx)(T,{className:`h-4 w-4 mr-2`}),t(`addBinding`)]})]})]})}function me(e){return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:e.label??`Runtime Entries`}),(0,L.jsx)(a,{children:e.help??`统一管理可见的 runtime entry 与其配置。`})]}),(0,L.jsxs)(l,{className:`space-y-3`,children:[e.entries.map((t,n)=>(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,L.jsx)(p,{value:t.id,onChange:t=>e.onUpdateEntry(n,{id:t.target.value}),placeholder:`entry id,例如 hermes`}),(0,L.jsx)(p,{value:t.label??``,onChange:t=>e.onUpdateEntry(n,{label:t.target.value}),placeholder:`展示名称,例如 Hermes`}),(0,L.jsx)(p,{value:t.type,onChange:t=>e.onUpdateEntry(n,{type:t.target.value}),placeholder:`runtime type,例如 narp-stdio`}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2`,children:[(0,L.jsx)(`span`,{className:`text-sm text-gray-700`,children:`Enabled`}),(0,L.jsx)(m,{checked:t.enabled!==!1,onCheckedChange:t=>e.onUpdateEntry(n,{enabled:t})})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:`Config JSON`}),(0,L.jsx)(`textarea`,{className:`min-h-32 w-full rounded-md border border-gray-200 px-3 py-2 text-sm font-mono`,value:t.configText,onChange:t=>e.onUpdateEntry(n,{configText:t.target.value}),spellCheck:!1})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(i,{type:`button`,variant:`outline`,onClick:()=>e.onRemoveEntry(n),children:[(0,L.jsx)(D,{className:`mr-2 h-4 w-4`}),`Delete`]})})]},`${n}-${t.id||`runtime-entry`}`)),(0,L.jsxs)(i,{type:`button`,variant:`outline`,onClick:e.onAddEntry,children:[(0,L.jsx)(T,{className:`mr-2 h-4 w-4`}),`Add Runtime Entry`]})]})]})}var he=[{value:`main`,label:`main`},{value:`per-peer`,label:`per-peer`},{value:`per-channel-peer`,label:`per-channel-peer`},{value:`per-account-channel-peer`,label:`per-account-channel-peer`}];function ge(e){return(0,L.jsxs)(g,{children:[(0,L.jsxs)(h,{children:[(0,L.jsx)(u,{children:e.dmScopeLabel??t(`dmScope`)}),(0,L.jsx)(a,{children:e.dmScopeHelp??t(`dmScopeHelp`)})]}),(0,L.jsxs)(l,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:e.defaultContextTokensLabel??t(`defaultContextTokens`)}),(0,L.jsx)(p,{type:`number`,min:1e3,step:1e3,value:e.defaultContextTokens,onChange:t=>e.onDefaultContextTokensChange(Math.max(1e3,Number.parseInt(t.target.value,10)||1e3))}),(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:e.defaultContextTokensHelp??t(`defaultContextTokensHelp`)})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:e.defaultEngineLabel??t(`defaultEngine`)}),(0,L.jsx)(p,{value:e.defaultEngine,onChange:t=>e.onDefaultEngineChange(t.target.value),placeholder:t(`defaultEnginePlaceholder`)}),(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:e.defaultEngineHelp??t(`defaultEngineHelp`)})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:e.dmScopeLabel??t(`dmScope`)}),(0,L.jsxs)(w,{value:e.dmScope,onValueChange:t=>e.onDmScopeChange(t),children:[(0,L.jsx)(x,{children:(0,L.jsx)(b,{})}),(0,L.jsx)(S,{children:he.map(e=>(0,L.jsx)(C,{value:e.value,children:e.label},e.value))})]})]})]})]})}function _e(e){let n=(0,I.useMemo)(()=>ue(e.config),[e.config]),[r,a]=(0,I.useState)(n.agents),[s,l]=(0,I.useState)(n.bindings),[u,d]=(0,I.useState)(n.runtimeEntries),[f,p]=(0,I.useState)(n.dmScope),[m,h]=(0,I.useState)(n.defaultContextTokens),[g,_]=(0,I.useState)(n.defaultEngine),v=(0,I.useMemo)(()=>{let e=new Set([`main`]);return r.forEach(t=>{let n=t.id.trim();n&&e.add(n)}),e},[r]);return(0,L.jsxs)(o,{className:`space-y-6`,children:[(0,L.jsx)(ie,{}),(0,L.jsx)(ge,{dmScope:f,defaultContextTokens:m,defaultEngine:g,onDmScopeChange:p,onDefaultContextTokensChange:h,onDefaultEngineChange:_,dmScopeLabel:P(`session.dmScope`,e.uiHints)?.label,dmScopeHelp:P(`session.dmScope`,e.uiHints)?.help,defaultContextTokensLabel:P(`agents.defaults.contextTokens`,e.uiHints)?.label,defaultContextTokensHelp:P(`agents.defaults.contextTokens`,e.uiHints)?.help,defaultEngineLabel:P(`agents.defaults.engine`,e.uiHints)?.label,defaultEngineHelp:P(`agents.defaults.engine`,e.uiHints)?.help}),(0,L.jsx)(me,{entries:u,onUpdateEntry:(e,t)=>d(n=>n.map((n,r)=>r===e?{...n,...t}:n)),onRemoveEntry:e=>d(t=>t.filter((t,n)=>n!==e)),onAddEntry:()=>d(e=>[...e,se()]),label:P(`agents.runtimes.entries`,e.uiHints)?.label,help:P(`agents.runtimes.entries`,e.uiHints)?.help}),(0,L.jsx)(fe,{agents:r,onUpdateAgent:(e,t)=>{a(n=>n.map((n,r)=>r===e?{...n,...t}:n))},onRemoveAgent:e=>a(t=>t.filter((t,n)=>n!==e)),onAddAgent:()=>a(e=>[...e,ae()]),onSetDefaultAgent:(e,t)=>a(n=>t?n.map((t,n)=>({...t,default:n===e})):n.map((t,n)=>n===e?{...t,default:!1}:t)),label:P(`agents.list`,e.uiHints)?.label,help:P(`agents.list`,e.uiHints)?.help,contextTokensLabel:P(`agents.list.*.contextTokens`,e.uiHints)?.label,engineLabel:P(`agents.list.*.engine`,e.uiHints)?.label}),(0,L.jsx)(pe,{bindings:s,onUpdateBinding:(e,t)=>{l(n=>n.map((n,r)=>r===e?t:n))},onRemoveBinding:e=>l(t=>t.filter((t,n)=>n!==e)),onAddBinding:()=>l(e=>[...e,oe()]),label:P(`bindings`,e.uiHints)?.label,help:P(`bindings`,e.uiHints)?.help}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(i,{type:`button`,onClick:()=>{try{let t=de({agents:r,bindings:s,runtimeEntries:u,dmScope:f,defaultContextTokens:m,defaultEngine:g,knownAgentIds:v});e.updateRuntime.mutate({data:t})}catch(e){c.error(e instanceof Error?e.message:String(e))}},disabled:e.updateRuntime.isPending,children:[(0,L.jsx)(ne,{className:`h-4 w-4 mr-2`}),e.updateRuntime.isPending?t(`saving`):t(`saveRuntimeSettings`)]})})]})}function ve(){let{data:e,isLoading:n}=A(),{data:r}=k(),i=j();return n||!e?(0,L.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`runtimeLoading`)}):(0,L.jsx)(_e,{config:e,uiHints:r?.uiHints,updateRuntime:i})}export{ve as RuntimeConfig};
|
package/ui-dist/assets/{sessions-config-page-DZrdd2zT.js → sessions-config-page-CZGqS32n.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,n as r,p as i,t as a,u as o}from"./i18n-BnNAQpVM.js";import{At as s,Dt as c,Et as l,kt as u}from"./api-C51456xV.js";import{t as d}from"./createLucideIcon-C_GFKVuW.js";import{h as f,p,y as m}from"./theme-provider-dHqcWU-j.js";import{t as h}from"./search-DZSNKEGp.js";import{F as g,N as _,f as v,p as y,w as b}from"./chat-
|
|
1
|
+
import{_ as e,i as t,m as n,n as r,p as i,t as a,u as o}from"./i18n-BnNAQpVM.js";import{At as s,Dt as c,Et as l,kt as u}from"./api-C51456xV.js";import{t as d}from"./createLucideIcon-C_GFKVuW.js";import{h as f,p,y as m}from"./theme-provider-dHqcWU-j.js";import{t as h}from"./search-DZSNKEGp.js";import{F as g,N as _,f as v,p as y,w as b}from"./chat-BxA-mw53.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-DRDejPLk.js";import{t as E}from"./hash-CvcvtMBq.js";import{t as D}from"./settings-DjvNMJde.js";import{t as O}from"./use-viewport-layout-D-pjxsyz.js";import{S as k,c as A,f as j,m as M}from"./use-config-DFja1sda.js";import{a as N,c as P,i as F,o as I}from"./config-split-page-B3PRA_AV.js";import{t as L}from"./use-confirm-dialog-DvIbSUX3.js";var R=d(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),z=d(`Inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),B=e(n(),1),V=i();function H(e){return e===`service`?`system`:e===`tool`?`tool`:e}function U(e){let t=[];for(let n of e.parts){if(n.type===`text`||n.type===`rich-text`||n.type===`reasoning`){t.push(n.text);continue}if(n.type!==`tool-invocation`)continue;let e=n.toolName?.trim()?`[${n.toolName.trim()}]`:`[tool]`;if(n.state===`result`&&typeof n.result==`string`&&n.result.trim()){t.push(`${e} ${n.result.trim()}`);continue}t.push(e)}return t.join(`
|
|
2
2
|
`).trim()}function W({message:e}){let t=H(e.role),n=t===`user`,i=U(e);return(0,V.jsx)(`div`,{className:o(`flex w-full mb-6`,n?`justify-end`:`justify-start`),children:(0,V.jsxs)(`div`,{className:o(`max-w-[85%] rounded-[1.25rem] p-5 flex gap-3 text-sm`,n?`bg-primary text-white rounded-tr-sm`:`bg-gray-50 text-gray-800 rounded-tl-sm border border-gray-100/50`),children:[(0,V.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:n?(0,V.jsx)(g,{className:`w-4 h-4 text-primary-100`}):(0,V.jsx)(m,{className:`w-4 h-4 text-gray-400`})}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-1 overflow-x-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 mb-2`,children:[(0,V.jsx)(`span`,{className:o(`font-semibold text-xs capitalize`,n?`text-primary-50`:`text-gray-900`),children:t}),(0,V.jsx)(`span`,{className:o(`text-[10px]`,n?`text-primary-200`:`text-gray-400`),children:r(e.timestamp)})]}),(0,V.jsx)(`div`,{className:`whitespace-pre-wrap break-words leading-relaxed text-[15px]`,children:i||`-`})]})]})})}function G(e){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(e.session.label||``),[c,l]=(0,B.useState)(e.session.preferredModel||``);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>r(e=>!e),className:o(`h-8.5 rounded-lg shadow-none border-gray-200 transition-all text-xs font-semibold`,n?`bg-gray-100 text-gray-900`:`hover:bg-gray-50 hover:text-gray-900`),children:[(0,V.jsx)(D,{className:`w-3.5 h-3.5 mr-1.5`}),t(`sessionsMetadata`)]}),n?(0,V.jsxs)(`div`,{className:`flex items-center gap-3 bg-gray-50/50 p-3 rounded-lg border border-gray-100 animate-slide-in`,children:[(0,V.jsx)(u,{placeholder:t(`sessionsLabelPlaceholder`),value:i,onChange:e=>a(e.target.value),className:`h-8 text-sm bg-white`}),(0,V.jsx)(u,{placeholder:t(`sessionsModelPlaceholder`),value:c,onChange:e=>l(e.target.value),className:`h-8 text-sm bg-white`}),(0,V.jsx)(s,{size:`sm`,onClick:()=>{e.onSave({label:i,preferredModel:c}),r(!1)},className:`h-8 px-4 shrink-0 shadow-none`,disabled:e.isPending,children:t(`sessionsSaveMeta`)})]}):null]})}function K(){return(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-gray-400 p-8 h-full bg-white`,children:[(0,V.jsx)(`div`,{className:`w-20 h-20 bg-gray-50 rounded-3xl flex items-center justify-center mb-6 border border-gray-100 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.02)] rotate-3`,children:(0,V.jsx)(z,{className:`h-8 w-8 text-gray-300 -rotate-3`})}),(0,V.jsx)(`h3`,{className:`text-lg font-bold text-gray-900 mb-2`,children:t(`sessionsNoSelectionTitle`)}),(0,V.jsx)(`p`,{className:`text-sm text-center max-w-sm leading-relaxed`,children:t(`sessionsNoSelectionDescription`)})]})}function q(e){let n=j(e.sessionKey,300),r=k(),i=A(),{confirm:a,ConfirmDialog:o}=L();return(0,V.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col overflow-hidden relative bg-white rounded-2xl shadow-sm border border-gray-200`,children:[r.isPending||i.isPending?(0,V.jsx)(`div`,{className:`absolute top-0 left-0 w-full h-1 bg-primary/20 overflow-hidden z-20`,children:(0,V.jsx)(`div`,{className:`h-full bg-primary animate-pulse w-1/3 rounded-r-full`})}):null,e.sessionKey&&e.session&&e.summary&&e.channelLabel?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`shrink-0 border-b border-gray-100 bg-white px-4 py-4 z-10 space-y-4 sm:px-8 sm:py-5`,children:(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(`div`,{className:`h-12 w-12 rounded-[14px] bg-gray-50 border border-gray-100 flex items-center justify-center text-gray-400 shrink-0`,children:(0,V.jsx)(E,{className:`h-6 w-6`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-1.5`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-bold text-gray-900 tracking-tight`,children:e.session.label?.trim()||e.session.key.split(`:`).pop()||e.session.key}),(0,V.jsx)(`span`,{className:`text-[10px] font-bold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500 uppercase tracking-widest`,children:e.channelLabel}),e.summary.status===`running`?(0,V.jsx)(_,{status:`running`,className:`h-4 w-4`}):null]}),(0,V.jsx)(`div`,{className:`text-xs text-gray-500 font-mono break-all line-clamp-1 opacity-70`,title:e.sessionKey,children:e.sessionKey})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,V.jsx)(G,{session:e.session,isPending:r.isPending,onSave:t=>{e.sessionKey&&r.mutate({sessionId:e.sessionKey,data:{label:t.label.trim()||null,preferredModel:t.preferredModel.trim()||null}})}},e.session.key),(0,V.jsx)(s,{variant:`outline`,size:`sm`,onClick:async()=>{e.sessionKey&&await a({title:t(`sessionsDeleteConfirm`)+`?`,variant:`destructive`,confirmLabel:t(`sessionsDeleteConfirm`)})&&i.mutate({sessionId:e.sessionKey},{onSuccess:()=>e.onClearSelection()})},className:`h-8.5 rounded-lg shadow-none hover:bg-red-50 hover:text-red-600 hover:border-red-200 border-gray-200 text-xs font-semibold text-red-500`,children:t(`delete`)})]})]})}),(0,V.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 relative [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:bg-gray-300/80 [&::-webkit-scrollbar-thumb]:rounded-full sm:p-6`,children:[n.isLoading?(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-gray-50/50 backdrop-blur-sm z-10`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-3 animate-pulse`,children:[(0,V.jsx)(p,{className:`w-6 h-6 text-primary animate-spin`}),(0,V.jsx)(`span`,{className:`text-sm font-medium text-gray-500`,children:t(`sessionsHistoryLoading`)})]})}):null,n.error?(0,V.jsx)(`div`,{className:`text-center p-6 bg-red-50 rounded-xl text-red-600 border border-red-100 text-sm`,children:n.error.message}):null,!n.isLoading&&n.data?.messages.length===0?(0,V.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center text-gray-400`,children:[(0,V.jsx)(f,{className:`w-12 h-12 mb-3 text-gray-300`}),(0,V.jsx)(`p`,{className:`text-sm`,children:t(`sessionsEmpty`)})]}):null,(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(n.data?.messages??[]).map(e=>(0,V.jsx)(W,{message:e},e.id))})]})]}):(0,V.jsx)(K,{}),(0,V.jsx)(o,{})]})}var J=`__unknown_channel__`;function Y(e){let t=e.indexOf(`:`);return t<=0?J:e.slice(0,t).trim()||J}function X(e){return e===J?t(`sessionsUnknownChannel`):e}function Z(e){return(0,V.jsxs)(`button`,{onClick:e.onSelect,className:o(`w-full text-left p-3.5 rounded-xl transition-all duration-200 outline-none focus:outline-none focus:ring-0 group`,e.isSelected?`bg-brand-50 border border-brand-100/50`:`bg-transparent border border-transparent hover:bg-gray-50/80`),children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between mb-1.5`,children:[(0,V.jsx)(`div`,{className:o(`font-semibold truncate pr-2 flex-1 text-sm`,e.isSelected?`text-brand-800`:`text-gray-900`),children:v(e.session)}),(0,V.jsx)(`div`,{className:o(`text-[10px] font-bold px-2 py-0.5 rounded-full shrink-0 capitalize`,e.isSelected?`bg-white text-brand-600 shadow-[0_1px_2px_rgba(0,0,0,0.02)]`:`bg-gray-100 text-gray-500`),children:e.channelLabel})]}),(0,V.jsxs)(`div`,{className:o(`flex items-center text-xs justify-between mt-2 font-medium`,e.isSelected?`text-brand-600/80`:`text-gray-400`),children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:e.summary.status===`running`?(0,V.jsx)(_,{status:`running`}):null}),(0,V.jsx)(R,{className:`w-3.5 h-3.5 opacity-70`}),(0,V.jsx)(`span`,{className:`truncate max-w-[100px]`,children:a(e.summary.updatedAt)})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(f,{className:`w-3.5 h-3.5 opacity-70`}),(0,V.jsx)(`span`,{children:e.summary.messageCount})]})]})]})}function Q(){let{isMobile:e}=O(),[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(null),[d,f]=(0,B.useState)(`all`),m=M({limit:100}),g=(0,B.useMemo)(()=>m.data?.sessions??[],[m.data?.sessions]),_=(0,B.useMemo)(()=>b(g),[g]),v=(0,B.useMemo)(()=>new Map(g.map(e=>[e.sessionId,e])),[g]),E=(0,B.useMemo)(()=>_.filter(e=>d!==`all`&&Y(e.key)!==d?!1:y(e,n)),[n,d,_]),D=(0,B.useMemo)(()=>{let e=new Set;for(let t of _)e.add(Y(t.key));return Array.from(e).sort((e,t)=>e===J?1:t===J?-1:e.localeCompare(t))},[_]),k=i&&v.has(i)?i:null,A=(0,B.useMemo)(()=>_.find(e=>e.key===k)??null,[k,_]),j=k?v.get(k)??null:null,L=A?X(Y(A.key)):null;return(0,V.jsxs)(c,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,V.jsx)(l,{title:t(`sessionsPageTitle`),description:t(`sessionsPageDescription`)}),(0,V.jsxs)(F,{className:`xl:min-h-0`,mobileView:e?k?`detail`:`list`:void 0,onMobileBack:()=>a(null),mobileListLabel:t(`sessionsPageTitle`),children:[(0,V.jsxs)(N,{className:`xl:w-[320px] xl:flex-none`,children:[(0,V.jsxs)(P,{className:`space-y-3 px-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] font-semibold text-gray-400 uppercase tracking-wider`,children:[_.length,` `,t(`sessionsListTitle`)]}),(0,V.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-7 w-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>m.refetch(),children:(0,V.jsx)(p,{className:o(`h-3.5 w-3.5`,m.isFetching&&`animate-spin`)})})]}),(0,V.jsxs)(T,{value:d,onValueChange:f,children:[(0,V.jsx)(S,{className:`w-full h-8.5 rounded-lg bg-gray-50/50 hover:bg-gray-100 border-gray-200 focus:ring-0 shadow-none text-xs font-medium text-gray-700`,children:(0,V.jsx)(x,{placeholder:t(`sessionsAllChannels`)})}),(0,V.jsxs)(C,{className:`rounded-xl shadow-lg border-gray-100 max-w-[280px]`,children:[(0,V.jsx)(w,{value:`all`,className:`rounded-lg text-xs`,children:t(`sessionsAllChannels`)}),D.map(e=>(0,V.jsx)(w,{value:e,className:`rounded-lg text-xs truncate pr-6`,children:X(e)},e))]})]}),(0,V.jsxs)(`div`,{className:`relative w-full`,children:[(0,V.jsx)(h,{className:`h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400`}),(0,V.jsx)(u,{value:n,onChange:e=>r(e.target.value),placeholder:t(`sessionsSearchPlaceholder`),className:`pl-8 h-8.5 rounded-lg bg-gray-50/50 border-gray-200 focus-visible:bg-white text-xs`})]})]}),(0,V.jsx)(I,{className:`space-y-1 p-3 pb-10`,children:m.isLoading?(0,V.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`sessionsLoading`)}):E.length===0?(0,V.jsxs)(`div`,{className:`text-sm text-gray-400 p-4 text-center border-2 border-dashed border-gray-100 rounded-xl mt-4`,children:[(0,V.jsx)(z,{className:`w-8 h-8 mx-auto mb-2 text-gray-300`}),t(`sessionsEmpty`)]}):E.map(e=>{let t=v.get(e.key);return t?(0,V.jsx)(Z,{session:e,summary:t,channelLabel:X(Y(e.key)),isSelected:k===e.key,onSelect:()=>a(e.key)},e.key):null})})]}),(0,V.jsx)(q,{sessionKey:k,session:A,summary:j,channelLabel:L,onClearSelection:()=>a(null)})]})]})}export{Q as SessionsConfig};
|
package/ui-dist/index.html
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
})();
|
|
79
79
|
</script>
|
|
80
80
|
<title>NextClaw</title>
|
|
81
|
-
<script type="module" crossorigin src="/assets/index-
|
|
81
|
+
<script type="module" crossorigin src="/assets/index-CAYF44Dz.js"></script>
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/i18n-BnNAQpVM.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/api-C51456xV.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/es2015-BlNhrQUG.js">
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
<link rel="modulepreload" crossorigin href="/assets/use-viewport-layout-D-pjxsyz.js">
|
|
110
110
|
<link rel="modulepreload" crossorigin href="/assets/logo-badge-uB4SwANR.js">
|
|
111
111
|
<link rel="modulepreload" crossorigin href="/assets/skeleton-5Mg6vZHN.js">
|
|
112
|
-
<link rel="modulepreload" crossorigin href="/assets/chat-
|
|
112
|
+
<link rel="modulepreload" crossorigin href="/assets/chat-BxA-mw53.js">
|
|
113
113
|
<link rel="modulepreload" crossorigin href="/assets/key-round-BQXmPSxD.js">
|
|
114
114
|
<link rel="modulepreload" crossorigin href="/assets/message-square-CLVODA23.js">
|
|
115
115
|
<link rel="modulepreload" crossorigin href="/assets/app-navigation.config-Dve1W20Y.js">
|