@lacneu/atrium 0.101.3 → 0.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-JmFp20Kp.js +1 -0
- package/dist/assets/AdminSettings-B8n1yLsD.js +1 -0
- package/dist/assets/AdvancedFilter-Bb66m5kb.js +1 -0
- package/dist/assets/AgentFilesTab-C3CUT4Ep.js +3 -0
- package/dist/assets/AnomaliesTab-BQ2Bu98W.js +1 -0
- package/dist/assets/AuditTab-BV-XydO_.js +1 -0
- package/dist/assets/BridgeTab-D4RFq-Rb.js +1 -0
- package/dist/assets/ChatDefaultsTab-D0d9yEow.js +1 -0
- package/dist/assets/ConfirmDialog-BXcki0Ee.js +1 -0
- package/dist/assets/DataTableShell-DRFFBx_j.js +1 -0
- package/dist/assets/DeletedChatsTab-COYSFkNf.js +1 -0
- package/dist/assets/DetailChips-Cv1sxdhU.js +1 -0
- package/dist/assets/EntitySheet-B2B48bss.js +1 -0
- package/dist/assets/FeedbacksTab-6URuFdfg.js +1 -0
- package/dist/assets/FieldLabel-Tea3wyVe.js +1 -0
- package/dist/assets/FilesTab-esMtHJXt.js +1 -0
- package/dist/assets/FilterBar-DTVwlDpF.js +1 -0
- package/dist/assets/GroupsTab-Io16XZHz.js +1 -0
- package/dist/assets/InstancesTab-BevtM68H.js +1 -0
- package/dist/assets/IntegrationsTab-DMY6VTUC.js +1 -0
- package/dist/assets/KnobRow-BsOT2O6U.js +1 -0
- package/dist/assets/KpiTab-KPPcgUxA.js +1 -0
- package/dist/assets/PreferencesTab-DJ9p401L.js +1 -0
- package/dist/assets/ProjectPage-BxEF71jN.js +1 -0
- package/dist/assets/PromptInjectionsTab-Vdb1lF36.js +4 -0
- package/dist/assets/RolesTab-DU0g4d-R.js +1 -0
- package/dist/assets/ScheduledTab-B6gWc0HN.js +1 -0
- package/dist/assets/ServiceAccountsTab-Dmb_LH0V.js +1 -0
- package/dist/assets/SubAgentReportsTab-D9rclslo.js +1 -0
- package/dist/assets/ThemeShowroom-N4qzUtlq.js +1 -0
- package/dist/assets/TimeRangePicker-D3PJq1H8.js +1 -0
- package/dist/assets/TimezoneCombobox-CPTpWNQm.js +1 -0
- package/dist/assets/TracesTab-DiAkOmei.js +1 -0
- package/dist/assets/TrashTab-BMSJ7ANC.js +1 -0
- package/dist/assets/UsersTab-BQaLsUCK.js +1 -0
- package/dist/assets/VoiceTab-BSh-05Ze.js +1 -0
- package/dist/assets/alert-dialog-BoEv1f8g.js +7 -0
- package/dist/assets/api-DSJJn0d7.js +44 -0
- package/dist/assets/appHost-CH3EGcJw.js +1 -0
- package/dist/assets/badge-C4po8DQ1.js +1 -0
- package/dist/assets/{button-HksxbiUF.js → button-Dio0PVrp.js} +1 -1
- package/dist/assets/capabilities-BTqhMVxR.js +1 -0
- package/dist/assets/{card-BS-Ukkxw.js → card-CerX9wDn.js} +1 -1
- package/dist/assets/check-DmQzfrws.js +1 -0
- package/dist/assets/checkbox-CsI4ggnp.js +1 -0
- package/dist/assets/chevron-left-DQ9FCoo_.js +1 -0
- package/dist/assets/chevron-right-C_b_y922.js +1 -0
- package/dist/assets/chevron-up-Dsqj2Oaj.js +1 -0
- package/dist/assets/chevrons-up-down-Pva00Np5.js +1 -0
- package/dist/assets/chunk-7TTQLYRW-ByhoRIPY.js +156 -0
- package/dist/assets/{compatView-BmFG4Q3R.js → compatView--1YlftIc.js} +1 -1
- package/dist/assets/convexApi-CyScjgcq.js +1 -0
- package/dist/assets/copy-BaUCUMp2.js +1 -0
- package/dist/assets/cronDescribe-CAuRX7uW.js +1 -0
- package/dist/assets/deliveryRecorder-C7NQZrrH.js +2 -0
- package/dist/assets/dialog-BfrsWZiD.js +1 -0
- package/dist/assets/dispatchErrorInfo-Bb7JyJFO.js +1 -0
- package/dist/assets/dist-ChrIV8UV.js +1 -0
- package/dist/assets/{dist-DjxjpzgS.js → dist-CkbybbG7.js} +1 -1
- package/dist/assets/dist-ClkJChBn.js +1 -0
- package/dist/assets/dist-Cw3aN_jM.js +1 -0
- package/dist/assets/{dist-BDjijy9l.js → dist-D-RIDSJc.js} +1 -1
- package/dist/assets/dist-D7doQlva.js +1 -0
- package/dist/assets/dist-DDCmobc1.js +1 -0
- package/dist/assets/download-DWgC7zCa.js +1 -0
- package/dist/assets/dropdown-menu-DHMOOlaP.js +1 -0
- package/dist/assets/eye-B-ipuYEd.js +1 -0
- package/dist/assets/fileMetaView-Ci5C4w9Q.js +1 -0
- package/dist/assets/format-DGKgJf2p.js +1 -0
- package/dist/assets/groupManageView-BMBqgRhV.js +1 -0
- package/dist/assets/highlighted-body-JLMTFACH-3FraDdGA.js +1 -0
- package/dist/assets/index-D6RuTaB7.css +1 -0
- package/dist/assets/index-DQC7YnEQ.js +158 -0
- package/dist/assets/input-BSpTsBA6.js +1 -0
- package/dist/assets/{list-DnhyuzZ4.js → list-eSch39T9.js} +1 -1
- package/dist/assets/loader-circle-BNhIFGdg.js +1 -0
- package/dist/assets/lock-0lxfSnTE.js +1 -0
- package/dist/assets/mermaid-WFAXDIZX-DpR3_BmG.js +1 -0
- package/dist/assets/pdf-EQHMWEbX.js +54 -0
- package/dist/assets/pencil-aUWxuLhy.js +1 -0
- package/dist/assets/plus-Djbdyc2E.js +1 -0
- package/dist/assets/popover-DBaIbsBr.js +1 -0
- package/dist/assets/preload-helper-Czpn1I53.js +1 -0
- package/dist/assets/roleDescriptions-x3mUxTcX.js +1 -0
- package/dist/assets/rotate-ccw-BD-9XzMC.js +1 -0
- package/dist/assets/search-BK6bzZNi.js +1 -0
- package/dist/assets/searchSchemas-CS2ZgsHC.js +64 -0
- package/dist/assets/select-qM3ZfTHx.js +1 -0
- package/dist/assets/server-DLnWqkX-.js +1 -0
- package/dist/assets/speech-CrNma2Ue.js +1 -0
- package/dist/assets/star-CM6J2w_J.js +1 -0
- package/dist/assets/{table-CwhkOFwK.js → table-D2SJC960.js} +1 -1
- package/dist/assets/tabs-mZfLmn2f.js +1 -0
- package/dist/assets/toast-xNFwDnUy.js +1 -0
- package/dist/assets/tooltip-v_AyOWn6.js +87 -0
- package/dist/assets/trash-2-B4WSfc7G.js +1 -0
- package/dist/assets/trashPage-WtAhGCt7.js +1 -0
- package/dist/assets/trashView-Ct0Xw-a9.js +1 -0
- package/dist/assets/triangle-alert-BkDa-x8g.js +1 -0
- package/dist/assets/usageView-C9Y6E0Zu.js +1 -0
- package/dist/assets/useChart-CKFEN42T.js +1 -0
- package/dist/assets/useFontScale-ByBFat3y.js +1 -0
- package/dist/assets/useNavigate-D3GIoxyW.js +1 -0
- package/dist/assets/useStartNewChat-BszDHUjD.js +5 -0
- package/dist/assets/useStartNewChat-DgQf_3y0.css +1 -0
- package/dist/assets/{use_paginated_query-BKOSBoa7.js → use_paginated_query-CQj09xXv.js} +1 -1
- package/dist/assets/users-BJqaWlH1.js +1 -0
- package/dist/assets/x-CK8d5DC1.js +1 -0
- package/dist/index.html +64 -9
- package/package.json +2 -2
- package/dist/assets/AccessTab-DwQXs7Qd.js +0 -1
- package/dist/assets/AdvancedFilter-BmALfXnB.js +0 -1
- package/dist/assets/AgentFilesTab-BXBJmeSc.js +0 -3
- package/dist/assets/AnomaliesTab-CofoaMkF.js +0 -1
- package/dist/assets/AuditTab-XWQHKIp_.js +0 -1
- package/dist/assets/BridgeTab-BUFvmr2d.js +0 -1
- package/dist/assets/ChatDefaultsTab-Dmd6QOKm.js +0 -1
- package/dist/assets/DataTableShell-BYSvf6VZ.js +0 -1
- package/dist/assets/DeletedChatsTab-C_hfpRhG.js +0 -1
- package/dist/assets/DetailChips-DUlvwews.js +0 -1
- package/dist/assets/FeedbacksTab-DXelU8Ru.js +0 -1
- package/dist/assets/FieldLabel-CcWGFs5F.js +0 -1
- package/dist/assets/FilesTab-DkcqLbSs.js +0 -1
- package/dist/assets/FilterBar-BgVXfm-6.js +0 -1
- package/dist/assets/GroupsTab-I7HSSXyG.js +0 -1
- package/dist/assets/InstancesTab-CQwASkfp.js +0 -1
- package/dist/assets/IntegrationsTab-C2ZW4PH-.js +0 -1
- package/dist/assets/KpiTab-LgHgVxRb.js +0 -1
- package/dist/assets/PreferencesTab-BH7-p_lT.js +0 -1
- package/dist/assets/ProjectPage-Bl8fhfx1.js +0 -1
- package/dist/assets/PromptInjectionsTab-BIURoP_R.js +0 -4
- package/dist/assets/RolesTab-Baw2YHq3.js +0 -1
- package/dist/assets/ScheduledTab-DORhocyn.js +0 -1
- package/dist/assets/ServiceAccountsTab-UmjjOrwp.js +0 -1
- package/dist/assets/SubAgentReportsTab-cm_UrpNl.js +0 -1
- package/dist/assets/ThemeShowroom-CFTzDqq9.js +0 -1
- package/dist/assets/TimeRangePicker-CSLm7VwE.js +0 -1
- package/dist/assets/TimezoneCombobox-ObUCuHhu.js +0 -1
- package/dist/assets/TracesTab-BhR-6Ixe.js +0 -1
- package/dist/assets/TrashTab-BZUmrLBK.js +0 -1
- package/dist/assets/UsersTab-Cxo_mjSa.js +0 -1
- package/dist/assets/VoiceTab-BP_6mdHw.js +0 -1
- package/dist/assets/api--rqKQo-l.js +0 -44
- package/dist/assets/chevrons-up-down-4c0Fo5uU.js +0 -1
- package/dist/assets/dispatchErrorInfo-CW3gRHkP.js +0 -1
- package/dist/assets/dist-e05Gnyj5.js +0 -1
- package/dist/assets/dist-lcVkVTM0.js +0 -1
- package/dist/assets/highlighted-body-OFNGDK62-DAKnlLPW.js +0 -1
- package/dist/assets/index-DEccjMsV.css +0 -1
- package/dist/assets/index-l7elBM2O.js +0 -447
- package/dist/assets/mermaid-GHXKKRXX-CvLURkTf.js +0 -1
- package/dist/assets/pdf-CgxfnVev.js +0 -54
- package/dist/assets/roleDescriptions-Csn1bSUI.js +0 -1
- package/dist/assets/trashPage-DgXB4jOM.js +0 -1
- package/dist/assets/x-C5eyKPkE.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BX as r,Bx as i,Fx as a,Gx as o,Hx as s,Ix as c,Kx as l,Lx as u,Mx as d,Nx as f,Px as p,Rx as m,Ux as h,Vx as g,Wx as _,XX as v,t as y,zx as b}from"./api-DSJJn0d7.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-qM3ZfTHx.js";import"./convexApi-CyScjgcq.js";import{t as E}from"./badge-C4po8DQ1.js";var D=t(e(),1);function O(e){return e===`user`?c():e===`all`?a():p({group:e.group})}function k(e){return e===`common`?f():e===`owner`?d():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=v(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=v(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":o(),children:(0,A.jsx)(x,{placeholder:o()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(w,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(E,{variant:`default`,children:u()}):null,(0,A.jsx)(E,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(E,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:i()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(E,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$x as e,Ch as t,FE as n,Jx as r,NX as i,PE as a,Qx as o,TY as s,V_ as c,Xx as l,Yk as u,Yx as d,Zx as f,aS as p,cX as m,eS as h,fu as g,iS as _,nS as v,pq as y,qx as b,rS as x,tS as S,vv as C}from"./api-DSJJn0d7.js";var w=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`,`trash`,`deletedChats`],T=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`,`trash`,`deletedChats`],E={users:()=>p(),groups:()=>r(),instances:()=>_(),bridge:()=>x(),injections:()=>u(),serviceAccounts:()=>v(),roles:()=>S(),access:()=>b(),traces:()=>h(),kpi:()=>e(),anomalies:()=>o(),files:()=>m(),scheduled:()=>s(),agentFiles:()=>C(),preferences:()=>i(),integrations:()=>f(),theme:()=>y(),chatDefaults:()=>c(),audit:()=>l(),feedbacks:()=>d(),subagentReports:()=>t(),voice:()=>g(),trash:()=>n(),deletedChats:()=>a()},D={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`,trash:`admin.manage`,deletedChats:`chats.read`},O=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k(e){let t=new Set(e);return w.filter(e=>t.has(D[e]))}function A(e){return`/settings/${e}`}function j(e){let t=e.split(`/`)[2];return w.includes(t)?t:void 0}var M={uiprefs:`preferences`};export{E as a,j as c,w as i,k as l,T as n,D as o,M as r,A as s,O as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_w as r,dw as i,fw as a,gw as o,hw as s,mw as c,pw as l}from"./api-DSJJn0d7.js";import{r as u}from"./dist-ClkJChBn.js";import{t as d}from"./plus-Djbdyc2E.js";import{t as f}from"./x-CK8d5DC1.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-qM3ZfTHx.js";import{t as v}from"./button-Dio0PVrp.js";import{t as y}from"./input-BSpTsBA6.js";import{r as b}from"./TimeRangePicker-D3PJq1H8.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:c()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(v,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(d,{}),i()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,Af as i,BX as a,Bf as o,Df as s,Ef as c,Ff as l,G_ as u,Gf as d,HX as f,H_ as p,Hf as m,If as h,J_ as g,K_ as _,Lf as v,Mf as y,Nf as b,Of as x,Pf as S,Q_ as C,Rf as w,Tf as T,U_ as E,Uf as D,Vf as O,W_ as k,Wf as A,XX as j,X_ as M,YX as N,Y_ as P,ZV as F,Z_ as I,_v as L,af as R,av as ee,cf as z,cv as te,dv as B,ev as V,fv as H,gv as ne,hv as re,if as U,iv as ie,jf as ae,kf as oe,ks as se,lf as ce,lv as le,mv as ue,nv as de,of as fe,ov as pe,pv as me,qX as W,q_ as he,rf as ge,rv as _e,ry as G,sf as ve,sv as ye,t as K,tv as be,ty as xe,uv as Se,zf as Ce}from"./api-DSJJn0d7.js";import{t as q}from"./triangle-alert-BkDa-x8g.js";import{a as we,i as Te,n as Ee,r as De,t as Oe}from"./select-qM3ZfTHx.js";import{a as ke,c as Ae,i as je,n as Me,o as Ne,r as Pe,s as Fe,t as Ie}from"./alert-dialog-BoEv1f8g.js";import{t as J}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{r as Y}from"./toast-xNFwDnUy.js";import{t as Le}from"./badge-C4po8DQ1.js";import{a as Re,n as ze,o as Be,r as Ve,t as He}from"./dialog-BfrsWZiD.js";import{t as Ue}from"./appHost-CH3EGcJw.js";import{n as We}from"./capabilities-BTqhMVxR.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView--1YlftIc.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
+
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=j(K.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=j(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&s(r[0].name)},[t,r,i]);let c=j(K.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),l=j(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return i===null||c===void 0?r!==void 0&&r.length===0?[]:void 0:c.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,c,r,l]),[d,p]=(0,X.useState)(null);(0,X.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&p($(u[0]))},[u,d]);let h=u?.find(e=>$(e)===d)??null,g=W(K.agentFiles.listAgentFiles),[_,v]=(0,X.useState)({status:`idle`}),y=h?.instanceName??null,b=h?.agentId??null,x=j(K.compat.forInstance,n&&y!==null?{instanceName:y}:`skip`),S=n&&y!==null?We(x,`agentFiles`):null,C=S===null?!1:S===`loading`?null:S.blocked,w=(0,X.useCallback)(async()=>{if(!(y===null||b===null)){v({status:`loading`});try{let e=await g({instanceName:y,agentId:b});v({status:`done`,files:e.files})}catch(e){v({status:`error`,dashboardAbsent:tt(e)})}}},[g,y,b]);(0,X.useEffect)(()=>{C===!1&&w()},[w,C]);let[T,E]=(0,X.useState)(null),D=j(K.agentFileCuration.listCurations,t&&y!==null&&b!==null?{instanceName:y,agentId:b}:`skip`),k=j(K.agentFileCuration.curationSettings,t&&y!==null?{instanceName:y}:`skip`),A=W(K.agentFileCuration.requestCuration),[M,N]=(0,X.useState)(null),[P,F]=(0,X.useState)(null),{toast:I}=Y(),R=(0,X.useMemo)(()=>{let e=new Map;for(let t of D??[])e.has(t.name)||e.set(t.name,t);return e},[D]),z=(0,X.useCallback)(async e=>{if(!(y===null||b===null)){N(e);try{let t=await A({instanceName:y,agentId:b,name:e,trigger:`manual`});t.ok?I({title:m(),variant:`success`}):I({title:O({reason:t.reason??`unknown`}),variant:`error`})}catch{I({title:o(),variant:`error`})}finally{N(null)}}},[A,y,b,I]),V=f(),U=(0,X.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:L()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Oe,{value:i??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":ne(),children:(0,Q.jsx)(we,{})}),(0,Q.jsx)(Ee,{children:(r??[]).map(e=>(0,Q.jsx)(De,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Oe,{value:d??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":re(),children:(0,Q.jsx)(we,{})}),(0,Q.jsx)(Ee,{children:u.map(e=>(0,Q.jsx)(De,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()})]}),h===null?null:S===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):S!==null&&S.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(S.gatewayVersion,S.provider)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_.dashboardAbsent?se():H(),` `,!_.dashboardAbsent&&(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:xe()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Le,{variant:`outline`,children:B()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:Se({size:Z(e.size,V)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:le({pct:U.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":te()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>E(e),children:t?pe():ee()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:k?.budgetChars??null,enabled:k?.enabled??!1,curation:R.get(e.name)??null,inFlight:M===e.name,onCurate:()=>void z(e.name),onReview:e=>F(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ye({used:Z(Qe(_.files),V),total:Z(Ye,V),pct:U.format(Ze(Qe(_.files)))})})]}),T&&h?(0,Q.jsx)(at,{instanceName:h.instanceName,agentId:h.agentId,name:T.name,isAdmin:t,onClose:()=>E(null),onSaved:()=>void w()}):null,P?(0,Q.jsx)(ot,{curationId:P,onClose:()=>F(null),onApplied:()=>{F(null),w()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(J,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:A()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Le,{variant:`outline`,className:`oc-afiles__curate-status`,children:D()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:d()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:o,onSaved:s}){let c=W(K.agentFiles.getAgentFile),l=W(K.agentFiles.setAgentFile),d=Y(),[m,h]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(``),[S,w]=(0,X.useState)(!1),[T,D]=(0,X.useState)(!1),[O,A]=(0,X.useState)(!1),[j,N]=(0,X.useState)(!1),L=(0,X.useCallback)(async r=>{y(!1);try{let i=await c({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),A(!1)}catch{y(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{L(!1)},[L]);async function R(){if(m!==null){D(!0),N(!1);try{await l({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:m.updatedAtMs??void 0}),d.success(C({name:n})),s(),await L(!1)}catch(e){nt(e)?A(!0):N(!0)}finally{D(!1)}}}let ee=m!==null&&b!==m.content,z=(0,X.useMemo)(()=>m===null?null:et(m.content,b),[m,b]),te=b.length>Je,B=f(),H=(0,X.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(ze,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Be,{children:ie({name:n})}),(0,Q.jsxs)(Ve,{children:[_e({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,de()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[M(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:xe()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:b,readOnly:!i,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":ie({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:be()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[P(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:g()})]}):null,j?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:I()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${te?` is-over`:``}`,children:V({count:H.format(b.length),max:H.format(Je)})}),i?(0,Q.jsx)(J,{size:`sm`,disabled:!ee||T||O,onClick:()=>w(!0),children:T?G():r()}):null]})]}),(0,Q.jsx)(Ie,{open:S,onOpenChange:w,children:(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(Ae,{children:he({name:n})}),(0,Q.jsx)(ke,{children:_({agent:t})})]}),z?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:u({added:z.added,removed:z.removed})}),z.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:k()}),z.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,z.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),z.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Pe,{children:F()}),(0,Q.jsx)(Me,{onClick:()=>void R(),children:p()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=j(K.agentFileCuration.getProposal,{curationId:e}),u=W(K.agentFileCuration.approveCuration),d=N(K.agentFileCuration.rejectCuration),{toast:p}=Y(),[m,g]=(0,X.useState)(null),[_,C]=(0,X.useState)(!1),[E,D]=(0,X.useState)(``),O=f(),k=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function A(){g(`approve`);try{let t=await u({curationId:e});t.ok?(p({title:Ce(),variant:`success`}),n()):p({title:t.reason===`conflict`?v():h({reason:t.reason??`unknown`}),variant:`error`})}catch{p({title:o(),variant:`error`})}finally{g(null)}}async function M(n){g(`reject`);try{let r=E.trim();(await d({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?p({title:n?U():w(),variant:`success`}):p({title:b(),variant:`error`}),t()}catch{p({title:o(),variant:`error`})}finally{g(null)}}return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(ze,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Be,{children:r?l({name:r.name}):a()}),(0,Q.jsx)(Ve,{children:S()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[y({before:Z(r.beforeSize,O),after:Z(r.proposedSize,O)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,ae()]}):null]}),k?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:i({added:k.added,removed:k.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ge({feedback:r.feedback})}):null,k&&k.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:T()}),(0,Q.jsx)(`ul`,{children:k.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:c()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:oe()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),_?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:ce()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:z(),value:E,onChange:e=>D(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>C(!1),disabled:m!==null,children:ve()}),(0,Q.jsx)(J,{variant:`outline`,onClick:()=>void M(!1),disabled:m!==null,children:m===`reject`?G():fe()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void M(!0),disabled:m!==null,children:m===`reject`?G():R()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>C(!0),disabled:m!==null||r==null,children:x()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void A(),disabled:m!==null||r==null,children:m===`approve`?G():s()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,BM as i,CN as a,DN as o,EN as s,FM as c,GM as ee,HM as te,IM as l,JM as u,KM as ne,LM as d,NM as f,ON as p,PM as m,QM as h,RM as g,SN as re,TN as ie,UM as ae,VM as oe,WM as se,XM as ce,XX as _,YM as le,YX as ue,ZM as de,_N as fe,aN as v,bN as pe,cN as me,dN as he,eN as y,fN as ge,gN as _e,hN as ve,iN as ye,lN as be,mN as xe,nN as Se,oN as Ce,pN as we,qM as b,rN as x,sN as S,t as C,tN as w,uN as T,vN as E,wN as D,xN as O,yN as k,zM as A}from"./api-DSJJn0d7.js";import{n as Te,t as j}from"./useNavigate-D3GIoxyW.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-qM3ZfTHx.js";import"./convexApi-CyScjgcq.js";import{r as Ee}from"./toast-xNFwDnUy.js";import{t as L}from"./badge-C4po8DQ1.js";import{n as R}from"./format-DGKgJf2p.js";import{a as z,n as B,o as V,t as H}from"./dialog-BfrsWZiD.js";import{c as De,o as Oe}from"./searchSchemas-CS2ZgsHC.js";import{t as ke}from"./appHost-CH3EGcJw.js";import{n as Ae}from"./ConfirmDialog-BXcki0Ee.js";import{n as je}from"./TimeRangePicker-D3PJq1H8.js";import{t as Me}from"./FilterBar-DTVwlDpF.js";import{t as Ne}from"./DataTableShell-DRFFBx_j.js";import{t as U}from"./dispatchErrorInfo-Bb7JyJFO.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?p():e===`acknowledged`?o():s()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],Re={kind:`relative`,from:`now-30d`,to:`now`},ze=200,X=`all`;function Z(){let e=Te({from:`/settings/anomalies`}),t=j({from:`/settings/anomalies`}),n=e.q??``,i=e.status===X?Y:e.status,o=e.severity??Y,s=e.kind??Y,[c,l]=(0,W.useState)(Y),d=Oe(e.from,e.to),{from:f,to:p}=je(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),g=e=>void t({search:t=>({...t,status:e===Y?X:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),B=e=>void t({search:t=>({...t,...De(e)})}),V=Ae(),H=Ee(),U=ue(C.anomalies.resolveAnomaly),G=(_(C.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),K=_(C.anomalies.listAnomalies,{limit:ze,filter:{q:n||void 0,from:f,to:p,anomalyStatus:i===Y?void 0:i,severity:o===Y?void 0:o,source:c===Y?void 0:c,kind:s===Y?void 0:s}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Z=n!==``||i!==`open`||o!==Y||c!==Y||s!==Y||d.kind!==`relative`||d.from!==Re.from;function Q(){l(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:ie(),description:(0,J.jsxs)(J.Fragment,{children:[D(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,a(),` `,(0,J.jsx)(`strong`,{children:re()}),`.`,` `,O()]}),confirmLabel:pe()}))try{await U({anomalyId:e._id,status:`resolved`}),H.success(k(),e.kind)}catch(e){H.error(E(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),H.success(fe(),e.kind)}catch(e){H.error(_e(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ve(),` `,(0,J.jsx)(`strong`,{children:xe()}),` `,we(),` `,(0,J.jsx)(`strong`,{children:ge()}),` `,he(),` `,(0,J.jsx)(`strong`,{children:T()}),` `,be(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:me()})]}),(0,J.jsxs)(Me,{q:n,onQChange:m,searchPlaceholder:S(),timeRange:d,onTimeRangeChange:B,onReset:Q,canReset:Z,children:[(0,J.jsxs)(I,{value:i,onValueChange:g,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:Ce()}),Pe.map(e=>(0,J.jsx)(F,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:o,onValueChange:A,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:v()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:w()}),Ie.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:c,onValueChange:l,children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(M,{placeholder:y()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:r()}),Le.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:s,onValueChange:z,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:h()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:de()}),q.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:ce(),rows:K,emptyHint:i===`open`?le():u(),rowActions:e=>G&&e.status===`open`?[{label:b(),onSelect:()=>void We(e)},{label:ne(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ee(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)}),sort:e=>e.at},{header:h(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ye(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:Se({when:R(e.firstAt)}),children:x({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:v(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:se(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:y(),cell:e=>(0,J.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ae(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:te(),cell:e=>(0,J.jsx)($,{row:e}),sort:e=>e.evidence??null},{header:oe(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function $({row:e}){let t=j();if(e.kind===`subagent.failure`){let n=Q(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,i()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,i()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),a=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),a?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:a,limit:100}}),children:[`↗ `,i()]}):null]})}function Be({row:e}){let[t,n]=(0,W.useState)(!1),r=_(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[A(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(H,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(z,{children:(0,J.jsx)(V,{children:g()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:l()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(L,{variant:`destructive`,children:c()}):e===`acknowledged`?(0,J.jsx)(L,{variant:`secondary`,children:m()}):(0,J.jsx)(L,{variant:`outline`,children:f()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,AP as i,CP as a,DP as o,EP as s,Ju as c,MP as l,NP as u,OP as d,PP as f,Qu as p,SP as m,TP as h,XX as g,Xu as _,Yu as v,Zu as y,bP as b,jP as x,kP as S,t as C,wP as w,xP as T}from"./api-DSJJn0d7.js";import{n as E,t as D}from"./useNavigate-D3GIoxyW.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-qM3ZfTHx.js";import"./convexApi-CyScjgcq.js";import{n as N}from"./format-DGKgJf2p.js";import{c as P,o as F,s as I,t as L,u as R}from"./searchSchemas-CS2ZgsHC.js";import{n as ee}from"./TimeRangePicker-D3PJq1H8.js";import{t as z}from"./FilterBar-DTVwlDpF.js";import{t as B}from"./AdvancedFilter-Bb66m5kb.js";import{t as V}from"./DataTableShell-DRFFBx_j.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:r()},{value:`realLabel`,label:p()},{value:`targetLabel`,label:y()},{value:`impersonated`,label:_()},{value:`resource`,label:v()},{value:`resourceId`,label:c()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,c=e.impersonated??G,p=e.resource??G,_=F(e.from,e.to),v=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:y,to:L}=ee(_),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:I(e)}),replace:!0}),$=g(C.admin.listAudit,{filter:{q:n||void 0,from:y,to:L,action:r===G?void 0:r,resource:p===G?void 0:p,impersonated:c===G?void 0:c===`yes`,advanced:v.length>0?v:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||c!==G||p!==G||v.length>0||_.kind!==`relative`||_.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:l(),timeRange:_,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:r,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:x()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:i()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:c,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:S()}),(0,U.jsx)(j,{value:`yes`,children:d()}),(0,U.jsx)(j,{value:`no`,children:o()})]})]}),(0,U.jsxs)(M,{value:p,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:s()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:h()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:v,onChange:Q}),(0,U.jsx)(V,{title:w(),rows:$,emptyHint:a(),columns:[{header:m(),cell:e=>N(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:T(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:b(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AA as i,A_ as a,Ak as o,As as s,Bk as c,CA as l,C_ as u,Ck as d,DA as f,D_ as p,Dk as m,E as h,EA as ee,E_ as g,Ek as _,Fk as te,Gk as ne,Hk as re,Ik as ie,Jk as ae,Kk as oe,Lk as v,Mk as y,Nk as se,O_ as ce,Ok as le,Pk as ue,QO as de,Rk as fe,SA as pe,S_ as me,Sk as he,Su as ge,TA as _e,T_ as ve,Tk as b,Uk as ye,Vk as be,Wk as xe,XO as Se,XX as x,YX as Ce,ZO as S,_A as we,_k as Te,_u as Ee,ak as De,bA as Oe,b_ as ke,bk as Ae,ck as je,dk as Me,ek as Ne,fk as Pe,gA as Fe,gk as Ie,gu as Le,hk as Re,hu as ze,ik as Be,j_ as Ve,jk as He,kA as Ue,k_ as We,kk as Ge,lk as Ke,mk as qe,nk as Je,ok as Ye,oo as Xe,p_ as Ze,pk as Qe,qX as $e,qk as et,rk as tt,sk as nt,t as C,tk as rt,uk as w,vk as it,vu as at,wA as ot,w_ as st,wk as ct,xA as lt,x_ as ut,xk as dt,y_ as ft,yk as pt,yu as mt,zk as ht}from"./api-DSJJn0d7.js";import{i as gt,n as T,o as _t,r as vt,s as yt}from"./FieldLabel-Tea3wyVe.js";import{n as bt,t as E}from"./useNavigate-D3GIoxyW.js";import{r as D}from"./dist-ClkJChBn.js";import{t as O}from"./chevron-right-C_b_y922.js";import{t as xt}from"./chevron-up-Dsqj2Oaj.js";import{t as St}from"./chevrons-up-down-Pva00Np5.js";import{n as Ct,t as wt}from"./usageView-C9Y6E0Zu.js";import{t as Tt}from"./loader-circle-BNhIFGdg.js";import{t as Et}from"./checkbox-CsI4ggnp.js";import{t as Dt}from"./server-DLnWqkX-.js";import{t as k}from"./triangle-alert-BkDa-x8g.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-qM3ZfTHx.js";import{i as Ot,n as kt,r as At,t as jt}from"./tabs-mZfLmn2f.js";import{n as Mt,r as Nt,t as Pt}from"./popover-DBaIbsBr.js";import{t as Ft}from"./button-Dio0PVrp.js";import{t as F}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as It}from"./toast-xNFwDnUy.js";import{t as I}from"./badge-C4po8DQ1.js";import{a as L,n as R}from"./format-DGKgJf2p.js";import{a as Lt,n as Rt,o as zt,r as Bt,t as Vt}from"./dialog-BfrsWZiD.js";import{t as Ht}from"./appHost-CH3EGcJw.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as z,i as B,n as V,o as H,r as U,t as Wt}from"./table-D2SJC960.js";import{t as Gt}from"./FilterBar-DTVwlDpF.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView--1YlftIc.js";import{t as W}from"./dispatchErrorInfo-Bb7JyJFO.js";var $t=h(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=h(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:Me(),onReset:()=>i(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:Ke()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(A,{placeholder:je()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:nt()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:De(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Be(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:tt(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Je(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:rt(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(B,{children:Ne()}),(0,Z.jsx)(Q,{label:r(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(V,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(St,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Qe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:L(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${L(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${L(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Pe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${L(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?de():e===`error`?S():Se()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(I,{variant:`secondary`,children:de()}):e===`error`?(0,Z.jsx)(I,{variant:`destructive`,children:S()}):(0,Z.jsx)(I,{variant:`outline`,children:Se()})}function wn(){return x(C.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=x(C.compat.getBridgeCompat,{}),n=x(C.me.getMe,{host:Ht})?.role===`admin`,r=x(C.admin.listInstances,n?{}:`skip`),i=x(C.agents.usageForInstances,n?{}:`skip`),a=E(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=bt({from:`/settings/bridge`}),l=E({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ue()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:se()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{children:mt()}),(0,Z.jsx)(B,{children:at()}),(0,Z.jsx)(B,{children:Ee()}),(0,Z.jsx)(B,{children:Le()}),(0,Z.jsx)(B,{children:ze()})]})}),(0,Z.jsx)(V,{children:i.flatMap(e=>{let t=wt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(I,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(jt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(At,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(Ot,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Dt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(kt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:We(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ce({build:t.buildVersion??`?`})]}):null,` · `,p(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?g():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ct()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,f=R(e.checkedAt),m=e.startedAt==null?null:R(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(Ct,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(k,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?d():c===`gateways_unreachable`?pt({count:l.length}):s?he():dt({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,Ae({time:f})]}),m?(0,Z.jsx)(`span`,{children:Te({time:m})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:it({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ie()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Dt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(I,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ve()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),Re({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[y(),i.length>0?(0,Z.jsx)(I,{variant:`destructive`,children:o({count:i.length})}):a>0?(0,Z.jsx)(I,{variant:`destructive`,children:Ge()}):(0,Z.jsx)(I,{variant:`secondary`,children:He()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[le({version:e.vendoredVersion}),r?` · `+m({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),_({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ge({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:u({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:g()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(I,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Vt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Lt,{children:[(0,Z.jsx)(zt,{children:i({instance:e.displayName??e.name})}),(0,Z.jsx)(Bt,{children:Ue()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ct,{"aria-hidden":!0}):(0,Z.jsx)(k,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?fe():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,v()]}):null}function jn({instance:e,onClose:t}){let n=Ce(C.admin.upsertInstanceConfig),r=$e(C.bridge.validateMediaPaths),i=It(),a=Ut(e.config?.contentLocale,void 0),[o,s]=(0,G.useState)(()=>gt(e.config??{},a)),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,y=_||v;async function se(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(re(),e)}finally{m(!1)}}async function ce(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(o,r,a)}),t()}catch(e){i.error(pe(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:f(),help:lt()}),(0,Z.jsxs)(P,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:yt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ee(),help:Oe()}),(0,Z.jsxs)(P,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:_t.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:_e(),help:we()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ae(),help:et()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:oe(),help:ne()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(T,{label:ot(),help:Fe()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),te({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:c(),result:h.inbound}),(0,Z.jsx)($,{label:ht(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),ie()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(Ft,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:p,children:[p?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ye():xe()]}),(0,Z.jsx)(Ft,{size:`sm`,onClick:()=>void ce(),disabled:u,children:l()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?me():ut({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Mt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ke()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(I,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{At as r,BX as i,B_ as a,Bp as o,Bt as s,Ct as c,Dt as l,Et as u,F_ as d,Ft as f,Gp as p,Hp as m,Ht as h,I_ as g,It as _,Kp as v,L_ as y,Lt as b,M_ as x,Mt as ee,N_ as S,Nt as C,OA as te,Ot as ne,P_ as w,Pt as T,R_ as re,Rp as ie,Rt as ae,St as oe,Tt as se,Up as ce,Ut as le,Vp as ue,Vt as de,Wp as E,Wt as D,XX as O,Xv as fe,YX as k,Zv as pe,bt as me,gv as A,jt as he,kt as ge,qX as j,qp as _e,ry as M,t as N,ty as ve,wt as ye,xt as P,xu as be,yt as xe,z_ as F,zp as Se,zt as Ce}from"./api-DSJJn0d7.js";import{t as we}from"./use_paginated_query-CQj09xXv.js";import{t as I}from"./checkbox-CsI4ggnp.js";import{t as Te}from"./triangle-alert-BkDa-x8g.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-qM3ZfTHx.js";import{t as H}from"./button-Dio0PVrp.js";import{t as U}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{a as Ee,t as W}from"./KnobRow-BsOT2O6U.js";import{n as De}from"./capabilities-BTqhMVxR.js";import{a as Oe}from"./compatView--1YlftIc.js";/* empty css */var G=t(e(),1),ke=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Ae(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var K=[`auto`,`hybrid`,`tool`,`off`];function je(e){switch(e){case`auto`:return de();case`hybrid`:return s();case`tool`:return Ce();default:return ae()}}function q(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function J(e){return typeof e==`string`&&K.includes(e)}function Y(e){return{injection:J(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function X(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function Me(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?C():Ne(e)?c():null:T(),i=Y(e),a=t.injection!==i.injection||!X(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:_()}}function Ne(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Pe(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Z(e){return e.ok?null:e.code===`scope_refused`?C():e.code===`stale_default`?ee():e.code===`write_unknown`||e.code===`not_confirmed`?ge():e.code===`not_applied`?ne():e.code===`default_too_large`?P():e.code===`allowlist_too_large`?oe():e.code===`plugin_too_old`?c():e.code===`source_not_allowed`?ye():e.code===`plugin_config_lag`?se():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?f():he({code:e.code})}function Q(e,t){let n=q(e),r=q(t);if(n.injection!==r.injection||!X(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let i=j(N.knowledge.setAgentKnowledgeDefault),[a,o]=(0,G.useState)(t),[s,c]=(0,G.useState)(()=>Y(t)),[l,u]=(0,G.useState)(`idle`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),g=e=>{o(e),c(Y(e)),f(null)},_=Q(a,t);(0,G.useEffect)(()=>{p&&_&&(m(!1),g(t))},[p,_]);let v=Me(a,s,n),y=v.readOnlyReason===null;async function x(){u(`saving`),f(null);try{let n=Z(await i({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:q(a)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(Z({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(V,{value:s.injection,onValueChange:e=>{J(e)&&c({...s,injection:e})},disabled:!y,children:[(0,$.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":h(),children:(0,$.jsx)(L,{})}),(0,$.jsx)(z,{children:K.map(e=>(0,$.jsx)(B,{value:e,children:je(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(I,{checked:s.sources.includes(e.id),onCheckedChange:()=>c(Pe(t,s,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),_&&!p?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[me(),` `,(0,$.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>g(t),children:xe()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),y?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(H,{size:`sm`,disabled:!v.dirty||!v.valid||l===`saving`,onClick:()=>void x(),children:l===`saving`?M():w()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:v.readOnlyReason}),y&&v.dirty&&v.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v.invalidReason}):null,l===`done`&&d===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,d===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function Ie({instanceName:e}){let t=O(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=we(N.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":D(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:T()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l({shown:n.length})}),(0,$.jsx)(H,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:u()})]}):null]})}function Le({instance:e}){let t=k(N.admin.upsertInstanceConfig),n=O(N.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,G.useState)(r),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,l=i!==r;async function u(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let d=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(V,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,$.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":E(),children:(0,$.jsx)(L,{placeholder:m()})}),(0,$.jsxs)(z,{children:[(0,$.jsx)(B,{value:c,children:m()}),d.map(e=>(0,$.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(H,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void u(),children:o===`saving`?M():w()})]}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null]})}function Re({instance:e}){let t=k(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,G.useState)(n),[s,c]=(0,G.useState)(r===null?``:String(r)),[l,u]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n),c(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let d=s.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,m=!i||f===null||Number.isInteger(f)&&f>=4e3&&f<=6e4,h=i!==n||(f??null)!==r;async function g(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||f===null||Number.isNaN(f)?delete n.curationBudgetChars:n.curationBudgetChars=f,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(I,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":p()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":ue(),disabled:!i}),(0,$.jsx)(H,{size:`sm`,disabled:!h||!m||l===`saving`,onClick:()=>void g(),children:l===`saving`?M():w()})]}),m?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}),l===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,l===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:Se()})]})}function ze({instance:e}){let t=k(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,G.useState)(n===null?``:String(n)),[a,o]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,u=(c??null)!==n;async function d(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:_e()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,$.jsx)(H,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?M():w()})]}),l?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ie()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()})]})}function Be(){let e=j(N.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=O(N.admin.listInstances,{}),[o,s]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!o||!r.some(e=>e.name===o))&&s(r[0].name)},[r,o]);let c=(r?.length??0)>1,l=r!==void 0&&r.length===0,u=O(N.compat.forInstance,o?{instanceName:o}:`skip`),f=o?De(u,`configDefaults`):`loading`,p=f===`loading`?null:f.blocked,m=(0,G.useMemo)(()=>c&&o?{instanceName:o}:{},[c,o]),h=(0,G.useRef)(0),_=(0,G.useCallback)(async()=>{let t=++h.current;n({status:`loading`});try{let r=Ae(await e(m));if(h.current!==t)return;n({status:`done`,current:r})}catch{if(h.current!==t)return;n({status:`error`})}},[e,m]);(0,G.useEffect)(()=>{p===!1&&(c&&!o||_())},[_,p,c,o]);let v=t.status===`done`?t.current:null,b=(0,G.useMemo)(()=>ke.map(e=>({id:e,label:Ee(e)})),[]),x=(0,G.useMemo)(()=>[{id:`fast`,label:pe()},{id:`standard`,label:fe()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),c&&o?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,$.jsxs)(V,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(R,{size:`sm`,"aria-label":A(),children:(0,$.jsx)(L,{})}),(0,$.jsx)(z,{children:(r??[]).map(e=>(0,$.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:te()}):f===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):f.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":!0}),` `,Oe(f.gatewayVersion,f.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[d(),` `,(0,$.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:ve()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:F()}),(0,$.jsx)(W,{field:`thinkingLevel`,options:b,value:v?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:F()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,$.jsx)(W,{field:`fastMode`,options:x,value:v===null||v.fastModeDefault===null?null:v.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:y()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:g()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:be()})]}),(()=>{let e=r?.find(e=>e.name===(o??r[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be as ChatDefaultsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gd as r,Jd as i,Kd as a,Wd as o,Yd as s,qd as c}from"./api-DSJJn0d7.js";import{a as l,c as u,i as d,o as f,r as p,s as m,t as h}from"./alert-dialog-BoEv1f8g.js";import{t as g}from"./button-Dio0PVrp.js";import{t as _}from"./input-BSpTsBA6.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-BfrsWZiD.js";var w=t(e(),1),T=n(),E=w.createContext(null);function D({children:e}){let[t,n]=w.useState(null),D=w.useRef(null),O=w.useRef(null),[k,A]=w.useState(``),j=w.useCallback(e=>{let t=D.current;D.current=null,n(null),t&&t(e)},[]),M=w.useMemo(()=>({confirm:e=>new Promise(t=>{D.current=t,A(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{D.current=t,A(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),N=t?.kind===`confirm`,P=t?.kind===`prompt`,F=t?.kind===`confirm`?t.opts.confirmWord:void 0,I=!F||k.trim().toLowerCase()===F.trim().toLowerCase(),L=k.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,R=e=>{e.preventDefault(),requestAnimationFrame(()=>O.current?.focus())};return(0,T.jsxs)(E.Provider,{value:M,children:[e,(0,T.jsx)(h,{open:N,onOpenChange:e=>{e||j(!1)},children:N?(0,T.jsxs)(d,{onOpenAutoFocus:F?R:void 0,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(u,{children:t.opts.title}),t.opts.description?(0,T.jsx)(l,{children:t.opts.description}):null]}),F?(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[a(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:o({word:F})}),` `,r()]}),(0,T.jsx)(_,{ref:O,value:k,placeholder:F,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I&&(e.preventDefault(),j(!0))}})]}):null,(0,T.jsxs)(f,{children:[(0,T.jsx)(p,{onClick:()=>j(!1),children:t.opts.cancelLabel??s()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??i()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(v,{children:[(0,T.jsx)(x,{children:t.opts.title}),t.opts.description?(0,T.jsx)(S,{children:t.opts.description}):null]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,T.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,T.jsx)(_,{ref:O,value:k,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&L&&(e.preventDefault(),j(k.trim()))}})]}),(0,T.jsxs)(y,{children:[(0,T.jsx)(g,{variant:`outline`,onClick:()=>j(null),children:t.opts.cancelLabel??s()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??c()})]})]}):null})]})}function O(){let e=w.useContext(E);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function k(){return O().confirm}function A(){return O().prompt}export{k as n,A as r,D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CC as r,DC as i,EC as a,OC as o,TC as s,kC as c,wC as l}from"./api-DSJJn0d7.js";import{r as u}from"./dist-ClkJChBn.js";import{t as d}from"./chevron-up-Dsqj2Oaj.js";import{t as f}from"./chevrons-up-down-Pva00Np5.js";import{c as p,g as m,n as h,r as g,s as _,t as v}from"./dropdown-menu-DHMOOlaP.js";import{t as y}from"./checkbox-CsI4ggnp.js";import{t as b}from"./plus-Djbdyc2E.js";import{t as x}from"./trash-2-B4WSfc7G.js";import{t as S}from"./button-Dio0PVrp.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-D2SJC960.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(S,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(S,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(y,{"aria-label":a(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(y,{"aria-label":s(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(h,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(_,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{BE as t,JE as n,VE as r,YE as i,YX as a,t as o,xj as s,zE as c}from"./api-DSJJn0d7.js";import{t as l}from"./use_paginated_query-CQj09xXv.js";import{t as u}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{n as d}from"./ConfirmDialog-BXcki0Ee.js";import{r as f}from"./trashView-Ct0Xw-a9.js";import{n as p,t as m}from"./trashPage-WtAhGCt7.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(o.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=a(o.trash.restoreChat),b=a(o.trash.purgeChat),x=a(o.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:i({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:t(),description:c(),confirmLabel:r(),destructive:!0})&&await x({})},children:r()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:n()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-C4po8DQ1.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bd as r,Vd as i,oy as a,r as o}from"./api-DSJJn0d7.js";import{t as s}from"./loader-circle-BNhIFGdg.js";import{t as c}from"./x-CK8d5DC1.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CkbybbG7.js";import{t as g}from"./button-Dio0PVrp.js";var _=t(e(),1),v=n();function y({...e}){return(0,v.jsx)(f,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-portal`,...e})}function x({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function S({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,v.jsxs)(b,{children:[(0,v.jsx)(x,{}),(0,v.jsxs)(d,{"data-slot":`sheet-content`,"data-side":n,className:o(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,v.jsx)(h,{"data-slot":`sheet-close`,asChild:!0,children:(0,v.jsxs)(g,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,v.jsx)(c,{}),(0,v.jsx)(`span`,{className:`sr-only`,children:a()})]})})]})]})}function C({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-0.5 p-4`,e),...t})}function w({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-footer`,className:o(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function T({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:o(`font-heading text-base font-medium text-foreground`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(p,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function D({open:e,onOpenChange:t,title:n,description:a,children:o,onSubmit:c,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,_.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await c()}finally{p(!1)}}return(0,v.jsx)(y,{open:e,onOpenChange:t,children:(0,v.jsxs)(S,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,v.jsxs)(C,{className:`border-b px-6 py-4`,children:[(0,v.jsx)(T,{children:n}),a?(0,v.jsx)(E,{children:a}):null]}),(0,v.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,v.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,v.jsxs)(w,{className:`border-t px-6 py-4`,children:[(0,v.jsxs)(g,{type:`submit`,disabled:!d||m,children:[m?(0,v.jsx)(s,{className:`size-4 animate-spin`}):null,l??i()]}),(0,v.jsx)(g,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:r()})]})]})]})})}export{w as a,E as i,y as n,C as o,S as r,T as s,D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AL as i,BL as a,CL as o,DL as s,EL as c,FL as l,GL as u,HL as d,IL as f,JL as p,KL as ee,LL as te,ML as ne,NL as m,OL as h,PL as g,QL as _,RL as re,SL as v,TL as y,UL as ie,VL as ae,WL as b,XL as x,XX as S,YL as C,YX as w,Yf as T,ZL as E,Zf as D,_L as O,aL as k,aR as A,bL as j,cL as M,dL as N,eR as P,fL as F,gL as I,hL as L,iL as R,iR as z,jL as B,kL as V,lL as H,mL as U,nR as oe,oL as W,oR as G,pL as K,qL as q,rR as se,sL as ce,t as J,tR as le,uL as ue,vL as de,wL as fe,xL as pe,yL as me,zL as he}from"./api-DSJJn0d7.js";import{t as ge}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{n as _e}from"./format-DGKgJf2p.js";import{n as Y}from"./ConfirmDialog-BXcki0Ee.js";import{t as ve}from"./DataTableShell-DRFFBx_j.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>G(),incorrect:()=>A(),incoherence:()=>z(),formatting:()=>se(),latency:()=>oe(),api_error:()=>le(),other:()=>P()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:_()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:E()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:r()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,o=w(J.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[h,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(!1);async function S(){let t=h.trim();if(!(!t||v)){y(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),_(``)}finally{y(!1)}}}let T=[];try{T=r.contextJson?JSON.parse(r.contextJson):[]}catch{T=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${x()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:fe(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?q():e.authorRole===`agent`?e.authorLabel??D():ee()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:u()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:b(),value:h,maxLength:2e3,rows:3,onChange:e=>_(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void S(),disabled:!h.trim()||v,children:v?ie():d()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||a()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:he()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||a()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,T.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te({count:r.contextCount??T.length,truncated:r.contextTruncated?f():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:T.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?ne({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[B(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,i()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=S(J.feedback.listForAdmin,{}),t=w(J.feedback.readSnapshot),n=w(J.feedback.deleteFeedback),r=Y(),[i,a]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function d(e){if(i===e._id){a(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}a(e._id)}async function f(e){await r({title:W(),description:k(),confirmLabel:R(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[V(),` `,(0,Z.jsx)(`strong`,{children:h()}),` `,s()]}),(0,Z.jsx)(ve,{title:c(),rows:e,emptyHint:y(),isExpanded:e=>i===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:o(),cell:e=>_e(e.at),sort:e=>e.at},{header:v(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:pe(),cell:e=>e.messageRole===`user`?j():me(),sort:e=>e.messageRole},{header:de(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${O({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:I(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:L(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:U(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:K()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:F()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:N()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?H():M(),onSelect:()=>void d(e)},{label:ce(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,rZ as n}from"./api-DSJJn0d7.js";import{a as r,i,n as a,o,r as s,t as c}from"./tooltip-v_AyOWn6.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=Object.defineProperty,u=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>u(e,typeof t==`symbol`?t:t+``,n),f=`https://docs.convex.dev/error#undefined-validator`;function p(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${f} for details.`)}var m=class{constructor({isOptional:e}){d(this,`type`),d(this,`fieldPaths`),d(this,`isOptional`),d(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},h=class e extends m{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),d(this,`tableName`),d(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},g=class e extends m{constructor(){super(...arguments),d(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},_=class e extends m{constructor(){super(...arguments),d(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},v=class e extends m{constructor(){super(...arguments),d(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},y=class e extends m{constructor(){super(...arguments),d(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},b=class e extends m{constructor(){super(...arguments),d(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends m{constructor(){super(...arguments),d(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends m{constructor(){super(...arguments),d(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends m{constructor({isOptional:e,fields:t}){super({isOptional:e}),d(this,`fields`),d(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&p(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},w=class e extends m{constructor({isOptional:e,value:t}){if(super({isOptional:e}),d(this,`value`),d(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:n(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},T=class e extends m{constructor({isOptional:e,element:t}){super({isOptional:e}),d(this,`element`),d(this,`kind`,`array`),t===void 0&&p(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},E=class e extends m{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),d(this,`key`),d(this,`value`),d(this,`kind`,`record`),t===void 0&&p(`v.record()`,`key`),n===void 0&&p(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},D=class e extends m{constructor({isOptional:e,members:t}){super({isOptional:e}),d(this,`members`),d(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&p(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},O={id:e=>new h({isOptional:`required`,tableName:e}),null:()=>new x({isOptional:`required`}),number:()=>new g({isOptional:`required`}),float64:()=>new g({isOptional:`required`}),bigint:()=>new _({isOptional:`required`}),int64:()=>new _({isOptional:`required`}),boolean:()=>new v({isOptional:`required`}),string:()=>new b({isOptional:`required`}),bytes:()=>new y({isOptional:`required`}),literal:e=>new w({isOptional:`required`,value:e}),array:e=>new T({isOptional:`required`,element:e}),object:e=>new C({isOptional:`required`,fields:e}),record:(e,t)=>new E({isOptional:`required`,key:e,value:t}),union:(...e)=>new D({isOptional:`required`,members:e}),any:()=>new S({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>O.union(e,O.null())},k=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),A=[`gateway-http`,`shared-fs`,`off`],j=[`inline`,`shared-fs`],M=[`reactive`,`sse`],N=`reactive`;O.object({mediaMode:O.optional(O.union(O.literal(`gateway-http`),O.literal(`shared-fs`),O.literal(`off`))),inboundMediaMode:O.optional(O.union(O.literal(`inline`),O.literal(`shared-fs`))),rehydration:O.optional(O.boolean()),mediaMaxMb:O.optional(O.number()),attachmentFixAttested:O.optional(O.boolean()),summarizeThresholdChars:O.optional(O.number()),curationEnabled:O.optional(O.boolean()),curationBudgetChars:O.optional(O.number()),converterAgentId:O.optional(O.string()),voiceEnabled:O.optional(O.boolean()),talkEnabled:O.optional(O.boolean()),widgetsEnabled:O.optional(O.boolean()),widgetPromptConfirm:O.optional(O.boolean()),voiceEngine:O.optional(O.union(O.literal(`browser`),O.literal(`gateway`))),voiceLang:O.optional(O.string()),voiceRate:O.optional(O.number()),voiceAutoRead:O.optional(O.boolean()),contentLocale:O.optional(O.string()),inboundAgentMount:O.optional(O.string()),outboundAgentMount:O.optional(O.string()),transcriptProjection:O.optional(O.union(O.literal(`off`),O.literal(`shadow`),O.literal(`on`))),promptInjections:O.optional(O.record(O.string(),O.object({enabled:O.optional(O.boolean()),template:O.optional(O.string())})))});var P={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function F(e,t){let n={};for(let i of o){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function I(e,t){let n={};for(let i of o){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function L(e,t){return{mediaMode:e.mediaMode??P.mediaMode,inboundMediaMode:e.inboundMediaMode??P.inboundMediaMode,rehydration:e.rehydration??P.rehydration,mediaMaxMb:e.mediaMaxMb??P.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??P.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??P.outboundAgentMount,promptInjections:F(e.promptInjections,t)}}var R=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function z(e,t,n){let r={},i=n=>{(e[n]!==P[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=I(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of R){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var B=e();function V({text:e}){return(0,B.jsx)(s,{delayDuration:150,children:(0,B.jsxs)(c,{children:[(0,B.jsx)(i,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,B.jsx)(k,{"aria-hidden":!0})})}),(0,B.jsx)(a,{className:`max-w-xs text-pretty`,children:e})]})})}function H({label:e,help:t}){return(0,B.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,B.jsx)(V,{text:t})]})}export{N as a,M as c,L as i,H as n,j as o,z as r,A as s,V as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$Y as ee,AY as r,BX as i,BY as te,DY as ne,EY as re,FY as ie,GY as a,HX as o,HY as s,IY as c,JY as l,KY as u,LY as d,MY as f,NY as ae,OY as oe,PY as p,QY as se,RY as ce,UY as le,VY as ue,WY as m,XX as de,XY as h,YX as fe,YY as g,ZV as pe,ZY as me,aX as he,eX as ge,ep as _e,iX as _,jY as ve,kY as ye,nX as be,oX as xe,qY as v,rX as y,sX as b,t as x,tX as S,tp as C,zY as w}from"./api-DSJJn0d7.js";import{c as T,g as E,n as D,r as O,t as k}from"./dropdown-menu-DHMOOlaP.js";import{t as A}from"./download-DWgC7zCa.js";import{t as j}from"./checkbox-CsI4ggnp.js";import{t as M}from"./rotate-ccw-BD-9XzMC.js";import{t as Se}from"./trash-2-B4WSfc7G.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-qM3ZfTHx.js";import{a as Ce,c as we,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./alert-dialog-BoEv1f8g.js";import{t as R}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{r as je}from"./toast-xNFwDnUy.js";import{t as z}from"./badge-C4po8DQ1.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-D2SJC960.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return h();case`audio`:return g();case`video`:return l();case`pdf`:return v();case`document`:return u();case`archive`:return a();default:return m()}}function q(){let[e,t]=(0,U.useState)(G),[n,a]=(0,U.useState)(G),[l,u]=(0,U.useState)(G),[m,h]=(0,U.useState)(G),[g,v]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=fe(x.files.softDelete),Y=je();function Ie(){t(G),a(G),u(G),h(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(ae())}catch(e){Y.error(f(),e)}}let X=de(x.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:l===G?void 0:l,category:m===G?void 0:m,includeAutoGenerated:g||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(o(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:i()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||l!==G||m!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":xe(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:he()}),(0,W.jsx)(I,{value:`inbound`,children:_()}),(0,W.jsx)(I,{value:`outbound`,children:y()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:a,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":be(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:S()}),Q.chats.map(e=>(0,W.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:l,onValueChange:u,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:ee()}),Q.instances.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:m,onValueChange:h,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":se(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:me()}),Q.categories.map(e=>(0,W.jsx)(I,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(j,{checked:g,onCheckedChange:e=>v(e===!0),"aria-label":C()}),(0,W.jsx)(`span`,{children:C()})]}),$?(0,W.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(M,{size:14,"aria-hidden":!0}),c()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ne():oe()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:s()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:te()}),(0,W.jsx)(B,{children:w()}),(0,W.jsx)(B,{className:`text-right`,children:ce()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(z,{variant:`outline`,style:{marginLeft:6},children:_e()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(z,{variant:`secondary`,children:e.direction===`inbound`?_():y()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(k,{children:[(0,W.jsx)(T,{asChild:!0,children:(0,W.jsx)(R,{variant:`ghost`,size:`icon`,"aria-label":ie(),children:(0,W.jsx)(E,{size:16})})}),(0,W.jsxs)(D,{align:`end`,children:[e.url?(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),d()]})}):(0,W.jsxs)(O,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),ye()]}),(0,W.jsxs)(O,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Se,{size:14}),p()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:re({cap:Be})}):null]}),(0,W.jsx)(Ae,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Te,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:ve()}),(0,W.jsx)(Ce,{children:r()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(Oe,{children:pe()}),(0,W.jsx)(Ee,{onClick:()=>void Le(),children:p()})]})]})})]})}export{q as FilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,jC as i}from"./api-DSJJn0d7.js";import{t as a}from"./search-BK6bzZNi.js";import{t as o}from"./rotate-ccw-BD-9XzMC.js";import{t as s}from"./button-Dio0PVrp.js";import{t as c}from"./input-BSpTsBA6.js";import{t as l}from"./TimeRangePicker-D3PJq1H8.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(a,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(s,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$y as i,Ab as a,Ax as o,Ay as s,Bb as c,By as l,Cb as u,Cx as d,Db as f,Dx as p,Dy as m,E as h,Eb as g,Ex as _,Fb as v,Fy as y,Gb as b,Gy as x,Hb as S,Hy as ee,Ib as C,Iy as w,Jb as T,Jy as E,Kb as D,Ky as te,Lb as O,Ly as k,Mb as A,My as j,Nb as M,Ny as N,Ob as ne,Ox as P,Oy as F,Pb as I,Py as re,Qy as ie,Rb as ae,Ry as oe,Sb as se,Sx as ce,Tb as le,Tx as ue,Ub as de,Uy as fe,Vb as pe,Vy as me,Wb as he,Wy as ge,XX as L,Xy as _e,YX as R,Yb as ve,Yy as ye,Zy as be,_b as xe,_x as Se,ab as Ce,ax as we,bb as Te,bx as Ee,by as De,cb as Oe,cx as ke,dx as Ae,eb as je,ex as Me,fx as Ne,gb as Pe,gx as Fe,hb as Ie,hx as Le,ib as Re,ix as ze,jb as Be,jx as Ve,jy as He,kb as Ue,kx as We,ky as Ge,lb as Ke,lx as qe,mb as Je,mx as Ye,nb as Xe,nx as z,ob as Ze,ox as Qe,px as $e,qb as B,qy as et,rb as tt,rx as nt,sb as rt,sx as it,t as V,tb as at,tx as ot,ub as H,ux as st,vb as ct,vx as lt,vy as ut,wb as dt,wx as ft,xb as pt,xx as mt,xy as ht,yb as gt,yx as _t,yy as vt,zb as yt,zy as bt}from"./api-DSJJn0d7.js";import{t as xt}from"./chevron-left-DQ9FCoo_.js";import{t as St}from"./chevron-right-C_b_y922.js";import{t as U}from"./checkbox-CsI4ggnp.js";import{t as Ct}from"./server-DLnWqkX-.js";import{i as wt,n as Tt,r as Et,t as Dt}from"./users-BJqaWlH1.js";import{t as W}from"./star-CM6J2w_J.js";import{t as Ot}from"./x-CK8d5DC1.js";import{a as kt,i as At,n as jt,r as Mt,t as Nt}from"./select-qM3ZfTHx.js";import{i as Pt,n as Ft,r as It,t as Lt}from"./tabs-mZfLmn2f.js";import{t as G}from"./button-Dio0PVrp.js";import{t as K}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as q}from"./toast-xNFwDnUy.js";import{t as J}from"./badge-C4po8DQ1.js";import{a as Rt,n as zt,o as Bt,r as Vt,t as Ht}from"./dialog-BfrsWZiD.js";import{t as Ut}from"./appHost-CH3EGcJw.js";import{n as Wt}from"./ConfirmDialog-BXcki0Ee.js";import{t as Gt}from"./EntitySheet-B2B48bss.js";import{a as Y,c as Kt,d as qt,f as Jt,i as Yt,l as Xt,n as Zt,o as Qt,r as $t,t as X,u as en}from"./groupManageView-BMBqgRhV.js";import{t as tn}from"./FilterBar-DTVwlDpF.js";import{t as nn}from"./DataTableShell-DRFFBx_j.js";import{t as Z}from"./DetailChips-Cv1sxdhU.js";var rn=h(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Q=t(e(),1),$=n(),an={name:``,description:``};function on(){let e=L(V.groups.listGroups,{}),t=L(V.me.getMe,{host:Ut})?.role===`admin`,n=R(V.groups.createGroup),r=R(V.groups.updateGroup),i=R(V.groups.deleteGroup),a=Wt(),s=q(),[c,l]=(0,Q.useState)(!1),[u,f]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(an),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(``),S=(0,Q.useMemo)(()=>{if(!e)return e;let t=b.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,b]);function ee(){f(null),h(an),l(!0)}function C(e){f(e),h({name:e.name,description:e.description??``}),l(!0)}async function w(){try{u?await r({groupId:u._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),h(an),f(null),l(!1)}catch(e){s.error(g(),e)}}async function T(e){if(await a({title:Ne({name:e.name}),description:Ae(),confirmWord:e.name,confirmLabel:st(),cancelLabel:lt(),destructive:!0}))try{await i({groupId:e._id})}catch(e){s.error(le(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),t?(0,$.jsx)(pn,{}):null,(0,$.jsx)(tn,{q:b,onQChange:x,onReset:()=>x(``),canReset:b!==``,searchPlaceholder:d()}),(0,$.jsx)(nn,{title:Ve(),rows:S,addLabel:We(),onAdd:t?ee:void 0,emptyHint:P(),columns:[{header:p(),cell:e=>e.name,sort:e=>e.name},{header:_(),cell:e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:(0,$.jsx)(Dt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(wt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,$.jsx)(J,{variant:`secondary`,children:Je({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:ue(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ct,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ft(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(rn,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ce(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:mt(),onSelect:()=>C(e)},{label:Ee(),variant:`destructive`,onSelect:()=>void T(e)}]:[]]}),(0,$.jsx)(Gt,{open:c,onOpenChange:l,title:u?Fe():Se(),description:Le(),canSubmit:!!m.name.trim(),onSubmit:w,submitLabel:_t(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:Ye()}),(0,$.jsx)(K,{value:m.name,onChange:e=>h({...m,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:$e()}),(0,$.jsx)(K,{value:m.description,onChange:e=>h({...m,description:e.target.value})})]})]})}),(0,$.jsx)(ln,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(null)}})]})}var sn=8;function cn({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(xt,{size:14,"aria-hidden":!0}),ot()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":r({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Me(),(0,$.jsx)(St,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=L(V.groups.getGroup,n&&e?{groupId:e}:`skip`),o=i?.viewerIsAdmin===!0,s=L(V.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),c=L(V.groups.listAssignableUsers,n&&o?{}:`skip`),l=R(V.groups.addMember),u=R(V.groups.removeMember),d=R(V.groups.bulkSetMembers),f=R(V.groups.setGroupManager),p=q(),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`members`),[x,S]=(0,Q.useState)(1),[ee,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(new Set),E=(0,Q.useRef)(null),D=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),te=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),O=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),k=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>X(e.instanceName,e.agentId))),[i]),A=(0,Q.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?X(e.instanceName,e.agentId):null},[i]);(0,Q.useEffect)(()=>{h(``),_(``),y(`members`),S(1),C(null),E.current=null},[n,e]),(0,Q.useEffect)(()=>{S(1)},[m]),(0,Q.useEffect)(()=>{n&&i&&e&&E.current!==e&&(E.current=e,T(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Q.useMemo)(()=>c?Yt(c,m,w):[],[c,m,w]);async function M(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(dt(),Y(e))}}async function N(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(ne(),e)}}let P=qt(j,e=>D.has(e.userId)),F=j.filter(e=>D.has(e.userId)).length,I=Xt(j,x,sn);async function re(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){p.error(dt(),Y(e))}}let ie=(e,t)=>(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":Ce({user:t}),title:Ce({user:t}),onClick:()=>C({userId:e,label:t}),children:[(0,$.jsx)(Et,{size:13,"aria-hidden":!0}),Ze()]});return(0,$.jsx)(Ht,{open:n,onOpenChange:r,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:qe({name:t})}),(0,$.jsx)(Vt,{children:i&&!o?se():ke()})]}),(0,$.jsxs)(Lt,{value:v,onValueChange:y,className:`oc-access__tabs`,children:[(0,$.jsxs)(It,{className:`w-full`,children:[(0,$.jsxs)(Pt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Dt,{size:13,"aria-hidden":!0}),it(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,$.jsxs)(Pt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),we(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(Pt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(rn,{size:13,"aria-hidden":!0}),yt(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(Ft,{value:`members`,children:i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):o?c===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:m,onChange:e=>h(e.target.value),placeholder:Qe(),className:`oc-access__search`}),j.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:nt()}):(0,$.jsxs)($.Fragment,{children:[j.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:P===`all`||P===`some`&&`indeterminate`,onCheckedChange:()=>void re(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()}),(0,$.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=D.has(e.userId),n=Jt(e),r=te.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:t,onCheckedChange:()=>void M(e.userId,t),"aria-label":ve({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&O.has(e.userId)?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:Re()}):null,(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:en(e.role)}),t?ie(e.userId,n.primary):null,(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Ue():a(),title:r?Ue():a(),onClick:()=>void N(e.userId,r),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(cn,{page:I.page,pageCount:I.pageCount,onPage:S})]})]}):e?(0,$.jsx)(un,{groupId:e,members:i.members,agentsButton:ie}):null}),(0,$.jsxs)(Ft,{value:`agents`,children:[i&&!o?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ye()}):null,s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:g,onChange:e=>_(e.target.value),placeholder:ze(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,defaultKey:A,viewerIsAdmin:o,query:g},`${e}-${t._id}`))})]})]}),(0,$.jsx)(Ft,{value:`charts`,children:(0,$.jsx)(mn,{groupId:e})})]}),(0,$.jsx)(dn,{groupId:e,member:ee,onOpenChange:e=>{e||C(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=L(V.groupInvites.listGroupInviteRequests,{groupId:e}),i=R(V.groupInvites.requestGroupInvite),a=R(V.groups.removeMember),o=Wt(),s=q(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(1),f=Xt(t,u,sn);async function p(t){t.preventDefault();let n=c.trim();if(n)try{await i({groupId:e,email:n}),l(``),s.success(xe())}catch(e){s.error(Pe(),e)}}async function h(t,n){if(await o({title:H({user:n}),description:Oe({user:n}),confirmLabel:rt(),cancelLabel:lt(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(dt(),Y(e))}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void p(e),children:[(0,$.jsx)(K,{type:`email`,value:c,onChange:e=>l(e.target.value),placeholder:gt(),"aria-label":pt()}),(0,$.jsxs)(G,{type:`submit`,size:`sm`,disabled:!c.trim(),children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),ct()]})]}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Te()}),t.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:tt()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:f.pageItems.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:Re()}):null,n(e.userId,e.label),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Be(),title:Be(),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null}),(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":H({user:e.label}),title:e.manager?Ke():e.lastGroup?m():H({user:e.label}),onClick:()=>void h(e.userId,e.label),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,$.jsx)(cn,{page:f.page,pageCount:f.pageCount,onPage:d})]}),r!==void 0&&r.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:Ie()}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsx)(J,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Qt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=L(V.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=R(V.groups.setMemberAgents),a=R(V.groups.setMemberDefaultAgent),o=q();async function l(e){try{await e()}catch(e){o.error(F(),e)}}let u=r?.agents??[],d=new Map(u.map(e=>[X(e.instanceName,e.agentId),e])),f=[...d.keys()],p=new Set(u.filter(e=>e.allowed).map(e=>X(e.instanceName,e.agentId)));function m(n){if(!e||!t||!r)return;let a=Kt(f,p,r.restricted,n).map(e=>{let t=d.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});l(()=>i({groupId:e,userId:t.userId,agents:a}))}return(0,$.jsx)(Ht,{open:t!==null,onOpenChange:n,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:k({user:t?.label??``})}),(0,$.jsx)(Vt,{children:w()})]}),r===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):r===null||u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ge()}):(0,$.jsxs)($.Fragment,{children:[r.settable?null:(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ut()}),r.adminNarrowed?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ht()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:vt()}):null,(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?re():y()}),r.restricted?(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin,onClick:()=>e&&t?void l(()=>i({groupId:e,userId:t.userId,agents:null})):void 0,children:N()}):null]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let i=X(n.instanceName,n.agentId),o=n.displayName??n.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>m(i),"aria-label":j({name:o})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:o,children:o}),n.limitedByAdmin?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:De()}):null,n.state===`deleted`?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:c()}):null,n.allowed?n.isMemberDefault?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":He(),title:He(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,disabled:!r.settable,"aria-label":s(),title:s(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,$.jsx)(W,{size:14})}):null]},i)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=L(V.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),d=R(V.groups.assignAgentToGroup),f=R(V.groups.removeAgentFromGroup),p=R(V.groups.bulkSetGroupAgents),m=R(V.groups.claimAgentForGroup),h=R(V.groups.setGroupDefaultAgent),g=q(),[_,v]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{v(1)},[o]),!e)return null;let y=$t(s?.agents??[],o),b=s?.discovery&&!s.discovery.lastPollOk,C=e=>Zt({assigned:r.has(X(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),w=y.filter(e=>C(e)!==`claim`),O=y.filter(e=>C(e)===`claim`);if(o.trim()&&y.length===0)return null;let k=w.filter(e=>C(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),A=qt(k,e=>r.has(X(t,e.agentId))),j=Xt(w,_,sn);async function M(n,r){try{r?await f({groupId:e,instanceName:t,agentId:n}):await d({groupId:e,instanceName:t,agentId:n})}catch(e){g.error(u(),Y(e))}}async function N(){if(k.length===0)return;let n=k.map(e=>e.agentId);try{await p({groupId:e,instanceName:t,agentIds:n,assigned:A!==`all`})}catch(e){g.error(u(),Y(e))}}async function ne(n){try{await m({groupId:e,instanceName:t,agentId:n})}catch(e){g.error(ge(),e)}}async function P(n){try{await h({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){g.error(oe(),e)}}let F=e=>e.reservedForGroup?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:fe()}):e.reserved?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?me():ee({group:e.reservedGroupName})}):null;return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),b?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:pe()}):null]}),s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:D()}):y.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:b?S():de()}):(0,$.jsxs)($.Fragment,{children:[k.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:A===`all`||A===`some`&&`indeterminate`,onCheckedChange:()=>void N(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()})]}):null,j.pageItems.map(e=>{let n=X(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=C(e)===`locked`;return(0,$.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,$.jsx)(U,{checked:a,disabled:s&&!a,onCheckedChange:()=>void M(e.agentId,a),"aria-label":T({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,F(e),o?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:c()}):null,a?i===n?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":l(),title:l(),onClick:()=>void P(null),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":bt(),title:bt(),onClick:()=>void P(e.agentId),children:(0,$.jsx)(W,{size:14})}):null]},e.agentId)}),(0,$.jsx)(cn,{page:j.page,pageCount:j.pageCount,onPage:v}),O.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:E()}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:et()}),O.map(e=>{let t=e.displayName??e.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":x({name:t}),onClick:()=>void ne(e.agentId),children:te()})]},e.agentId)})]}):null]})]})}function pn(){let e=L(V.groupInvites.listPendingInviteRequests,{}),t=R(V.groupInvites.decideGroupInvite),n=q();if(e===void 0||e.length===0)return null;async function r(e,r){try{await t({requestId:e,approve:r})}catch(e){n.error(_e(),e)}}return(0,$.jsxs)(`section`,{className:`oc-invites`,"aria-label":Xe(),children:[(0,$.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),Xe(),(0,$.jsx)(J,{variant:`secondary`,children:e.length})]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,at({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?ie():be()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:je()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:i()})]},e._id))})]})}function mn({groupId:e}){let t=L(V.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(V.charts.assignChartToGroup),r=R(V.charts.removeChartFromGroup),i=R(V.charts.setGroupDefaultChart),a=R(V.charts.addChartToGroupPool),o=R(V.charts.removeChartFromGroupPool),s=q();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(f(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(f(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(f(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(f(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":I({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":M(),title:M(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:A()}):null,u?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":v({name:e.name}),title:v({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Nt,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(At,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(kt,{placeholder:C()})}),(0,$.jsx)(jt,{children:l.map(e=>(0,$.jsx)(Mt,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:O()}):null:null]})}export{on as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$F as i,$P as a,AF as o,AI as s,An as c,Ao as l,BF as u,BP as d,CF as f,CI as p,Co as m,DF as h,DI as g,Dn as _,Do as v,EF as y,EI as b,En as ee,Eo as x,Eu as te,FF as S,FP as C,Fn as ne,Fo as re,GF as w,GP as T,GU as E,HF as D,HP as ie,IF as O,IP as k,J as ae,JF as oe,JP as se,K as ce,KF as le,KP as ue,KU as de,LF as fe,LP as pe,MF as me,Mn as he,Mo as ge,NF as _e,Nn as ve,No as ye,OF as be,OI as xe,On as Se,Oo as Ce,PF as we,Pn as Te,Po as Ee,Q as De,QF as Oe,QP as ke,RF as Ae,RP as je,SF as Me,SI as Ne,So as Pe,TF as Fe,TI as Ie,To as Le,Tu as Re,UF as ze,UP as Be,VF as Ve,VP as He,WF as Ue,WP as We,X as Ge,XF as Ke,XP as qe,XX as A,Y as Je,YF as Ye,YP as Xe,YX as j,Z as Ze,ZF as Qe,ZP as $e,_F as et,_I as tt,_y as nt,aF as rt,aI as it,bF as at,bI as ot,bo as st,cF as ct,cI as lt,cm as ut,dF as M,dI as dt,dm as ft,eF as pt,eI as mt,et as ht,fF as gt,fI as _t,gF as N,gI as P,gy as vt,hF as yt,hI as bt,hy as xt,iF as St,iI as Ct,jF as wt,jn as Tt,jo as Et,kF as Dt,kI as Ot,kn as kt,ko as At,lF as jt,lI as Mt,lm as Nt,mF as F,mI as Pt,nF as Ft,nI as It,oF as Lt,oI as Rt,pF as zt,pI as Bt,q as Vt,qF as I,qP as Ht,qX as L,rF as Ut,rI as Wt,sF as Gt,sI as Kt,t as R,tF as qt,tI as Jt,uI as Yt,um as Xt,vA as Zt,vF as Qt,vI as $t,wF as en,wI as tn,wo as nn,wu as rn,xF as an,xI as on,xo as sn,yA as cn,yF as ln,yI as un,yo as dn,zF as fn,zP as pn}from"./api-DSJJn0d7.js";import{a as mn,c as hn}from"./FieldLabel-Tea3wyVe.js";import{t as gn}from"./checkbox-CsI4ggnp.js";import{a as z,i as B,n as V,r as H,t as U}from"./select-qM3ZfTHx.js";import{n as _n,r as vn,t as yn}from"./popover-DBaIbsBr.js";import{t as W}from"./button-Dio0PVrp.js";import{t as G}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as K}from"./toast-xNFwDnUy.js";import{t as q}from"./badge-C4po8DQ1.js";import{a as bn,n as xn,o as Sn,r as Cn,t as wn}from"./dialog-BfrsWZiD.js";import{n as Tn}from"./ConfirmDialog-BXcki0Ee.js";import{t as En}from"./EntitySheet-B2B48bss.js";import{a as J}from"./groupManageView-BMBqgRhV.js";import{t as Dn}from"./DataTableShell-DRFFBx_j.js";import{InstanceConfigDialog as On}from"./BridgeTab-D4RFq-Rb.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:mn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=A(R.admin.listInstances,{}),t=A(R.agents.listAllInstanceAgents,{}),n=j(R.admin.upsertInstance),a=j(R.widgets.setInstanceWidgets),o=j(R.admin.deleteInstance),u=K(),[d,f]=(0,Y.useState)(!1),[h,y]=(0,Y.useState)(Q),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(null);async function oe(){try{let t=await n({instanceId:O??void 0,name:h.name,gatewayUrl:h.gatewayUrl,bridgeUrl:h.bridgeUrl||void 0,displayName:h.displayName||void 0,kind:h.kind,transport:h.kind===`hermes`?h.transport:void 0,gatewayVersion:h.gatewayVersion||void 0,gatewayHttpUrl:h.gatewayHttpUrl||void 0,...h.kind===`openclaw`?{authMode:h.authMode,personScopes:h.personScopes,identitySource:h.identitySource,participantIdentity:h.participantIdentity,managePermissionModes:h.managePermissionModes,systemIdentity:h.systemIdentity||void 0}:{},streamTransport:h.streamTransport}),r=O===null?null:e?.find(e=>e._id===O),i=r?.config?.widgetsEnabled!==!1,o=r?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==i||h.widgetPromptConfirm!==o)&&await a({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),y(Q),k(null),f(!1)}catch(e){u.error(xe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),(0,Z.jsx)(`strong`,{children:b()}),Ie()]}),(0,Z.jsx)(Dn,{title:tn(),rows:e,addLabel:p(),onAdd:()=>{k(null),y(Q),f(!0)},emptyHint:Ne(),columns:[{header:on(),cell:e=>e.name,sort:e=>e.name},{header:ot(),cell:e=>(0,Z.jsx)(q,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:un(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:$t(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:s(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(q,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ie():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Pt(),onSelect:()=>{k(e._id),y(Nn(e)),f(!0)}},{label:Ot(),onSelect:()=>C(e.name)},{label:i(),onSelect:()=>D(e)},{label:tt(),onSelect:()=>T(e)},{label:P(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:P(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(En,{open:d,onOpenChange:f,title:O?Bt():bt(),description:dt(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:oe,submitLabel:Yt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Mt(),children:[(0,Z.jsx)(G,{value:h.name,disabled:O!==null,onChange:e=>y({...h,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_t()}):null]}),(0,Z.jsx)($,{label:lt(),children:(0,Z.jsxs)(U,{value:h.kind,onValueChange:e=>y({...h,kind:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(H,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,Z.jsx)($,{label:te(),children:(0,Z.jsxs)(U,{value:h.transport,onValueChange:e=>y({...h,transport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`ws`,children:Re()}),(0,Z.jsx)(H,{value:`rest`,children:rn()})]})]})}):null,(0,Z.jsx)($,{label:Kt(),children:(0,Z.jsx)(G,{value:h.gatewayUrl,onChange:e=>y({...h,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Rt(),children:(0,Z.jsx)(G,{value:h.bridgeUrl,placeholder:it(),onChange:e=>y({...h,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ct(),children:(0,Z.jsx)(G,{value:h.displayName,onChange:e=>y({...h,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:cn(),children:[(0,Z.jsxs)(U,{value:h.streamTransport,onValueChange:e=>y({...h,streamTransport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsx)(V,{children:hn.map(e=>(0,Z.jsx)(H,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Zt()})]}),(0,Z.jsx)($,{label:Wt(),children:(0,Z.jsx)(G,{value:h.gatewayVersion,placeholder:It(),onChange:e=>y({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Le(),children:[(0,Z.jsxs)(U,{value:h.authMode,onValueChange:e=>y({...h,authMode:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`token`,children:nn()}),(0,Z.jsx)(H,{value:`trusted-proxy`,children:m()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?sn():Pe()})]}),h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsxs)(U,{value:h.personScopes,onValueChange:e=>y({...h,personScopes:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`capped`,children:Ee()}),(0,Z.jsx)(H,{value:`full`,children:ye()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?Et():ge()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsxs)(U,{value:h.identitySource,onValueChange:e=>y({...h,identitySource:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`canonical`,children:At()}),(0,Z.jsx)(H,{value:`email`,children:Ce()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?x():v()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsxs)(U,{value:h.participantIdentity,onValueChange:e=>y({...h,participantIdentity:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`owner`,children:Te()}),(0,Z.jsx)(H,{value:`self`,children:ve()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?ee():he()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:Tt(),children:[(0,Z.jsxs)(U,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>y({...h,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:c()}),(0,Z.jsx)(H,{value:`on`,children:kt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?_():Se()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:ht(),children:[(0,Z.jsxs)(U,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>y({...h,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`on`,children:r()}),(0,Z.jsx)(H,{value:`off`,children:De()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?Ze():Ge()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,Z.jsxs)($,{label:Je(),children:[(0,Z.jsxs)(U,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>y({...h,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:ae()}),(0,Z.jsx)(H,{value:`on`,children:Vt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:ce()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(G,{value:h.systemIdentity,placeholder:dn(),onChange:e=>y({...h,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Jt(),children:(0,Z.jsx)(G,{value:h.gatewayHttpUrl,placeholder:mt(),onChange:e=>y({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:S,open:S!==null,onOpenChange:e=>{e||C(null)}}),w?(0,Z.jsx)(On,{instance:w,onClose:()=>T(null)},w._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=A(R.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(xn,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:Oe({instance:e.displayName??e.name})}),(0,Z.jsx)(Cn,{children:Qe()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ln,{instance:e})}),(0,Z.jsx)(In,{instance:e})]})})}function In({instance:e}){let t=L(R.instanceSync.forceInstanceSync),n=K(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(wt());break;case`no_agents`:n.success(Dt());break;case`no_bridge_url`:n.error(be());break;case`deploy_misconfigured`:n.error(h());break;case`unauthorized`:n.error(Fe());break;case`not_served`:n.error(en());break;default:n.error(y());break}}catch(e){n.error(o(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?me():_e()})})]})}function Ln({instance:e}){let t=A(R.bridgeAuth.listBridgeAuthStatus,{}),n=L(R.bridgeAuth.mintBridgeSecret),r=j(R.bridgeAuth.revokeBridgeSecret),i=K(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{let t=await n({instanceId:e._id});c(t.plaintext),u(!1)}catch(e){i.error(N(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(et())}catch(e){i.error(N(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:an()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:f?`outline`:`secondary`,children:f?`${I()} · ${d.prefix}…${d.lastFour}`:le()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?ln():at()}),f?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Qt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:yt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?de():E()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:F()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=L(R.instanceSecrets.setInstanceSecret),i=j(R.instanceSecrets.clearInstanceSecret),a=L(R.deviceIdentity.generateDeviceIdentity),o=K(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Ke():t===`deviceIdentity`?Ye():oe();async function y(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Ve())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function b(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(fn())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function ee(){if(!l){d(!0);try{let t=await a({instanceId:e});p(t),h(!1),o.success(O())}catch(e){o.error(we(),e)}finally{d(!1)}}}let x=f?`openclaw devices approve ${f.id}`:``;async function te(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:g?`outline`:`secondary`,children:g?I():le()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ue():w(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void y(),disabled:l||s.trim().length===0,children:ze()}),_?(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:l,children:Ae()}):null,g?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:l,children:D()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:m?de():E()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:F()})]}):null]})}var zn={conversational:Ut,documentary:qt,summarizer:ft,curator:Nt},Bn={conversational:Ft,documentary:pt,summarizer:Xt,curator:ut},Vn=e=>(zn[e]??(()=>e))(),Hn=e=>(Bn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Gt()}),t.map(e=>(0,Z.jsx)(q,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(vn,{asChild:!0,children:(0,Z.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Lt()})}),(0,Z.jsxs)(_n,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:rt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:St()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(gn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=A(R.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=j(R.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=j(R.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=j(R.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=j(R.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=j(R.agents.removeInstanceAgent),u=j(R.agents.setAgentReservation),f=A(R.groups.listGroupLabels,t?{}:`skip`),p=Tn(),m=K();async function h(t,n){if(e&&await p({title:je({name:n}),description:pe(),confirmLabel:pn()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(M(),J(e))}}async function g(t,n,r){if(!e)return;let i=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:nt({name:n,group:i}),description:vt({group:i}),confirmLabel:xt()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(M(),J(e))}}async function _(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(M(),e)}}async function v(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(M(),e)}}async function y(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){m.error(M(),e)}}async function b(t,n){if(e&&await p({title:$e({name:n}),description:qe(),confirmLabel:Xe(),destructive:!0}))try{await l({instanceName:e,agentId:t}),m.success(se())}catch(e){m.error(M(),e)}}return(0,Z.jsx)(wn,{open:t,onOpenChange:n,children:(0,Z.jsxs)(xn,{className:`oc-access`,children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:zt({name:e??``})}),(0,Z.jsx)(Cn,{children:gt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ht()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ue():r.discovery.lastPollOk?T():We({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Be()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(gn,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,Z.jsx)(q,{variant:`outline`,children:t.reserved.groupName===null?d():He({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:C()}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,o),children:ke()})]}):i?(0,Z.jsx)(q,{variant:`default`,children:ie()}):(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:a()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,o),children:pn()}),(0,Z.jsxs)(U,{value:``,onValueChange:e=>void g(t.agentId,o,e),children:[(0,Z.jsx)(B,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(z,{placeholder:k()})}),(0,Z.jsx)(V,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(H,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:s,onToggle:e=>void y(t.agentId,e,s)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){m.error(M(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:jt(),"aria-label":ct(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pn as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Dh as i,Eh as a,Mh as o,Oh as s,Th as c,XX as l,YX as u,_R as d,bR as f,cR as p,dR as m,fR as h,gR as g,hR as _,jh as v,kh as y,lR as b,mR as x,pR as S,qX as C,t as w,uR as T,vR as E,wh as D,xR as O,yR as k}from"./api-DSJJn0d7.js";import{t as A}from"./checkbox-CsI4ggnp.js";import"./select-qM3ZfTHx.js";import{t as j}from"./button-Dio0PVrp.js";import{t as M}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{t as N}from"./badge-C4po8DQ1.js";var P=t(e(),1),F=n();function I(){let e=l(w.integrations.status.status,{}),t=u(w.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:O()});let a=n,s=(e,t,n)=>i({...a,[e]:{...a[e],[t]:n}}),c=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,F.jsx)(`strong`,{children:k()}),` `,E()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:_()}),note:x(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>s(`langfuse`,`host`,e.target.value),onBlur:()=>c(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:p(),checked:a.langfuse.enabled??!0,onChange:e=>{s(`langfuse`,`enabled`,e),c(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:_()}),note:S(),children:[(0,F.jsx)(R,{label:m(),children:(0,F.jsx)(M,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>s(`opik`,`baseUrl`,e.target.value),onBlur:()=>c(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:T(),children:(0,F.jsx)(M,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||b(),onChange:e=>s(`opik`,`workspace`,e.target.value),onBlur:()=>c(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:p(),checked:a.opik.enabled??!0,onChange:e=>{s(`opik`,`enabled`,e),c(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:o()}),note:v(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>s(`otlp`,`endpoint`,e.target.value),onBlur:()=>c(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:p(),checked:a.otlp.enabled??!0,onChange:e=>{s(`otlp`,`enabled`,e),c(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(A,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=C(w.integrations.otlpSecret.setOtlpHeaders),n=u(w.integrations.otlpSecret.clearOtlpHeaders),[r,o]=(0,P.useState)(``),[l,d]=(0,P.useState)(null),[f,p]=(0,P.useState)(!1),m=async()=>{p(!0),d(null);try{await t({headersJson:r}),o(``)}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}};return(0,F.jsxs)(R,{label:y(),children:[(0,F.jsx)(M,{value:r,placeholder:e?s():i(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(j,{size:`sm`,disabled:f||r.trim().length===0,onClick:()=>void m(),children:a()}),e?(0,F.jsx)(j,{variant:`ghost`,size:`sm`,disabled:f,onClick:()=>void n({}),children:c()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:D()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Fv as a,Lv as o,Mv as s,Qv as c,XX as l,Xv as u,YX as d,Zv as f,ay as p,ey as m,iy as h,jv as g,ny as _,ry as v,t as y,ty as b,yU as x}from"./api-DSJJn0d7.js";import{t as S}from"./loader-circle-BNhIFGdg.js";import{t as ee}from"./rotate-ccw-BD-9XzMC.js";import"./convexApi-CyScjgcq.js";import{r as C,t as w}from"./capabilities-BTqhMVxR.js";var T=t(e(),1),E={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`};function D(e,t){return E[e]===`segmented`&&t<=5?`segmented`:`list`}function O(e,t){return e!=null&&e[t]!==void 0}var k=[`inherit`,`fast`,`standard`];function A(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function j(e){return e===`inherit`?c():e===`fast`?f():u()}function M(e){return e===`inherit`?null:e===`fast`}function N(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function P(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var F={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function I(e,t){return F[e]??t}function L(e){return R(e).used}function R(e){if(!e)return{used:null,source:`unknown`};let t=e.contextTokens,n=e=>e==null||t&&e>t?null:e;if(e.estimatedPromptTokens!=null)return{used:e.estimatedPromptTokens,source:`budget_estimate`};let r=n(e.activeTokens);if(r!=null)return{used:r,source:`last_call_usage`};if(e.totalTokensFresh===!1)return{used:null,source:`unknown`};let i=n(e.totalTokens);return i==null?{used:null,source:`unknown`}:{used:i,source:`last_call_usage`}}function z(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function B(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=L(e),n=z(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function V(e){return R(e).source}function H(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function U(e,t){let n=H(e,t);return n===null?null:o({pct:n,used:N(e),total:N(t)})}function W(e){return a({level:e??`full`})}function G(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?s({cost:e.toFixed(2),tokens:N(t)}):n?g({cost:e.toFixed(2)}):r?i({tokens:N(t)}):null}function K(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function q(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=L(e),i=z(e);if(r===null||i===null)return null;let a=H(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function J(e,t){let n=l(y.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,T.useCallback)(e=>w(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,provider:n?.provider??null,beyondValidated:n?.versionBeyondValidated===!0}}var Y=n();function X(e){let t=d(y.chats.setSessionKnob),[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(null);return{apply:(0,T.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function Z({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0}){return(0,Y.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,Y.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,Y.jsx)(S,{size:13,className:`oc-spanel__spin`,"aria-label":v()}):t?c?(0,Y.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:h(),"aria-label":h(),onClick:n,children:(0,Y.jsx)(ee,{size:12,"aria-hidden":!0})}):null:(0,Y.jsx)(`span`,{className:`oc-spanel__badge`,children:p()})]}),(0,Y.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,Y.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,Y.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[_(),(0,Y.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:b()})]}):null]})}function Q({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,Y.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,Y.jsx)(`button`,{type:`button`,className:`oc-spanel__seg-btn${t===e.id?` is-active`:``}`,"aria-pressed":t===e.id,title:e.title??e.label,"aria-label":e.title??e.label,disabled:i,onClick:()=>{e.id!==t&&n(e.id)},children:e.label},e.id))})}function te({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,Y.jsxs)(`select`,{className:`oc-spanel__select`,value:t??``,disabled:r,"aria-label":i,onChange:e=>{e.target.value&&e.target.value!==t&&n(e.target.value)},children:[t===null?(0,Y.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,Y.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function $({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return D(e,t.length)===`list`?(0,Y.jsx)(te,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,Y.jsx)(Q,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function ne({chatId:e,sm:t,settings:n}){let{apply:i,pending:a,error:o}=X(e),{can:s}=J(e),c=a!==null,l=(0,T.useCallback)(()=>{o&&i(o.field,o.value)},[i,o]),u=t.thinkingLevels??[],d=t.availableModels??[],f=A(n),p=C(s,{hasModels:d.length>0,hasLevels:u.length>0});return(0,Y.jsxs)(Y.Fragment,{children:[p.model?(0,Y.jsx)(Z,{label:x(),overridden:O(n,`model`),onReset:()=>void i(`model`,null),pending:a===`model`,error:o?.field===`model`,onRetry:l,resettable:p.reset,children:(0,Y.jsx)($,{field:`model`,options:d,value:t.model??null,onChange:e=>void i(`model`,e),disabled:c,ariaLabel:x()})}):null,p.thinking?(0,Y.jsx)(Z,{label:m(),overridden:O(n,`thinkingLevel`),onReset:()=>void i(`thinkingLevel`,null),pending:a===`thinkingLevel`,error:o?.field===`thinkingLevel`,onRetry:l,resettable:p.reset,children:(0,Y.jsx)($,{field:`thinkingLevel`,ariaLabel:m(),options:u.map(e=>({id:e.id,label:I(e.id,P(e.label)),title:P(e.label)})),value:t.thinkingLevel??null,onChange:e=>void i(`thinkingLevel`,e),disabled:c})}):null,p.speed?(0,Y.jsx)(Z,{label:r(),overridden:O(n,`fastMode`),onReset:()=>void i(`fastMode`,null),pending:a===`fastMode`,error:o?.field===`fastMode`,onRetry:l,resettable:p.reset,children:(0,Y.jsx)($,{field:`fastMode`,ariaLabel:r(),options:k.map(e=>({id:e,label:j(e)})),value:f,onChange:e=>void i(`fastMode`,M(e)),disabled:c})}):null]})}export{P as a,H as c,G as d,L as f,W as g,O as h,K as i,q as l,N as m,ne as n,U as o,z as p,J as r,B as s,$ as t,V as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,Cz as a,DO as o,EO as s,FO as c,IO as l,MO as u,NO as d,OO as f,PO as p,SO as m,Sz as h,TO as g,XX as _,Yz as v,jO as ee,kO as te,mz as y,pz as b,t as x,wO as S,wz as C,xz as w}from"./api-DSJJn0d7.js";import{n as T,t as E}from"./useNavigate-D3GIoxyW.js";import"./convexApi-CyScjgcq.js";import{c as D,n as O,o as ne}from"./searchSchemas-CS2ZgsHC.js";import{t as re}from"./appHost-CH3EGcJw.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-CerX9wDn.js";import{n as P,t as F}from"./TimeRangePicker-D3PJq1H8.js";var I=t(e(),1),L={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},R=Object.keys(L).length,z=n(),B=15,V=e=>String(Math.round(e));function H(){let e=_(x.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=_(x.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:v()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:C()}),(0,z.jsx)(M,{children:h()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),o=e=>74-e*68/r,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[b(),` p50 `,V(c.cP50),` `,a()]}),(0,z.jsxs)(`span`,{children:[y(),` p50 `,V(c.aP50),` `,a()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":C(),children:[(0,z.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:l(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:c(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:p(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:d(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:u(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:ee(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:r(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=T({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=ne(e.from,e.to,O,`now`),r=e=>void t({search:t=>({...t,...D(e)})}),{from:i,to:a}=P(n),{rowLimit:c,buckets:l}=Y(i,a),u=_(x.kpi.listKpis,{limit:c,filter:{from:i,to:a}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),p=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:g({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:S()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:i({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":m({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AG as r,AX as i,BG as a,BX as o,Bc as s,CG as c,CX as l,Cc as u,DG as d,DX as f,EG as p,EX as m,Ec as h,FG as g,FX as _,HG as v,IG as ee,LG as te,MG as ne,MX as re,NG as ie,OG as ae,OX as oe,PG as se,Pc as ce,RG as le,SG as ue,SX as de,Sc as fe,TG as pe,TX as me,Tc as he,UG as ge,VG as y,XX as b,YX as x,_G as S,_X as C,aG as w,bG as T,bX as E,bc as D,cG as O,dG as k,dX as A,fG as j,fX as M,gG as N,gX as P,hG as F,hX as I,iG as L,jG as _e,jX as ve,kG as ye,kX as be,lG as xe,lX as Se,mG as Ce,mX as we,oG as Te,pG as R,pX as Ee,r as z,sG as De,t as B,uG as Oe,uI as ke,uX as Ae,vG as je,vX as Me,wG as Ne,wX as Pe,wc as Fe,xG as Ie,xX as Le,xc as Re,yG as ze,yX as Be,yc as Ve,zG as He,zc as Ue}from"./api-DSJJn0d7.js";import{t as V}from"./checkbox-CsI4ggnp.js";import{a as We,i as Ge,n as Ke,r as H,t as qe}from"./select-qM3ZfTHx.js";import{t as U}from"./button-Dio0PVrp.js";import{t as W}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{c as Je,d as Ye,r as Xe,t as Ze,u as Qe}from"./useFontScale-ByBFat3y.js";import{r as $e}from"./toast-xNFwDnUy.js";import{t as G}from"./badge-C4po8DQ1.js";import{t as K}from"./appHost-CH3EGcJw.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-CPTpWNQm.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>ge()},{id:`composer`,label:()=>v()},{id:`sidebar`,label:()=>y()},{id:`notifications`,label:()=>Ne()},{id:`other`,label:()=>a()}],X={showSource:{category:`messages`,label:()=>He(),help:()=>le()},showReport:{category:`messages`,label:()=>te(),help:()=>ee()},copyAssistant:{category:`messages`,label:()=>g()},copyUser:{category:`messages`,label:()=>se()},showDelete:{category:`messages`,label:()=>ie()},showTools:{category:`messages`,label:()=>ne(),help:()=>_e()},voiceInput:{category:`composer`,label:()=>r(),help:()=>ye()},showUsage:{category:`composer`,label:()=>ae(),help:()=>d()},autoReadAloud:{category:`composer`,label:()=>s(),help:()=>Ue()},showChatAge:{category:`sidebar`,label:()=>p(),help:()=>pe()},notifSound:{category:`notifications`,label:()=>c(),help:()=>ue()},notifSystem:{category:`notifications`,label:()=>Ie(),help:()=>T()},replySound:{category:`notifications`,label:()=>ze(),help:()=>je()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`||e!==`off`&&null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>O()};function ut({prefKey:e,ui:t}){let n=x(B.admin.setUiPrefDefault),r=x(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:j()}),(0,J.jsxs)(qe,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Ge,{size:`sm`,className:`w-36`,children:(0,J.jsx)(We,{})}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(H,{value:`on`,children:Te()}),(0,J.jsx)(H,{value:`off`,children:w()}),(0,J.jsx)(H,{value:`inherit`,children:L()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(V,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":k()}),k()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=x(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[h(),e?(0,J.jsx)(G,{variant:`secondary`,children:Ye(e,Je())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?u():r?Fe():he()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:Ve()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?D():e?Re():fe()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=b(B.me.getMe,{host:K}),a=i?.ui,s=$(i?.role)&&n,c=x(B.me.setUiPref).withOptimisticUpdate(Xe),l=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(V,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":R()}),R()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Oe()}),(0,J.jsx)(`p`,{children:xe()}),(0,J.jsx)(`p`,{children:De()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:S(),"aria-label":S(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:N()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(G,{variant:`outline`,children:F()}):l?(0,J.jsx)(G,{variant:`secondary`,children:ce()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:Ce()}):null,(0,J.jsx)(nt,{checked:o,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:o()})}var pt={sm:()=>E(),md:()=>Be(),lg:()=>Me(),xl:()=>C(),"2xl":()=>P(),"3xl":()=>I()};function mt(){let e=b(B.me.getMe,{host:K}),t=x(B.me.setLocale),n=x(B.me.setTimezone),r=x(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:K});n&&e.setQuery(B.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=x(B.me.setMyName),o=$e(),s=e?.locale??`default`,c=e?.name??``,[u,d]=(0,q.useState)(null),p=u??c,h=p.trim()!==c.trim();async function g(){try{await a({name:p}),d(null),o.success(oe())}catch(e){o.error(f(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:p,maxLength:120,placeholder:i(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h&&(e.preventDefault(),g())}}),(0,J.jsx)(U,{size:`sm`,disabled:!h,onClick:()=>void g(),children:ke()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:m()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(U,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(U,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:_()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Pe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:we()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(U,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:M()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:A()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Ze.map(t=>(0,J.jsx)(U,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ae()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|