@lacneu/atrium 0.104.3 → 0.105.1
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-BEJ_Jyn5.js +1 -0
- package/dist/assets/{AdminSettings-CtNcFhMz.js → AdminSettings-5meEb9W8.js} +1 -1
- package/dist/assets/{AdvancedFilter-Cod8SSd6.js → AdvancedFilter-xN0--ljK.js} +1 -1
- package/dist/assets/AgentFilesTab-Can04JU-.js +3 -0
- package/dist/assets/AnomaliesTab-4RaS1dK-.js +1 -0
- package/dist/assets/AuditTab-Sl2mKF7H.js +1 -0
- package/dist/assets/BridgeTab-CuyyGEDU.js +1 -0
- package/dist/assets/ChatDefaultsTab-BUW8zL7h.js +1 -0
- package/dist/assets/{ConfirmDialog-B7k0wvSi.js → ConfirmDialog-2GlWReLp.js} +1 -1
- package/dist/assets/{DataTableShell-DvtkASQG.js → DataTableShell-DbR2ZB8f.js} +1 -1
- package/dist/assets/DeletedChatsTab-CJeOOn67.js +1 -0
- package/dist/assets/{DetailChips-DDAtgnjA.js → DetailChips-3dcLcTwx.js} +1 -1
- package/dist/assets/{EntitySheet-DRzkWKlH.js → EntitySheet-C6w3z1QT.js} +1 -1
- package/dist/assets/FeedbacksTab-Xzcf0-m6.js +1 -0
- package/dist/assets/{FieldLabel-imj_Z0rZ.js → FieldLabel-C4REF2c9.js} +1 -1
- package/dist/assets/FilesTab-CAQXH5ub.js +1 -0
- package/dist/assets/{FilterBar-DCCuFxDn.js → FilterBar-DB4FJ8Dg.js} +1 -1
- package/dist/assets/GroupsTab-Bza-axVm.js +1 -0
- package/dist/assets/InstancesTab-ylJayyDG.js +1 -0
- package/dist/assets/IntegrationsTab-SlsD4tnS.js +1 -0
- package/dist/assets/KnobRow-C5AnEUHi.js +1 -0
- package/dist/assets/KpiTab-66ywB2qQ.js +1 -0
- package/dist/assets/PreferencesTab-DVGrydjd.js +1 -0
- package/dist/assets/ProjectPage-m5wYC2Rt.js +1 -0
- package/dist/assets/PromptInjectionsTab-Dj53oYJM.js +4 -0
- package/dist/assets/RolesTab-DWAYA0bo.js +1 -0
- package/dist/assets/ScheduledTab-CgXOwbXe.js +1 -0
- package/dist/assets/ServiceAccountsTab-DDHjiTam.js +1 -0
- package/dist/assets/SubAgentReportsTab-CkY5rTJw.js +1 -0
- package/dist/assets/ThemeShowroom-CP-Ano4O.js +1 -0
- package/dist/assets/{TimeRangePicker-BZtw1JkM.js → TimeRangePicker-BWc2zMyq.js} +1 -1
- package/dist/assets/{TimezoneCombobox-CeRN4N3z.js → TimezoneCombobox-BFCCUJtt.js} +1 -1
- package/dist/assets/TracesTab--6clA1rh.js +1 -0
- package/dist/assets/TrashTab-DLVzwkoC.js +1 -0
- package/dist/assets/UsersTab-CZ7JvSwK.js +1 -0
- package/dist/assets/VoiceTab-jKwAy1TX.js +1 -0
- package/dist/assets/{alert-dialog-BcJMHbhI.js → alert-dialog-DC8Z8Wmm.js} +1 -1
- package/dist/assets/api-V6x-16tY.js +44 -0
- package/dist/assets/{badge-ChMMFtuW.js → badge-X282ki8x.js} +1 -1
- package/dist/assets/{button-C_rIPtCv.js → button-Dk2mXV1u.js} +1 -1
- package/dist/assets/{card-BV8NO76j.js → card-BOTLCW-9.js} +1 -1
- package/dist/assets/check-BgudyeCZ.js +1 -0
- package/dist/assets/{checkbox-DPxJTQjc.js → checkbox-D6bftQAn.js} +1 -1
- package/dist/assets/chevron-left-C0Y3isEh.js +1 -0
- package/dist/assets/chevron-right-Bh8XLdLx.js +1 -0
- package/dist/assets/chevron-up-DvUmXiwf.js +1 -0
- package/dist/assets/chevrons-up-down-PaGXQ-HZ.js +1 -0
- package/dist/assets/compatView-B790jH8G.js +1 -0
- package/dist/assets/convexApi-BPs2Hfq9.js +1 -0
- package/dist/assets/{copy-DbstFM9Q.js → copy-rAnqIOxQ.js} +1 -1
- package/dist/assets/{cronDescribe-CkiSvbCK.js → cronDescribe-_S84hFUo.js} +1 -1
- package/dist/assets/{deliveryRecorder-B_kVKMkR.js → deliveryRecorder-C4wafMM5.js} +1 -1
- package/dist/assets/{dialog-CPAskUwF.js → dialog-BNsKJRIY.js} +1 -1
- package/dist/assets/dispatchErrorInfo-3a3ZRCxk.js +1 -0
- package/dist/assets/{dist-BjZo0sql.js → dist-BH0QTybL.js} +1 -1
- package/dist/assets/{dist-Uf18yR_a.js → dist-BIRd8lcZ.js} +1 -1
- package/dist/assets/{dist-Bu9sqVcp.js → dist-BR-NmSzA.js} +1 -1
- package/dist/assets/{dist-CYh9BuQS.js → dist-BcFkCuIu.js} +1 -1
- package/dist/assets/{dist-CzmY6YrA.js → dist-Dn0V4znq.js} +1 -1
- package/dist/assets/{download-BaebAe6Z.js → download-D9QjuqE8.js} +1 -1
- package/dist/assets/{dropdown-menu-BVKVjups.js → dropdown-menu-CvM7DyUW.js} +1 -1
- package/dist/assets/{eye-LggiM6Z5.js → eye-uNqwwZRR.js} +1 -1
- package/dist/assets/{format-AQELUhPa.js → format-BrALULQ2.js} +1 -1
- package/dist/assets/{groupManageView-DC3eSLA1.js → groupManageView-CDgw3aW6.js} +1 -1
- package/dist/assets/index-CIz3ifJj.css +1 -0
- package/dist/assets/index-DfYoeoNU.js +158 -0
- package/dist/assets/{input-CSZu-bVE.js → input-BxgrPOQB.js} +1 -1
- package/dist/assets/{list-obbqPBzD.js → list-Dh8ZiyiT.js} +1 -1
- package/dist/assets/loader-circle-BotUEUd9.js +1 -0
- package/dist/assets/{lock-BlVhOk85.js → lock-EGsKhQj8.js} +1 -1
- package/dist/assets/{pencil-K7SBkvHL.js → pencil-DNZlqJcO.js} +1 -1
- package/dist/assets/plus-D_fN9BU6.js +1 -0
- package/dist/assets/{popover-C-Y_Yoco.js → popover-BwLP1xvY.js} +1 -1
- package/dist/assets/roleDescriptions-3xKxmmOg.js +1 -0
- package/dist/assets/rotate-ccw-Cyt4JAE8.js +1 -0
- package/dist/assets/{search-Dz6sLH0-.js → search-Bwyf2eDv.js} +1 -1
- package/dist/assets/{select-CjcMQhwm.js → select-BTp5btAs.js} +1 -1
- package/dist/assets/{server-DcInl3Nh.js → server-DLcIoj6y.js} +1 -1
- package/dist/assets/{speech-ehUcmGCg.js → speech-CsTQ-A5Z.js} +1 -1
- package/dist/assets/{star-5ysDlx3k.js → star-C8s9YR-B.js} +1 -1
- package/dist/assets/{switch--NPD3Vp0.js → switch-CGlTuNUT.js} +1 -1
- package/dist/assets/{table-rRR3TpMc.js → table-CbcTxWSv.js} +1 -1
- package/dist/assets/{tabs-B8emuY1B.js → tabs-CgaqwjVr.js} +1 -1
- package/dist/assets/toast-n2l0FW-G.js +1 -0
- package/dist/assets/{tooltip-Ct0TGxtk.js → tooltip-CRMDA8JT.js} +1 -1
- package/dist/assets/{trash-2-xhtrhYsd.js → trash-2-DMkzussw.js} +1 -1
- package/dist/assets/trashPage-CaQsoE3L.js +1 -0
- package/dist/assets/trashView-nGIDBl8U.js +1 -0
- package/dist/assets/{triangle-alert-DoL9TI6v.js → triangle-alert-CcKY6Wsw.js} +1 -1
- package/dist/assets/{usageView-BuRtXekW.js → usageView-ht_gv_iV.js} +1 -1
- package/dist/assets/{useChart-bV4rotdu.js → useChart-6Fi69FKB.js} +1 -1
- package/dist/assets/{useFontScale-DiSkEM6I.js → useFontScale-CPt1xprW.js} +1 -1
- package/dist/assets/{useStartNewChat-8wVLrYnZ.js → useStartNewChat-rxpg0noT.js} +2 -2
- package/dist/assets/{use_paginated_query-CebdO_HQ.js → use_paginated_query-SUExS5Ri.js} +1 -1
- package/dist/assets/{users-CRbE186D.js → users-BYrKGPt9.js} +1 -1
- package/dist/assets/x-C7RkX_i_.js +1 -0
- package/dist/index.html +54 -54
- package/package.json +1 -1
- package/dist/assets/AccessTab-D8xdWzT5.js +0 -1
- package/dist/assets/AgentFilesTab-Dfkkm3Fw.js +0 -3
- package/dist/assets/AnomaliesTab-DlZ5M2UC.js +0 -1
- package/dist/assets/AuditTab-Dh6gO6j5.js +0 -1
- package/dist/assets/BridgeTab-Bnu9R5N4.js +0 -1
- package/dist/assets/ChatDefaultsTab-CxmayDqi.js +0 -1
- package/dist/assets/DeletedChatsTab-CnaK-AH0.js +0 -1
- package/dist/assets/FeedbacksTab-D4LKaB_2.js +0 -1
- package/dist/assets/FilesTab-D3XWSI2t.js +0 -1
- package/dist/assets/GroupsTab-DbayDYbZ.js +0 -1
- package/dist/assets/InstancesTab-031fn2Jt.js +0 -1
- package/dist/assets/IntegrationsTab-1whhDsmk.js +0 -1
- package/dist/assets/KnobRow-D6kXWvVI.js +0 -1
- package/dist/assets/KpiTab-2Vk6EtCf.js +0 -1
- package/dist/assets/PreferencesTab-B5h49bYq.js +0 -1
- package/dist/assets/ProjectPage-BNKL-iOz.js +0 -1
- package/dist/assets/PromptInjectionsTab-Bmn1iSpB.js +0 -4
- package/dist/assets/RolesTab-DHxLatAl.js +0 -1
- package/dist/assets/ScheduledTab-NHSyQ677.js +0 -1
- package/dist/assets/ServiceAccountsTab-CKV8crhK.js +0 -1
- package/dist/assets/SubAgentReportsTab-BWfXOTck.js +0 -1
- package/dist/assets/ThemeShowroom-Do9I3hrR.js +0 -1
- package/dist/assets/TracesTab-BNWFPad2.js +0 -1
- package/dist/assets/TrashTab-D5irFeF0.js +0 -1
- package/dist/assets/UsersTab-CHs3CRev.js +0 -1
- package/dist/assets/VoiceTab-DRvjgMdZ.js +0 -1
- package/dist/assets/api-CWqdeSbN.js +0 -44
- package/dist/assets/check-DdmANHSb.js +0 -1
- package/dist/assets/chevron-left-ByEQraEh.js +0 -1
- package/dist/assets/chevron-right-DMqzlhWH.js +0 -1
- package/dist/assets/chevron-up-B3KYmtzo.js +0 -1
- package/dist/assets/chevrons-up-down-CITEfz7_.js +0 -1
- package/dist/assets/compatView-Cz5KNXa-.js +0 -1
- package/dist/assets/convexApi-G20_TNBS.js +0 -1
- package/dist/assets/dispatchErrorInfo-7H2cJGwt.js +0 -1
- package/dist/assets/index-DLjKxzJ_.css +0 -1
- package/dist/assets/index-Dq26_OeV.js +0 -158
- package/dist/assets/loader-circle-BqKiW3X9.js +0 -1
- package/dist/assets/plus-DTL4K-j9.js +0 -1
- package/dist/assets/roleDescriptions-DHny6e80.js +0 -1
- package/dist/assets/rotate-ccw-CvefWwHW.js +0 -1
- package/dist/assets/toast-C_YfUacM.js +0 -1
- package/dist/assets/trashPage-3suR6eIy.js +0 -1
- package/dist/assets/trashView-CwUC01r_.js +0 -1
- package/dist/assets/x-CcIT4ync.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{FQ as r,_C as i,aC as a,cC as o,dC as s,fC as c,gC as l,hC as u,lC as d,mC as f,oC as p,pC as m,sC as h,t as g,uC as _,vC as v,wQ as y,yC as b}from"./api-V6x-16tY.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-BTp5btAs.js";import"./convexApi-BPs2Hfq9.js";import{t as E}from"./badge-X282ki8x.js";var D=t(e(),1);function O(e){return e===`user`?d():e===`all`?o():h({group:e.group})}function k(e){return e===`common`?p():e===`owner`?a():h({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=r(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=r(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":v(),children:(0,A.jsx)(x,{placeholder:v()})}),(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:i()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(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:l()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(E,{variant:`default`,children:_()}):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:m()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(E,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{AC as e,Aj as t,CC as n,DC as r,EC as i,Gy as a,KZ as o,MC as s,OC as c,SC as l,TC as u,Xg as d,YJ as f,_Q as p,_d as m,bC as h,gO as g,hO as _,jC as v,kC as y,lZ as b,my as x,wC as S,xC as C}from"./api-V6x-16tY.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:()=>s(),groups:()=>C(),instances:()=>v(),bridge:()=>e(),injections:()=>t(),serviceAccounts:()=>y(),roles:()=>c(),access:()=>h(),traces:()=>r(),kpi:()=>i(),anomalies:()=>u(),files:()=>o(),scheduled:()=>b(),agentFiles:()=>a(),preferences:()=>p(),integrations:()=>S(),theme:()=>f(),chatDefaults:()=>x(),audit:()=>n(),feedbacks:()=>l(),subagentReports:()=>d(),voice:()=>m(),trash:()=>g(),deletedChats:()=>_()},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{BT as r,GT as i,HT as a,KT as o,UT as s,VT as c,WT as l}from"./api-V6x-16tY.js";import{r as u}from"./dist-Dn0V4znq.js";import{t as d}from"./plus-D_fN9BU6.js";import{t as f}from"./x-C7RkX_i_.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-BTp5btAs.js";import{t as v}from"./button-Dk2mXV1u.js";import{t as y}from"./input-BxgrPOQB.js";import{r as b}from"./TimeRangePicker-BWc2zMyq.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{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 o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.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}),i(),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:l()}):(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:s()})}),(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:a()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),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,{}),r()]})]}):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{$p as r,Ab as i,Ay as a,By as o,Cy as s,DQ as ee,Dy as c,Ey as l,FQ as u,Fy as d,Gp as f,Hy as p,Iy as m,Jp as h,Kp as g,Ly as _,MQ as v,My as y,NU as b,Ny as x,Ob as S,Oy as C,PQ as w,Py as T,Qp as E,Ry as D,Sy as O,Ty as te,Up as k,Uy as ne,Vy as re,Wp as A,Wy as j,Xp as M,Yp as N,Zp as P,_y as F,am as ie,by as I,cm as L,cp as R,dp as ae,em as oe,fp as z,gy as B,hy as se,im as V,jy as H,kc as ce,ky as U,lm as W,lp as G,mp as le,nm as ue,om as de,pp as fe,qp as pe,rm as me,sm as he,t as K,tm as ge,up as _e,vy as ve,wQ as q,wy as ye,xy as be,yy as xe,zy as Se}from"./api-V6x-16tY.js";import{t as J}from"./triangle-alert-CcKY6Wsw.js";import{a as Ce,i as we,n as Te,r as Ee,t as De}from"./select-BTp5btAs.js";import{a as Oe,c as ke,i as Ae,n as je,o as Me,r as Ne,s as Pe,t as Fe}from"./alert-dialog-DC8Z8Wmm.js";import{t as Y}from"./button-Dk2mXV1u.js";import"./convexApi-BPs2Hfq9.js";import{r as Ie}from"./toast-n2l0FW-G.js";import{t as Le}from"./badge-X282ki8x.js";import{a as Re,i as ze,n as Be,o as Ve,r as He,t as Ue}from"./dialog-BNsKJRIY.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-B790jH8G.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=u(K.me.getMe,{host:We}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=u(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let s=u(K.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),c=u(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return i===null||s===void 0?r!==void 0&&r.length===0?[]:void 0:s.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,s,r,c]),[f,h]=(0,X.useState)(null);(0,X.useEffect)(()=>{!l||l.length===0||(!f||!l.some(e=>$(e)===f))&&h($(l[0]))},[l,f]);let g=l?.find(e=>$(e)===f)??null,b=v(K.agentFiles.listAgentFiles),[C,w]=(0,X.useState)({status:`idle`}),E=g?.instanceName??null,O=g?.agentId??null,te=u(K.compat.forInstance,n&&E!==null?{instanceName:E}:`skip`),k=n&&E!==null?Ge(te,`agentFiles`):null,A=k===null?!1:k===`loading`?null:k.blocked,M=(0,X.useCallback)(async()=>{if(!(E===null||O===null)){w({status:`loading`});try{let e=await b({instanceName:E,agentId:O});w({status:`done`,files:e.files})}catch(e){w({status:`error`,dashboardAbsent:it(e)})}}},[b,E,O]);(0,X.useEffect)(()=>{A===!1&&M()},[M,A]);let[N,P]=(0,X.useState)(null),F=u(K.agentFileCuration.listCurations,t&&E!==null&&O!==null?{instanceName:E,agentId:O}:`skip`),I=u(K.agentFileCuration.curationSettings,t&&E!==null?{instanceName:E}:`skip`),L=v(K.agentFileCuration.requestCuration),[R,ae]=(0,X.useState)(null),[oe,z]=(0,X.useState)(null),{toast:B}=Ie(),se=(0,X.useMemo)(()=>{let e=new Map;for(let t of F??[])e.has(t.name)||e.set(t.name,t);return e},[F]),H=(0,X.useCallback)(async e=>{if(!(E===null||O===null)){ae(e);try{let t=await L({instanceName:E,agentId:O,name:e,trigger:`manual`});t.ok?B({title:de(),variant:`success`}):B({title:ie({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:V(),variant:`error`})}finally{ae(null)}}},[L,E,O,B]),U=ee(),W=(0,X.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]),G=(0,X.useRef)(null),le=Ke(()=>{let e=G.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]}},()=>[G.current],[C,U,t]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:q()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(De,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":ne(),children:(0,Q.jsx)(Ce,{})}),(0,Q.jsx)(Te,{children:(r??[]).map(e=>(0,Q.jsx)(Ee,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(De,{value:f??``,onValueChange:e=>h(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":p(),children:(0,Q.jsx)(Ce,{})}),(0,Q.jsx)(Te,{children:l.map(e=>(0,Q.jsx)(Ee,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:re()})]}),g===null?null:k===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:q()}):k!==null&&k.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Xe(k.gatewayVersion,k.provider)]}):C.status===`loading`||C.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:q()}):C.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[C.dashboardAbsent?ce():Se(),` `,!C.dashboardAbsent&&(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void M(),children:S()})]}):C.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:G,className:`oc-afiles__list`,"data-layout":le===0?`line`:`two-level`,children:C.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)(Le,{variant:`outline`,children:D()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:_({size:Z(e.size,U)})}),(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:m({pct:W.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":d()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?x():y()}),t&&!e.missing?(0,Q.jsx)(st,{curatable:Ye.includes(e.name),size:e.size??0,budget:I?.budgetChars??null,enabled:I?.enabled??!1,curation:se.get(e.name)??null,inFlight:R===e.name,onCurate:()=>void H(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:T({used:Z(tt(C.files),U),total:Z(Qe,U),pct:W.format(et(tt(C.files)))})})]}),N&&g?(0,Q.jsx)(ct,{instanceName:g.instanceName,agentId:g.agentId,name:N.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void M()}):null,oe?(0,Q.jsx)(lt,{curationId:oe,onClose:()=>z(null),onApplied:()=>{z(null),M()}}):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)(Y,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:L()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Le,{variant:`outline`,className:`oc-afiles__curate-status`,children:he()}):e&&r&&n!==null&&Je(t,n)?(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:W()}):null}function ct({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:o,onSaved:u}){let d=v(K.agentFiles.getAgentFile),f=v(K.agentFiles.setAgentFile),p=Ie(),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(!1),[y,x]=(0,X.useState)(``),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),[k,ne]=(0,X.useState)(!1),[re,A]=(0,X.useState)(!1),j=(0,X.useCallback)(async r=>{_(!1);try{let i=await d({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),ne(!1)}catch{_(!0)}},[d,e,t,n]);(0,X.useEffect)(()=>{j(!1)},[j]);async function M(){if(m!==null){D(!0),A(!1);try{await f({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:m.updatedAtMs??void 0}),p.success(te({name:n})),u(),await j(!1)}catch(e){at(e)?ne(!0):A(!0)}finally{D(!1)}}}let N=m!==null&&y!==m.content,P=(0,X.useMemo)(()=>m===null?null:rt(m.content,y),[m,y]),ie=y.length>Ze,L=ee(),R=(0,X.useMemo)(()=>new Intl.NumberFormat(L),[L]);return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Ve,{children:H({name:n})}),(0,Q.jsxs)(He,{children:[a({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,U()]})]})]}),g?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[s(),` `,(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void j(!1),children:S()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:q()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!r,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":H({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:C()}),k?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O(),` `,(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void j(!0),children:be()})]}):null,re?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:ye()}):null,(0,Q.jsxs)(ze,{className:`oc-afiles__editor-foot flex-row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:c({count:R.format(y.length),max:R.format(Ze)})}),r?(0,Q.jsx)(Y,{size:`sm`,disabled:!N||E||k,onClick:()=>T(!0),children:E?i():l()}):null]})]}),(0,Q.jsx)(Fe,{open:w,onOpenChange:T,children:(0,Q.jsxs)(Ae,{children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(ke,{children:I({name:n})}),(0,Q.jsx)(Oe,{children:xe({agent:t})})]}),P?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ve({added:P.added,removed:P.removed})}),P.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:F()}),P.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,P.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:B()}),P.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ne,{children:b()}),(0,Q.jsx)(je,{onClick:()=>void M(),children:se()})]})]})})]})})}function lt({curationId:e,onClose:t,onApplied:n}){let a=u(K.agentFileCuration.getProposal,{curationId:e}),o=v(K.agentFileCuration.approveCuration),s=w(K.agentFileCuration.rejectCuration),{toast:c}=Ie(),[l,d]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),[_,y]=(0,X.useState)(``),b=ee(),x=(0,X.useMemo)(()=>a?rt(a.beforeContent,a.proposedContent):null,[a]);async function S(){d(`approve`);try{let t=await o({curationId:e});t.ok?(c({title:me(),variant:`success`}),n()):c({title:t.reason===`conflict`?ge():oe({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:V(),variant:`error`})}finally{d(null)}}async function C(n){d(`reject`);try{let r=_.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?G():ue(),variant:`success`}):c({title:P(),variant:`error`}),t()}catch{c({title:V(),variant:`error`})}finally{d(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)(Re,{children:[(0,Q.jsx)(Ve,{children:a?r({name:a.name}):q()}),(0,Q.jsx)(He,{children:E()})]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:q()}):a===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[M({before:Z(a.beforeSize,b),after:Z(a.proposedSize,b)}),a.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,N()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:h({added:x.added,removed:x.removed})}):null,a.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:R({feedback:a.feedback})}):null,x&&x.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:k()}),(0,Q.jsx)(`ul`,{children:x.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:A()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:pe()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:le()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:fe(),value:_,onChange:e=>y(e.target.value)})]}):null,p?(0,Q.jsxs)(ze,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(Y,{variant:`ghost`,onClick:()=>m(!1),disabled:l!==null,children:z()}),(0,Q.jsx)(Y,{variant:`outline`,onClick:()=>void C(!1),disabled:l!==null,children:l===`reject`?i():ae()}),(0,Q.jsx)(Y,{variant:`default`,onClick:()=>void C(!0),disabled:l!==null,children:l===`reject`?i():_e()})]}):(0,Q.jsxs)(ze,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(Y,{variant:`outline`,onClick:()=>m(!0),disabled:l!==null||a==null,children:g()}),(0,Q.jsx)(Y,{variant:`default`,onClick:()=>void S(),disabled:l!==null||a==null,children:l===`approve`?i():f()})]})]})})}export{ot as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AP as i,BP as ee,CP as te,DP as a,EP as ne,FP as re,FQ as o,GP as ie,HP as ae,IP as s,JP as oe,KP as se,LP as c,MP as l,NP as u,OP as d,PP as f,PQ as ce,QP as le,RP as ue,SP as p,TP as de,UP as fe,VP as m,WP as pe,XP as me,YP as he,ZP as ge,_P as h,aF as _e,bP as g,cF as _,eF as ve,gP as v,hP as y,iF as ye,jP as be,kP as xe,lF as b,nF as Se,oF as Ce,qP as x,rF as S,sF as C,t as w,tF as T,uF as E,vP as D,wP as O,xP as k,yP as A,zP as we}from"./api-V6x-16tY.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-BTp5btAs.js";import"./convexApi-BPs2Hfq9.js";import{r as Ee}from"./toast-n2l0FW-G.js";import{t as L}from"./badge-X282ki8x.js";import{n as R}from"./format-BrALULQ2.js";import{a as z,n as B,o as V,t as H}from"./dialog-BNsKJRIY.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-2GlWReLp.js";import{n as je}from"./TimeRangePicker-BWc2zMyq.js";import{t as Me}from"./FilterBar-DB4FJ8Dg.js";import{t as Ne}from"./DataTableShell-DbR2ZB8f.js";import{t as U}from"./dispatchErrorInfo-3a3ZRCxk.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`?E():e===`acknowledged`?b():_()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],X={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=Te({from:`/settings/anomalies`}),t=j({from:`/settings/anomalies`}),n=e.q??``,p=e.status===Z?Y:e.status,h=e.severity??Y,g=e.kind??Y,[_,v]=(0,W.useState)(Y),y=Oe(e.from,e.to),{from:b,to:E}=je(y),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),k=e=>void t({search:t=>({...t,status:e===Y?Z:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),B=e=>void t({search:t=>({...t,...De(e)})}),V=Ae(),H=Ee(),U=ce(w.anomalies.resolveAnomaly),G=(o(w.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),K=o(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:b,to:E,anomalyStatus:p===Y?void 0:p,severity:h===Y?void 0:h,source:_===Y?void 0:_,kind:g===Y?void 0:g}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Q=n!==``||p!==`open`||h!==Y||_!==Y||g!==Y||y.kind!==`relative`||y.from!==X.from;function $(){v(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:C(),description:(0,J.jsxs)(J.Fragment,{children:[Ce(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,_e(),` `,(0,J.jsx)(`strong`,{children:ye()}),`.`,` `,S()]}),confirmLabel:Se()}))try{await U({anomalyId:e._id,status:`resolved`}),H.success(T(),e.kind)}catch(e){H.error(ve(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),H.success(r(),e.kind)}catch(e){H.error(le(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ge(),` `,(0,J.jsx)(`strong`,{children:me()}),` `,he(),` `,(0,J.jsx)(`strong`,{children:oe()}),` `,x(),` `,(0,J.jsx)(`strong`,{children:se()}),` `,ie(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:pe()})]}),(0,J.jsxs)(Me,{q:n,onQChange:D,searchPlaceholder:fe(),timeRange:y,onTimeRangeChange:B,onReset:$,canReset:Q,children:[(0,J.jsxs)(I,{value:p,onValueChange:k,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:ae()}),Pe.map(e=>(0,J.jsx)(F,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:h,onValueChange:A,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:m()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:c()}),Ie.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:_,onValueChange:v,children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(M,{placeholder:s()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:re()}),Le.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:g,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:u()}),q.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:l(),rows:K,emptyHint:p===`open`?be():i(),rowActions:e=>G&&e.status===`open`?[{label:xe(),onSelect:()=>void We(e)},{label:d(),onSelect:()=>void Ge(e)}]:[],columns:[{header:a(),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:ue({when:R(e.firstAt)}),children:we({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:m(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ne(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:s(),cell:e=>(0,J.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:de(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:O(),cell:e=>(0,J.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:te(),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 $(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 ze({row:e}){let t=j();if(e.kind===`subagent.failure`){let n=$(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 Be({row:e}){let[t,n]=(0,W.useState)(!1),r=o(w.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:[k(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(H,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(z,{children:(0,J.jsx)(V,{children:g()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:A()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:D()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(L,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,J.jsx)(L,{variant:`secondary`,children:v()}):(0,J.jsx)(L,{variant:`outline`,children:y()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,FQ as i,aI as a,cI as o,dI as s,ef as c,fI as l,gI as u,hI as d,iI as f,if as p,lI as m,mI as h,nI as g,nf as _,oI as v,pI as y,rI as b,rf as x,sI as S,t as C,tf as w,uI as T}from"./api-V6x-16tY.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-BTp5btAs.js";import"./convexApi-BPs2Hfq9.js";import{n as N}from"./format-BrALULQ2.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-BWc2zMyq.js";import{t as z}from"./FilterBar-DB4FJ8Dg.js";import{t as B}from"./AdvancedFilter-xN0--ljK.js";import{t as V}from"./DataTableShell-DbR2ZB8f.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:p()},{value:`realLabel`,label:x()},{value:`targetLabel`,label:_()},{value:`impersonated`,label:w()},{value:`resource`,label:c()},{value:`resourceId`,label:r()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,c=e.impersonated??G,p=e.resource??G,_=F(e.from,e.to),x=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:w,to:L}=ee(_),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:I(e)}),replace:!0}),$=i(C.admin.listAudit,{filter:{q:n||void 0,from:w,to:L,action:r===G?void 0:r,resource:p===G?void 0:p,impersonated:c===G?void 0:c===`yes`,advanced:x.length>0?x:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||c!==G||p!==G||x.length>0||_.kind!==`relative`||_.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:d()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:h(),timeRange:_,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:r,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:y()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:l()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:c,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:s()}),(0,U.jsx)(j,{value:`yes`,children:T()}),(0,U.jsx)(j,{value:`no`,children:m()})]})]}),(0,U.jsxs)(M,{value:p,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:o()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:S()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:x,onChange:Q}),(0,U.jsx)(V,{title:v(),rows:$,emptyHint:a(),columns:[{header:f(),cell:e=>N(e.at),sort:e=>e.at},{header:y(),cell:e=>e.action,sort:e=>e.action},{header:b(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:g(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:o(),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,$v as i,Ac as a,BA as o,Bv as s,Cd as c,Cj as l,Dd as u,Dj as d,Ej as f,FA as p,FQ as m,GA as h,HA as g,IA as _,JA as v,Jv as y,KA as b,Kv as x,LA as ee,MA as S,MQ as te,NA as ne,Oj as re,PA as ie,PQ as ae,QA as oe,Qj as se,Qv as ce,RA as le,Sd as ue,Sj as de,Tj as fe,UA as pe,VA as me,WA as he,XA as ge,Xv as _e,YA as ve,Yv as ye,ZA as be,Zj as xe,Zv as Se,_j as Ce,aM as we,aj as Te,bd as Ee,bj as De,cM as Oe,cj as ke,dM as Ae,dj as je,ej as Me,ey as Ne,fj as Pe,gj as Fe,hj as Ie,iM as Le,ij as Re,iy as ze,jA as C,k as w,kj as Be,lj as Ve,mj as He,nM as Ue,nj as We,ny as Ge,oM as Ke,oj as qe,os as Je,pj as Ye,qA as Xe,qv as Ze,rM as Qe,rj as $e,ry as et,sM as tt,sj as nt,t as T,tM as rt,tj as it,ty as at,uM as ot,uj as st,vj as ct,wd as lt,wj as ut,xd as dt,xj as ft,yj as pt,zA as mt}from"./api-V6x-16tY.js";import{i as ht,n as E,o as gt,r as _t,s as vt}from"./FieldLabel-C4REF2c9.js";import{n as yt,t as bt}from"./useNavigate-D3GIoxyW.js";import{r as D}from"./dist-Dn0V4znq.js";import{t as O}from"./chevron-right-Bh8XLdLx.js";import{t as xt}from"./chevron-up-DvUmXiwf.js";import{t as St}from"./chevrons-up-down-PaGXQ-HZ.js";import{n as k,t as Ct}from"./usageView-ht_gv_iV.js";import{t as wt}from"./loader-circle-BotUEUd9.js";import{t as Tt}from"./checkbox-D6bftQAn.js";import{t as Et}from"./server-DLcIoj6y.js";import{t as A}from"./triangle-alert-CcKY6Wsw.js";import{a as j,i as M,n as N,r as P,t as F}from"./select-BTp5btAs.js";import{n as Dt,r as Ot,t as kt}from"./popover-BwLP1xvY.js";import{i as At,n as jt,r as Mt,t as Nt}from"./tabs-CgaqwjVr.js";import{t as I}from"./button-Dk2mXV1u.js";import{t as L}from"./input-BxgrPOQB.js";import"./convexApi-BPs2Hfq9.js";import{r as Pt}from"./toast-n2l0FW-G.js";import{t as R}from"./badge-X282ki8x.js";import{a as z,n as B}from"./format-BrALULQ2.js";import{a as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-BNsKJRIY.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-CbcTxWSv.js";import{t as Gt}from"./FilterBar-DB4FJ8Dg.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-B790jH8G.js";import{t as W}from"./dispatchErrorInfo-3a3ZRCxk.js";var $t=w(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=w(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[i,a]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),i),[s,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:b(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(F,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:he()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(P,{value:J,children:h()}),c.map(e=>(0,Z.jsx)(P,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(F,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:pe()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(P,{value:J,children:h()}),l.map(e=>(0,Z.jsx)(P,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(F,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:g()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(P,{value:J,children:h()}),u.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:o(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:mt(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:le(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:ee(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:_(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(V,{children:p()}),(0,Z.jsx)(Q,{label:ie(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(St,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:v({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:z(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${z(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Je({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${z(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${z(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?ne():e===`error`?S():C()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(R,{variant:`secondary`,children:ne()}):e===`error`?(0,Z.jsx)(R,{variant:`destructive`,children:S()}):(0,Z.jsx)(R,{variant:`outline`,children:C()})}function wn(){return m(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=m(T.compat.getBridgeCompat,{}),n=m(T.me.getMe,{host:Bt})?.role===`admin`,r=m(T.admin.listInstances,n?{}:`skip`),i=m(T.agents.usageForInstances,n?{}:`skip`),a=bt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),l=un(e?e.targets:[],t?t.targets:[],r??[]),{section:u}=yt({from:`/settings/bridge`}),d=bt({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,h=f!==null&&Xt(f,`hermes`)&&!l.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ie()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:He()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:lt()}),(0,Z.jsx)(V,{children:c()}),(0,Z.jsx)(V,{children:ue()}),(0,Z.jsx)(V,{children:dt()}),(0,Z.jsx)(V,{children:Ee()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Ct(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(R,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,l.length>0?(0,Z.jsxs)(Nt,{value:l.some(e=>e.key===u)?u:l[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Z.jsx)(Mt,{className:`w-full`,children:l.map(e=>(0,Z.jsxs)(At,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Et,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),l.map(e=>(0,Z.jsx)(jt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,h?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let a=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,o=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,s=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),o?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:Ge(),children:[`(`,o,`)`]})]}):null,a?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,at({build:t.buildVersion??`?`})]}):null,` · `,Ne(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?i():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Te()});let c=tn(e.targets),l=!e.reachable,u=rn(e),d=e.unreachableInstances??[],f=u===`ok`?`ok`:u===`gateways_unreachable`?`warn`:`error`,p=B(e.checkedAt),m=e.startedAt==null?null:B(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u===`ok`?(0,Z.jsx)(k,{size:22}):l||u===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(A,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:u===`ok`?Re():u===`gateways_unreachable`?Me({count:d.length}):l?$e():We({count:c.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,it({time:p})]}),m?(0,Z.jsx)(`span`,{children:oe({time:m})}):null,s]}),u===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r({names:d.join(`, `)})}):null,l?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:be()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Et,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(R,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ze()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),ge({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ye(),i.length>0?(0,Z.jsx)(R,{variant:`destructive`,children:je({count:i.length})}):o>0?(0,Z.jsx)(R,{variant:`destructive`,children:st()}):(0,Z.jsx)(R,{variant:`secondary`,children:Pe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ve({version:e.vendoredVersion}),r?` · `+ke({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),o>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),nt({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:a,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:u({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:_e({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:i()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:a.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(R,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(zt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Lt,{children:Ae({instance:e.displayName??e.name})}),(0,Z.jsx)(Rt,{children:ot()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(k,{"aria-hidden":!0}):(0,Z.jsx)(A,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?pt():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ct()]}):null}function jn({instance:e,onClose:t}){let n=ae(T.admin.upsertInstanceConfig),r=te(T.bridge.validateMediaPaths),i=Pt(),a=Vt(e.config?.contentLocale,void 0),[o,s]=(0,G.useState)(()=>ht(e.config??{},a)),[c,u]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(l(),e)}finally{m(!1)}}async function x(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(o,r,a)}),t()}catch(e){i.error(Qe(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Oe(),help:Ue()}),(0,Z.jsxs)(F,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(N,{children:vt.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:tt(),help:rt()}),(0,Z.jsxs)(F,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(N,{children:gt.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ke(),help:se()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Be(),help:re()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:d(),help:f()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Tt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(E,{label:we(),help:xe()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),Fe({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ft(),result:h.inbound}),(0,Z.jsx)($,{label:De(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:de()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(A,{"aria-hidden":!0}),Ce()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ut():fe()]}),(0,Z.jsx)(I,{size:`sm`,onClick:()=>void x(),disabled:c,children:Le()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ye():y({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Dt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Ze()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Ab as i,An as a,B as o,Bn as s,Cb as c,Cn as l,Dn as u,Ed as d,En as f,F as p,FQ as m,Fn as h,G as g,H as _,Hn as v,I as y,In as b,J as x,K as ee,L as te,Ln as S,MQ as C,Mn as w,Nn as ne,Ob as T,On as re,P as ie,PQ as E,Pn as D,Q as ae,R as oe,Rn as O,Sn as se,Tn as ce,U as le,Uy as ue,V as de,Vn as fe,W as pe,X as me,Y as he,Z as ge,_h as _e,_n as ve,ay as k,bh as ye,bn as be,cy as xe,dh as Se,dy as Ce,et as we,fh as Te,fy as A,gh as Ee,hh as De,jn as Oe,k as ke,kn as Ae,lM as je,ly as Me,mh as Ne,nt as Pe,oy as j,ph as Fe,py as Ie,q as Le,rt as Re,sy as M,t as N,uy as ze,vh as Be,vn as Ve,wQ as P,wb as He,wn as Ue,xn as We,yh as Ge,yn as Ke,z as qe,zn as Je}from"./api-V6x-16tY.js";import{t as Ye}from"./use_paginated_query-SUExS5Ri.js";import{t as Xe}from"./loader-circle-BotUEUd9.js";import{t as F}from"./checkbox-D6bftQAn.js";import{t as Ze}from"./plus-D_fN9BU6.js";import{t as Qe}from"./triangle-alert-CcKY6Wsw.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-BTp5btAs.js";import{n as $e,r as et,t as tt}from"./popover-BwLP1xvY.js";import{t as V}from"./button-Dk2mXV1u.js";import{t as H}from"./input-BxgrPOQB.js";import"./convexApi-BPs2Hfq9.js";import{a as nt,t as U}from"./KnobRow-C5AnEUHi.js";import{n as rt}from"./capabilities-CASxhKEd.js";import{a as it}from"./compatView-B790jH8G.js";/* empty css */import{t as at}from"./switch-CGlTuNUT.js";var ot=ke(`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`}]]),W=t(e(),1),st=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ct(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 lt=[`auto`,`hybrid`,`tool`,`off`];function ut(e){switch(e){case`auto`:return Je();case`hybrid`:return O();case`tool`:return S();default:return b()}}function G(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function dt(e){return typeof e==`string`&<.includes(e)}function K(e){return{injection:dt(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function ft(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function pt(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?Oe():mt(e)?We():null:w(),i=K(e),a=t.injection!==i.injection||!ft(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:D()}}function mt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function ht(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 gt(e){return e.ok?null:e.code===`scope_refused`?Oe():e.code===`stale_default`?a():e.code===`write_unknown`||e.code===`not_confirmed`?u():e.code===`not_applied`?f():e.code===`default_too_large`?Ke():e.code===`allowlist_too_large`?be():e.code===`plugin_too_old`?We():e.code===`source_not_allowed`?se():e.code===`plugin_config_lag`?l():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?ne():Ae({code:e.code})}function _t(e,t){let n=G(e),r=G(t);if(n.injection!==r.injection||!ft(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 q=n();function vt({instanceName:e,row:t,supported:n}){let r=C(N.knowledge.setAgentKnowledgeDefault),[a,o]=(0,W.useState)(t),[c,l]=(0,W.useState)(()=>K(t)),[u,d]=(0,W.useState)(`idle`),[f,p]=(0,W.useState)(null),[m,g]=(0,W.useState)(!1),_=e=>{o(e),l(K(e)),p(null)},v=_t(a,t);(0,W.useEffect)(()=>{m&&v&&(g(!1),_(t))},[m,v]);let y=pt(a,c,n),b=y.readOnlyReason===null;async function x(){d(`saving`),p(null);try{let n=gt(await r({instanceName:e,agentId:t.agentId,injection:c.injection,sources:c.sources,expected:G(a)}));p(n),d(n===null?`done`:`idle`),n===null&&g(!0)}catch(e){p(gt({ok:!1,code:String(e?.message??`error`).slice(0,60)})),d(`idle`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,q.jsxs)(B,{value:c.injection,onValueChange:e=>{dt(e)&&l({...c,injection:e})},disabled:!b,children:[(0,q.jsx)(L,{className:`oc-cdefaults__select`,"aria-label":s(),children:(0,q.jsx)(I,{})}),(0,q.jsx)(R,{children:lt.map(e=>(0,q.jsx)(z,{value:e,children:ut(e)},e))})]})}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),t.sources.map(e=>(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:b?`pointer`:`default`},title:e.description||void 0,children:[(0,q.jsx)(F,{checked:c.sources.includes(e.id),onCheckedChange:()=>l(ht(t,c,e.id)),disabled:!b,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,q.jsx)(`span`,{children:e.label})]},e.id)),v&&!m?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[Ve(),` `,(0,q.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>_(t),children:ve()})]}):null,t.overridesAllowed?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()}),b?(0,q.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,q.jsx)(V,{size:`sm`,disabled:!y.dirty||!y.valid||u===`saving`,onClick:()=>void x(),children:u===`saving`?i():M()})}):(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:y.readOnlyReason}),b&&y.dirty&&y.invalidReason!==null?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y.invalidReason}):null,u===`done`&&f===null?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,f===null?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f})]})]})}function yt({instanceName:e}){let t=m(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ye(N.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,q.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":v(),children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:v()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),t.supported?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:w()}),n.map(n=>(0,q.jsx)(vt,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:ce({shown:n.length})}),(0,q.jsx)(V,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:Ue()})]}):null]})}function J(e){return e.displayName??e.agentId}function bt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function Y(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function xt(e,t){let n=Y(t);return n===``||Y(J(e)).includes(n)||Y(e.agentId).includes(n)}var St=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function X(e,t){return St.compare(J(e),J(t))||St.compare(e.agentId,t.agentId)}function Ct(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(X).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function wt(e,t){return Tt(e.length)?e.filter(e=>xt(e.agent,t)):[...e]}function Tt(e){return e>8}function Z(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&xt(e,t));return[...n.filter(e=>e.enabled).sort(X),...n.filter(e=>!e.enabled).sort(X)]}function Et(e){return!e}function Dt(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Ot(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function kt(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 Q=e=>e?Re():Pe();function $(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=m(N.agents.listAgentsForInstance,{instanceName:e}),n=E(N.agents.setInstanceReasoningDefault),a=E(N.agents.setAgentReasoningDefault),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(``),[h,g]=(0,W.useState)(``),_=(0,W.useRef)(null),v=(0,W.useId)(),b=t?.showReasoningDefault===!0,S=t?.agents??[],C=(0,W.useMemo)(()=>Ct(S,b),[S,b]),w=wt(C,h),ne=Z(S,``).length>0;async function T(e,t,n){c(e),u(null),f(``);try{return await t(),f(n),!0}catch{return u(e),!1}finally{c(t=>t===e?null:t)}}let re=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),te({value:Q(t)})),D=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>a({instanceName:e,agentId:t.agentId,show:n}),r);async function oe(e){await D(e,null,ie({agent:J(e)}))&&_.current?.focus()}let O=s!==null;return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:we()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),t===void 0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):S.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,q.jsx)(`label`,{htmlFor:v,className:`oc-rdefaults__default-label`,children:ge()}),(0,q.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:s?.kind===`instance`?(0,q.jsx)(Xe,{size:14,className:`oc-rdefaults__spin`}):Q(b)}),(0,q.jsx)(at,{id:v,checked:b,disabled:O,"aria-busy":s?.kind===`instance`,onCheckedChange:re})]}),l?.kind===`instance`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,q.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:me({count:C.length})}),(0,q.jsx)(jt,{agents:S,instanceDefault:b,disabled:!ne,triggerRef:_,onPick:e=>{let t=Et(b);D(e,t,y({agent:J(e),value:Q(t)}))}})]}),C.length===0?(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:he()}):(0,q.jsxs)(q.Fragment,{children:[Tt(C.length)?(0,q.jsx)(H,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:o(),"aria-label":o(),className:`oc-rdefaults__filter`}):null,w.length===0?(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:qe()}):(0,q.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":me({count:C.length}),children:w.map(({agent:e,show:t,sameAsDefault:n})=>{let r=J(e),a={kind:`agent`,agentId:e.agentId};return(0,q.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,q.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__name`,children:r}),bt(e)?(0,q.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,q.jsx)(`span`,{className:`oc-rdefaults__same`,children:x()}):null]}),(0,q.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[$(s,a)?(0,q.jsx)(Xe,{size:14,className:`oc-rdefaults__spin`,"aria-label":i()}):null,(0,q.jsx)(U,{field:`showReasoning`,ariaLabel:Le({agent:r}),options:[{id:`on`,label:Re()},{id:`off`,label:Pe()}],value:t?`on`:`off`,onChange:t=>void D(e,t===`on`,p({agent:r,value:Q(t===`on`)})),disabled:O}),(0,q.jsx)(V,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":ee({agent:r}),title:ee({agent:r}),onClick:()=>void oe(e),children:(0,q.jsx)(ot,{"aria-hidden":!0})})]}),$(l,a)?(0,q.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:k()}):null]},e.agentId)})})]}),l?.kind===`agent`&&!C.some(e=>e.agent.agentId===l.agentId)?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]}),(0,q.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:d})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(null),d=(0,W.useId)(),f=(0,W.useRef)(null),p=Z(e,s),m=Dt(p,l),h=Z(e,``).length===0,v=e=>`${d}-opt-${e}`;function y(){o(!1),c(``),u(null)}function b(e){u(e>=0?p[e].agentId:null),e>=0&&f.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(kt(m,e.key,p.length));else if(e.key===`Enter`){e.preventDefault();let t=Ot(p,l);t===null?u(null):(y(),i(t))}}return(0,q.jsxs)(tt,{open:a,onOpenChange:e=>e?o(!0):y(),children:[(0,q.jsx)(et,{asChild:!0,children:(0,q.jsxs)(V,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,q.jsx)(Ze,{"aria-hidden":!0}),g()]})}),(0,q.jsxs)($e,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,q.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:pe({value:Q(Et(t))})}),(0,q.jsx)(H,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":d,"aria-autocomplete":`list`,"aria-activedescendant":m>=0&&m<p.length?v(m):void 0,"aria-label":le(),placeholder:le(),value:s,onChange:e=>{c(e.target.value),u(null)},onKeyDown:x,className:`oc-rdefaults__search`}),(0,q.jsx)(`div`,{id:d,ref:f,role:`listbox`,"aria-label":g(),className:`oc-rdefaults__options`,children:p.length===0?(0,q.jsx)(`p`,{className:`oc-rdefaults__empty`,children:h?de():_()}):p.map((e,t)=>(0,q.jsxs)(`div`,{id:v(t),role:`option`,"aria-selected":t===m,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===m?` is-active`:``}`,onMouseEnter:()=>u(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{y(),i(e)},children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__name`,children:J(e)}),bt(e)?(0,q.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,q.jsx)(`span`,{className:`oc-rdefaults__badge`,children:oe()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=E(N.admin.upsertInstanceConfig),n=m(N.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,W.useState)(r),[s,c]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{o(r),c(`idle`)},[e._id,r]);let l=`__none__`,u=a!==r;async function d(){c(`saving`);try{let n={...e.config??{}};a===``||a===l?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let f=n?.agents??[];return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_e()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsxs)(B,{value:a===``?l:a,onValueChange:e=>o(e===l?``:e),children:[(0,q.jsx)(L,{className:`oc-cdefaults__select`,"aria-label":_e(),children:(0,q.jsx)(I,{placeholder:De()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(z,{value:l,children:De()}),f.map(e=>(0,q.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,q.jsx)(V,{size:`sm`,disabled:!u||s===`saving`,onClick:()=>void d(),children:s===`saving`?i():M()})]}),s===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,s===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]})}function Nt({instance:e}){let t=E(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,W.useState)(n),[s,c]=(0,W.useState)(r===null?``:String(r)),[l,u]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{o(n),c(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let d=s.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,p=!a||f===null||Number.isInteger(f)&&f>=4e3&&f<=6e4,m=a!==n||(f??null)!==r;async function h(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||f===null||Number.isNaN(f)?delete n.curationBudgetChars:n.curationBudgetChars=f,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(F,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":Be()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Be()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(H,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p,"aria-label":Ne(),disabled:!a}),(0,q.jsx)(V,{size:`sm`,disabled:!m||!p||l===`saving`,onClick:()=>void h(),children:l===`saving`?i():M()})]}),p?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Fe()}),l===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,l===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Te()})]})}function Pt({instance:e}){let t=E(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,W.useState)(n===null?``:String(n)),[o,s]=(0,W.useState)(`idle`);(0,W.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,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:ye()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(H,{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,q.jsx)(V,{size:`sm`,disabled:!d||!u||o===`saving`,onClick:()=>void f(),children:o===`saving`?i():M()})]}),u?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Se()}),o===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:j()}):null,o===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ge()})]})}function Ft(){let e=C(N.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),r=m(N.admin.listInstances,{}),[i,a]=(0,W.useState)(null);(0,W.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let o=(r?.length??0)>1,s=r!==void 0&&r.length===0,l=m(N.compat.forInstance,i?{instanceName:i}:`skip`),u=i?rt(l,`configDefaults`):`loading`,f=u===`loading`?null:u.blocked,p=(0,W.useMemo)(()=>o&&i?{instanceName:i}:{},[o,i]),h=(0,W.useRef)(0),g=(0,W.useCallback)(async()=>{let t=++h.current;n({status:`loading`});try{let r=ct(await e(p));if(h.current!==t)return;n({status:`done`,current:r})}catch{if(h.current!==t)return;n({status:`error`})}},[e,p]);(0,W.useEffect)(()=>{f===!1&&(o&&!i||g())},[g,f,o,i]);let _=t.status===`done`?t.current:null,v=(0,W.useMemo)(()=>st.map(e=>({id:e,label:nt(e)})),[]),y=(0,W.useMemo)(()=>[{id:`fast`,label:He()},{id:`standard`,label:c()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}),o&&i?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:ue()}),(0,q.jsxs)(B,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(L,{size:`sm`,"aria-label":ue(),children:(0,q.jsx)(I,{})}),(0,q.jsx)(R,{children:(r??[]).map(e=>(0,q.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,s?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:je()}):u===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):u.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(Qe,{size:14,"aria-hidden":!0}),` `,it(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[xe(),` `,(0,q.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:T()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,q.jsx)(U,{field:`thinkingLevel`,options:v,value:_?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:A()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ce()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:ze()}),(0,q.jsx)(U,{field:`fastMode`,options:y,value:_===null||_.fastModeDefault===null?null:_.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:ze()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Me()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:d()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Pt,{instance:e}),(0,q.jsx)(Nt,{instance:e}),(0,q.jsx)(Mt,{instance:e}),(0,q.jsx)(At,{instanceName:e.name}),(0,q.jsx)(yt,{instanceName:e.name})]}):null})()]})}export{Ft as ChatDefaultsTab};
|
|
@@ -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{$f as r,Qf as i,Xf as a,Yf as o,Zf as s,ep as c}from"./api-V6x-16tY.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-DC8Z8Wmm.js";import{t as g}from"./button-Dk2mXV1u.js";import{t as _}from"./input-BxgrPOQB.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-BNsKJRIY.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:[s(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:o({word:F})}),` `,a()]}),(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??c()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??r()})]})]}):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??c()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??i()})]})]}):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};
|
|
@@ -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{$w as r,DQ as i,Qw as a,eT as o,iT as s,nT as c,rT as l,tT as u}from"./api-V6x-16tY.js";import{r as d}from"./dist-Dn0V4znq.js";import{t as f}from"./chevron-up-DvUmXiwf.js";import{t as p}from"./chevrons-up-down-PaGXQ-HZ.js";import{c as m,g as h,n as g,r as _,s as v,t as y}from"./dropdown-menu-CvM7DyUW.js";import{t as b}from"./checkbox-D6bftQAn.js";import{t as x}from"./plus-D_fN9BU6.js";import{t as S}from"./trash-2-DMkzussw.js";import{t as C}from"./button-Dk2mXV1u.js";import{a as w,i as T,n as E,o as D,r as O,t as k}from"./table-CbcTxWSv.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=s(),bulkActions:L,emptyHint:R=l(),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,i()]);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:c()}):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":u(),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":a({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)??[],i=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":o(),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":r(),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]}),i&&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{AO as t,PQ as n,SO as r,bO as i,kO as a,rN as o,t as s,xO as c}from"./api-V6x-16tY.js";import{t as l}from"./use_paginated_query-SUExS5Ri.js";import{t as u}from"./button-Dk2mXV1u.js";import"./convexApi-BPs2Hfq9.js";import{n as d}from"./ConfirmDialog-2GlWReLp.js";import{r as f}from"./trashView-nGIDBl8U.js";import{n as p,t as m}from"./trashPage-CaQsoE3L.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(s.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=n(s.trash.restoreChat),b=n(s.trash.purgeChat),x=n(s.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:t({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:c(),description:i(),confirmLabel:r(),destructive:!0})&&await x({})},children:r()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:o()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:a()}):(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-X282ki8x.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};
|
|
@@ -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{Gf as r,Kf as i,Nb as a,i as o,o as s}from"./api-V6x-16tY.js";import{t as c}from"./loader-circle-BotUEUd9.js";import{t as l}from"./x-C7RkX_i_.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-BIRd8lcZ.js";import{t as _}from"./button-Dk2mXV1u.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:s(`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=o(`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:s(`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:a()})]})})]})]})}function T({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-header`,className:s(`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:s(`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:s(`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:s(`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,Az as i,BR as a,Bz as o,Cz as s,Dz as c,Ez as l,FQ as u,Fz as d,GR as f,HR as p,Hz as m,Iz as h,JR as g,KR as ee,Lz as _,Mz as te,Nz as ne,Oz as re,PQ as v,Pz as ie,QR as ae,Rz as y,Sz as b,Tz as x,UR as S,VR as C,Vz as w,WR as T,XR as E,YR as D,ZR as O,_z as k,az as A,bz as j,cz as M,dz as N,ez as P,fz as F,gz as I,hm as L,hz as R,iz as z,jz as B,kz as V,lz as H,mz as oe,nz as U,oz as W,pm as G,pz as K,qR as q,rz as se,sz as ce,t as J,tz as le,uz as ue,vz as de,wz as fe,xz as pe,yz as me,zz as he}from"./api-V6x-16tY.js";import{t as ge}from"./button-Dk2mXV1u.js";import"./convexApi-BPs2Hfq9.js";import{n as _e}from"./format-BrALULQ2.js";import{n as Y}from"./ConfirmDialog-2GlWReLp.js";import{t as ve}from"./DataTableShell-DbR2ZB8f.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>m(),incorrect:()=>w(),incoherence:()=>o(),formatting:()=>he(),latency:()=>y(),api_error:()=>_(),other:()=>h()},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:ie()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:ne()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:d()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,a=v(J.feedback.respondToFeedback),[o,u]=(0,X.useState)(e.thread),[d,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(!1);async function h(){let t=d.trim();if(!(!t||p)){m(!0);try{await a({feedbackId:e._id,text:t}),u(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{m(!1)}}}let g=[];try{g=r.contextJson?JSON.parse(r.contextJson):[]}catch{g=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${te()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:W(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(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:ee()}),(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:i()}),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`?V():e.authorRole===`agent`?e.authorLabel??L():re()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:c()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:l(),value:d,maxLength:2e3,rows:3,onChange:e=>f(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 h(),disabled:!d.trim()||p,children:p?x():fe()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:s()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||b()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:pe()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||b()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,g.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:me({count:r.contextCount??g.length,truncated:r.contextTruncated?de():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:g.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?oe({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[K(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,F()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=u(J.feedback.listForAdmin,{}),t=v(J.feedback.readSnapshot),n=v(J.feedback.deleteFeedback),i=Y(),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)({});async function d(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function m(e){await i({title:p(),description:C(),confirmLabel:a(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[N(),` `,(0,Z.jsx)(`strong`,{children:ue()}),` `,H()]}),(0,Z.jsx)(ve,{title:M(),rows:e,emptyHint:ce(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(be,{data:c[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:A(),cell:e=>_e(e.at),sort:e=>e.at},{header:z(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:se(),cell:e=>e.messageRole===`user`?U():le(),sort:e=>e.messageRole},{header:P(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${r({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ae(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:O(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:E(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:D()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:g()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:G()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:q()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?f():T(),onSelect:()=>void d(e)},{label:S(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{HQ as t,k as n}from"./api-V6x-16tY.js";import{c as r,i,l as a,n as o,r as s,s as c,t as l}from"./tooltip-CRMDA8JT.js";import{n as u,r as d,t as f}from"./popover-BwLP1xvY.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{AZ as r,BZ as ee,CZ as i,DQ as a,DZ as te,EZ as ne,FQ as re,FZ as ie,GZ as ae,HZ as o,IZ as oe,LZ as s,MZ as c,NU as l,NZ as u,OZ as d,PQ as se,PZ as f,RZ as ce,SZ as le,TZ as ue,UZ as de,VZ as p,WZ as fe,_Z as pe,bZ as me,dZ as he,fZ as ge,gZ as _e,hZ as ve,jZ as m,kZ as h,mZ as ye,pZ as be,t as g,uZ as xe,vZ as _,vm as v,wQ as y,wZ as b,xZ as x,yZ as S,ym as C,zZ as w}from"./api-V6x-16tY.js";import{c as T,g as E,n as D,r as O,t as k}from"./dropdown-menu-CvM7DyUW.js";import{t as A}from"./download-D9QjuqE8.js";import{t as j}from"./checkbox-D6bftQAn.js";import{t as M}from"./rotate-ccw-Cyt4JAE8.js";import{t as Se}from"./trash-2-DMkzussw.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-BTp5btAs.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-DC8Z8Wmm.js";import{t as R}from"./button-Dk2mXV1u.js";import"./convexApi-BPs2Hfq9.js";import{r as je}from"./toast-n2l0FW-G.js";import{t as z}from"./badge-X282ki8x.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CbcTxWSv.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return f();case`audio`:return u();case`video`:return c();case`pdf`:return m();case`document`:return r();case`archive`:return h();default:return d()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[c,u]=(0,U.useState)(G),[d,f]=(0,U.useState)(G),[m,h]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=se(g.files.softDelete),Y=je();function Ie(){t(G),r(G),u(G),f(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(pe())}catch(e){Y.error(_e(),e)}}let X=re(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:c===G?void 0:c,category:d===G?void 0:d,includeAutoGenerated:m||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(a(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:y()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||c!==G||d!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),(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":fe(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:de()}),(0,W.jsx)(I,{value:`inbound`,children:o()}),(0,W.jsx)(I,{value:`outbound`,children:p()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:r,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":ee(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:w()}),Q.chats.map(e=>(0,W.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:c,onValueChange:u,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":ce(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:s()}),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":oe(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:ie()}),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:m,onCheckedChange:e=>h(e===!0),"aria-label":C()}),(0,W.jsx)(`span`,{children:C()})]}),$?(0,W.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(M,{size:14,"aria-hidden":!0}),me()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?he():ge()}):(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:te()}),(0,W.jsx)(B,{children:ne()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:b()}),(0,W.jsx)(B,{children:i()}),(0,W.jsx)(B,{className:`text-right`,children:le()})]})}),(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:v()}):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`?o():p()})}),(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":S(),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}),x()]})}):(0,W.jsxs)(O,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),be()]}),(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:xe({cap:Be})}):null]}),(0,W.jsx)(Ae,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Te,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:ve()}),(0,W.jsx)(Ce,{children:ye()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(Oe,{children:l()}),(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{aT as r,oT as i}from"./api-V6x-16tY.js";import{t as a}from"./search-Bwyf2eDv.js";import{t as o}from"./rotate-ccw-Cyt4JAE8.js";import{t as s}from"./button-Dk2mXV1u.js";import{t as c}from"./input-BxgrPOQB.js";import{t as l}from"./TimeRangePicker-BWc2zMyq.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(a,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(s,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$x as i,AS as a,Ax as o,BS as s,Cx as c,DS as l,Dx as u,ES as d,Ex as f,FQ as p,FS as m,Fx as h,GS as g,Gb as _,Gx as v,HS as y,Hx as b,IS as x,Ix as S,JS as C,Jb as w,Jx as T,KS as E,Kb as D,Kx as O,LS as k,Lx as A,MS as ee,Mx as te,NS as ne,Nx as re,OS as ie,Ox as ae,PQ as j,PS as oe,Px as M,QS as se,Qx as N,RS as ce,SS as le,Sx as ue,Tx as de,US as P,Ux as fe,VS as F,Vx as pe,WS as me,Wx as he,XS as ge,Xx as _e,YS as ve,Yx as ye,ZS as be,Zx as I,_S as xe,_x as Se,aS as Ce,ax as we,bS as L,bx as Te,cS as Ee,cx as De,dS as Oe,dx as ke,eC as Ae,eS as R,ex as je,fS as Me,fx as Ne,gS as Pe,gx as Fe,hS as Ie,hx as Le,iC as Re,iS as ze,ix as Be,jS as Ve,jx as He,k as Ue,kS as z,kx as We,lS as Ge,lx as Ke,mS as qe,mx as Je,nC as Ye,nS as Xe,nx as Ze,oS as Qe,ox as $e,pS as et,px as tt,qS as nt,qb as rt,qx as it,rC as at,rS as ot,rx as st,sS as ct,sx as lt,t as B,tC as ut,tS as dt,tx as ft,uS as pt,ux as mt,vS as ht,vx as gt,wx as _t,xS as vt,xx as yt,yS as bt,yx as xt,zS as St}from"./api-V6x-16tY.js";import{t as Ct}from"./chevron-left-C0Y3isEh.js";import{t as wt}from"./chevron-right-Bh8XLdLx.js";import{t as V}from"./checkbox-D6bftQAn.js";import{t as H}from"./server-DLcIoj6y.js";import{i as Tt,n as Et,r as Dt,t as Ot}from"./users-BYrKGPt9.js";import{t as U}from"./star-C8s9YR-B.js";import{t as kt}from"./x-C7RkX_i_.js";import{a as At,i as jt,n as Mt,r as Nt,t as Pt}from"./select-BTp5btAs.js";import{i as Ft,n as It,r as Lt,t as Rt}from"./tabs-CgaqwjVr.js";import{t as W}from"./button-Dk2mXV1u.js";import{t as G}from"./input-BxgrPOQB.js";import"./convexApi-BPs2Hfq9.js";import{r as K}from"./toast-n2l0FW-G.js";import{t as q}from"./badge-X282ki8x.js";import{a as zt,n as Bt,o as Vt,r as Ht,t as Ut}from"./dialog-BNsKJRIY.js";import{t as Wt}from"./appHost-CH3EGcJw.js";import{n as Gt}from"./ConfirmDialog-2GlWReLp.js";import{t as Kt}from"./EntitySheet-C6w3z1QT.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-CDgw3aW6.js";import{t as nn}from"./FilterBar-DB4FJ8Dg.js";import{t as rn}from"./DataTableShell-DbR2ZB8f.js";import{t as X}from"./DetailChips-3dcLcTwx.js";var an=Ue(`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=p(B.groups.listGroups,{}),t=p(B.me.getMe,{host:Wt})?.role===`admin`,n=j(B.groups.createGroup),a=j(B.groups.updateGroup),o=j(B.groups.deleteGroup),c=Gt(),l=K(),[u,d]=(0,Z.useState)(!1),[f,m]=(0,Z.useState)(null),[h,_]=(0,Z.useState)(on),[v,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(``),w=(0,Z.useMemo)(()=>{if(!e)return e;let t=x.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,x]);function T(){m(null),_(on),d(!0)}function D(e){m(e),_({name:e.name,description:e.description??``}),d(!0)}async function O(){try{f?await a({groupId:f._id,name:h.name,description:h.description}):await n({name:h.name,description:h.description||void 0}),_(on),m(null),d(!1)}catch(e){l.error(i(),e)}}async function A(e){if(await c({title:St({name:e.name}),description:ce(),confirmWord:e.name,confirmLabel:k(),cancelLabel:g(),destructive:!0}))try{await o({groupId:e._id})}catch(e){l.error(N(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:x,onQChange:S,onReset:()=>S(``),canReset:x!==``,searchPlaceholder:ge()}),(0,Q.jsx)(rn,{title:Re(),rows:w,addLabel:Ye(),onAdd:t?T:void 0,emptyHint:ut(),columns:[{header:Ae(),cell:e=>e.name,sort:e=>e.name},{header:r(),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)(Tt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,Q.jsx)(q,{variant:`secondary`,children:pe({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:se(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(H,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:be(),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:ve(),onSelect:()=>b({groupId:e._id,name:e.name})},...t?[{label:C(),onSelect:()=>D(e)},{label:nt(),variant:`destructive`,onSelect:()=>void A(e)}]:[]]}),(0,Q.jsx)(Kt,{open:u,onOpenChange:d,title:f?P():me(),description:y(),canSubmit:!!h.name.trim(),onSubmit:O,submitLabel:E(),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:F()}),(0,Q.jsx)(G,{value:h.name,onChange:e=>_({...h,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,Q.jsx)(G,{value:h.description,onChange:e=>_({...h,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||b(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)(Ct,{size:14,"aria-hidden":!0}),ie()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":d({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:[l(),(0,Q.jsx)(wt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=p(B.groups.getGroup,n&&e?{groupId:e}:`skip`),o=i?.viewerIsAdmin===!0,s=p(B.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),c=p(B.groups.listAssignableUsers,n&&o?{}:`skip`),l=j(B.groups.addMember),u=j(B.groups.removeMember),d=j(B.groups.bulkSetMembers),f=j(B.groups.setGroupManager),h=K(),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(``),[b,S]=(0,Z.useState)(`members`),[C,w]=(0,Z.useState)(1),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(new Set),k=(0,Z.useRef)(null),A=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ie=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ae=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),M=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>Y(e.instanceName,e.agentId))),[i]),se=(0,Z.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?Y(e.instanceName,e.agentId):null},[i]);(0,Z.useEffect)(()=>{_(``),y(``),S(`members`),w(1),E(null),k.current=null},[n,e]),(0,Z.useEffect)(()=>{w(1)},[g]),(0,Z.useEffect)(()=>{n&&i&&e&&k.current!==e&&(k.current=e,O(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let N=(0,Z.useMemo)(()=>c?Xt(c,g,D):[],[c,g,D]);async function ce(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){h.error(I(),J(e))}}async function de(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){h.error(dt(),e)}}let P=Jt(N,e=>A.has(e.userId)),fe=N.filter(e=>A.has(e.userId)).length,F=Zt(N,C,$);async function pe(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(I(),J(e))}}let me=(e,t)=>(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":te({user:t}),title:te({user:t}),onClick:()=>E({userId:e,label:t}),children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":!0}),re()]});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:x({name:t})}),(0,Q.jsx)(Ht,{children:i&&!o?ye():m()})]}),(0,Q.jsxs)(Rt,{value:b,onValueChange:S,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}),oe(),i?(0,Q.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(Ft,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(H,{size:13,"aria-hidden":!0}),ee(),i?(0,Q.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(Ft,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),Me(),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:L()}):o?c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ht()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:g,onChange:e=>_(e.target.value),placeholder:ne(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(V,{checked:P===`all`||P===`some`&&`indeterminate`,onCheckedChange:()=>void pe(),"aria-label":z()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:z()}),(0,Q.jsxs)(q,{variant:`outline`,className:`oc-access__count`,children:[fe,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=A.has(e.userId),n=Yt(e),r=ie.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(V,{checked:t,onCheckedChange:()=>void ce(e.userId,t),"aria-label":le({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&&ae.has(e.userId)?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:He()}):null,(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:tn(e.role)}),t?me(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?Xe():ot(),title:r?Xe():ot(),onClick:()=>void de(e.userId,r),children:(0,Q.jsx)(Tt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(cn,{page:F.page,pageCount:F.pageCount,onPage:w})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:i.members,agentsButton:me}):null}),(0,Q.jsxs)(It,{value:`agents`,children:[i&&!o?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):null,s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:v,onChange:e=>y(e.target.value),placeholder:Ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,defaultKey:se,viewerIsAdmin:o,query:v},`${e}-${t._id}`))})]})]}),(0,Q.jsx)(It,{value:`charts`,children:(0,Q.jsx)(mn,{groupId:e})})]}),(0,Q.jsx)(dn,{groupId:e,member:T,onOpenChange:e=>{e||E(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=p(B.groupInvites.listGroupInviteRequests,{groupId:e}),i=j(B.groupInvites.requestGroupInvite),a=j(B.groups.removeMember),s=Gt(),c=K(),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(1),m=Zt(t,d,$);async function _(t){t.preventDefault();let n=l.trim();if(n)try{await i({groupId:e,email:n}),u(``),c.success(he())}catch(e){c.error(fe(),e)}}async function y(t,n){if(await s({title:A({user:n}),description:h({user:n}),confirmLabel:M(),cancelLabel:g(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){c.error(I(),J(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void _(e),children:[(0,Q.jsx)(G,{type:`email`,value:l,onChange:e=>u(e.target.value),placeholder:O(),"aria-label":T()}),(0,Q.jsxs)(W,{type:`submit`,size:`sm`,disabled:!l.trim(),children:[(0,Q.jsx)(Et,{size:14,"aria-hidden":!0}),v()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:it()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:o()}):(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:He()}):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":ze(),title:ze(),children:(0,Q.jsx)(Tt,{size:15,"aria-hidden":!0})}):null}),(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":A({user:e.label}),title:e.manager?S():e.lastGroup?je():A({user:e.label}),onClick:()=>void y(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:f})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:b()}),(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=p(B.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=j(B.groups.setMemberAgents),a=j(B.groups.setMemberDefaultAgent),o=K();async function s(e){try{await e()}catch(e){o.error(ft(),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:mt({user:t?.label??``})}),(0,Q.jsx)(Ht,{children:Ke()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):r===null||c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ze()}):(0,Q.jsxs)(Q.Fragment,{children:[r.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}),r.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:D()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?lt():De()}),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:$e()}):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)(V,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>f(i),"aria-label":we({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:rt()}):null,n.state===`deleted`?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:et()}):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":Be(),title:Be(),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":st(),title:st(),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:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=p(B.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),c=j(B.groups.assignAgentToGroup),l=j(B.groups.removeAgentFromGroup),u=j(B.groups.bulkSetGroupAgents),d=j(B.groups.claimAgentForGroup),f=j(B.groups.setGroupDefaultAgent),m=K(),[h,g]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{g(1)},[o]),!e)return null;let _=en(s?.agents??[],o),v=s?.discovery&&!s.discovery.lastPollOk,y=e=>Qt({assigned:r.has(Y(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),b=_.filter(e=>y(e)!==`claim`),x=_.filter(e=>y(e)===`claim`);if(o.trim()&&_.length===0)return null;let S=b.filter(e=>y(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),C=Jt(S,e=>r.has(Y(t,e.agentId))),w=Zt(b,h,$);async function T(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(_e(),J(e))}}async function E(){if(S.length===0)return;let n=S.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:C!==`all`})}catch(e){m.error(_e(),J(e))}}async function D(n){try{await d({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(Se(),e)}}async function O(n){try{await f({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(ke(),e)}}let k=e=>e.reservedForGroup?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:Fe()}):e.reserved?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?Je():Le({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)(H,{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:qe()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:bt()}):_.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v?Ie():Pe()}):(0,Q.jsxs)(Q.Fragment,{children:[S.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(V,{checked:C===`all`||C===`some`&&`indeterminate`,onCheckedChange:()=>void E(),"aria-label":z()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:z()})]}):null,w.pageItems.map(e=>{let n=Y(t,e.agentId),a=r.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)(V,{checked:a,disabled:s&&!a,onCheckedChange:()=>void T(e.agentId,a),"aria-label":vt({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:et()}):null,a?i===n?(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":tt(),title:tt(),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":Ne(),title:Ne(),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:yt()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Te()}),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":gt({name:t}),onClick:()=>void D(e.agentId),children:xt()})]},e.agentId)})]}):null]})]})}function pn(){let e=p(B.groupInvites.listPendingInviteRequests,{}),t=j(B.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(c(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":We(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Et,{size:14,"aria-hidden":!0}),We(),(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??`?`,` ·`,` `,ae({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?de():_t()}),(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:u()}),(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:f()})]},e._id))})]})}function mn({groupId:e}){let t=p(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=j(B.charts.assignChartToGroup),r=j(B.charts.removeChartFromGroup),i=j(B.charts.setGroupDefaultChart),a=j(B.charts.addChartToGroupPool),o=j(B.charts.removeChartFromGroupPool),s=K();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Oe()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(V,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":ct({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":Qe(),title:Qe(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:Ce()}):null,u?(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":Ee({name:e.name}),title:Ee({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(kt,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.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:Ge()})}),(0,Q.jsx)(Mt,{children:l.map(e=>(0,Q.jsx)(Nt,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:pt()}):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,$L as i,$j as a,AI as o,AL as s,Ad as c,Ar as l,As as u,BI as d,BL as f,Bt as p,CI as m,CL as h,Cs as g,DG as _,DI as v,DL as y,Dr as b,Ds as x,EI as S,EL as C,Er as ee,Es as te,FI as w,FL as T,FQ as E,Fh as D,Fs as ne,GI as O,GL as re,HI as k,HL as ie,Hb as ae,Ht as oe,II as se,IL as ce,Ih as le,It as ue,JI as de,JL as fe,KL as pe,LI as me,LL as he,Lh as ge,Lt as _e,MI as ve,ML as ye,MQ as A,Mr as be,Ms as xe,NI as Se,NL as Ce,Nr as we,Ns as Te,OG as j,OI as Ee,OL as M,Or as De,Os as Oe,PI as ke,PL as Ae,PQ as N,Ps as je,QI as P,QL as F,RI as Me,RL as Ne,Rh as Pe,Rt as Fe,SI as Ie,SL as I,Ss as Le,TI as Re,TL as ze,Tr as Be,Ts as Ve,UI as He,UL as Ue,Ub as We,Ut as Ge,VI as Ke,VL as qe,Vt as Je,WI as Ye,WL as Xe,Wb as Ze,Wt as Qe,XI as $e,XL as et,YI as tt,YL as nt,ZI as rt,ZL as it,_I as at,_L as ot,aL as st,aR as ct,bI as lt,bL as ut,bs as dt,cL as ft,cR as pt,dL as mt,dR as ht,eL as gt,eM as _t,eR as vt,fL as yt,fR as bt,gL as xt,hL as St,iL as Ct,iR as wt,jI as Tt,jL as Et,jd as Dt,jr as Ot,js as kt,kI as At,kL as jt,kd as Mt,kr as Nt,ks as Pt,lL as Ft,lR as It,mL as Lt,nL as Rt,nR as zt,oL as Bt,oR as Vt,pL as Ht,qI as L,qL as Ut,rL as Wt,rR as Gt,sL as Kt,sR as qt,t as R,tL as Jt,tR as Yt,uL as Xt,uR as Zt,vI as Qt,vL as $t,wI as en,wL as tn,wr as nn,ws as rn,xI as an,xL as on,xs as sn,yI as cn,yL as ln,ys as un,zI as dn,zL as fn,zt as pn}from"./api-V6x-16tY.js";import{a as mn,c as hn}from"./FieldLabel-C4REF2c9.js";import{t as gn}from"./checkbox-D6bftQAn.js";import{a as z,i as B,n as V,r as H,t as U}from"./select-BTp5btAs.js";import{n as _n,r as vn,t as yn}from"./popover-BwLP1xvY.js";import{t as W}from"./button-Dk2mXV1u.js";import{t as G}from"./input-BxgrPOQB.js";import"./convexApi-BPs2Hfq9.js";import{r as K}from"./toast-n2l0FW-G.js";import{t as q}from"./badge-X282ki8x.js";import{a as bn,n as xn,o as Sn,r as Cn,t as J}from"./dialog-BNsKJRIY.js";import{n as wn}from"./ConfirmDialog-2GlWReLp.js";import{t as Tn}from"./EntitySheet-C6w3z1QT.js";import{a as En}from"./groupManageView-CDgw3aW6.js";import{t as Dn}from"./DataTableShell-DbR2ZB8f.js";import{InstanceConfigDialog as On}from"./BridgeTab-CuyyGEDU.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:mn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=E(R.admin.listInstances,{}),t=E(R.agents.listAllInstanceAgents,{}),n=N(R.admin.upsertInstance),r=N(R.widgets.setInstanceWidgets),o=N(R.admin.deleteInstance),s=K(),[d,m]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)(Q),[v,y]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null),[w,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(null);async function ae(){try{let t=await n({instanceId:O??void 0,name:h.name,gatewayUrl:h.gatewayUrl,bridgeUrl:h.bridgeUrl||void 0,displayName:h.displayName||void 0,kind:h.kind,transport:h.kind===`hermes`?h.transport:void 0,gatewayVersion:h.gatewayVersion||void 0,gatewayHttpUrl:h.gatewayHttpUrl||void 0,...h.kind===`openclaw`?{authMode:h.authMode,personScopes:h.personScopes,identitySource:h.identitySource,participantIdentity:h.participantIdentity,managePermissionModes:h.managePermissionModes,systemIdentity:h.systemIdentity||void 0}:{},streamTransport:h.streamTransport}),i=O===null?null:e?.find(e=>e._id===O),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==a||h.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),_(Q),k(null),m(!1)}catch(e){s.error(Zt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[It(),(0,Z.jsx)(`strong`,{children:pt()}),qt()]}),(0,Z.jsx)(Dn,{title:Vt(),rows:e,addLabel:ct(),onAdd:()=>{k(null),_(Q),m(!0)},emptyHint:wt(),columns:[{header:Gt(),cell:e=>e.name,sort:e=>e.name},{header:zt(),cell:e=>(0,Z.jsx)(q,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Yt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:vt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:bt(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(q,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?en():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:et(),onSelect:()=>{k(e._id),_(Nn(e)),m(!0)}},{label:ht(),onSelect:()=>y(e.name)},{label:T(),onSelect:()=>D(e)},{label:i(),onSelect:()=>C(e)},{label:F(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:F(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(Tn,{open:d,onOpenChange:m,title:O?nt():it(),description:Ut(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:ae,submitLabel:pe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsx)(G,{value:h.name,disabled:O!==null,onChange:e=>_({...h,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:fe()}):null]}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsxs)(U,{value:h.kind,onValueChange:e=>_({...h,kind:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(H,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,Z.jsx)($,{label:Dt(),children:(0,Z.jsxs)(U,{value:h.transport,onValueChange:e=>_({...h,transport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`ws`,children:c()}),(0,Z.jsx)(H,{value:`rest`,children:Mt()})]})]})}):null,(0,Z.jsx)($,{label:Ue(),children:(0,Z.jsx)(G,{value:h.gatewayUrl,onChange:e=>_({...h,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ie(),children:(0,Z.jsx)(G,{value:h.bridgeUrl,placeholder:qe(),onChange:e=>_({...h,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:f(),children:(0,Z.jsx)(G,{value:h.displayName,onChange:e=>_({...h,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:_t(),children:[(0,Z.jsxs)(U,{value:h.streamTransport,onValueChange:e=>_({...h,streamTransport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsx)(V,{children:hn.map(e=>(0,Z.jsx)(H,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a()})]}),(0,Z.jsx)($,{label:fn(),children:(0,Z.jsx)(G,{value:h.gatewayVersion,placeholder:Ne(),onChange:e=>_({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Ve(),children:[(0,Z.jsxs)(U,{value:h.authMode,onValueChange:e=>_({...h,authMode:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`token`,children:rn()}),(0,Z.jsx)(H,{value:`trusted-proxy`,children:g()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?sn():Le()})]}),h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsxs)(U,{value:h.personScopes,onValueChange:e=>_({...h,personScopes:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`capped`,children:je()}),(0,Z.jsx)(H,{value:`full`,children:Te()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?kt():xe()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:u(),children:[(0,Z.jsxs)(U,{value:h.identitySource,onValueChange:e=>_({...h,identitySource:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`canonical`,children:Pt()}),(0,Z.jsx)(H,{value:`email`,children:Oe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?te():x()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:we(),children:[(0,Z.jsxs)(U,{value:h.participantIdentity,onValueChange:e=>_({...h,participantIdentity:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`owner`,children:be()}),(0,Z.jsx)(H,{value:`self`,children:Ot()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?nn():l()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:Nt(),children:[(0,Z.jsxs)(U,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>_({...h,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:De()}),(0,Z.jsx)(H,{value:`on`,children:b()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?Be():ee()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:Qe(),children:[(0,Z.jsxs)(U,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>_({...h,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`on`,children:Ge()}),(0,Z.jsx)(H,{value:`off`,children:oe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?Je():p()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,Z.jsxs)($,{label:pn(),children:[(0,Z.jsxs)(U,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>_({...h,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:Fe()}),(0,Z.jsx)(H,{value:`on`,children:_e()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:ue()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:dt(),children:(0,Z.jsx)(G,{value:h.systemIdentity,placeholder:un(),onChange:e=>_({...h,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:he(),children:(0,Z.jsx)(G,{value:h.gatewayHttpUrl,placeholder:ce(),onChange:e=>_({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:v,open:v!==null,onOpenChange:e=>{e||y(null)}}),S?(0,Z.jsx)(On,{instance:S,onClose:()=>C(null)},S._id):null,w?(0,Z.jsx)(Fn,{instance:w,onClose:()=>D(null)},w._id):null]})}function Fn({instance:e,onClose:t}){let n=E(R.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(J,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(xn,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:Ae({instance:e.displayName??e.name})}),(0,Z.jsx)(Cn,{children:Ce()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ln,{instance:e})}),(0,Z.jsx)(In,{instance:e})]})})}function In({instance:e}){let t=A(R.instanceSync.forceInstanceSync),n=K(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Ht());break;case`no_agents`:n.success(mt());break;case`no_bridge_url`:n.error(Xt());break;case`deploy_misconfigured`:n.error(Ft());break;case`unauthorized`:n.error(Kt());break;case`not_served`:n.error(Bt());break;default:n.error(ft());break}}catch(e){n.error(yt(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Lt():St()})})]})}function Ln({instance:e}){let t=E(R.bridgeAuth.listBridgeAuthStatus,{}),n=A(R.bridgeAuth.mintBridgeSecret),i=N(R.bridgeAuth.revokeBridgeSecret),a=K(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!o){s(!0);try{let t=await n({instanceId:e._id});l(t.plaintext),d(!1)}catch(e){a.error(P(),e)}finally{s(!1)}}}async function h(){if(!o){s(!0);try{await i({instanceId:e._id}),l(null),a.success(r())}catch(e){a.error(P(),e)}finally{s(!1)}}}async function g(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Ct(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Wt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:p?`outline`:`secondary`,children:p?`${jt()} · ${f.prefix}…${f.lastFour}`:M()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void m(),disabled:o,children:p?Jt():Rt()}),p?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:o,children:gt()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:rt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?j():_()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:$e()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=A(R.instanceSecrets.setInstanceSecret),i=N(R.instanceSecrets.clearInstanceSecret),a=A(R.deviceIdentity.generateDeviceIdentity),o=K(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(!1),v=n!==null,b=t===`deviceIdentity`,x=t===`token`?ye():t===`deviceIdentity`?Et():s();async function S(){if(!(!c.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),p(null),g(!1),o.success(h())}catch(e){o.error(I(),e)}finally{d(!1)}}}async function ee(){if(!u){d(!0);try{await i({instanceId:e,field:t}),p(null),g(!1),o.success(on())}catch(e){o.error(I(),e)}finally{d(!1)}}}async function te(){if(!u){d(!0);try{let t=await a({instanceId:e});p(t),g(!1),o.success($t())}catch(e){o.error(xt(),e)}finally{d(!1)}}}let w=f?`openclaw devices approve ${f.id}`:``;async function T(){if(w)try{await navigator.clipboard.writeText(w),g(!0)}catch{}}return(0,Z.jsxs)($,{label:x,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ln()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:v?`outline`:`secondary`,children:v?jt():M()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:v?C():y(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void S(),disabled:u||c.trim().length===0,children:ze()}),b?(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void te(),disabled:u,children:ut()}):null,v?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:u,children:tn()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:$t()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:w}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:m?j():_()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),g(!1)},children:$e()})]}):null]})}var zn={conversational:dn,documentary:me,summarizer:Pe,curator:le},Bn={conversational:Me,documentary:se,summarizer:ge,curator:D},Vn=e=>(zn[e]??(()=>e))(),Hn=e=>(Bn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:He()}),t.map(e=>(0,Z.jsx)(q,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:(0,Z.jsx)(`span`,{className:`oc-agenttype__label`,children:Vn(e)})},e)),(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(vn,{asChild:!0,children:(0,Z.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:k()})}),(0,Z.jsxs)(_n,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ke()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:d()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(gn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=E(R.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=N(R.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=N(R.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=N(R.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=N(R.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=N(R.agents.removeInstanceAgent),u=N(R.agents.setAgentReservation),d=E(R.groups.listGroupLabels,t?{}:`skip`),f=wn(),p=K();async function h(t,n){if(e&&await f({title:lt({name:n}),description:cn(),confirmLabel:an()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){p.error(L(),En(e))}}async function g(t,n,r){if(!e)return;let i=(d??[]).find(e=>e._id===r)?.name??`?`;if(await f({title:Ze({name:n,group:i}),description:We({group:i}),confirmLabel:ae()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){p.error(L(),En(e))}}async function _(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){p.error(L(),e)}}async function y(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){p.error(L(),e)}}async function b(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){p.error(L(),e)}}async function x(t,n){if(e&&await f({title:Se({name:n}),description:ve(),confirmLabel:Tt(),destructive:!0}))try{await l({instanceName:e,agentId:t}),p.success(o())}catch(e){p.error(L(),e)}}return(0,Z.jsx)(J,{open:t,onOpenChange:n,children:(0,Z.jsxs)(xn,{className:`oc-access`,children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:tt({name:e??``})}),(0,Z.jsx)(Cn,{children:de()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:At()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Ee():r.discovery.lastPollOk?v():S({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Re()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(gn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,Z.jsxs)(`div`,{className:`oc-agentcard__main`,children:[(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,Z.jsx)(q,{variant:`outline`,children:t.reserved.groupName===null?Ie():m({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:at()}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void x(t.agentId,a),children:ke()})]}):i?(0,Z.jsx)(q,{variant:`default`,children:en()}):(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void y(t.agentId),children:w()})]})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,a),children:an()}),(0,Z.jsxs)(U,{value:``,onValueChange:e=>void g(t.agentId,a,e),children:[(0,Z.jsx)(B,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(z,{placeholder:Qt()})}),(0,Z.jsx)(V,{children:(d??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(H,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:o,onToggle:e=>void b(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){p.error(L(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:O(),"aria-label":Ye(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pn as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$z as i,FQ as a,Gz as o,Jz as s,Kz as c,MQ as l,PQ as u,Qg as d,Qz as f,Wz as p,Xz as m,Yz as h,Zg as g,Zz as _,a_ as v,eB as y,e_ as b,i_ as x,nB as S,n_ as C,qz as w,rB as T,r_ as E,t as D,tB as O,t_ as k}from"./api-V6x-16tY.js";import{t as A}from"./checkbox-D6bftQAn.js";import"./select-BTp5btAs.js";import{t as j}from"./button-Dk2mXV1u.js";import{t as M}from"./input-BxgrPOQB.js";import"./convexApi-BPs2Hfq9.js";import{t as N}from"./badge-X282ki8x.js";var P=t(e(),1),F=n();function I(){let e=a(D.integrations.status.status,{}),t=u(D.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:T()});let l=n,d=(e,t,n)=>r({...l,[e]:{...l[e],[t]:n}}),g=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,F.jsx)(`strong`,{children:O()}),` `,y()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:i()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:_()}),note:m(),children:[(0,F.jsx)(R,{label:s(),children:(0,F.jsx)(M,{value:l.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>d(`langfuse`,`host`,e.target.value),onBlur:()=>g(`langfuse`,{host:l.langfuse.host??``})})}),(0,F.jsx)(z,{label:p(),checked:l.langfuse.enabled??!0,onChange:e=>{d(`langfuse`,`enabled`,e),g(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:i()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:_()}),note:h(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:l.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>d(`opik`,`baseUrl`,e.target.value),onBlur:()=>g(`opik`,{baseUrl:l.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:l.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||o(),onChange:e=>d(`opik`,`workspace`,e.target.value),onBlur:()=>g(`opik`,{workspace:l.opik.workspace??``})})}),(0,F.jsx)(z,{label:p(),checked:l.opik.enabled??!0,onChange:e=>{d(`opik`,`enabled`,e),g(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:i()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:v()}),note:x(),children:[(0,F.jsx)(R,{label:E(),children:(0,F.jsx)(M,{value:l.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>d(`otlp`,`endpoint`,e.target.value),onBlur:()=>g(`otlp`,{endpoint:l.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:p(),checked:l.otlp.enabled??!0,onChange:e=>{d(`otlp`,`enabled`,e),g(`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=l(D.integrations.otlpSecret.setOtlpHeaders),n=u(D.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,f]=(0,P.useState)(!1),p=async()=>{f(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:C(),children:[(0,F.jsx)(M,{value:i,placeholder:e?k():b(),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||i.trim().length===0,onClick:()=>void p(),children:r()}),e?(0,F.jsx)(j,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:d()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:g()})]})}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,Ab as i,Cb as a,Db as o,Eb as s,FQ as c,M as l,Mb as u,N as d,Ob as f,PQ as p,Tb as m,ab as h,cb as g,ib as _,it as v,j as y,jb as b,kb as x,nt as S,rb as C,rt as w,t as T,tG as E,tt as D,ub as O,wb as ee}from"./api-V6x-16tY.js";import{t as te}from"./loader-circle-BotUEUd9.js";import{t as ne}from"./rotate-ccw-Cyt4JAE8.js";import"./convexApi-BPs2Hfq9.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`?m():e===`fast`?ee():a()}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 ae(e){return H(e).source}function G(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function K(e,t){let n=G(e,t);return n===null?null:O({pct:n,used:L(e),total:L(t)})}function q(e){return g({level:e??`full`})}function J(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?h({cost:e.toFixed(2),tokens:L(t)}):n?_({cost:e.toFixed(2)}):r?C({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=G(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?w():S();return e===`agent`?{inheritedLabel:d(),resetLabel:y({value:n})}:e===`instance`?{inheritedLabel:l(),resetLabel:r({value:n})}:{}}function Y(e,t){let n=c(T.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=p(T.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:a,onRetry:o,help:s,children:c,resettable:l=!0,inheritedLabel:d,resetLabel:p}){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":i()}):t?l?(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:p??b(),"aria-label":p??b(),onClick:n,children:(0,X.jsx)(ne,{size:12,"aria-hidden":!0})}):null:(0,X.jsx)(`span`,{className:`oc-spanel__badge`,children:d??u()})]}),(0,X.jsx)(`div`,{className:`oc-spanel__ctl`,children:c}),s?(0,X.jsx)(`p`,{className:`oc-spanel__help`,children:s}):null,a?(0,X.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[x(),(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:o,children:f()})]}):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:c}=Y(e),l=i!==null,u=(0,k.useCallback)(()=>{a&&r(a.field,a.value)},[r,a]),d=t?.thinkingLevels??[],f=t?.availableModels??[],p=P(n),m=re(c,{hasModels:f.length>0,hasLevels:d.length>0,described:t!==null});return(0,X.jsxs)(X.Fragment,{children:[m.model?(0,X.jsx)(Q,{label:E(),overridden:M(n,`model`),onReset:()=>void r(`model`,null),pending:i===`model`,error:a?.field===`model`,onRetry:u,resettable:m.reset,children:(0,X.jsx)($,{field:`model`,options:f,value:t?.model??null,onChange:e=>void r(`model`,e),disabled:l,ariaLabel:E()})}):null,m.thinking?(0,X.jsx)(Q,{label:o(),overridden:M(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:i===`thinkingLevel`,error:a?.field===`thinkingLevel`,onRetry:u,resettable:m.reset,children:(0,X.jsx)($,{field:`thinkingLevel`,ariaLabel:o(),options:d.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:l})}):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:u,disabled:l}),m.speed?(0,X.jsx)(Q,{label:s(),overridden:M(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:i===`fastMode`,error:a?.field===`fastMode`,onRetry:u,resettable:m.reset,children:(0,X.jsx)($,{field:`fastMode`,ariaLabel:s(),options:N.map(e=>({id:e,label:F(e)})),value:p,onChange:e=>void r(`fastMode`,I(e)),disabled:l})}):null]})}function fe({chatId:e,overridden:t,onApply:n,pending:r,error:i,onRetry:a,disabled:o}){let s=c(T.messages.getSessionMeta,{chatId:e}),l=s?.showReasoning===!0,{inheritedLabel:u,resetLabel:d}=ce(s?.showReasoningDefaultSource,s?.showReasoningDefault===!0);return(0,X.jsx)(Q,{label:v(),overridden:t,inheritedLabel:u,resetLabel:d,onReset:()=>n(null),pending:r,error:i,onRetry:a,help:D(),children:(0,X.jsx)($,{field:`showReasoning`,ariaLabel:v(),options:[{id:`on`,label:w()},{id:`off`,label:S()}],value:s==null?null:l?`on`:`off`,onChange:e=>n(e===`on`),disabled:o})})}export{R as a,G as c,J as d,V as f,q as g,M as h,oe as i,se as l,L as m,de as n,K as o,U as p,Y as r,W as s,$ as t,ae as u};
|