@lacneu/atrium 0.103.5 → 0.104.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-Bk4_F0iH.js +1 -0
- package/dist/assets/{AdminSettings-DJrTOlAw.js → AdminSettings-BdVeeUB1.js} +1 -1
- package/dist/assets/{AdvancedFilter-D4ja71eC.js → AdvancedFilter-B4QfxxEB.js} +1 -1
- package/dist/assets/AgentFilesTab-Dlm2lBii.js +3 -0
- package/dist/assets/AnomaliesTab-D_QuI8BU.js +1 -0
- package/dist/assets/AuditTab-DOfKzC0D.js +1 -0
- package/dist/assets/BridgeTab-OC_GNU22.js +1 -0
- package/dist/assets/ChatDefaultsTab-BeTKiTFl.js +1 -0
- package/dist/assets/ConfirmDialog-BmOX8o6F.js +1 -0
- package/dist/assets/DataTableShell-BTk71L7O.js +1 -0
- package/dist/assets/DeletedChatsTab-BCD6pwBJ.js +1 -0
- package/dist/assets/{DetailChips-DJDPdjC6.js → DetailChips-BU-SQfjj.js} +1 -1
- package/dist/assets/EntitySheet-BXEY6TCb.js +1 -0
- package/dist/assets/FeedbacksTab-Ch0Og-WD.js +1 -0
- package/dist/assets/FieldLabel-Wb5bwK7r.js +1 -0
- package/dist/assets/FilesTab-C6xs9TIo.js +1 -0
- package/dist/assets/{FilterBar-vkX3BGGz.js → FilterBar-D2w0wWnm.js} +1 -1
- package/dist/assets/GroupsTab-Dktghl12.js +1 -0
- package/dist/assets/InstancesTab-B_jY-L5V.js +1 -0
- package/dist/assets/IntegrationsTab-CA10qkLR.js +1 -0
- package/dist/assets/KnobRow-DsPgcIxU.js +1 -0
- package/dist/assets/KpiTab-DN2VV-KL.js +1 -0
- package/dist/assets/PreferencesTab-DCUtb7jt.js +1 -0
- package/dist/assets/ProjectPage-CZbKzufX.js +1 -0
- package/dist/assets/ProjectPage-D3DrzSxV.css +1 -0
- package/dist/assets/PromptInjectionsTab-D-qkRO-x.js +4 -0
- package/dist/assets/RolesTab-B-kY1GSh.js +1 -0
- package/dist/assets/ScheduledTab-C3lqr_Wn.js +1 -0
- package/dist/assets/ServiceAccountsTab-4Tcuxr0L.js +1 -0
- package/dist/assets/SubAgentReportsTab-BvaMpkUp.js +1 -0
- package/dist/assets/ThemeShowroom-BNUhcoUx.js +1 -0
- package/dist/assets/TimeRangePicker-BvcqBpnq.js +1 -0
- package/dist/assets/{TimezoneCombobox-CWbHKOiS.js → TimezoneCombobox-BUC66FuM.js} +1 -1
- package/dist/assets/TracesTab-CmHSn4oj.js +1 -0
- package/dist/assets/TrashTab-CCNS2Ybn.js +1 -0
- package/dist/assets/UsersTab-B-H2pRkF.js +1 -0
- package/dist/assets/VoiceTab-C4f9SFZl.js +1 -0
- package/dist/assets/alert-dialog-BwvaE8oD.js +7 -0
- package/dist/assets/api-jG5Fwsg4.js +44 -0
- package/dist/assets/badge-CSm2xaYH.js +1 -0
- package/dist/assets/button-sV7hIR3f.js +1 -0
- package/dist/assets/{card-CoPKGkaG.js → card-i1bbFYFv.js} +1 -1
- package/dist/assets/check-MG02lA-U.js +1 -0
- package/dist/assets/{checkbox-Bbl8iiIs.js → checkbox-U99HMqP3.js} +1 -1
- package/dist/assets/chevron-left-cmPkj5_M.js +1 -0
- package/dist/assets/chevron-right-DbysoSJS.js +1 -0
- package/dist/assets/chevron-up-DQBDpk9Z.js +1 -0
- package/dist/assets/chevrons-up-down-3woN2nFd.js +1 -0
- package/dist/assets/{compatView-DCGywg8d.js → compatView-Cqu0P9sx.js} +1 -1
- package/dist/assets/confTabs-BpNy5aSd.css +1 -0
- package/dist/assets/convexApi-DeaVGrsr.js +1 -0
- package/dist/assets/{copy-BzGjJBzv.js → copy-BIRdG3Nl.js} +1 -1
- package/dist/assets/{cronDescribe-BP6ZrZEc.js → cronDescribe-D9eP5CDy.js} +1 -1
- package/dist/assets/{deliveryRecorder-B3Trh8JA.js → deliveryRecorder-DEtCAEff.js} +1 -1
- package/dist/assets/dialog-Bpoyy7pR.js +1 -0
- package/dist/assets/dispatchErrorInfo-DBq1hdag.js +1 -0
- package/dist/assets/dist-B9q2nlqC.js +5 -0
- package/dist/assets/{dist-Col6E8px.js → dist-Bxf4XoMW.js} +1 -1
- package/dist/assets/{dist-CQTmJUEo.js → dist-ChYvHRlL.js} +1 -1
- package/dist/assets/{dist-CMQ8ZmbJ.js → dist-D7Oplune.js} +1 -1
- package/dist/assets/{dist-B12lxLhp.js → dist-t45SSvfU.js} +1 -1
- package/dist/assets/{download-C_249zkC.js → download-DQYw1N-_.js} +1 -1
- package/dist/assets/dropdown-menu-yCbwljS-.js +1 -0
- package/dist/assets/{eye-0fRXv2uN.js → eye-CZuTJsZX.js} +1 -1
- package/dist/assets/{format-CE4Tb-R7.js → format-BQaxlN43.js} +1 -1
- package/dist/assets/{groupManageView-9KcuSXgR.js → groupManageView-BcbLXWZ4.js} +1 -1
- package/dist/assets/index-CHdY282S.css +1 -0
- package/dist/assets/index-CVhaNoJz.js +158 -0
- package/dist/assets/{input-BW0GOs_g.js → input-DReDYsos.js} +1 -1
- package/dist/assets/{list-DJaWqeCP.js → list-kKcfLqpz.js} +1 -1
- package/dist/assets/loader-circle-_HV4tchJ.js +1 -0
- package/dist/assets/{lock-Cai4iWP-.js → lock-DJQnxN_w.js} +1 -1
- package/dist/assets/measureClone-CHN0WNEY.js +1 -0
- package/dist/assets/{pencil-DPtIvpHp.js → pencil-C_IJUeJn.js} +1 -1
- package/dist/assets/plus-A35Qzur2.js +1 -0
- package/dist/assets/popover-BcL-AsC2.js +1 -0
- package/dist/assets/roleDescriptions-D-rhX1-Q.js +1 -0
- package/dist/assets/rotate-ccw-XgdDTtI8.js +1 -0
- package/dist/assets/{search-B-R9kd8o.js → search-CGco_tlI.js} +1 -1
- package/dist/assets/select-DGKgMOlh.js +1 -0
- package/dist/assets/{server-D8sEPnaP.js → server-ClLFUY_D.js} +1 -1
- package/dist/assets/{speech-C9rnmV3n.js → speech-DO_eJ8Aq.js} +1 -1
- package/dist/assets/{star-DgW-1Cj9.js → star-B6yMf_Hc.js} +1 -1
- package/dist/assets/{switch-BZom6_SV.js → switch-D-QGMGm7.js} +1 -1
- package/dist/assets/{table-CGUWJWZI.js → table-CIrFKiPM.js} +1 -1
- package/dist/assets/tabs-BWfAdnjK.js +1 -0
- package/dist/assets/{toast-pKIYRpST.js → toast-daONdZpX.js} +1 -1
- package/dist/assets/tooltip-CobtYK4c.js +87 -0
- package/dist/assets/{trash-2-B3-1X1oZ.js → trash-2-UxV-pTWt.js} +1 -1
- package/dist/assets/{trashPage-DfKyy5ga.css → trashPage-B7NvDkP2.css} +1 -1
- package/dist/assets/trashPage-CFUn9bkp.js +1 -0
- package/dist/assets/trashView-CrjCfgVT.js +1 -0
- package/dist/assets/{triangle-alert-uaH9SXmM.js → triangle-alert-BMryltpr.js} +1 -1
- package/dist/assets/{usageView-DIbIuJOR.js → usageView-CKi8uUZb.js} +1 -1
- package/dist/assets/{useChart-DLAE1JpY.js → useChart-BE4pYQJh.js} +1 -1
- package/dist/assets/{useFontScale-CWLfjbAm.js → useFontScale-DCa0acMC.js} +1 -1
- package/dist/assets/{useStartNewChat-BxlZDRnF.js → useStartNewChat-BatYRWH7.js} +2 -2
- package/dist/assets/useTableLayout-Cmwnuzxb.js +1 -0
- package/dist/assets/{use_paginated_query-DVbu_Fe7.js → use_paginated_query-imV3AXlW.js} +1 -1
- package/dist/assets/{users-BUeuEf6k.js → users-CBI99oGw.js} +1 -1
- package/dist/assets/x-TiVTngrx.js +1 -0
- package/dist/index.html +59 -56
- package/package.json +1 -1
- package/dist/assets/AccessTab-DmfPezpr.js +0 -1
- package/dist/assets/AgentFilesTab-DsXOfdpT.js +0 -3
- package/dist/assets/AnomaliesTab-B1KVrvF9.js +0 -1
- package/dist/assets/AuditTab-BsxWGDzT.js +0 -1
- package/dist/assets/BridgeTab-CBhC6xPF.js +0 -1
- package/dist/assets/ChatDefaultsTab-D84PkwGg.js +0 -1
- package/dist/assets/ConfirmDialog-BTkA9EEC.js +0 -1
- package/dist/assets/DataTableShell-PyJIukLO.js +0 -1
- package/dist/assets/DeletedChatsTab-CGzdG-VS.js +0 -1
- package/dist/assets/EntitySheet-DZaO__IZ.js +0 -1
- package/dist/assets/FeedbacksTab-C56lOjnO.js +0 -1
- package/dist/assets/FieldLabel-BW2ofPSg.js +0 -1
- package/dist/assets/FilesTab-Bo8GHHoP.js +0 -1
- package/dist/assets/GroupsTab-UPA0jBCI.js +0 -1
- package/dist/assets/InstancesTab-Cz8ZV2Yl.js +0 -1
- package/dist/assets/IntegrationsTab-DLf771n0.js +0 -1
- package/dist/assets/KnobRow-NCREweI3.js +0 -1
- package/dist/assets/KpiTab-CKvYVEzA.js +0 -1
- package/dist/assets/PreferencesTab-CCwKgY4H.js +0 -1
- package/dist/assets/ProjectPage-BXsrYrrF.css +0 -1
- package/dist/assets/ProjectPage-CVFZP9wJ.js +0 -1
- package/dist/assets/PromptInjectionsTab-BVyjgCHZ.js +0 -4
- package/dist/assets/RolesTab-D2iPXBrM.js +0 -1
- package/dist/assets/ScheduledTab-Cl9WgL-w.js +0 -1
- package/dist/assets/ServiceAccountsTab-B0XVQpdC.js +0 -1
- package/dist/assets/SubAgentReportsTab-xU0OVWGk.js +0 -1
- package/dist/assets/ThemeShowroom-D_wDwAQt.js +0 -1
- package/dist/assets/TimeRangePicker-B3Jl2mvx.js +0 -1
- package/dist/assets/TracesTab-DOy5oUHa.js +0 -1
- package/dist/assets/TrashTab-DFi1o7_K.js +0 -1
- package/dist/assets/UsersTab-CIC9NMtm.js +0 -1
- package/dist/assets/VoiceTab-DD0Y1Cqz.js +0 -1
- package/dist/assets/alert-dialog-D8JROLng.js +0 -7
- package/dist/assets/api-C9TZ4xjz.js +0 -44
- package/dist/assets/badge-UrSDbO1c.js +0 -1
- package/dist/assets/button-DEKA-XdT.js +0 -1
- package/dist/assets/check-DLsNvgAq.js +0 -1
- package/dist/assets/chevron-left-PEVM2kG9.js +0 -1
- package/dist/assets/chevron-right-DrdFABbO.js +0 -1
- package/dist/assets/chevron-up-DpsXK7Un.js +0 -1
- package/dist/assets/chevrons-up-down-roy0B5KU.js +0 -1
- package/dist/assets/confTabs-BzReq467.css +0 -1
- package/dist/assets/convexApi-D2VdPGGW.js +0 -1
- package/dist/assets/dialog-CHpclz_0.js +0 -1
- package/dist/assets/dispatchErrorInfo-B-CAt7GQ.js +0 -1
- package/dist/assets/dist-BwFz2rDM.js +0 -1
- package/dist/assets/dist-CT8KFZnw.js +0 -5
- package/dist/assets/dropdown-menu-DhetHpBb.js +0 -1
- package/dist/assets/index-D8Eob_Mc.css +0 -1
- package/dist/assets/index-DT3YA902.js +0 -158
- package/dist/assets/loader-circle-D_v0YERy.js +0 -1
- package/dist/assets/plus-DYL_4aqG.js +0 -1
- package/dist/assets/popover-rh1_TqjX.js +0 -1
- package/dist/assets/roleDescriptions-heGPDkTY.js +0 -1
- package/dist/assets/rotate-ccw-Bs40VcST.js +0 -1
- package/dist/assets/select-CeQpPnet.js +0 -1
- package/dist/assets/tabs-xefd1SeB.js +0 -1
- package/dist/assets/tooltip-B27138uH.js +0 -87
- package/dist/assets/trashPage-BNLG_tTi.js +0 -1
- package/dist/assets/trashView-CcPdpr1y.js +0 -1
- package/dist/assets/x-E03nFsG9.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,JS as i,QS as a,XS as o,YS as s,ZS as c,aC as l,eC as u,iC as d,nC as f,oC as p,qS as m,rC as h,sC as g,sQ as _,t as v,tC as y,vQ as b}from"./api-jG5Fwsg4.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-DGKgMOlh.js";import"./convexApi-DeaVGrsr.js";import{t as E}from"./badge-CSm2xaYH.js";var D=t(e(),1);function O(e){return e===`user`?c():e===`all`?o():s({group:e.group})}function k(e){return e===`common`?i():e===`owner`?m():s({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=b(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=b(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":p(),children:(0,A.jsx)(x,{placeholder:p()})}),(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:l()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(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:d()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.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:f()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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:a()}):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:y()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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:u()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$
|
|
1
|
+
import{$D as e,KX as t,MJ as n,Ny as r,QD as i,Rg as a,_C as o,ad as s,bC as c,cC as l,dC as u,eQ as d,fC as f,gC as p,hC as m,kZ as h,lC as g,mC as _,ny as v,pC as y,pj as b,uC as x,vC as S,yC as C}from"./api-jG5Fwsg4.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:()=>c(),groups:()=>g(),instances:()=>C(),bridge:()=>S(),injections:()=>b(),serviceAccounts:()=>o(),roles:()=>p(),access:()=>l(),traces:()=>m(),kpi:()=>_(),anomalies:()=>y(),files:()=>h(),scheduled:()=>t(),agentFiles:()=>r(),preferences:()=>d(),integrations:()=>f(),theme:()=>n(),chatDefaults:()=>v(),audit:()=>u(),feedbacks:()=>x(),subagentReports:()=>a(),voice:()=>s(),trash:()=>e(),deletedChats:()=>i()},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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,MT as i,NT as a,OT as o,PT as s,jT as c,kT as l}from"./api-jG5Fwsg4.js";import{r as u}from"./dist-Bxf4XoMW.js";import{t as d}from"./plus-A35Qzur2.js";import{t as f}from"./x-TiVTngrx.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-DGKgMOlh.js";import{t as v}from"./button-sV7hIR3f.js";import{t as y}from"./input-DReDYsos.js";import{r as b}from"./TimeRangePicker-BvcqBpnq.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:s()},{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 s=(0,x.useRef)(t),w=!!(s.current&&s.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(s.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}),a(),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:i()}):(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:r()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),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,{}),o()]})]}):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{$f as r,Ay as i,Bp as a,Cy as o,Dy as s,Ey as c,Fp as l,Gp as u,Hp as d,Ip as f,Jp as p,Kp as m,Lp as h,Mp as g,My as _,Np as v,Oy as y,Pp as b,Qf as x,Rp as S,Sy as C,Ty as w,Up as T,Vp as E,Wp as ee,Xf as D,Xp as O,Yp as k,Zf as A,Zp as j,_Q as M,_c as te,_y as N,ay as P,by as ne,cy as re,dy as ie,ep as ae,fy as F,gU as I,gb as oe,gy as se,hQ as L,hy as ce,iy as R,jp as z,jy as le,ky as ue,ly as B,my as de,np as fe,oy as pe,py as me,qp as he,ry as ge,sQ as V,sy as _e,t as H,tp as ve,uQ as U,uy as ye,vQ as W,vb as G,vy as be,wy as xe,xy as Se,yy as Ce,zp as we}from"./api-jG5Fwsg4.js";import{t as K}from"./triangle-alert-BMryltpr.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./select-DGKgMOlh.js";import{a as Ae,c as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./alert-dialog-BwvaE8oD.js";import{t as q}from"./button-sV7hIR3f.js";import"./convexApi-DeaVGrsr.js";import{r as J}from"./toast-daONdZpX.js";import{t as Re}from"./badge-CSm2xaYH.js";import{a as ze,i as Y,n as Be,o as Ve,r as He,t as Ue}from"./dialog-Bpoyy7pR.js";import{t as We}from"./appHost-CH3EGcJw.js";import{n as Ge}from"./capabilities-CASxhKEd.js";import{r as Ke,t as qe}from"./measureClone-CHN0WNEY.js";import{n as Je,t as Ye}from"./curation-CQksaIbm.js";import{a as Xe}from"./compatView-Cqu0P9sx.js";/* empty css */var X=t(e(),1),Ze=2e4,Qe=6e4;function $e(e){return typeof e!=`number`||e<=0?0:Math.round(e/Ze*100)}function et(e){return e<=0?0:Math.round(e/Qe*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 tt(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var nt=3;function rt(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<nt&&a.push(e)):t>0&&(i+=t,o.length<nt&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function it(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function at(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function ot(){let e=W(H.me.getMe,{host:We}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=W(H.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,l]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&l(r[0].name)},[t,r,a]);let u=W(H.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),d=W(H.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),f=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,u,r,d]),[h,g]=(0,X.useState)(null);(0,X.useEffect)(()=>{!f||f.length===0||(!h||!f.some(e=>$(e)===h))&&g($(f[0]))},[f,h]);let v=f?.find(e=>$(e)===h)??null,b=L(H.agentFiles.listAgentFiles),[x,S]=(0,X.useState)({status:`idle`}),T=v?.instanceName??null,E=v?.agentId??null,ee=W(H.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),D=n&&T!==null?Ge(ee,`agentFiles`):null,O=D===null?!1:D===`loading`?null:D.blocked,k=(0,X.useCallback)(async()=>{if(!(T===null||E===null)){S({status:`loading`});try{let e=await b({instanceName:T,agentId:E});S({status:`done`,files:e.files})}catch(e){S({status:`error`,dashboardAbsent:it(e)})}}},[b,T,E]);(0,X.useEffect)(()=>{O===!1&&k()},[k,O]);let[A,j]=(0,X.useState)(null),M=W(H.agentFileCuration.listCurations,t&&T!==null&&E!==null?{instanceName:T,agentId:E}:`skip`),N=W(H.agentFileCuration.curationSettings,t&&T!==null?{instanceName:T}:`skip`),P=L(H.agentFileCuration.requestCuration),[re,ie]=(0,X.useState)(null),[ae,F]=(0,X.useState)(null),{toast:I}=J(),se=(0,X.useMemo)(()=>{let e=new Map;for(let t of M??[])e.has(t.name)||e.set(t.name,t);return e},[M]),ce=(0,X.useCallback)(async e=>{if(!(T===null||E===null)){ie(e);try{let t=await P({instanceName:T,agentId:E,name:e,trigger:`manual`});t.ok?I({title:p(),variant:`success`}):I({title:he({reason:t.reason??`unknown`}),variant:`error`})}catch{I({title:m(),variant:`error`})}finally{ie(null)}}},[P,T,E,I]),R=U(),z=(0,X.useMemo)(()=>new Intl.NumberFormat(R,{maximumFractionDigits:0}),[R]),B=(0,X.useRef)(null),de=Ke(()=>{let e=B.current;if(e===null)return null;let[t]=qe(e,[e=>e.setAttribute(`data-layout`,`line`)],`oc-afiles__measure`);return{available:e.clientWidth,required:[t]}},()=>[B.current],[x,R,t]);return e===void 0||f===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(ke,{value:a??``,onValueChange:e=>l(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":le(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(De,{children:(r??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,f.length>0?(0,Q.jsxs)(ke,{value:h??``,onValueChange:e=>g(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(De,{children:f.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()})]}),v===null?null:D===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):D!==null&&D.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(K,{size:14,"aria-hidden":!0}),` `,Xe(D.gatewayVersion,D.provider)]}):x.status===`loading`||x.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):x.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[x.dashboardAbsent?te():s(),` `,!x.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:oe()})]}):x.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:B,className:`oc-afiles__list`,"data-layout":de===0?`line`:`two-level`,children:x.files.map(e=>{let n=$e(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)(Re,{variant:`outline`,children:c()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:w({size:Z(e.size,R)})}),(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:xe({pct:z.format(n)})}),r?(0,Q.jsx)(K,{size:14,className:`oc-afiles__warn`,"aria-label":o()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>j(e),children:t?Se():ne()}),t&&!e.missing?(0,Q.jsx)(st,{curatable:Ye.includes(e.name),size:e.size??0,budget:N?.budgetChars??null,enabled:N?.enabled??!1,curation:se.get(e.name)??null,inFlight:re===e.name,onCurate:()=>void ce(e.name),onReview:e=>F(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:C({used:Z(tt(x.files),R),total:Z(Qe,R),pct:z.format(et(tt(x.files)))})})]}),A&&v?(0,Q.jsx)(ct,{instanceName:v.instanceName,agentId:v.agentId,name:A.name,isAdmin:t,onClose:()=>j(null),onSaved:()=>void k()}):null,ae?(0,Q.jsx)(lt,{curationId:ae,onClose:()=>F(null),onApplied:()=>{F(null),k()}}):null]})}function st({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:O()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Re,{variant:`outline`,className:`oc-afiles__curate-status`,children:k()}):e&&r&&n!==null&&Je(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:j()}):null}function ct({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=L(H.agentFiles.getAgentFile),s=L(H.agentFiles.setAgentFile),c=J(),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),C=(0,X.useCallback)(async r=>{f(!1);try{let i=await o({instanceName:e,agentId:t,name:n});u({content:i.content,updatedAtMs:i.updatedAtMs}),r||m(i.content),b(!1)}catch{f(!0)}},[o,e,t,n]);(0,X.useEffect)(()=>{C(!1)},[C]);async function w(){if(l!==null){v(!0),S(!1);try{await s({instanceName:e,agentId:t,name:n,content:p,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(me({name:n})),a(),await C(!1)}catch(e){at(e)?b(!0):S(!0)}finally{v(!1)}}}let T=l!==null&&p!==l.content,E=(0,X.useMemo)(()=>l===null?null:rt(l.content,p),[l,p]),ee=p.length>Ze,D=U(),O=(0,X.useMemo)(()=>new Intl.NumberFormat(D),[D]);return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Ve,{children:Ce({name:n})}),(0,Q.jsxs)(He,{children:[be({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,N()]})]})]}),d?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ie(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void C(!1),children:oe()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:p,readOnly:!r,spellCheck:!1,onChange:e=>m(e.target.value),"aria-label":Ce({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:se()}),y?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ye(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void C(!0),children:B()})]}):null,x?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:F()}):null,(0,Q.jsxs)(Y,{className:`oc-afiles__editor-foot flex-row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ee?` is-over`:``}`,children:ce({count:O.format(p.length),max:O.format(Ze)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!T||_||y,onClick:()=>g(!0),children:_?G():de()}):null]})]}),(0,Q.jsx)(Le,{open:h,onOpenChange:g,children:(0,Q.jsxs)(Me,{children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(je,{children:re({name:n})}),(0,Q.jsx)(Ae,{children:_e({agent:t})})]}),E?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:pe({added:E.added,removed:E.removed})}),E.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:P()}),E.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,E.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:R()}),E.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Fe,{children:I()}),(0,Q.jsx)(Ne,{onClick:()=>void w(),children:ge()})]})]})})]})})}function lt({curationId:e,onClose:t,onApplied:n}){let i=W(H.agentFileCuration.getProposal,{curationId:e}),o=L(H.agentFileCuration.approveCuration),s=M(H.agentFileCuration.rejectCuration),{toast:c}=J(),[p,_]=(0,X.useState)(null),[y,C]=(0,X.useState)(!1),[w,O]=(0,X.useState)(``),k=U(),j=(0,X.useMemo)(()=>i?rt(i.beforeContent,i.proposedContent):null,[i]);async function te(){_(`approve`);try{let t=await o({curationId:e});t.ok?(c({title:u(),variant:`success`}),n()):c({title:t.reason===`conflict`?T():d({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:m(),variant:`error`})}finally{_(null)}}async function N(n){_(`reject`);try{let r=w.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?A():ee(),variant:`success`}):c({title:we(),variant:`error`}),t()}catch{c({title:m(),variant:`error`})}finally{_(null)}}return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Ve,{children:i?E({name:i.name}):V()}),(0,Q.jsx)(He,{children:a()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[S({before:Z(i.beforeSize,k),after:Z(i.proposedSize,k)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),` `,h()]}):null]}),j?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:f({added:j.added,removed:j.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:D({feedback:i.feedback})}):null,j&&j.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:z()}),(0,Q.jsx)(`ul`,{children:j.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:g()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:l()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),y?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:fe()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:ve(),value:w,onChange:e=>O(e.target.value)})]}):null,y?(0,Q.jsxs)(Y,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>C(!1),disabled:p!==null,children:ae()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void N(!1),disabled:p!==null,children:p===`reject`?G():r()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void N(!0),disabled:p!==null,children:p===`reject`?G():x()})]}):(0,Q.jsxs)(Y,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>C(!0),disabled:p!==null||i==null,children:b()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void te(),disabled:p!==null||i==null,children:p===`approve`?G():v()})]})]})})}export{ot as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AP as i,BP as a,CP as ee,DP as te,EP as ne,FP as o,GP as s,HP as c,IP as l,KP as u,LP as re,MP as ie,NP as ae,OP as oe,PP as se,QN as d,RP as ce,SP as le,TP as ue,UP as de,VP as fe,WP as pe,_P as f,_Q as me,aP as p,bP as m,cP as h,dP as g,eP as _,fP as he,gP as ge,hP as _e,iP as v,jP as ve,kP as ye,lP as be,mP as xe,nP as y,oP as Se,pP as Ce,qP as b,rP as x,sP as S,t as C,tP as w,uP as T,vP as E,vQ as D,wP as O,xP as k,yP as A,zP as we}from"./api-jG5Fwsg4.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-DGKgMOlh.js";import"./convexApi-DeaVGrsr.js";import{r as Ee}from"./toast-daONdZpX.js";import{t as L}from"./badge-CSm2xaYH.js";import{n as R}from"./format-BQaxlN43.js";import{a as z,n as B,o as V,t as H}from"./dialog-Bpoyy7pR.js";import{c as De,o as Oe}from"./searchSchemas-Dm-Qg010.js";import{t as ke}from"./appHost-CH3EGcJw.js";import{n as Ae}from"./ConfirmDialog-BmOX8o6F.js";import{n as je}from"./TimeRangePicker-BvcqBpnq.js";import{t as Me}from"./FilterBar-D2w0wWnm.js";import{t as Ne}from"./DataTableShell-BTk71L7O.js";import{t as U}from"./dispatchErrorInfo-DBq1hdag.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`?b():e===`acknowledged`?u():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??``,r=e.status===X?Y:e.status,s=e.severity??Y,u=e.kind??Y,[d,p]=(0,W.useState)(Y),_=Oe(e.from,e.to),{from:v,to:y}=je(_),b=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),x=e=>void t({search:t=>({...t,status:e===Y?X:e})}),w=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=me(C.anomalies.resolveAnomaly),G=(D(C.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),K=D(C.anomalies.listAnomalies,{limit:ze,filter:{q:n||void 0,from:v,to:y,anomalyStatus:r===Y?void 0:r,severity:s===Y?void 0:s,source:d===Y?void 0:d,kind:u===Y?void 0:u}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Z=n!==``||r!==`open`||s!==Y||d!==Y||u!==Y||_.kind!==`relative`||_.from!==Re.from;function Q(){p(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:pe(),description:(0,J.jsxs)(J.Fragment,{children:[de(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,c(),` `,(0,J.jsx)(`strong`,{children:fe()}),`.`,` `,a()]}),confirmLabel:we()}))try{await U({anomalyId:e._id,status:`resolved`}),H.success(ce(),e.kind)}catch(e){H.error(re(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),H.success(l(),e.kind)}catch(e){H.error(o(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),` `,(0,J.jsx)(`strong`,{children:ae()}),` `,ie(),` `,(0,J.jsx)(`strong`,{children:ve()}),` `,i(),` `,(0,J.jsx)(`strong`,{children:ye()}),` `,oe(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:te()})]}),(0,J.jsxs)(Me,{q:n,onQChange:b,searchPlaceholder:ne(),timeRange:_,onTimeRangeChange:B,onReset:Q,canReset:Z,children:[(0,J.jsxs)(I,{value:r,onValueChange:x,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:ue()}),Pe.map(e=>(0,J.jsx)(F,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:s,onValueChange:w,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:O()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:m()}),Ie.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:d,onValueChange:p,children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(M,{placeholder:A()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:E()}),Le.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:u,onValueChange:z,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:f()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:ge()}),q.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:_e(),rows:K,emptyHint:r===`open`?xe():Ce(),rowActions:e=>G&&e.status===`open`?[{label:he(),onSelect:()=>void We(e)},{label:g(),onSelect:()=>void Ge(e)}]:[],columns:[{header:T(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)}),sort:e=>e.at},{header:f(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ee(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:k({when:R(e.firstAt)}),children:le({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:O(),cell:e=>(0,J.jsx)($,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:be(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:A(),cell:e=>(0,J.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:h(),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)(Ve,{row:e})]}),sort:e=>e.message},{header:S(),cell:e=>(0,J.jsx)(Be,{row:e}),sort:e=>e.evidence??null},{header:Se(),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 Be({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:[`↗ `,p()]}):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:[`↗ `,p()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),i=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}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,p()]}):null]})}function Ve({row:e}){let[t,n]=(0,W.useState)(!1),r=D(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:[v(),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:x()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:y()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:w()}):(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 $({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:_()}):e===`acknowledged`?(0,J.jsx)(L,{variant:`secondary`,children:r()}):(0,J.jsx)(L,{variant:`outline`,children:d()})}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{$F as r,BF as i,GF as a,Gd as o,HF as s,Hd as c,JF as l,KF as u,Kd as d,QF as f,UF as p,Ud as m,VF as h,Vd as g,WF as _,Wd as v,XF as y,YF as b,ZF as x,qF as S,t as C,vQ as w,zF as T}from"./api-jG5Fwsg4.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-DGKgMOlh.js";import"./convexApi-DeaVGrsr.js";import{n as N}from"./format-BQaxlN43.js";import{c as P,o as F,s as I,t as L,u as R}from"./searchSchemas-Dm-Qg010.js";import{n as ee}from"./TimeRangePicker-BvcqBpnq.js";import{t as z}from"./FilterBar-D2w0wWnm.js";import{t as B}from"./AdvancedFilter-B4QfxxEB.js";import{t as V}from"./DataTableShell-BTk71L7O.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:d()},{value:`realLabel`,label:o()},{value:`targetLabel`,label:v()},{value:`impersonated`,label:m()},{value:`resource`,label:c()},{value:`resourceId`,label:g()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,o=e.action??G,c=e.impersonated??G,d=e.resource??G,m=F(e.from,e.to),g=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:v,to:L}=ee(m),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}),$=w(C.admin.listAudit,{filter:{q:n||void 0,from:v,to:L,action:o===G?void 0:o,resource:d===G?void 0:d,impersonated:c===G?void 0:c===`yes`,advanced:g.length>0?g: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!==``||o!==G||c!==G||d!==G||g.length>0||m.kind!==`relative`||m.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:[r(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:x(),timeRange:m,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:o,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:y()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:b()}),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:l()}),(0,U.jsx)(j,{value:`yes`,children:S()}),(0,U.jsx)(j,{value:`no`,children:u()})]})]}),(0,U.jsxs)(M,{value:d,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:a()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:_()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:g,onChange:Q}),(0,U.jsx)(V,{title:p(),rows:$,emptyHint:s(),columns:[{header:h(),cell:e=>N(e.at),sort:e=>e.at},{header:y(),cell:e=>e.action,sort:e=>e.action},{header:i(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:T(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:a(),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{$A as r,AA as i,BA as a,Bj as o,Bv as s,CA as c,DA as l,EA as u,FA as d,Fj as f,Fv as p,GA as m,Gj as ee,Gv as h,HA as g,Hj as te,Hv as _,IA as v,Iv as y,JA as b,Jj as x,Jo as ne,KA as re,Kv as ie,LA as ae,Lv as oe,MA as se,NA as ce,OA as S,Ov as le,PA as ue,Pj as de,Pv as fe,QA as pe,RA as me,Rj as he,Rv as ge,SA as _e,TA as ve,UA as C,Uj as ye,Uv as be,VA as xe,Vj as Se,Vv as w,WA as Ce,Wj as we,Wv as Te,XA as Ee,YA as De,ZA as Oe,_A as ke,_Q as Ae,aj as je,bA as Me,cd as Ne,cj as Pe,dd as Fe,dj as Ie,ej as Le,fd as Re,fj as ze,gA as Be,hA as Ve,hQ as He,hd as Ue,ij as We,jA as Ge,k as T,kA as Ke,ld as qe,lj as Je,mA as E,nj as Ye,oj as Xe,qA as Ze,qj as Qe,rj as $e,sj as et,t as D,tj as tt,ud as nt,uj as rt,vA as it,vQ as O,vc as at,wA as ot,xA as st,yA as ct,zA as lt,zj as ut,zv as dt}from"./api-jG5Fwsg4.js";import{i as ft,n as k,o as pt,r as mt,s as ht}from"./FieldLabel-Wb5bwK7r.js";import{n as gt,t as _t}from"./useNavigate-D3GIoxyW.js";import{r as A}from"./dist-Bxf4XoMW.js";import{t as vt}from"./chevron-right-DbysoSJS.js";import{t as yt}from"./chevron-up-DQBDpk9Z.js";import{t as bt}from"./chevrons-up-down-3woN2nFd.js";import{n as xt,t as St}from"./usageView-CKi8uUZb.js";import{t as Ct}from"./loader-circle-_HV4tchJ.js";import{t as wt}from"./checkbox-U99HMqP3.js";import{t as Tt}from"./server-ClLFUY_D.js";import{t as j}from"./triangle-alert-BMryltpr.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-DGKgMOlh.js";import{n as Et,r as Dt,t as Ot}from"./popover-BcL-AsC2.js";import{i as kt,n as At,r as jt,t as Mt}from"./tabs-BWfAdnjK.js";import{t as L}from"./button-sV7hIR3f.js";import{t as R}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as Nt}from"./toast-daONdZpX.js";import{t as z}from"./badge-CSm2xaYH.js";import{a as B,n as Pt}from"./format-BQaxlN43.js";import{a as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-Bpoyy7pR.js";import{t as Bt}from"./appHost-CH3EGcJw.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CIrFKiPM.js";import{t as Gt}from"./FilterBar-D2w0wWnm.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as W,t as Zt}from"./compatView-Cqu0P9sx.js";import{t as G}from"./dispatchErrorInfo-DBq1hdag.js";var Qt=T(`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`}]]),$t=T(`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`}]]),K=t(e(),1);function en(e){return e.filter(e=>e.state===`error`)}function tn(e){return e.reachable&&en(e.targets).length===0}function nn(e){return tn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function rn(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return rn(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(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,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(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 Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return W(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(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)=>Z(e.label,t.label))}function vn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>W(e,t)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(un),[i,a]=(0,K.useState)(null),o=(0,K.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]),s=(0,K.useMemo)(()=>gn(o),[o]),d=(0,K.useMemo)(()=>_n(o),[o]),f=(0,K.useMemo)(()=>vn(o),[o]),p=(0,K.useMemo)(()=>hn(fn(o,n),i),[o,n,i]);function m(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ke(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:l()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(F,{value:Y,children:S()}),s.map(e=>(0,Q.jsx)(F,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(M,{placeholder:u()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(F,{value:Y,children:S()}),d.map(e=>(0,Q.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:ve()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(F,{value:Y,children:S()}),f.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))]})]})]}),p.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:c(),sortKey:`target`,sort:i,onSort:m}),(0,Q.jsx)($,{label:_e(),sortKey:`state`,sort:i,onSort:m}),(0,Q.jsx)($,{label:st(),sortKey:`instance`,sort:i,onSort:m}),(0,Q.jsx)($,{label:Me(),sortKey:`host`,sort:i,onSort:m}),(0,Q.jsx)($,{label:ct(),sortKey:`version`,sort:i,onSort:m}),(0,Q.jsx)(V,{children:it()}),(0,Q.jsx)($,{label:ke(),sortKey:`lastOk`,sort:i,onSort:m})]})}),(0,Q.jsx)(Ut,{children:p.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(yt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(A,{size:13,"aria-hidden":!0}):(0,Q.jsx)(bt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=rn(e)?G(e.lastErrorCode):null,n=an(e)?G(e.lastDownstreamRejectCode):null,r=on(e)?G(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ge({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:B(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${B(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ne({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${B(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[i({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${B(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?Be():e===`error`?Ve():E()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(z,{variant:`secondary`,children:Be()}):e===`error`?(0,Q.jsx)(z,{variant:`destructive`,children:Ve()}):(0,Q.jsx)(z,{variant:`outline`,children:E()})}function Cn(){return O(D.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=O(D.compat.getBridgeCompat,{}),n=O(D.me.getMe,{host:Bt})?.role===`admin`,r=O(D.admin.listInstances,n?{}:`skip`),i=O(D.agents.usageForInstances,n?{}:`skip`),a=_t(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=gt({from:`/settings/bridge`}),l=_t({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,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:pe()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Oe()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Re()}),(0,Q.jsx)(V,{children:Fe()}),(0,Q.jsx)(V,{children:nt()}),(0,Q.jsx)(V,{children:qe()}),(0,Q.jsx)(V,{children:Ne()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=St(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(z,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Mt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(jt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(kt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Tt,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(At,{value:e.key,children:(0,Q.jsx)(En,{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,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):null]})}function Tn({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,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Te(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,be({build:t.buildVersion??`?`})]}):null,` · `,_(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:g()});let s=en(e.targets),c=!e.reachable,l=nn(e),u=e.unreachableInstances??[],f=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,p=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(xt,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)($t,{size:22}):(0,Q.jsx)(j,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?xe():l===`gateways_unreachable`?ae({count:u.length}):c?a():lt({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Qt,{size:12,"aria-hidden":!0}),` `,me({time:p})]}),m?(0,Q.jsx)(`span`,{children:d({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:v({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ue()})]})}function En({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=Zt(l.map(e=>e.state)),[f,p]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(Tt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(z,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ie()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(A,{size:13,"aria-hidden":!0}):(0,Q.jsx)(vt,{size:13,"aria-hidden":!0}),ce({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ee(),i.length>0?(0,Q.jsx)(z,{variant:`destructive`,children:b({count:i.length})}):a>0?(0,Q.jsx)(z,{variant:`destructive`,children:Ze()}):(0,Q.jsx)(z,{variant:`secondary`,children:De()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[re({version:e.vendoredVersion}),r?` · `+m({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(A,{size:13,"aria-hidden":!0}):(0,Q.jsx)(vt,{size:13,"aria-hidden":!0}),Ce({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ue({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:ge({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:w()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(z,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(zt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(Lt,{children:x({instance:e.displayName??e.name})}),(0,Q.jsx)(Rt,{children:Qe()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.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,Q.jsx)(xt,{"aria-hidden":!0}):(0,Q.jsx)(j,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ye():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,tt()]}):null}function jn({instance:e,onClose:t}){let n=Ae(D.admin.upsertInstanceConfig),i=He(D.bridge.validateMediaPaths),a=Nt(),s=Vt(e.config?.contentLocale,void 0),[c,l]=(0,K.useState)(()=>ft(e.config??{},s)),[u,d]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(null),_=c.inboundMediaMode===`shared-fs`,v=c.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){a.error(Xe(),e)}finally{m(!1)}}async function x(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:mt(c,r,s)}),t()}catch(e){a.error(o(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:ee(),help:ut()}),(0,Q.jsxs)(I,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(P,{children:ht.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:we(),help:he()}),(0,Q.jsxs)(I,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(P,{children:pt.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:ye(),help:f()}),(0,Q.jsx)(R,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:ze(),help:Ie()}),(0,Q.jsx)(R,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:rt(),help:Je()}),(0,Q.jsx)(R,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(wt,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(k,{label:te(),help:de()})]}),y&&h!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),r({reason:h.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:We(),result:h.inbound}),(0,Q.jsx)(An,{label:$e(),result:h.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:je()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),Le()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Q.jsx)(Ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?et():Pe()]}),(0,Q.jsx)(L,{size:`sm`,onClick:()=>void x(),disabled:u,children:Se()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(Dt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?oe():y({count:e.length}),(0,Q.jsx)(A,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Et,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:p()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(z,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$m as i,$v as a,An as o,B as s,Cn as c,Dn as l,En as u,F as d,G as f,H as p,I as m,J as h,Jv as g,K as _,Kj as v,L as y,Mn as b,On as x,P as ee,Q as te,Qv as S,R as C,Sn as w,Tn as ne,U as T,V as re,W as E,X as ie,Xv as ae,Y as oe,Yv as D,Z as se,Zv as ce,_Q as O,_n as le,ah as k,bn as ue,ch as de,cn as fe,db as pe,dn as me,eh as he,et as ge,ey as _e,fb as ve,fn as ye,gb as be,gn as xe,hQ as A,hn as Se,ih as Ce,jn as we,jy as Te,k as Ee,kn as De,ln as Oe,md as ke,mn as Ae,nh as je,nt as Me,oh as Ne,pn as Pe,q as Fe,qv as j,rh as Ie,rt as Le,sQ as M,sh as Re,sn as ze,t as N,th as Be,ty as Ve,un as He,vQ as P,vb as F,vn as Ue,wn as We,xn as I,yn as Ge,z as Ke}from"./api-jG5Fwsg4.js";import{t as qe}from"./use_paginated_query-imV3AXlW.js";import{t as Je}from"./loader-circle-_HV4tchJ.js";import{t as Ye}from"./checkbox-U99HMqP3.js";import{t as Xe}from"./plus-A35Qzur2.js";import{t as Ze}from"./triangle-alert-BMryltpr.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-DGKgMOlh.js";import{n as Qe,r as $e,t as et}from"./popover-BcL-AsC2.js";import{t as H}from"./button-sV7hIR3f.js";import{t as U}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{a as tt,t as W}from"./KnobRow-DsPgcIxU.js";import{n as nt}from"./capabilities-CASxhKEd.js";import{a as rt}from"./compatView-Cqu0P9sx.js";/* empty css */import{t as it}from"./switch-D-QGMGm7.js";var at=Ee(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),G=t(e(),1),ot=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function st(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 ct=[`auto`,`hybrid`,`tool`,`off`];function lt(e){switch(e){case`auto`:return De();case`hybrid`:return x();case`tool`:return l();default:return u()}}function K(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function ut(e){return typeof e==`string`&&ct.includes(e)}function q(e){return{injection:ut(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function dt(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function ft(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?I():pt(e)?me():null:w(),i=q(e),a=t.injection!==i.injection||!dt(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:We()}}function pt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function mt(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 ht(e){return e.ok?null:e.code===`scope_refused`?I():e.code===`stale_default`?ue():e.code===`write_unknown`||e.code===`not_confirmed`?le():e.code===`not_applied`?xe():e.code===`default_too_large`?Oe():e.code===`allowlist_too_large`?He():e.code===`plugin_too_old`?me():e.code===`source_not_allowed`?ye():e.code===`plugin_config_lag`?Pe():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?c():Ge({code:e.code})}function gt(e,t){let n=K(e),r=K(t);if(n.injection!==r.injection||!dt(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 J=n();function _t({instanceName:e,row:t,supported:n}){let r=A(N.knowledge.setAgentKnowledgeDefault),[i,a]=(0,G.useState)(t),[s,c]=(0,G.useState)(()=>q(t)),[l,u]=(0,G.useState)(`idle`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),h=e=>{a(e),c(q(e)),f(null)},_=gt(i,t);(0,G.useEffect)(()=>{p&&_&&(m(!1),h(t))},[p,_]);let v=ft(i,s,n),y=v.readOnlyReason===null;async function b(){u(`saving`),f(null);try{let n=ht(await r({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:K(i)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(ht({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsxs)(V,{value:s.injection,onValueChange:e=>{ut(e)&&c({...s,injection:e})},disabled:!y,children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":o(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:ct.map(e=>(0,J.jsx)(B,{value:e,children:lt(e)},e))})]})}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:ne()}),t.sources.map(e=>(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,J.jsx)(Ye,{checked:s.sources.includes(e.id),onCheckedChange:()=>c(mt(t,s,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,J.jsx)(`span`,{children:e.label})]},e.id)),_&&!p?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[fe(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:ze()})]}):null,t.overridesAllowed?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ue()}),y?(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsx)(H,{size:`sm`,disabled:!v.dirty||!v.valid||l===`saving`,onClick:()=>void b(),children:l===`saving`?F():D()})}):(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:v.readOnlyReason}),y&&v.dirty&&v.invalidReason!==null?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v.invalidReason}):null,l===`done`&&d===null?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,d===null?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function vt({instanceName:e}){let t=P(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=qe(N.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,J.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":b(),children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),t.supported?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:w()}),n.map(n=>(0,J.jsx)(_t,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Se({shown:n.length})}),(0,J.jsx)(H,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:Ae()})]}):null]})}function Y(e){return e.displayName??e.agentId}function yt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function X(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function bt(e,t){let n=X(t);return n===``||X(Y(e)).includes(n)||X(e.agentId).includes(n)}var xt=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function Z(e,t){return xt.compare(Y(e),Y(t))||xt.compare(e.agentId,t.agentId)}function St(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(Z).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function Ct(e,t){return wt(e.length)?e.filter(e=>bt(e.agent,t)):[...e]}function wt(e){return e>8}function Q(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&bt(e,t));return[...n.filter(e=>e.enabled).sort(Z),...n.filter(e=>!e.enabled).sort(Z)]}function Tt(e){return!e}function Et(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Dt(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function Ot(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:Math.min(e+1,n-1);case`ArrowUp`:return e<=0?0:e-1;case`Home`:return 0;case`End`:return n-1;default:return Math.min(e,n-1)}}var $=e=>e?Le():Me();function kt(e,t){return e===null||e.kind!==t.kind?!1:e.kind===`instance`||t.kind===`agent`&&e.agentId===t.agentId}function At({instanceName:e}){let t=P(N.agents.listAgentsForInstance,{instanceName:e}),n=O(N.agents.setInstanceReasoningDefault),i=O(N.agents.setAgentReasoningDefault),[a,o]=(0,G.useState)(null),[c,l]=(0,G.useState)(null),[u,f]=(0,G.useState)(``),[p,g]=(0,G.useState)(``),v=(0,G.useRef)(null),b=(0,G.useId)(),x=t?.showReasoningDefault===!0,S=t?.agents??[],C=(0,G.useMemo)(()=>St(S,x),[S,x]),w=Ct(C,p),ne=Q(S,``).length>0;async function T(e,t,n){o(e),l(null),f(``);try{return await t(),f(n),!0}catch{return l(e),!1}finally{o(t=>t===e?null:t)}}let re=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),y({value:$(t)})),E=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function ae(e){await E(e,null,ee({agent:Y(e)}))&&v.current?.focus()}let D=a!==null;return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:ge()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),t===void 0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):S.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,J.jsx)(`label`,{htmlFor:b,className:`oc-rdefaults__default-label`,children:se()}),(0,J.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,J.jsx)(Je,{size:14,className:`oc-rdefaults__spin`}):$(x)}),(0,J.jsx)(it,{id:b,checked:x,disabled:D,"aria-busy":a?.kind===`instance`,onCheckedChange:re})]}),c?.kind===`instance`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null,(0,J.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:ie({count:C.length})}),(0,J.jsx)(jt,{agents:S,instanceDefault:x,disabled:!ne,triggerRef:v,onPick:e=>{let t=Tt(x);E(e,t,m({agent:Y(e),value:$(t)}))}})]}),C.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()}):(0,J.jsxs)(J.Fragment,{children:[wt(C.length)?(0,J.jsx)(U,{type:`search`,value:p,onChange:e=>g(e.target.value),placeholder:s(),"aria-label":s(),className:`oc-rdefaults__filter`}):null,w.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ke()}):(0,J.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":ie({count:C.length}),children:w.map(({agent:e,show:t,sameAsDefault:n})=>{let r=Y(e),i={kind:`agent`,agentId:e.agentId};return(0,J.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:r}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,J.jsx)(`span`,{className:`oc-rdefaults__same`,children:h()}):null]}),(0,J.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[kt(a,i)?(0,J.jsx)(Je,{size:14,className:`oc-rdefaults__spin`,"aria-label":F()}):null,(0,J.jsx)(W,{field:`showReasoning`,ariaLabel:Fe({agent:r}),options:[{id:`on`,label:Le()},{id:`off`,label:Me()}],value:t?`on`:`off`,onChange:t=>void E(e,t===`on`,d({agent:r,value:$(t===`on`)})),disabled:D}),(0,J.jsx)(H,{variant:`ghost`,size:`icon`,disabled:D,"aria-label":_({agent:r}),title:_({agent:r}),onClick:()=>void ae(e),children:(0,J.jsx)(at,{"aria-hidden":!0})})]}),kt(c,i)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:j()}):null]},e.agentId)})})]}),c?.kind===`agent`&&!C.some(e=>e.agent.agentId===c.agentId)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null]}),(0,J.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:u})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),d=(0,G.useId)(),m=(0,G.useRef)(null),h=Q(e,s),g=Et(h,l),_=Q(e,``).length===0,v=e=>`${d}-opt-${e}`;function y(){o(!1),c(``),u(null)}function b(e){u(e>=0?h[e].agentId:null),e>=0&&m.current?.querySelector(`#${CSS.escape(v(e))}`)?.scrollIntoView({block:`nearest`})}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),b(Ot(g,e.key,h.length));else if(e.key===`Enter`){e.preventDefault();let t=Dt(h,l);t===null?u(null):(y(),i(t))}}return(0,J.jsxs)(et,{open:a,onOpenChange:e=>e?o(!0):y(),children:[(0,J.jsx)($e,{asChild:!0,children:(0,J.jsxs)(H,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,J.jsx)(Xe,{"aria-hidden":!0}),f()]})}),(0,J.jsxs)(Qe,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,J.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:E({value:$(Tt(t))})}),(0,J.jsx)(U,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":d,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<h.length?v(g):void 0,"aria-label":T(),placeholder:T(),value:s,onChange:e=>{c(e.target.value),u(null)},onKeyDown:x,className:`oc-rdefaults__search`}),(0,J.jsx)(`div`,{id:d,ref:m,role:`listbox`,"aria-label":f(),className:`oc-rdefaults__options`,children:h.length===0?(0,J.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?re():p()}):h.map((e,t)=>(0,J.jsxs)(`div`,{id:v(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>u(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{y(),i(e)},children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:Y(e)}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,J.jsx)(`span`,{className:`oc-rdefaults__badge`,children:C()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=P(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,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsxs)(V,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":k(),children:(0,J.jsx)(L,{placeholder:Ie()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:c,children:Ie()}),d.map(e=>(0,J.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,J.jsx)(H,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void u(),children:o===`saving`?F():D()})]}),o===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,o===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null]})}function Nt({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(r===null?``:String(r)),[c,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n),s(r===null?``:String(r)),l(`idle`)},[e._id,n,r]);let u=o.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=!i||d===null||Number.isInteger(d)&&d>=4e3&&d<=6e4,p=i!==n||(d??null)!==r;async function m(){l(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||d===null||Number.isNaN(d)?delete n.curationBudgetChars:n.curationBudgetChars=d,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,J.jsx)(Ye,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":Ne()}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Ne()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f,"aria-label":je(),disabled:!i}),(0,J.jsx)(H,{size:`sm`,disabled:!p||!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?F():D()})]}),f?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Be()}),c===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,c===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:he()})]})}function Pt({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,G.useState)(n===null?``:String(n)),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,u=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,d=(l??null)!==n;async function f(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:de()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,J.jsx)(H,{size:`sm`,disabled:!d||!u||o===`saving`,onClick:()=>void f(),children:o===`saving`?F():D()})]}),u?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:i()}),o===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,o===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Re()})]})}function Ft(){let e=A(N.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=P(N.admin.listInstances,{}),[i,o]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[r,i]);let s=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=P(N.compat.forInstance,i?{instanceName:i}:`skip`),u=i?nt(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,G.useMemo)(()=>s&&i?{instanceName:i}:{},[s,i]),p=(0,G.useRef)(0),m=(0,G.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=st(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,G.useEffect)(()=>{d===!1&&(s&&!i||m())},[m,d,s,i]);let h=t.status===`done`?t.current:null,g=(0,G.useMemo)(()=>ot.map(e=>({id:e,label:tt(e)})),[]),_=(0,G.useMemo)(()=>[{id:`fast`,label:ve()},{id:`standard`,label:pe()}],[]);return(0,J.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}),s&&i?(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Te()}),(0,J.jsxs)(V,{value:i,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,"aria-label":Te(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:(r??[]).map(e=>(0,J.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):u===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):u.blocked?(0,J.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,J.jsx)(Ze,{size:14,"aria-hidden":!0}),` `,rt(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):t.status===`error`?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ae(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void m(),children:be()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:_e()}),(0,J.jsx)(W,{field:`thinkingLevel`,options:g,value:h?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:_e()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,J.jsx)(W,{field:`fastMode`,options:_,value:h===null||h.fastModeDefault===null?null:h.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:S()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]}),(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:ke()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pt,{instance:e}),(0,J.jsx)(Nt,{instance:e}),(0,J.jsx)(Mt,{instance:e}),(0,J.jsx)(At,{instanceName:e.name}),(0,J.jsx)(vt,{instanceName:e.name})]}):null})()]})}export{Ft as ChatDefaultsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Hf as i,Lf as a,Rf as o,Vf as s,zf as c}from"./api-jG5Fwsg4.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-BwvaE8oD.js";import{t as g}from"./button-sV7hIR3f.js";import{t as _}from"./input-DReDYsos.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-Bpoyy7pR.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,returnFocus:t.opts.returnFocus,...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:[c(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:a({word:F})}),` `,o()]}),(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??i()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??s()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,returnFocus:t.opts.returnFocus,...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??i()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??r()})]})]}):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{Bw as r,Gw as i,Hw as a,Kw as o,Uw as s,Vw as c,Ww as l,uQ as u}from"./api-jG5Fwsg4.js";import{r as d}from"./dist-Bxf4XoMW.js";import{t as f}from"./chevron-up-DQBDpk9Z.js";import{t as p}from"./chevrons-up-down-3woN2nFd.js";import{c as m,g as h,n as g,r as _,s as v,t as y}from"./dropdown-menu-yCbwljS-.js";import{t as b}from"./checkbox-U99HMqP3.js";import{t as x}from"./plus-A35Qzur2.js";import{t as S}from"./trash-2-UxV-pTWt.js";import{t as C}from"./button-sV7hIR3f.js";import{a as w,i as T,n as E,o as D,r as O,t as k}from"./table-CIrFKiPM.js";import{t as A}from"./useTableLayout-Cmwnuzxb.js";var j=t(e(),1);function M(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 N(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=M(i,a);return n===`asc`?c:-c})}var P=n();function F({title:e,rows:t,columns:n,rowActions:M,onAdd:F,addLabel:I=o(),bulkActions:L,emptyHint:R=i(),isExpanded:z,renderExpanded:B}){let[V,H]=(0,j.useState)(new Set),U=(0,j.useRef)(null),[W,G]=(0,j.useState)(null),K=t??[],q=W?n[W.index]:void 0,J=W&&q?.sort?N(K,q.sort,W.dir):K;function Y(e){G(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let X=+!!L+n.length+ +!!M,Z=K.length>0&&V.size===K.length,Q=V.size>0&&!Z,$=A(U,[t,W?.index,W?.dir,n.length,!!L,!!M,u()]);function ee(){H(Z?new Set:new Set(K.map(e=>e._id)))}function te(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:`oc-dt`,children:[(0,P.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,P.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,P.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[V.size>0&&L?L.map(e=>(0,P.jsxs)(C,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...V]),H(new Set)},children:[e.variant===`destructive`?(0,P.jsx)(S,{}):null,e.label,` (`,V.size,`)`]},e.label)):null,F?(0,P.jsxs)(C,{size:`sm`,onClick:F,children:[(0,P.jsx)(x,{}),` `,I]}):null]})]}),t===void 0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):K.length===0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:R}):(0,P.jsx)(`div`,{ref:U,className:`oc-tablefit`,"data-layout":$,children:(0,P.jsxs)(k,{children:[(0,P.jsx)(w,{children:(0,P.jsxs)(D,{children:[L?(0,P.jsx)(T,{className:`oc-dt__check w-8`,children:(0,P.jsx)(b,{"aria-label":s(),checked:Z?!0:Q?`indeterminate`:!1,onCheckedChange:ee})}):null,n.map((e,t)=>{let n=W?.index===t;return e.sort?(0,P.jsx)(T,{className:e.className,"aria-sort":n?W.dir===`asc`?`ascending`:`descending`:`none`,children:(0,P.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>Y(t),"aria-label":r({column:e.header}),children:[e.header,n?W.dir===`asc`?(0,P.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(p,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,P.jsx)(T,{className:e.className,children:e.header},e.header)}),M?(0,P.jsx)(T,{className:`w-8`}):null]})}),(0,P.jsx)(E,{children:J.map(e=>{let t=M?.(e)??[],r=z?.(e)??!1;return(0,P.jsxs)(j.Fragment,{children:[(0,P.jsxs)(D,{className:`oc-reveal-host group/row`,children:[L?(0,P.jsx)(O,{className:`oc-dt__check`,children:(0,P.jsx)(b,{"aria-label":a(),checked:V.has(e._id),onCheckedChange:()=>te(e._id)})}):null,n.map((t,n)=>(0,P.jsx)(O,{className:n===0?`oc-dt__lead ${t.className??``}`:t.className,"data-label":t.header,children:t.cell(e)},t.header)),M?(0,P.jsx)(O,{className:`oc-dt__actions`,children:t.length>0?(0,P.jsxs)(y,{children:[(0,P.jsx)(m,{asChild:!0,children:(0,P.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),className:`oc-reveal oc-hit`,children:(0,P.jsx)(h,{})})}),(0,P.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,P.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,P.jsx)(v,{}):null,(0,P.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&B?(0,P.jsx)(D,{className:`oc-dt__expansion`,children:(0,P.jsx)(O,{colSpan:X,className:`oc-dt__expansion-cell`,children:B(e)})}):null]},e._id)})})]})})]})}export{F as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{BM as t,_Q as n,aO as r,fO as i,iO as a,pO as o,rO as s,t as c}from"./api-jG5Fwsg4.js";import{t as l}from"./use_paginated_query-imV3AXlW.js";import{t as u}from"./button-sV7hIR3f.js";import"./convexApi-DeaVGrsr.js";import{n as d}from"./ConfirmDialog-BmOX8o6F.js";import{r as f}from"./trashView-CrjCfgVT.js";import{n as p,t as m}from"./trashPage-CFUn9bkp.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=n(c.trash.restoreChat),b=n(c.trash.purgeChat),x=n(c.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:o({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:a(),description:s(),confirmLabel:r(),destructive:!0})&&await x({})},children:r()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:i()}):(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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-CSm2xaYH.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{Nf as r,Pf as i,i as a,o,xb as s}from"./api-jG5Fwsg4.js";import{t as c}from"./loader-circle-_HV4tchJ.js";import{t as l}from"./x-TiVTngrx.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-B9q2nlqC.js";import{t as _}from"./button-sV7hIR3f.js";var v=t(e(),1),y=n();function b({...e}){return(0,y.jsx)(p,{"data-slot":`sheet`,...e})}function x({...e}){return(0,y.jsx)(g,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,y.jsx)(u,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,y.jsx)(d,{"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 w({className:e,overlayClassName:t,children:n,side:r=`right`,showCloseButton:i=!0,returnFocus:c,...u}){let d=a(`dialog`,c);return(0,y.jsxs)(S,{children:[(0,y.jsx)(C,{className:t}),(0,y.jsxs)(f,{"data-slot":`sheet-content`,"data-side":r,className:o(`fixed z-50 flex flex-col gap-4 overflow-y-auto 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]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full 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),...u,ref:d.ref,onCloseAutoFocus:d.onCloseAutoFocus,children:[n,i&&(0,y.jsx)(g,{"data-slot":`sheet-close`,asChild:!0,children:(0,y.jsxs)(_,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,y.jsx)(l,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:s()})]})})]})]})}function T({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-0.5 p-4`,e),...t})}function E({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-footer`,className:o(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function D({className:e,...t}){return(0,y.jsx)(h,{"data-slot":`sheet-title`,className:o(`font-heading text-base font-medium text-foreground`,e),...t})}function O({className:e,...t}){return(0,y.jsx)(m,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function k({open:e,onOpenChange:t,title:n,description:a,children:o,onSubmit:s,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,v.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await s()}finally{p(!1)}}return(0,y.jsx)(b,{open:e,onOpenChange:t,children:(0,y.jsxs)(w,{side:`right`,className:`oc-entity-sheet sm:max-w-none gap-0 p-0`,children:[(0,y.jsxs)(T,{className:`border-b px-6 py-4`,children:[(0,y.jsx)(D,{children:n}),a?(0,y.jsx)(O,{children:a}):null]}),(0,y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,y.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,y.jsxs)(E,{className:`border-t px-6 py-4`,children:[(0,y.jsxs)(_,{type:`submit`,disabled:!d||m,children:[m?(0,y.jsx)(c,{className:`size-4 animate-spin`}):null,l??i()]}),(0,y.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:r()})]})]})]})})}export{O as a,D as c,w as i,b as n,E as o,x as r,T as s,k as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,AR as i,BR as a,CR as o,Cz as s,DR as c,ER as l,FR as u,GR as d,HR as f,IR as p,JR as m,KR as ee,LR as te,MR as ne,NR as h,OR as g,PR as _,QR as v,RR as re,Sz as y,TR as ie,Tz as b,UR as x,VR as S,WR as C,XR as w,YR as T,ZR as E,_Q as D,_z as O,az as k,bz as A,cz as j,dz as M,ez as N,fz as P,gz as F,hz as I,iz as L,jR as R,kR as z,lz as B,mz as V,nz as H,oz as U,pz as W,qR as G,rm as ae,rz as K,sz as q,t as J,tm as oe,tz as se,uz as ce,vQ as le,vz as ue,wR as de,wz as fe,xz as pe,yz as me,zR as he}from"./api-jG5Fwsg4.js";import{t as ge}from"./button-sV7hIR3f.js";import"./convexApi-DeaVGrsr.js";import{n as _e}from"./format-BQaxlN43.js";import{n as Y}from"./ConfirmDialog-BmOX8o6F.js";import{t as ve}from"./DataTableShell-BTk71L7O.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>b(),incorrect:()=>fe(),incoherence:()=>s(),formatting:()=>y(),latency:()=>pe(),api_error:()=>A(),other:()=>me()},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:O()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:F()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ue()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=D(J.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function f(){let t=c.trim();if(!(!t||u)){d(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let p=[];try{p=i.contextJson?JSON.parse(i.contextJson):[]}catch{p=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${I()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:x(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(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:z()}),(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:W()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.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`?P():e.authorRole===`agent`?e.authorLabel??ae():M()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ce()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:B(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 f(),disabled:!c.trim()||u,children:u?j():q()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||k()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||k()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,p.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H({count:i.contextCount??p.length,truncated:i.contextTruncated?se():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:p.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,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.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:v()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?E({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[w(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,T()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=le(J.feedback.listForAdmin,{}),t=D(J.feedback.readSnapshot),n=D(J.feedback.deleteFeedback),r=Y(),[s,v]=(0,X.useState)(null),[y,b]=(0,X.useState)({});async function x(e){if(s===e._id){v(null);return}if(!y[e._id]){let n=await t({feedbackId:e._id});b(t=>({...t,[e._id]:n}))}v(e._id)}async function w(e){await r({title:ie(),description:de(),confirmLabel:o(),destructive:!0})&&(await n({feedbackId:e._id}),s===e._id&&v(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,Z.jsx)(`strong`,{children:G()}),` `,ee()]}),(0,Z.jsx)(ve,{title:d(),rows:e,emptyHint:C(),isExpanded:e=>s===e._id&&!!y[e._id],renderExpanded:e=>y[e._id]?(0,Z.jsx)(be,{data:y[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:f(),cell:e=>_e(e.at),sort:e=>e.at},{header:S(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:a(),cell:e=>e.messageRole===`user`?he():re(),sort:e=>e.messageRole},{header:te(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${p({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:u(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:_(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:h(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ne()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:R()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:i()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:s===e._id?g():c(),onSelect:()=>void x(e)},{label:l(),onSelect:()=>void w(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{TQ as t,k as n}from"./api-jG5Fwsg4.js";import{c as r,i,l as a,n as o,r as s,s as c,t as l}from"./tooltip-CobtYK4c.js";import{n as u,r as d,t as f}from"./popover-BcL-AsC2.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var p=Object.defineProperty,m=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t,n)=>m(e,typeof t==`symbol`?t:t+``,n),g=`https://docs.convex.dev/error#undefined-validator`;function _(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 ${g} for details.`)}var v=class{constructor({isOptional:e}){h(this,`type`),h(this,`fieldPaths`),h(this,`isOptional`),h(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},y=class e extends v{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),h(this,`tableName`),h(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})}},b=class e extends v{constructor(){super(...arguments),h(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends v{constructor(){super(...arguments),h(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends v{constructor(){super(...arguments),h(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends v{constructor(){super(...arguments),h(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},w=class e extends v{constructor(){super(...arguments),h(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},T=class e extends v{constructor(){super(...arguments),h(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},E=class e extends v{constructor(){super(...arguments),h(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},D=class e extends v{constructor({isOptional:e,fields:t}){super({isOptional:e}),h(this,`fields`),h(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&_(`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}})}},O=class e extends v{constructor({isOptional:e,value:t}){if(super({isOptional:e}),h(this,`value`),h(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:t(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},k=class e extends v{constructor({isOptional:e,element:t}){super({isOptional:e}),h(this,`element`),h(this,`kind`,`array`),t===void 0&&_(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},A=class e extends v{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),h(this,`key`),h(this,`value`),h(this,`kind`,`record`),t===void 0&&_(`v.record()`,`key`),n===void 0&&_(`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})}},j=class e extends v{constructor({isOptional:e,members:t}){super({isOptional:e}),h(this,`members`),h(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&_(`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})}},M={id:e=>new y({isOptional:`required`,tableName:e}),null:()=>new T({isOptional:`required`}),number:()=>new b({isOptional:`required`}),float64:()=>new b({isOptional:`required`}),bigint:()=>new x({isOptional:`required`}),int64:()=>new x({isOptional:`required`}),boolean:()=>new S({isOptional:`required`}),string:()=>new w({isOptional:`required`}),bytes:()=>new C({isOptional:`required`}),literal:e=>new O({isOptional:`required`,value:e}),array:e=>new k({isOptional:`required`,element:e}),object:e=>new D({isOptional:`required`,fields:e}),record:(e,t)=>new A({isOptional:`required`,key:e,value:t}),union:(...e)=>new j({isOptional:`required`,members:e}),any:()=>new E({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>M.union(e,M.null())},N=n(`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`}]]),P=[`gateway-http`,`shared-fs`,`off`],F=[`inline`,`shared-fs`],I=[`reactive`,`sse`],L=`reactive`;M.object({mediaMode:M.optional(M.union(M.literal(`gateway-http`),M.literal(`shared-fs`),M.literal(`off`))),inboundMediaMode:M.optional(M.union(M.literal(`inline`),M.literal(`shared-fs`))),rehydration:M.optional(M.boolean()),mediaMaxMb:M.optional(M.number()),attachmentFixAttested:M.optional(M.boolean()),summarizeThresholdChars:M.optional(M.number()),curationEnabled:M.optional(M.boolean()),curationBudgetChars:M.optional(M.number()),converterAgentId:M.optional(M.string()),voiceEnabled:M.optional(M.boolean()),talkEnabled:M.optional(M.boolean()),widgetsEnabled:M.optional(M.boolean()),widgetPromptConfirm:M.optional(M.boolean()),voiceEngine:M.optional(M.union(M.literal(`browser`),M.literal(`gateway`))),voiceLang:M.optional(M.string()),voiceRate:M.optional(M.number()),voiceAutoRead:M.optional(M.boolean()),contentLocale:M.optional(M.string()),inboundAgentMount:M.optional(M.string()),outboundAgentMount:M.optional(M.string()),transcriptProjection:M.optional(M.union(M.literal(`off`),M.literal(`shadow`),M.literal(`on`))),promptInjections:M.optional(M.record(M.string(),M.object({enabled:M.optional(M.boolean()),template:M.optional(M.string())})))});var R={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function z(e,t){let n={};for(let i of a){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 B(e,t){let n={};for(let i of a){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 V(e,t){return{mediaMode:e.mediaMode??R.mediaMode,inboundMediaMode:e.inboundMediaMode??R.inboundMediaMode,rehydration:e.rehydration??R.rehydration,mediaMaxMb:e.mediaMaxMb??R.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??R.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??R.outboundAgentMount,promptInjections:z(e.promptInjections,t)}}var H=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function U(e,t,n){let r={},i=n=>{(e[n]!==R[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=B(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of H){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var W=e();function G({text:e}){return c()?(0,W.jsxs)(f,{children:[(0,W.jsx)(d,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help oc-hit`,"aria-label":e,children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(u,{className:`oc-fieldhelp w-auto p-3 text-sm text-pretty`,children:e})]}):(0,W.jsx)(s,{delayDuration:150,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(i,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(o,{className:`max-w-xs text-pretty`,children:e})]})})}function K({label:e,help:t}){return(0,W.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,W.jsx)(G,{text:t})]})}export{L as a,I as c,V as i,K as n,F as o,U as r,P as s,G as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$X as ee,CZ as r,DZ as te,EZ as ne,JX as re,OZ as ie,QX as ae,SZ as oe,TZ as i,XX as se,YX as ce,ZX as a,_Q as o,_Z as s,aZ as c,bZ as le,cZ as ue,dZ as l,eZ as de,fZ as u,gU as fe,gZ as d,hZ as f,iZ as pe,lZ as me,mZ as p,nZ as he,oZ as ge,om as _e,pZ as m,qX as ve,rZ as ye,sQ as be,sZ as xe,sm as h,t as g,tZ as _,uQ as v,uZ as y,vQ as b,vZ as x,wZ as S,xZ as C,yZ as w}from"./api-jG5Fwsg4.js";import{c as T,g as E,n as D,r as O,t as k}from"./dropdown-menu-yCbwljS-.js";import{t as A}from"./download-DQYw1N-_.js";import{t as j}from"./checkbox-U99HMqP3.js";import{t as M}from"./rotate-ccw-XgdDTtI8.js";import{t as Se}from"./trash-2-UxV-pTWt.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-DGKgMOlh.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-BwvaE8oD.js";import{t as R}from"./button-sV7hIR3f.js";import"./convexApi-DeaVGrsr.js";import{r as je}from"./toast-daONdZpX.js";import{t as z}from"./badge-CSm2xaYH.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CIrFKiPM.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return s();case`audio`:return d();case`video`:return f();case`pdf`:return p();case`document`:return m();case`archive`:return u();default:return l()}}function q(){let[e,t]=(0,U.useState)(G),[n,s]=(0,U.useState)(G),[l,u]=(0,U.useState)(G),[d,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=o(g.files.softDelete),Y=je();function Ie(){t(G),s(G),u(G),f(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(de())}catch(e){Y.error(ee(),e)}}let X=b(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:l===G?void 0:l,category:d===G?void 0:d,includeAutoGenerated:p||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:be()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||l!==G||d!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(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":te(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:ne()}),(0,W.jsx)(I,{value:`inbound`,children:i()}),(0,W.jsx)(I,{value:`outbound`,children:S()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:s,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":r(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:oe()}),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":C(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:le()}),Q.instances.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:d,onValueChange:f,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":w(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:x()}),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:p,onCheckedChange:e=>m(e===!0),"aria-label":h()}),(0,W.jsx)(`span`,{children:h()})]}),$?(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}),ye()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?re():ce()}):(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:y()}),(0,W.jsx)(B,{children:me()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:xe()}),(0,W.jsx)(B,{children:ge()}),(0,W.jsx)(B,{className:`text-right`,children:c()})]})}),(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`?i():S()})}),(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":he(),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}),pe()]})}):(0,W.jsxs)(O,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),se()]}),(0,W.jsxs)(O,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Se,{size:14}),_()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ve({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:ae()}),(0,W.jsx)(Ce,{children:a()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(Oe,{children:fe()}),(0,W.jsx)(Ee,{onClick:()=>void Le(),children:_()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Jw as r,qw as i}from"./api-jG5Fwsg4.js";import{t as a}from"./search-CGco_tlI.js";import{t as o}from"./rotate-ccw-XgdDTtI8.js";import{t as s}from"./button-sV7hIR3f.js";import{t as c}from"./input-DReDYsos.js";import{t as l}from"./TimeRangePicker-BvcqBpnq.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),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,{}),i()]})]})}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,$x as i,AS as a,Ax as o,BS as s,Bx as c,CS as l,Cx as u,DS as d,ES as f,FS as p,Fb as m,Fx as h,GS as g,Gb as _,Gx as v,HS as y,Hb as b,Hx as x,IS as S,Ib as C,Ix as w,Jb as T,Jx as E,KS as D,Kb as O,Kx as k,LS as ee,Lx as te,MS as ne,Mx as A,NS as j,Nb as re,Nx as ie,OS as M,PS as ae,Pb as N,Px as oe,Qb as se,Qx as ce,RS as le,Rx as ue,SS as de,Sx as fe,TS as pe,Tx as me,US as he,Ub as ge,Ux as _e,VS as ve,Vx as ye,WS as be,Wb as xe,Wx as Se,Xb as Ce,Xx as we,Yb as Te,Yx as Ee,Zb as De,Zx as Oe,_Q as P,_S as F,_x as ke,aS as Ae,ax as je,bS as Me,bx as Ne,cS as I,cx as Pe,dx as Fe,eS as Ie,ex as Le,fx as Re,gS as ze,gx as Be,hS as Ve,hx as He,iS as Ue,ix as We,jS as Ge,jx as Ke,k as qe,kS as Je,kx as Ye,lS as Xe,lx as Ze,mS as Qe,mx as $e,nS as et,nx as tt,oS as nt,ox as rt,px as it,qb as at,qx as ot,rS as st,rx as ct,sS as lt,sx as ut,t as L,tS as dt,tx as ft,uS as pt,ux as mt,vQ as R,vS as ht,vx as gt,wS as _t,wx as vt,xS as yt,xx as bt,yS as xt,yx as St,zS as Ct,zx as z}from"./api-jG5Fwsg4.js";import{t as wt}from"./chevron-left-cmPkj5_M.js";import{t as Tt}from"./chevron-right-DbysoSJS.js";import{t as B}from"./checkbox-U99HMqP3.js";import{t as V}from"./server-ClLFUY_D.js";import{i as H,n as Et,r as Dt,t as Ot}from"./users-CBI99oGw.js";import{t as U}from"./star-B6yMf_Hc.js";import{t as kt}from"./x-TiVTngrx.js";import{a as At,i as jt,n as Mt,r as Nt,t as Pt}from"./select-DGKgMOlh.js";import{i as Ft,n as It,r as Lt,t as Rt}from"./tabs-BWfAdnjK.js";import{t as W}from"./button-sV7hIR3f.js";import{t as G}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as K}from"./toast-daONdZpX.js";import{t as q}from"./badge-CSm2xaYH.js";import{a as zt,n as Bt,o as Vt,r as Ht,t as Ut}from"./dialog-Bpoyy7pR.js";import{t as Wt}from"./appHost-CH3EGcJw.js";import{n as Gt}from"./ConfirmDialog-BmOX8o6F.js";import{t as Kt}from"./EntitySheet-BXEY6TCb.js";import{a as J,c as qt,d as Jt,f as Yt,i as Xt,l as Zt,n as Qt,o as $t,r as en,t as Y,u as tn}from"./groupManageView-BcbLXWZ4.js";import{t as nn}from"./FilterBar-D2w0wWnm.js";import{t as rn}from"./DataTableShell-BTk71L7O.js";import{t as X}from"./DetailChips-BU-SQfjj.js";var an=qe(`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`}]]),Z=t(e(),1),Q=n(),on={name:``,description:``};function sn(){let e=R(L.groups.listGroups,{}),t=R(L.me.getMe,{host:Wt})?.role===`admin`,n=P(L.groups.createGroup),r=P(L.groups.updateGroup),i=P(L.groups.deleteGroup),o=Gt(),l=K(),[u,m]=(0,Z.useState)(!1),[h,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)(on),[x,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(``),E=(0,Z.useMemo)(()=>{if(!e)return e;let t=w.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,w]);function O(){_(null),b(on),m(!0)}function k(e){_(e),b({name:e.name,description:e.description??``}),m(!0)}async function te(){try{h?await r({groupId:h._id,name:v.name,description:v.description}):await n({name:v.name,description:v.description||void 0}),b(on),_(null),m(!1)}catch(e){l.error(ye(),e)}}async function A(e){if(await o({title:d({name:e.name}),description:f(),confirmWord:e.name,confirmLabel:pe(),cancelLabel:j(),destructive:!0}))try{await i({groupId:e._id})}catch(e){l.error(c(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:w,onQChange:T,onReset:()=>T(``),canReset:w!==``,searchPlaceholder:le()}),(0,Q.jsx)(rn,{title:D(),rows:E,addLabel:be(),onAdd:t?O:void 0,emptyHint:he(),columns:[{header:y(),cell:e=>e.name,sort:e=>e.name},{header:ve(),cell:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{icon:(0,Q.jsx)(Ot,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(H,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,Q.jsx)(q,{variant:`secondary`,children:Ye({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:s(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(V,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ct(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(an,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(U,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ee(),onSelect:()=>C({groupId:e._id,name:e.name})},...t?[{label:S(),onSelect:()=>k(e)},{label:p(),variant:`destructive`,onSelect:()=>void A(e)}]:[]]}),(0,Q.jsx)(Kt,{open:u,onOpenChange:m,title:h?Ge():ne(),description:a(),canSubmit:!!v.name.trim(),onSubmit:te,submitLabel:ae(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:Je()}),(0,Q.jsx)(G,{value:v.name,onChange:e=>b({...v,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:M()}),(0,Q.jsx)(G,{value:v.description,onChange:e=>b({...v,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:x?.groupId??null,groupName:x?.name??``,open:x!==null,onOpenChange:e=>{e||C(null)}})]})}var $=8;function cn({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(wt,{size:14,"aria-hidden":!0}),ze()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Qe({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Ve(),(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=R(L.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,o=R(L.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),s=R(L.groups.listAssignableUsers,n&&a?{}:`skip`),c=P(L.groups.addMember),u=P(L.groups.removeMember),d=P(L.groups.bulkSetMembers),f=P(L.groups.setGroupManager),p=K(),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(`members`),[x,S]=(0,Z.useState)(1),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),k=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ee=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),ne=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>Y(e.instanceName,e.agentId))),[i]),A=(0,Z.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?Y(e.instanceName,e.agentId):null},[i]);(0,Z.useEffect)(()=>{h(``),_(``),b(`members`),S(1),w(null),D.current=null},[n,e]),(0,Z.useEffect)(()=>{S(1)},[m]),(0,Z.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,E(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Z.useMemo)(()=>s?Xt(s,m,T):[],[s,m,T]);async function re(t,n){if(e)try{n?await u({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(z(),J(e))}}async function ie(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(_e(),e)}}let M=Jt(j,e=>O.has(e.userId)),ae=j.filter(e=>O.has(e.userId)).length,N=Zt(j,x,$);async function oe(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:M!==`all`})}catch(e){p.error(z(),J(e))}}let se=(e,t)=>(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":Ne({user:t}),title:Ne({user:t}),onClick:()=>w({userId:e,label:t}),children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":!0}),bt()]});return(0,Q.jsx)(Ut,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Bt,{className:`oc-access`,children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(Vt,{children:_t({name:t})}),(0,Q.jsx)(Ht,{children:i&&!a?te():l()})]}),(0,Q.jsxs)(Rt,{value:y,onValueChange:b,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Lt,{className:`w-full`,children:[(0,Q.jsxs)(Ft,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ot,{size:13,"aria-hidden":!0}),de(),i?(0,Q.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(Ft,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(V,{size:13,"aria-hidden":!0}),Me(),i?(0,Q.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:ne.size}):null]}),(0,Q.jsxs)(Ft,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),Ie(),i?(0,Q.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(It,{value:`members`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):a?s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:nt()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:m,onChange:e=>h(e.target.value),placeholder:yt(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ht()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(B,{checked:M===`all`||M===`some`&&`indeterminate`,onCheckedChange:()=>void oe(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()}),(0,Q.jsxs)(q,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=O.has(e.userId),n=Yt(e),r=k.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(B,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":pt({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&ee.has(e.userId)?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:St()}):null,(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:tn(e.role)}),t?se(e.userId,n.primary):null,(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Se():v(),title:r?Se():v(),onClick:()=>void ie(e.userId,r),children:(0,Q.jsx)(H,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(cn,{page:N.page,pageCount:N.pageCount,onPage:S})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:i.members,agentsButton:se}):null}),(0,Q.jsxs)(It,{value:`agents`,children:[i&&!a?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:mt()}):null,o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:g,onChange:e=>_(e.target.value),placeholder:xt(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:ne,defaultKey:A,viewerIsAdmin:a,query:g},`${e}-${t._id}`))})]})]}),(0,Q.jsx)(It,{value:`charts`,children:(0,Q.jsx)(mn,{groupId:e})})]}),(0,Q.jsx)(dn,{groupId:e,member:C,onOpenChange:e=>{e||w(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=R(L.groupInvites.listGroupInviteRequests,{groupId:e}),i=P(L.groupInvites.requestGroupInvite),a=P(L.groups.removeMember),s=Gt(),c=K(),[l,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(1),m=Zt(t,f,$);async function g(t){t.preventDefault();let n=l.trim();if(n)try{await i({groupId:e,email:n}),d(``),c.success(A())}catch(e){c.error(Ke(),e)}}async function _(t,n){if(await s({title:me({user:n}),description:u({user:n}),confirmLabel:fe(),cancelLabel:j(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){c.error(z(),J(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void g(e),children:[(0,Q.jsx)(G,{type:`email`,value:l,onChange:e=>d(e.target.value),placeholder:oe(),"aria-label":w()}),(0,Q.jsxs)(W,{type:`submit`,size:`sm`,disabled:!l.trim(),children:[(0,Q.jsx)(Et,{size:14,"aria-hidden":!0}),ie()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:gt()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:m.pageItems.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:St()}):null,n(e.userId,e.label),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":k(),title:k(),children:(0,Q.jsx)(H,{size:15,"aria-hidden":!0})}):null}),(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":me({user:e.label}),title:e.manager?vt():e.lastGroup?b():me({user:e.label}),onClick:()=>void _(e.userId,e.label),children:(0,Q.jsx)(kt,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,Q.jsx)(cn,{page:m.page,pageCount:m.pageCount,onPage:p})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:o()}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsx)(q,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:$t(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=R(L.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=P(L.groups.setMemberAgents),a=P(L.groups.setMemberDefaultAgent),o=K();async function s(e){try{await e()}catch(e){o.error(ge(),e)}}let c=r?.agents??[],l=new Map(c.map(e=>[Y(e.instanceName,e.agentId),e])),u=[...l.keys()],d=new Set(c.filter(e=>e.allowed).map(e=>Y(e.instanceName,e.agentId)));function f(n){if(!e||!t||!r)return;let a=qt(u,d,r.restricted,n).map(e=>{let t=l.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});s(()=>i({groupId:e,userId:t.userId,agents:a}))}return(0,Q.jsx)(Ut,{open:t!==null,onOpenChange:n,children:(0,Q.jsxs)(Bt,{className:`oc-access`,children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(Vt,{children:se({user:t?.label??``})}),(0,Q.jsx)(Ht,{children:De()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):r===null||c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[r.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:re()}),r.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?Te():Ce()}),r.restricted?(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`outline`,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin,onClick:()=>e&&t?void s(()=>i({groupId:e,userId:t.userId,agents:null})):void 0,children:T()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(n=>{let i=Y(n.instanceName,n.agentId),o=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row oc-reveal-host`,children:[(0,Q.jsx)(B,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>f(i),"aria-label":at({name:o})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:o,children:o}),n.limitedByAdmin?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:m()}):null,n.state===`deleted`?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:dt()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":O(),title:O(),onClick:()=>e&&t?void s(()=>a({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault oc-reveal oc-hit`,disabled:!r.settable,"aria-label":_(),title:_(),onClick:()=>e&&t?void s(()=>a({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(U,{size:14})}):null]},i)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:i,defaultKey:a,viewerIsAdmin:o,query:s}){let c=R(L.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),l=P(L.groups.assignAgentToGroup),u=P(L.groups.removeAgentFromGroup),d=P(L.groups.bulkSetGroupAgents),f=P(L.groups.claimAgentForGroup),p=P(L.groups.setGroupDefaultAgent),m=K(),[h,g]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{g(1)},[s]),!e)return null;let _=en(c?.agents??[],s),v=c?.discovery&&!c.discovery.lastPollOk,y=e=>Qt({assigned:i.has(Y(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},o),b=_.filter(e=>y(e)!==`claim`),x=_.filter(e=>y(e)===`claim`);if(s.trim()&&_.length===0)return null;let S=b.filter(e=>y(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),C=Jt(S,e=>i.has(Y(t,e.agentId))),w=Zt(b,h,$);async function T(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await l({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(ue(),J(e))}}async function E(){if(S.length===0)return;let n=S.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:C!==`all`})}catch(e){m.error(ue(),J(e))}}async function D(n){try{await f({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(je(),e)}}async function O(n){try{await p({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(r(),e)}}let k=e=>e.reservedForGroup?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:We()}):e.reserved?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?tt():ct({group:e.reservedGroupName})}):null;return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(V,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__kind`,children:n}),v?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__stale`,children:et()}):null]}),c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:lt()}):_.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v?st():Ue()}):(0,Q.jsxs)(Q.Fragment,{children:[S.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(B,{checked:C===`all`||C===`some`&&`indeterminate`,onCheckedChange:()=>void E(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()})]}):null,w.pageItems.map(e=>{let n=Y(t,e.agentId),r=i.has(n),o=e.presentInLastOk===!1,s=y(e)===`locked`;return(0,Q.jsxs)(`div`,{className:`oc-access__row oc-reveal-host${s?` is-disabled`:``}`,children:[(0,Q.jsx)(B,{checked:r,disabled:s&&!r,onCheckedChange:()=>void T(e.agentId,r),"aria-label":Xe({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,k(e),o?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:dt()}):null,r?a===n?(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":ft(),title:ft(),onClick:()=>void O(null),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault oc-reveal oc-hit`,"aria-label":Le(),title:Le(),onClick:()=>void O(e.agentId),children:(0,Q.jsx)(U,{size:14})}):null]},e.agentId)}),(0,Q.jsx)(cn,{page:w.page,pageCount:w.pageCount,onPage:g}),x.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:Ze()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Pe()}),x.map(e=>{let t=e.displayName??e.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":rt({name:t}),onClick:()=>void D(e.agentId),children:ut()})]},e.agentId)})]}):null]})]})}function pn(){let e=R(L.groupInvites.listPendingInviteRequests,{}),t=P(L.groupInvites.decideGroupInvite),n=K();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(Fe(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":ke(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Et,{size:14,"aria-hidden":!0}),ke(),(0,Q.jsx)(q,{variant:`secondary`,children:e.length})]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,Be({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?it():Re()}),(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:He()}),(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:$e()})]},e._id))})]})}function mn({groupId:e}){let t=R(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=P(L.charts.assignChartToGroup),r=P(L.charts.removeChartFromGroup),a=P(L.charts.setGroupDefaultChart),o=P(L.charts.addChartToGroupPool),s=P(L.charts.removeChartFromGroupPool),c=K();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(x(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(x(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(x(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(x(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(B,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":Ee({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":E(),title:E(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:ot()}):null,d?(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":we({name:e.name}),title:we({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(kt,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Pt,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(jt,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(At,{placeholder:Oe()})}),(0,Q.jsx)(Mt,{children:u.map(e=>(0,Q.jsx)(Nt,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):null:null]})}export{sn as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,AL as a,Ab as o,BI as s,BL as c,Bt as l,CI as u,CL as d,Ch as f,Cr as p,Cs as m,DI as h,DL as g,EI as _,EL as v,Eh as y,FI as b,FL as x,Ft as S,GI as C,GL as ee,HI as w,HL as te,Ht as ne,II as T,IL as re,Ij as ie,It as ae,JI as E,JL as oe,KI as D,KL as se,LI as O,LL as ce,Lj as le,Lt as ue,MI as de,ML as fe,Mb as pe,NI as me,NL as he,OI as ge,OL as _e,PI as ve,PL as ye,Pt as be,QI as xe,RI as Se,RL as Ce,Rt as we,SI as Te,SL as Ee,Sr as De,Ss as Oe,TI as ke,TL as Ae,Th as je,UI as Me,UL as Ne,VI as Pe,VL as Fe,Vt as Ie,WI as Le,WL as Re,XI as ze,YI as Be,YL as Ve,ZI as He,_I as Ue,_L as We,_Q as k,_d as Ge,_r as Ke,_s as qe,aI as Je,aL as Ye,bI as Xe,bL as Ze,br as Qe,bs as $e,cI as et,cL as tt,cs as nt,dG as rt,dI as it,dL as at,ds as ot,eI as st,eL as ct,fI as lt,fL as ut,fs as dt,gI as ft,gL as pt,gr as mt,gs as ht,hI as gt,hL as _t,hQ as A,hr as vt,hs as yt,iI as bt,iL as xt,jI as St,jL as Ct,jb as wt,kL as Tt,lI as Et,lL as Dt,ls as Ot,mI as kt,mL as At,mr as jt,ms as Mt,nI as Nt,nL as Pt,oI as Ft,oL as It,pI as Lt,pL as Rt,ps as zt,qI as Bt,qL as Vt,rI as Ht,rL as Ut,sI as j,sL as Wt,ss as Gt,t as M,tI as Kt,tL as N,uG as P,uI as qt,uL as Jt,us as Yt,vI as Xt,vL as Zt,vQ as F,vd as Qt,vr as $t,vs as en,wI as tn,wL as nn,wh as rn,xI as an,xL as on,xr as sn,xs as cn,yI as ln,yL as un,yd as dn,yr as fn,ys as pn,zI as mn,zL as hn,zt as gn}from"./api-jG5Fwsg4.js";import{a as _n,c as vn}from"./FieldLabel-Wb5bwK7r.js";import{t as yn}from"./checkbox-U99HMqP3.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-DGKgMOlh.js";import{n as bn,r as xn,t as Sn}from"./popover-BcL-AsC2.js";import{t as V}from"./button-sV7hIR3f.js";import{t as H}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as U}from"./toast-daONdZpX.js";import{t as W}from"./badge-CSm2xaYH.js";import{a as G,n as K,o as q,r as Cn,t as wn}from"./dialog-Bpoyy7pR.js";import{n as Tn}from"./ConfirmDialog-BmOX8o6F.js";import{t as En}from"./EntitySheet-BXEY6TCb.js";import{a as Dn}from"./groupManageView-BcbLXWZ4.js";import{t as On}from"./DataTableShell-BTk71L7O.js";import{InstanceConfigDialog as kn}from"./BridgeTab-OC_GNU22.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],An=new Set(Y),jn=`conversational`;function Mn(e){let t=new Set((e??[]).filter(e=>An.has(e)));return t.size===0?[jn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:_n,widgetsEnabled:!0,widgetPromptConfirm:!1},Nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Pn(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 Fn(){let e=F(M.admin.listInstances,{}),t=F(M.agents.listAllInstanceAgents,{}),n=k(M.admin.upsertInstance),r=k(M.widgets.setInstanceWidgets),i=k(M.admin.deleteInstance),o=U(),[s,u]=(0,J.useState)(!1),[f,h]=(0,J.useState)(Z),[_,y]=(0,J.useState)(null),[b,C]=(0,J.useState)(null),[w,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(null);async function O(){try{let t=await n({instanceId:E??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,participantIdentity:f.participantIdentity,managePermissionModes:f.managePermissionModes,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),i=E===null?null:e?.find(e=>e._id===E),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;f.kind===`openclaw`&&(f.widgetsEnabled!==a||f.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:f.widgetsEnabled,promptConfirm:f.widgetPromptConfirm}),h(Z),D(null),u(!1)}catch(e){o.error(Vt(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),(0,X.jsx)(`strong`,{children:ee()}),Re()]}),(0,X.jsx)(On,{title:Ne(),rows:e,addLabel:te(),onAdd:()=>{D(null),h(Z),u(!0)},emptyHint:Fe(),columns:[{header:c(),cell:e=>e.name,sort:e=>e.name},{header:hn(),cell:e=>(0,X.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ce(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ce(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ve(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(W,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?j():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:he(),onSelect:()=>{D(e._id),h(Pn(e)),u(!0)}},{label:oe(),onSelect:()=>y(e.name)},{label:Zt(),onSelect:()=>T(e)},{label:re(),onSelect:()=>C(e)},{label:x(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:x(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,X.jsx)(En,{open:s,onOpenChange:u,title:E?fe():ye(),description:a(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:O,submitLabel:Tt(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:_e(),children:[(0,X.jsx)(H,{value:f.name,disabled:E!==null,onChange:e=>h({...f,name:e.target.value})}),E?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ct()}):null]}),(0,X.jsx)($,{label:g(),children:(0,X.jsxs)(B,{value:f.kind,onValueChange:e=>h({...f,kind:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,X.jsx)($,{label:dn(),children:(0,X.jsxs)(B,{value:f.transport,onValueChange:e=>h({...f,transport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`ws`,children:Qt()}),(0,X.jsx)(z,{value:`rest`,children:Ge()})]})]})}):null,(0,X.jsx)($,{label:v(),children:(0,X.jsx)(H,{value:f.gatewayUrl,onChange:e=>h({...f,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:Ae(),children:(0,X.jsx)(H,{value:f.bridgeUrl,placeholder:nn(),onChange:e=>h({...f,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:d(),children:(0,X.jsx)(H,{value:f.displayName,onChange:e=>h({...f,displayName:e.target.value})})}),(0,X.jsxs)($,{label:le(),children:[(0,X.jsxs)(B,{value:f.streamTransport,onValueChange:e=>h({...f,streamTransport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsx)(R,{children:vn.map(e=>(0,X.jsx)(z,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ie()})]}),(0,X.jsx)($,{label:Ee(),children:(0,X.jsx)(H,{value:f.gatewayVersion,placeholder:on(),onChange:e=>h({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:zt(),children:[(0,X.jsxs)(B,{value:f.authMode,onValueChange:e=>h({...f,authMode:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`token`,children:dt()}),(0,X.jsx)(z,{value:`trusted-proxy`,children:ot()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?Ot():Yt()})]}),f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:m(),children:[(0,X.jsxs)(B,{value:f.personScopes,onValueChange:e=>h({...f,personScopes:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`capped`,children:Oe()}),(0,X.jsx)(z,{value:`full`,children:cn()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?pn():$e()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:en(),children:[(0,X.jsxs)(B,{value:f.identitySource,onValueChange:e=>h({...f,identitySource:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`canonical`,children:qe()}),(0,X.jsx)(z,{value:`email`,children:ht()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?Mt():yt()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:p(),children:[(0,X.jsxs)(B,{value:f.participantIdentity,onValueChange:e=>h({...f,participantIdentity:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`owner`,children:De()}),(0,X.jsx)(z,{value:`self`,children:sn()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.participantIdentity===`self`?jt():Qe()})]}):null,f.kind===`openclaw`?(0,X.jsxs)($,{label:fn(),children:[(0,X.jsxs)(B,{value:f.managePermissionModes?`on`:`off`,onValueChange:e=>h({...f,managePermissionModes:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:$t()}),(0,X.jsx)(z,{value:`on`,children:Ke()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.managePermissionModes?vt():mt()})]}):null,f.kind===`openclaw`?(0,X.jsxs)($,{label:ne(),children:[(0,X.jsxs)(B,{value:f.widgetsEnabled?`on`:`off`,onValueChange:e=>h({...f,widgetsEnabled:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`on`,children:Ie()}),(0,X.jsx)(z,{value:`off`,children:l()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.widgetsEnabled?gn():we()})]}):null,f.kind===`openclaw`&&f.widgetsEnabled?(0,X.jsxs)($,{label:ue(),children:[(0,X.jsxs)(B,{value:f.widgetPromptConfirm?`on`:`off`,onValueChange:e=>h({...f,widgetPromptConfirm:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:ae()}),(0,X.jsx)(z,{value:`on`,children:S()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:be()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsx)($,{label:nt(),children:(0,X.jsx)(H,{value:f.systemIdentity,placeholder:Gt(),onChange:e=>h({...f,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:Ze(),children:(0,X.jsx)(H,{value:f.gatewayHttpUrl,placeholder:un(),onChange:e=>h({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(Wn,{instanceName:_,open:_!==null,onOpenChange:e=>{e||y(null)}}),b?(0,X.jsx)(kn,{instance:b,onClose:()=>C(null)},b._id):null,w?(0,X.jsx)(In,{instance:w,onClose:()=>T(null)},w._id):null]})}function In({instance:e,onClose:t}){let n=F(M.instanceSecrets.listInstanceSecretStatus,{}),r=Nn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:We({instance:e.displayName??e.name})}),(0,X.jsx)(Cn,{children:pt()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(zn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(Rn,{instance:e})}),(0,X.jsx)(Ln,{instance:e})]})})}function Ln({instance:e}){let t=A(M.instanceSync.forceInstanceSync),n=U(),[r,i]=(0,J.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ze());break;case`no_agents`:n.success(E());break;case`no_bridge_url`:n.error(Bt());break;case`deploy_misconfigured`:n.error(D());break;case`unauthorized`:n.error(Le());break;case`not_served`:n.error(Me());break;default:n.error(C());break}}catch(e){n.error(Be(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?He():xe()})})]})}function Rn({instance:e}){let t=F(M.bridgeAuth.listBridgeAuthStatus,{}),n=A(M.bridgeAuth.mintBridgeSecret),r=k(M.bridgeAuth.revokeBridgeSecret),i=U(),[a,o]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{let t=await n({instanceId:e._id});l(t.plaintext),d(!1)}catch(e){i.error(b(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(T())}catch(e){i.error(b(),e)}finally{o(!1)}}}async function g(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,X.jsxs)($,{label:Pe(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:p?`outline`:`secondary`,children:p?`${ut()} · ${f.prefix}…${f.lastFour}`:at()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?Se():mn()}),p?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:O()}):null]})]}),c?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ve()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?rt():P()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:me()})]}):null]})}function zn({instanceId:e,field:t,updatedAt:n}){let i=A(M.instanceSecrets.setInstanceSecret),a=k(M.instanceSecrets.clearInstanceSecret),o=A(M.deviceIdentity.generateDeviceIdentity),s=U(),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?_t():t===`deviceIdentity`?At():Rt();async function y(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),p(null),h(!1),s.success(It())}catch(e){s.error(Ye(),e)}finally{d(!1)}}}async function b(){if(!u){d(!0);try{await a({instanceId:e,field:t}),p(null),h(!1),s.success(xt())}catch(e){s.error(Ye(),e)}finally{d(!1)}}}async function x(){if(!u){d(!0);try{let t=await o({instanceId:e});p(t),h(!1),s.success(N())}catch(e){s.error(r(),e)}finally{d(!1)}}}let S=f?`openclaw devices approve ${f.id}`:``;async function C(){if(S)try{await navigator.clipboard.writeText(S),h(!0)}catch{}}return(0,X.jsxs)($,{label:v,children:[_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Pt()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:g?`outline`:`secondary`,children:g?ut():at()}),(0,X.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:g?Dt():Jt(),onChange:e=>l(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void y(),disabled:u||c.trim().length===0,children:tt()}),_?(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void x(),disabled:u,children:Ut()}):null,g?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:u,children:Wt()}):null]})]}),f?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:N()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ct()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:S}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:m?rt():P()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:me()})]}):null]})}var Bn={conversational:Te,documentary:Xe,summarizer:y,curator:rn},Vn={conversational:an,documentary:ln,summarizer:je,curator:f},Hn=e=>(Bn[e]??(()=>e))(),Q=e=>(Vn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:_()}),t.map(e=>(0,X.jsx)(W,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:(0,X.jsx)(`span`,{className:`oc-agenttype__label`,children:Hn(e)})},e)),(0,X.jsxs)(Sn,{children:[(0,X.jsx)(xn,{asChild:!0,children:(0,X.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ke()})}),(0,X.jsxs)(bn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:tn()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:u()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(yn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Hn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=F(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=k(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),s=k(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=k(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Mn(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=k(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),u=k(M.agents.removeInstanceAgent),d=k(M.agents.setAgentReservation),f=F(M.groups.listGroupLabels,t?{}:`skip`),p=Tn(),m=U();async function h(t,n){if(e&&await p({title:Ht({name:n}),description:Nt(),confirmLabel:bt()}))try{await d({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(i(),Dn(e))}}async function g(t,n,r){if(!e)return;let a=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:pe({name:n,group:a}),description:wt({group:a}),confirmLabel:o()}))try{await d({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(i(),Dn(e))}}async function _(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(i(),e)}}async function v(t){if(e)try{await s({instanceName:e,agentId:t})}catch(e){m.error(i(),e)}}async function y(t,n,r){if(!e)return;let a=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:a})}catch(e){m.error(i(),e)}}async function b(t,n){if(e&&await p({title:ft({name:n}),description:gt(),confirmLabel:kt(),destructive:!0}))try{await u({instanceName:e,agentId:t}),m.success(Lt())}catch(e){m.error(i(),e)}}return(0,X.jsx)(wn,{open:t,onOpenChange:n,children:(0,X.jsxs)(K,{className:`oc-access`,children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:de({name:e??``})}),(0,X.jsx)(Cn,{children:St()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:lt()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?it():r.discovery.lastPollOk?qt():Et({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:et()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,a=r.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(yn,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,X.jsxs)(`div`,{className:`oc-agentcard__main`,children:[(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,X.jsx)(W,{variant:`outline`,children:t.reserved.groupName===null?Je():Ft({group:t.reserved.groupName})}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:st()}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,o),children:Ue()})]}):a?(0,X.jsx)(W,{variant:`default`,children:j()}):(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:Xt()})]})]}),t.reserved?(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,o),children:bt()}),(0,X.jsxs)(B,{value:``,onValueChange:e=>void g(t.agentId,o,e),children:[(0,X.jsx)(L,{size:`sm`,className:`h-7`,children:(0,X.jsx)(I,{placeholder:Kt()})}),(0,X.jsx)(R,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,X.jsx)(z,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,X.jsx)(Un,{agentId:t.agentId,types:s,onToggle:e=>void y(t.agentId,e,s)}):null,t.enabled?(0,X.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await l({instanceName:e,agentId:t.agentId,description:n})}catch(e){m.error(i(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(H,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:ge(),"aria-label":h(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Fn as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Az as r,Bg as i,Bz as a,Dz as o,Fz as s,Gg as c,Hg as l,Iz as u,Kg as d,Lz as f,Mz as p,Nz as m,Oz as h,Pz as g,Rz as _,Ug as v,Vg as y,Wg as b,_Q as x,hQ as S,jz as C,kz as w,qg as T,t as E,vQ as D,zg as O,zz as k}from"./api-jG5Fwsg4.js";import{t as A}from"./checkbox-U99HMqP3.js";import"./select-DGKgMOlh.js";import{t as j}from"./button-sV7hIR3f.js";import{t as M}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{t as N}from"./badge-CSm2xaYH.js";var P=t(e(),1),F=n();function I(){let e=D(E.integrations.status.status,{}),t=x(E.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:a()});let l=n,v=(e,t,n)=>i({...l,[e]:{...l[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,F.jsx)(`strong`,{children:_()}),` `,f()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:s()}):(0,F.jsx)(N,{variant:`outline`,children:g()}),note:m(),children:[(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(M,{value:l.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>v(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:l.langfuse.host??``})})}),(0,F.jsx)(z,{label:o(),checked:l.langfuse.enabled??!0,onChange:e=>{v(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:s()}):(0,F.jsx)(N,{variant:`outline`,children:g()}),note:p(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:l.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>v(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:l.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:l.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||h(),onChange:e=>v(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:l.opik.workspace??``})})}),(0,F.jsx)(z,{label:o(),checked:l.opik.enabled??!0,onChange:e=>{v(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:s()}):(0,F.jsx)(N,{variant:`outline`,children:T()}),note:d(),children:[(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:l.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>v(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:l.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:o(),checked:l.otlp.enabled??!0,onChange:e=>{v(`otlp`,`enabled`,e),y(`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=S(E.integrations.otlpSecret.setOtlpHeaders),n=x(E.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,u]=(0,P.useState)(!1),d=async()=>{u(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:b(),children:[(0,F.jsx)(M,{value:r,placeholder:e?v():l(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(j,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void d(),children:y()}),e?(0,F.jsx)(j,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:i()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:O()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,Gy as i,Ky as a,M as o,N as s,Qy as c,RW as l,Xy as u,_Q as d,_b as f,bb as p,db as m,fb as h,gb as g,hb as _,it as v,j as y,mb as b,nt as x,pb as ee,qy as S,rt as C,t as w,tt as T,vQ as E,vb as D,yb as O}from"./api-jG5Fwsg4.js";import{t as te}from"./loader-circle-_HV4tchJ.js";import{t as ne}from"./rotate-ccw-XgdDTtI8.js";import"./convexApi-DeaVGrsr.js";import{r as re,t as ie}from"./capabilities-CASxhKEd.js";var k=t(e(),1),A={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`,showReasoning:`segmented`};function j(e,t){return A[e]===`segmented`&&t<=5?`segmented`:`list`}function M(e,t){return e!=null&&e[t]!==void 0}var N=[`inherit`,`fast`,`standard`];function P(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function F(e){return e===`inherit`?ee():e===`fast`?h():m()}function I(e){return e===`inherit`?null:e===`fast`}function L(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function R(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var z={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function B(e,t){return z[e]??t}function V(e){return H(e).used}function H(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 U(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function W(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=V(e),n=U(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function G(e){return H(e).source}function K(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function q(e,t){let n=K(e,t);return n===null?null:c({pct:n,used:L(e),total:L(t)})}function J(e){return u({level:e??`full`})}function ae(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?S({cost:e.toFixed(2),tokens:L(t)}):n?a({cost:e.toFixed(2)}):r?i({tokens:L(t)}):null}function oe(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function se(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=V(e),i=U(e);if(r===null||i===null)return null;let a=K(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function ce(e,t){let n=t?C():x();return e===`agent`?{inheritedLabel:s(),resetLabel:y({value:n})}:e===`instance`?{inheritedLabel:o(),resetLabel:r({value:n})}:{}}function Y(e,t){let n=E(w.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,k.useCallback)(e=>ie(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,provider:n?.provider??null,beyondValidated:n?.versionBeyondValidated===!0}}var X=n();function Z(e){let t=d(w.chats.setSessionKnob),[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(null);return{apply:(0,k.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:n===`showReasoning`?o.showReasoning=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function Q({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0,inheritedLabel:l,resetLabel:u}){return(0,X.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,X.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,X.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,X.jsx)(te,{size:13,className:`oc-spanel__spin`,"aria-label":D()}):t?c?(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:u??O(),"aria-label":u??O(),onClick:n,children:(0,X.jsx)(ne,{size:12,"aria-hidden":!0})}):null:(0,X.jsx)(`span`,{className:`oc-spanel__badge`,children:l??p()})]}),(0,X.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,X.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,X.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[f(),(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:g()})]}):null]})}function le({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,X.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,X.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 ue({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,X.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,X.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,X.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function $({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return j(e,t.length)===`list`?(0,X.jsx)(ue,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,X.jsx)(le,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function de({chatId:e,sm:t,settings:n}){let{apply:r,pending:i,error:a}=Z(e),{can:o}=Y(e),s=i!==null,c=(0,k.useCallback)(()=>{a&&r(a.field,a.value)},[r,a]),u=t?.thinkingLevels??[],d=t?.availableModels??[],f=P(n),p=re(o,{hasModels:d.length>0,hasLevels:u.length>0,described:t!==null});return(0,X.jsxs)(X.Fragment,{children:[p.model?(0,X.jsx)(Q,{label:l(),overridden:M(n,`model`),onReset:()=>void r(`model`,null),pending:i===`model`,error:a?.field===`model`,onRetry:c,resettable:p.reset,children:(0,X.jsx)($,{field:`model`,options:d,value:t?.model??null,onChange:e=>void r(`model`,e),disabled:s,ariaLabel:l()})}):null,p.thinking?(0,X.jsx)(Q,{label:_(),overridden:M(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:i===`thinkingLevel`,error:a?.field===`thinkingLevel`,onRetry:c,resettable:p.reset,children:(0,X.jsx)($,{field:`thinkingLevel`,ariaLabel:_(),options:u.map(e=>({id:e.id,label:B(e.id,R(e.label)),title:R(e.label)})),value:t?.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:s})}):null,(0,X.jsx)(fe,{chatId:e,overridden:M(n,`showReasoning`),onApply:e=>void r(`showReasoning`,e),pending:i===`showReasoning`,error:a?.field===`showReasoning`,onRetry:c,disabled:s}),p.speed?(0,X.jsx)(Q,{label:b(),overridden:M(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:i===`fastMode`,error:a?.field===`fastMode`,onRetry:c,resettable:p.reset,children:(0,X.jsx)($,{field:`fastMode`,ariaLabel:b(),options:N.map(e=>({id:e,label:F(e)})),value:f,onChange:e=>void r(`fastMode`,I(e)),disabled:s})}):null]})}function fe({chatId:e,overridden:t,onApply:n,pending:r,error:i,onRetry:a,disabled:o}){let s=E(w.messages.getSessionMeta,{chatId:e}),c=s?.showReasoning===!0,{inheritedLabel:l,resetLabel:u}=ce(s?.showReasoningDefaultSource,s?.showReasoningDefault===!0);return(0,X.jsx)(Q,{label:v(),overridden:t,inheritedLabel:l,resetLabel:u,onReset:()=>n(null),pending:r,error:i,onRetry:a,help:T(),children:(0,X.jsx)($,{field:`showReasoning`,ariaLabel:v(),options:[{id:`on`,label:C()},{id:`off`,label:x()}],value:s==null?null:c?`on`:`off`,onChange:e=>n(e===`on`),disabled:o})})}export{R as a,K as c,ae as d,V as f,J as g,M as h,oe as i,se as l,L as m,de as n,q as o,U as p,Y as r,W as s,$ as t,G as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,BB as i,Bk as a,Gk as o,HB as s,Hk as c,Jk as l,Kk as u,MB as d,NB as f,Qk as p,UB as m,Uk as h,VB as g,Vk as _,Wk as ee,Xk as te,Yk as ne,Zk as v,eA as y,mV as b,qk as x,t as S,vQ as C}from"./api-jG5Fwsg4.js";import{n as w,t as T}from"./useNavigate-D3GIoxyW.js";import"./convexApi-DeaVGrsr.js";import{c as E,n as re,o as ie}from"./searchSchemas-Dm-Qg010.js";import{t as D}from"./appHost-CH3EGcJw.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-i1bbFYFv.js";import{n as N,t as P}from"./TimeRangePicker-BvcqBpnq.js";var F=t(e(),1),I={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`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=C(S.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=C(S.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:b()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:m()}),(0,R.jsx)(j,{children:g()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,R.jsx)(H,{series:n})})]})]})}function H({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),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[d(),` p50 `,B(c.cP50),` `,s()]}),(0,R.jsxs)(`span`,{children:[f(),` p50 `,B(c.aP50),` `,s()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":m(),children:[(0,R.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:y(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:r(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:p(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:v(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:te(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:ne(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:l(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=w({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=ie(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...E(e)})}),{from:i,to:a}=N(n),{rowLimit:s,buckets:c}=J(i,a),l=C(S.kpi.listKpis,{limit:s,filter:{from:i,to:a}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){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>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,R.jsx)(Y,{value:n,onChange:r})]});return l===void 0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):l.length===0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}):(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{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,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:h({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:c()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:_({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.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,o=Math.max(i-se,1);return(0,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":a({max:Q(r),unit:n}),children:e.map((e,a)=>{let s=r>0?e.value/r*(Z-1):0,c=a*i,l=Z-s;return(0,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:o,height:s,children:(0,R.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{ae as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,$Z as i,AK as a,AZ as o,BK as s,BZ as c,CK as l,DK as u,Dl as d,EK as f,FK as p,FZ as ee,GK as m,GZ as te,HK as h,HZ as ne,IK as g,IZ as re,JK as ie,JZ as ae,KK as oe,KZ as se,LK as ce,LZ as le,MK as _,MZ as ue,NK as de,NZ as fe,OK as pe,Ol as me,PK as he,PZ as v,QK as y,QZ as b,RK as x,RZ as S,Sl as C,TK as w,UK as T,UZ as E,VK as D,VZ as O,WK as k,WZ as A,XK as j,XZ as M,YK as N,YZ as P,ZK as F,ZZ as I,_Q as L,aq as R,cl as ge,cq as _e,dl as ve,eq as ye,fl as be,iq as xe,jK as Se,jZ as Ce,kK as we,kL as Te,ll as Ee,ml as De,nQ as Oe,nq as ke,oq as Ae,pl as je,qK as Me,qZ as Ne,rq as Pe,sQ as Fe,sl as Ie,sq as Le,t as z,tq as Re,ul as ze,vQ as B,wK as Be,zK as Ve,zZ as He}from"./api-jG5Fwsg4.js";import{t as V}from"./checkbox-U99HMqP3.js";import{a as Ue,i as We,n as Ge,r as H,t as Ke}from"./select-DGKgMOlh.js";import{t as U}from"./button-sV7hIR3f.js";import{t as W}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{c as qe,d as Je,r as Ye,t as Xe,u as Ze}from"./useFontScale-DCa0acMC.js";import{r as Qe}from"./toast-daONdZpX.js";import{t as G}from"./badge-CSm2xaYH.js";import{t as K}from"./appHost-CH3EGcJw.js";import{t as $e}from"./localePickerView-C2RmOS86.js";import{t as et}from"./switch-D-QGMGm7.js";import{t as tt}from"./TimezoneCombobox-BUC66FuM.js";var q=t(e(),1),J=[{id:`messages`,label:()=>_e()},{id:`composer`,label:()=>Le()},{id:`sidebar`,label:()=>Ae()},{id:`notifications`,label:()=>T()},{id:`other`,label:()=>R()}],Y={showSource:{category:`messages`,label:()=>xe(),help:()=>Pe()},showReport:{category:`messages`,label:()=>ke(),help:()=>Re()},copyAssistant:{category:`messages`,label:()=>ye()},copyUser:{category:`messages`,label:()=>r()},showDelete:{category:`messages`,label:()=>y()},showTools:{category:`messages`,label:()=>F(),help:()=>j()},voiceInput:{category:`composer`,label:()=>N(),help:()=>ie()},showUsage:{category:`composer`,label:()=>Me(),help:()=>oe()},autoReadAloud:{category:`composer`,label:()=>me(),help:()=>d()},showChatAge:{category:`sidebar`,label:()=>m(),help:()=>k()},notifSound:{category:`notifications`,label:()=>h(),help:()=>D()},notifSystem:{category:`notifications`,label:()=>s(),help:()=>Ve()},replySound:{category:`notifications`,label:()=>x(),help:()=>ce()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function nt(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.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 Z(e){return e===`admin`}function Q(e){return e===!0?`on`:e===!1?`off`:`inherit`}function ot(e){return e===`on`||e!==`off`&&null}function st(e){return at(e)?it[e]:void 0}var $=n(),ct={voiceInput:()=>u()};function lt({prefKey:e,ui:t}){let n=L(z.admin.setUiPrefDefault),r=L(z.admin.setFeatureEnabled),i=st(e),o=i?ct[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:Se()}),(0,$.jsxs)(Ke,{value:Q(t.defaults[e]),onValueChange:t=>void n({key:e,value:ot(t)}),children:[(0,$.jsx)(We,{size:`sm`,className:`w-36`,children:(0,$.jsx)(Ue,{})}),(0,$.jsxs)(Ge,{children:[(0,$.jsx)(H,{value:`on`,children:w()}),(0,$.jsx)(H,{value:`off`,children:Be()}),(0,$.jsx)(H,{value:`inherit`,children:l()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(V,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":a()}),a()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function ut({current:e,enabled:t}){let n=L(z.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=Ze(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,$.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[De(),e?(0,$.jsx)(G,{variant:`secondary`,children:Je(e,qe())}):null]}),(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:a?ve():r?be():je()})]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:Ie()}):null,(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?ge():e?Ee():ze()})]})]})}function dt(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=B(z.me.getMe,{host:K}),a=i?.ui,o=Z(i?.role)&&n,s=L(z.me.setUiPref).withOptimisticUpdate(Ye),c=(0,q.useMemo)(()=>a?nt(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(V,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,o?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:we()}),(0,$.jsx)(`p`,{children:pe()}),(0,$.jsx)(`p`,{children:f()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:g(),"aria-label":g(),className:`mb-2`}),c.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:p()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,$.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(G,{variant:`outline`,children:he()}):l?(0,$.jsx)(G,{variant:`secondary`,children:C()}):null]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:de()}):null,(0,$.jsx)(et,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,$.jsx)(lt,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,$.jsx)(ut,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:Fe()})}var ft={sm:()=>O(),md:()=>c(),lg:()=>He(),xl:()=>S(),"2xl":()=>le(),"3xl":()=>re()};function pt(){let e=B(z.me.getMe,{host:K}),t=L(z.me.setLocale),n=L(z.me.setTimezone),r=L(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:K});n&&e.setQuery(z.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=L(z.me.setMyName),s=Qe(),c=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await a({name:f}),d(null),s.success(P())}catch(e){s.error(ae(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:i()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:I(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,$.jsx)(U,{size:`sm`,disabled:!p,onClick:()=>void m(),children:Te()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:Ne()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[$e().map(e=>(0,$.jsx)(U,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,$.jsx)(U,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Oe()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,$.jsx)(U,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:fe()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:Xe.map(t=>(0,$.jsx)(U,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:ft[t]()},t))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,$.jsx)(dt,{})]})]})}export{pt as PreferencesTab};
|