@lacneu/atrium 0.68.9 → 0.68.10
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-B7G7Im-a.js → AccessTab-gw37MX4z.js} +1 -1
- package/dist/assets/{AdvancedFilter-CjEUAVch.js → AdvancedFilter-BDno6bpi.js} +1 -1
- package/dist/assets/{AgentFilesTab-DKEO7ihf.js → AgentFilesTab-W9i4xzRo.js} +1 -1
- package/dist/assets/{AnomaliesTab-Bvq6x8ww.js → AnomaliesTab-Cl6fhnzj.js} +1 -1
- package/dist/assets/{AuditTab-DIByJCQ9.js → AuditTab-D97UVjIT.js} +1 -1
- package/dist/assets/{BridgeTab-LvVXzAlN.js → BridgeTab-BDw6d-rB.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-D_jEnjO5.js → ChatDefaultsTab-DyNXBEEJ.js} +1 -1
- package/dist/assets/{DataTableShell-BmkE6ZKo.js → DataTableShell-BDPxsytR.js} +1 -1
- package/dist/assets/{DetailChips-Di7RSv7f.js → DetailChips-Dz1CvCUA.js} +1 -1
- package/dist/assets/{FeedbacksTab-BmhnkPhR.js → FeedbacksTab-CDK3yYEV.js} +1 -1
- package/dist/assets/{FieldLabel-DnOYy3n5.js → FieldLabel-TkK78Rxe.js} +1 -1
- package/dist/assets/{FilesTab-1YAzvBPF.js → FilesTab-DLluQLgq.js} +1 -1
- package/dist/assets/{FilterBar-DlTMnvB-.js → FilterBar-BBUyj-UI.js} +1 -1
- package/dist/assets/{GroupsTab-ClVeesJC.js → GroupsTab-Co_3EhXl.js} +1 -1
- package/dist/assets/{InstancesTab-DYkjYsMn.js → InstancesTab-CsLF4tq3.js} +1 -1
- package/dist/assets/{IntegrationsTab-zS2Esk5O.js → IntegrationsTab-Bjt9q4ZK.js} +1 -1
- package/dist/assets/{KpiTab-CNmL3EST.js → KpiTab-CRc4Euhi.js} +1 -1
- package/dist/assets/{PreferencesTab-CdrkzuY3.js → PreferencesTab-BXkrfdNS.js} +1 -1
- package/dist/assets/{ProjectPage-MZ9pfIea.js → ProjectPage-u5Zbldt0.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-BiynJSD3.js → PromptInjectionsTab-BMZROwau.js} +1 -1
- package/dist/assets/{RolesTab-BM2zOyLw.js → RolesTab-B_YbBBXC.js} +1 -1
- package/dist/assets/{ScheduledTab-BQSbjoZM.js → ScheduledTab-C-0Lokx_.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-C6HWauET.js → ServiceAccountsTab-DOcs-VU3.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-XlPZnH2k.js → SubAgentReportsTab-BCuAGsRD.js} +1 -1
- package/dist/assets/{ThemeShowroom-BxvDwHhY.js → ThemeShowroom-BudrZBVa.js} +1 -1
- package/dist/assets/{TimeRangePicker-BUrfipct.js → TimeRangePicker-Cgf77qy5.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DAcSoa-v.js → TimezoneCombobox-B6dL9fFG.js} +1 -1
- package/dist/assets/{TracesTab-g0feaQwD.js → TracesTab-DDn4A81J.js} +1 -1
- package/dist/assets/{UsersTab-hygxYWM3.js → UsersTab-uCx1h5JL.js} +1 -1
- package/dist/assets/{VoiceTab-F9Y302WC.js → VoiceTab-Dr48C_we.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-DCfSxTbs.js → highlighted-body-OFNGDK62-CYygbYpM.js} +1 -1
- package/dist/assets/index-7VpXzGMb.css +1 -0
- package/dist/assets/{index-C6y-Zg32.js → index-DI3wVm5g.js} +26 -26
- package/dist/assets/mermaid-GHXKKRXX-Q9KS1K9K.js +1 -0
- package/dist/assets/{pdf-BGco1DwX.js → pdf-DRifwjPA.js} +1 -1
- package/dist/assets/{tabs-DNVRkGA5.js → tabs-CNjvgr2F.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/index-CX1S7Sqd.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-Ci5Jr2Ma.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Ff as i,Gf as a,Hf as o,If as s,Kf as c,Lf as l,Nf as u,PL as d,Pf as f,Rf as p,UL as m,Uf as h,Vf as g,Wf as _,qf as v,t as y,zf as b}from"./api-CZm__5my.js";import{_t as x,bt as S,ut as C,vt as w,xt as T,yt as E}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Ff as i,Gf as a,Hf as o,If as s,Kf as c,Lf as l,Nf as u,PL as d,Pf as f,Rf as p,UL as m,Uf as h,Vf as g,Wf as _,qf as v,t as y,zf as b}from"./api-CZm__5my.js";import{_t as x,bt as S,ut as C,vt as w,xt as T,yt as E}from"./index-DI3wVm5g.js";var D=t(e(),1);function O(e){return e===`user`?l():e===`all`?s():i({group:e.group})}function k(e){return e===`common`?f():e===`owner`?u():i({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=m(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=m(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,A.jsxs)(x,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":c(),children:(0,A.jsx)(T,{placeholder:c()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(E,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(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:_()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(C,{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:o()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:p()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{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:g()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{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:r()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ah as r,eh as i,ih as a,nh as o,oh as s,rh as c,th as l}from"./api-CZm__5my.js";import{r as u}from"./dist-51K385p9.js";import{t as d}from"./x-B8ncs2fH.js";import{t as f}from"./button-DMpgqct_.js";import{_t as p,bt as m,jt as h,ln as g,vt as _,xt as v,yt as y}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ah as r,eh as i,ih as a,nh as o,oh as s,rh as c,th as l}from"./api-CZm__5my.js";import{r as u}from"./dist-51K385p9.js";import{t as d}from"./x-B8ncs2fH.js";import{t as f}from"./button-DMpgqct_.js";import{_t as p,bt as m,jt as h,ln as g,vt as _,xt as v,yt as y}from"./index-DI3wVm5g.js";import{r as b}from"./TimeRangePicker-Cgf77qy5.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:s()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let s=(0,x.useRef)(t),w=!!(s.current&&s.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(s.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),r(),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:a()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(p,{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)(v,{placeholder:c()})}),(0,S.jsx)(_,{children:e.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(p,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(_,{children:C.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:o()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(g,{}),i()]})]}):null]})}export{D as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,$l as i,BL as a,Bi as o,Ca as s,Cu as c,Du as l,Ea as u,Eu as d,HL as f,Hi as p,IL as m,PL as h,Ql as g,Ri as _,Sa as v,Su as y,Ta as b,Tu as x,UL as S,Ui as C,Vi as w,Wi as T,_a as E,_u as D,au as O,ba as k,bu as A,ca as j,cu as ee,da as M,dd as N,du as P,eu as F,fa as I,fu as te,ga as ne,gu as re,ha as L,hu as ie,iu as ae,la as R,ld as oe,lu as z,ma as B,mu as V,nu as H,oa as U,ou as se,pa as ce,pu as le,ru as ue,sa as de,su as fe,t as W,tu as pe,ua as me,uu as he,va as ge,vu as _e,wa as ve,wu as ye,xa as G,xu as be,ya as xe,yu as Se,zi as Ce}from"./api-CZm__5my.js";import{t as K}from"./button-DMpgqct_.js";import{$ as we,Dt as q,V as Te,_t as Ee,at as De,bt as Oe,dt as ke,et as Ae,ft as je,gt as Me,ht as Ne,it as Pe,nt as Fe,ot as Ie,pt as Le,rn as J,rt as Re,tt as ze,ut as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,$l as i,BL as a,Bi as o,Ca as s,Cu as c,Du as l,Ea as u,Eu as d,HL as f,Hi as p,IL as m,PL as h,Ql as g,Ri as _,Sa as v,Su as y,Ta as b,Tu as x,UL as S,Ui as C,Vi as w,Wi as T,_a as E,_u as D,au as O,ba as k,bu as A,ca as j,cu as ee,da as M,dd as N,du as P,eu as F,fa as I,fu as te,ga as ne,gu as re,ha as L,hu as ie,iu as ae,la as R,ld as oe,lu as z,ma as B,mu as V,nu as H,oa as U,ou as se,pa as ce,pu as le,ru as ue,sa as de,su as fe,t as W,tu as pe,ua as me,uu as he,va as ge,vu as _e,wa as ve,wu as ye,xa as G,xu as be,ya as xe,yu as Se,zi as Ce}from"./api-CZm__5my.js";import{t as K}from"./button-DMpgqct_.js";import{$ as we,Dt as q,V as Te,_t as Ee,at as De,bt as Oe,dt as ke,et as Ae,ft as je,gt as Me,ht as Ne,it as Pe,nt as Fe,ot as Ie,pt as Le,rn as J,rt as Re,tt as ze,ut as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-DI3wVm5g.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-DP5Md9HZ.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*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 Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
|
|
2
2
|
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
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<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=S(W.me.getMe,{host:He}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=S(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[t,r,i]);let u=S(W.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),f=S(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),p=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,u,r,f]),[g,_]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!p||p.length===0||(!g||!p.some(e=>$(e)===g))&&_($(p[0]))},[p,g]);let b=p?.find(e=>$(e)===g)??null,C=a(W.agentFiles.listAgentFiles),[w,T]=(0,Y.useState)({status:`idle`}),E=b?.instanceName??null,O=b?.agentId??null,k=S(W.compat.forInstance,n&&E!==null?{instanceName:E}:`skip`),j=n&&E!==null?Te(k,`agentFiles`):null,ee=j===null?!1:j===`loading`?null:j.blocked,M=(0,Y.useCallback)(async()=>{if(!(E===null||O===null)){T({status:`loading`});try{T({status:`done`,files:(await C({instanceName:E,agentId:O})).files})}catch{T({status:`error`})}}},[C,E,O]);(0,Y.useEffect)(()=>{ee===!1&&M()},[M,ee]);let[N,P]=(0,Y.useState)(null),F=S(W.agentFileCuration.listCurations,t&&E!==null&&O!==null?{instanceName:E,agentId:O}:`skip`),I=S(W.agentFileCuration.curationSettings,t&&E!==null?{instanceName:E}:`skip`),te=a(W.agentFileCuration.requestCuration),[ne,L]=(0,Y.useState)(null),[ae,R]=(0,Y.useState)(null),{toast:z}=q(),B=(0,Y.useMemo)(()=>{let e=new Map;for(let t of F??[])e.has(t.name)||e.set(t.name,t);return e},[F]),V=(0,Y.useCallback)(async e=>{if(!(E===null||O===null)){L(e);try{let t=await te({instanceName:E,agentId:O,name:e,trigger:`manual`});t.ok?z({title:s(),variant:`success`}):z({title:v({reason:t.reason??`unknown`}),variant:`error`})}catch{z({title:G(),variant:`error`})}finally{L(null)}}},[te,E,O,z]),H=m(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||p===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ee,{value:i??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Oe,{size:`sm`,"aria-label":d(),children:(0,Q.jsx)(Ue,{})}),(0,Q.jsx)(Ve,{children:(r??[]).map(e=>(0,Q.jsx)(We,{value:e.name,children:e.name},e.name))})]}):null,p.length>0?(0,Q.jsxs)(Ee,{value:g??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(Oe,{size:`sm`,"aria-label":x(),children:(0,Q.jsx)(Ue,{})}),(0,Q.jsx)(Ve,{children:p.map(e=>(0,Q.jsx)(We,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()})]}),b===null?null:j===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):j!==null&&j.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(j.gatewayVersion,j.provider)]}):w.status===`loading`||w.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):w.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[y(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void M(),children:oe()})]}):w.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:w.files.map(e=>{let n=Ye(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)(Be,{variant:`outline`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:A({size:Z(e.size,H)})}),(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:Se({pct:U.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":_e()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?re():ie()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:I?.budgetChars??null,enabled:I?.enabled??!1,curation:B.get(e.name)??null,inFlight:ne===e.name,onCurate:()=>void V(e.name),onReview:e=>R(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:D({used:Z(Ze(w.files),H),total:Z(Je,H),pct:U.format(Xe(Ze(w.files)))})})]}),N&&b?(0,Q.jsx)(rt,{instanceName:b.instanceName,agentId:b.agentId,name:N.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void M()}):null,ae?(0,Q.jsx)(it,{curationId:ae,onClose:()=>R(null),onApplied:()=>{R(null),M()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:b()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Be,{variant:`outline`,className:`oc-afiles__curate-status`,children:ve()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:u()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:o,onClose:s,onSaved:c}){let l=a(W.agentFiles.getAgentFile),u=a(W.agentFiles.setAgentFile),d=q(),[f,p]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!1),[D,k]=(0,Y.useState)(!1),A=(0,Y.useCallback)(async r=>{v(!1);try{let i=await l({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||b(i.content),E(!1)}catch{v(!0)}},[l,e,t,n]);(0,Y.useEffect)(()=>{A(!1)},[A]);async function j(){if(f!==null){w(!0),k(!1);try{await u({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:f.updatedAtMs??void 0}),d.success(ee({name:n})),c(),await A(!1)}catch(e){et(e)?E(!0):k(!0)}finally{w(!1)}}}let M=f!==null&&y!==f.content,I=(0,Y.useMemo)(()=>f===null?null:$e(f.content,y),[f,y]),ne=y.length>X,re=m(),L=(0,Y.useMemo)(()=>new Intl.NumberFormat(re),[re]);return(0,Q.jsx)(ke,{open:!0,onOpenChange:e=>!e&&s(),children:(0,Q.jsxs)(je,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Me,{children:V({name:n})}),(0,Q.jsxs)(Le,{children:[le({agent:t,instance:e}),o?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,te()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[se(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void A(!1),children:oe()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!o,spellCheck:!1,onChange:e=>b(e.target.value),"aria-label":V({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:P()}),T?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void A(!0),children:ae()})]}):null,D?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:fe()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:he({count:L.format(y.length),max:L.format(X)})}),o?(0,Q.jsx)(K,{size:`sm`,disabled:!M||C||T,onClick:()=>S(!0),children:C?N():z()}):null]})]}),(0,Q.jsx)(we,{open:x,onOpenChange:S,children:(0,Q.jsxs)(Fe,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Ie,{children:ue({name:n})}),(0,Q.jsx)(Re,{children:H({agent:t})})]}),I?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:pe({added:I.added,removed:I.removed})}),I.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:F()}),I.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,I.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:i()}),I.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(ze,{children:r()}),(0,Q.jsx)(Ae,{onClick:()=>void j(),children:g()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=S(W.agentFileCuration.getProposal,{curationId:e}),i=a(W.agentFileCuration.approveCuration),s=f(W.agentFileCuration.rejectCuration),{toast:c}=q(),[l,u]=(0,Y.useState)(null),[d,g]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),b=m(),x=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function D(){u(`approve`);try{let t=await i({curationId:e});t.ok?(c({title:k(),variant:`success`}),n()):c({title:t.reason===`conflict`?ge():E({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:G(),variant:`error`})}finally{u(null)}}async function O(n){u(`reject`);try{let r=v.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?Ce():xe(),variant:`success`}):c({title:B(),variant:`error`}),t()}catch{c({title:G(),variant:`error`})}finally{u(null)}}return(0,Q.jsx)(ke,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(je,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Me,{children:r?ne({name:r.name}):h()}),(0,Q.jsx)(Le,{children:L()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[ce({before:Z(r.beforeSize,b),after:Z(r.proposedSize,b)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,I()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:M({added:x.added,removed:x.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:_({feedback:r.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:U()}),(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:de()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:me()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),d?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:T()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:C(),value:v,onChange:e=>y(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:l!==null,children:p()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void O(!1),disabled:l!==null,children:l===`reject`?N():w()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void O(!0),disabled:l!==null,children:l===`reject`?N():o()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:l!==null||r==null,children:R()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void D(),disabled:l!==null||r==null,children:l===`approve`?N():j()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,Bx as i,CS as ee,DS as a,ES as o,Gx as te,HL as ne,Hx as s,Ix as c,Jx as l,Kx as u,Lx as d,OS as f,Qx as re,Rx as p,SS as ie,TS as ae,UL as m,Ux as h,Vx as g,Wx as oe,Xx as se,Yx as _,Zx as ce,_S as le,aS as v,bS as y,cS as b,dS as ue,eS as de,fS as fe,gS as pe,hS as me,iS as he,lS as ge,mS as _e,nS as ve,oS as ye,pS as x,qx as S,rS as C,sS as w,t as T,tS as E,uS as D,vS as O,wS as k,xS as A,yS as j,zx as M}from"./api-CZm__5my.js";import{Dt as N,Fn as P,Pn as F,Z as be,_t as I,bt as L,ct as xe,dt as R,ft as z,gt as B,ht as V,i as Se,o as Ce,ut as H,vt as U,wt as we,xt as W,yt as G}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,Bx as i,CS as ee,DS as a,ES as o,Gx as te,HL as ne,Hx as s,Ix as c,Jx as l,Kx as u,Lx as d,OS as f,Qx as re,Rx as p,SS as ie,TS as ae,UL as m,Ux as h,Vx as g,Wx as oe,Xx as se,Yx as _,Zx as ce,_S as le,aS as v,bS as y,cS as b,dS as ue,eS as de,fS as fe,gS as pe,hS as me,iS as he,lS as ge,mS as _e,nS as ve,oS as ye,pS as x,qx as S,rS as C,sS as w,t as T,tS as E,uS as D,vS as O,wS as k,xS as A,yS as j,zx as M}from"./api-CZm__5my.js";import{Dt as N,Fn as P,Pn as F,Z as be,_t as I,bt as L,ct as xe,dt as R,ft as z,gt as B,ht as V,i as Se,o as Ce,ut as H,vt as U,wt as we,xt as W,yt as G}from"./index-DI3wVm5g.js";import{n as Te}from"./TimeRangePicker-Cgf77qy5.js";import{t as Ee}from"./FilterBar-BBUyj-UI.js";import{t as De}from"./DataTableShell-BDPxsytR.js";import{t as K}from"./dispatchErrorInfo-BXrHatTD.js";var q=t(e(),1),J=n(),Y=`__all__`,Oe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function ke(e){return e===`open`?f():e===`acknowledged`?a():o()}var Ae=[`info`,`warn`,`critical`],je=[`detector`,`agent`,`user`],Me={kind:`relative`,from:`now-30d`,to:`now`},Ne=200,X=`all`;function Z(){let e=P({from:`/settings/anomalies`}),t=F({from:`/settings/anomalies`}),n=e.q??``,i=e.status===X?Y:e.status,a=e.severity??Y,o=e.kind??Y,[s,c]=(0,q.useState)(Y),d=Se(e.from,e.to),{from:f,to:p}=Te(d),h=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),g=e=>void t({search:t=>({...t,status:e===Y?X:e})}),M=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,...Ce(e)})}),B=be(),V=N(),K=ne(T.anomalies.resolveAnomaly),Z=(m(T.me.getMe,{host:we})?.permissions??[]).includes(`admin.manage`),Q=m(T.anomalies.listAnomalies,{limit:Ne,filter:{q:n||void 0,from:f,to:p,anomalyStatus:i===Y?void 0:i,severity:a===Y?void 0:a,source:s===Y?void 0:s,kind:o===Y?void 0:o}}),$=(0,q.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),ze=n!==``||i!==`open`||a!==Y||s!==Y||o!==Y||d.kind!==`relative`||d.from!==Me.from;function Be(){c(Y),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await B({title:ae(),description:(0,J.jsxs)(J.Fragment,{children:[k(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ee(),` `,(0,J.jsx)(`strong`,{children:ie()}),`.`,` `,A()]}),confirmLabel:y()}))try{await K({anomalyId:e._id,status:`resolved`}),V.success(j(),e.kind)}catch(e){V.error(O(),e)}}async function He(e){try{await K({anomalyId:e._id,status:`acknowledged`}),V.success(le(),e.kind)}catch(e){V.error(pe(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),` `,(0,J.jsx)(`strong`,{children:_e()}),` `,x(),` `,(0,J.jsx)(`strong`,{children:fe()}),` `,ue(),` `,(0,J.jsx)(`strong`,{children:D()}),` `,ge(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,J.jsxs)(Ee,{q:n,onQChange:h,searchPlaceholder:w(),timeRange:d,onTimeRangeChange:z,onReset:Be,canReset:ze,children:[(0,J.jsxs)(I,{value:i,onValueChange:g,children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:Y,children:ye()}),Oe.map(e=>(0,J.jsx)(G,{value:e.value,children:ke(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:a,onValueChange:M,children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{placeholder:v()})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:Y,children:he()}),Ae.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:s,onValueChange:c,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(W,{placeholder:C()})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:Y,children:ve()}),je.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:o,onValueChange:R,children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(W,{placeholder:E()})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:Y,children:de()}),$.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]})]}),(0,J.jsx)(De,{title:r(),rows:Q,emptyHint:i===`open`?re():ce(),rowActions:e=>Z&&e.status===`open`?[{label:se(),onSelect:()=>void Ve(e)},{label:_(),onSelect:()=>void He(e)}]:[],columns:[{header:l(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:xe(e.at)}),sort:e=>e.at},{header:E(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:v(),cell:e=>(0,J.jsx)(Ie,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:S(),cell:e=>(0,J.jsx)(Le,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:C(),cell:e=>(0,J.jsx)(H,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:u(),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)(Fe,{row:e})]}),sort:e=>e.message},{header:te(),cell:e=>(0,J.jsx)(Pe,{row:e}),sort:e=>e.evidence??null},{header:oe(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}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 Pe({row:e}){let t=F();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:[`↗ `,h()]}):null]})}let n=Q(e);if(!n.dominantCode)return(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=K(n.dominantCode),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:{q:i,limit:100}}),children:[`↗ `,h()]}):null]})}function Fe({row:e}){let[t,n]=(0,q.useState)(!1),r=m(T.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:[s(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(R,{open:t,onOpenChange:n,children:(0,J.jsxs)(z,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(V,{children:(0,J.jsx)(B,{children:g()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:i()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:M()}):(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 Ie({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Le({status:e}){return e===`open`?(0,J.jsx)(H,{variant:`destructive`,children:p()}):e===`acknowledged`?(0,J.jsx)(H,{variant:`secondary`,children:d()}):(0,J.jsx)(H,{variant:`outline`,children:c()})}function Re(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,Br as i,CC as a,DC as o,EC as s,Fr as c,Ir as l,Lr as u,MC as d,NC as f,OC as p,Rr as m,SC as h,TC as g,UL as _,bC as v,jC as y,kC as b,t as x,wC as S,xC as C,yC as w,zr as T}from"./api-CZm__5my.js";import{Fn as E,Pn as D,_t as O,a as k,bt as A,ct as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,Br as i,CC as a,DC as o,EC as s,Fr as c,Ir as l,Lr as u,MC as d,NC as f,OC as p,Rr as m,SC as h,TC as g,UL as _,bC as v,jC as y,kC as b,t as x,wC as S,xC as C,yC as w,zr as T}from"./api-CZm__5my.js";import{Fn as E,Pn as D,_t as O,a as k,bt as A,ct as j,i as M,n as N,o as P,s as F,vt as I,xt as L,yt as R}from"./index-DI3wVm5g.js";import{n as ee}from"./TimeRangePicker-Cgf77qy5.js";import{t as z}from"./FilterBar-BBUyj-UI.js";import{t as B}from"./AdvancedFilter-BDno6bpi.js";import{t as V}from"./DataTableShell-BDPxsytR.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:i()},{value:`realLabel`,label:T()},{value:`targetLabel`,label:m()},{value:`impersonated`,label:u()},{value:`resource`,label:l()},{value:`resourceId`,label:c()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,c=e.impersonated??G,l=e.resource??G,u=M(e.from,e.to),m=(0,H.useMemo)(()=>F(e.adv),[e.adv]),{from:T,to:N}=ee(u),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:k(e)}),replace:!0}),$=_(x.admin.listAudit,{filter:{q:n||void 0,from:T,to:N,action:i===G?void 0:i,resource:l===G?void 0:l,impersonated:c===G?void 0:c===`yes`,advanced:m.length>0?m: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!==``||i!==G||c!==G||l!==G||m.length>0||u.kind!==`relative`||u.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:d()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:y(),timeRange:u,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(O,{value:i,onValueChange:J,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:r()})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:b()}),te.map(e=>(0,U.jsx)(R,{value:e,children:e},e))]})]}),(0,U.jsxs)(O,{value:c,onValueChange:Y,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:p()}),(0,U.jsx)(R,{value:`yes`,children:o()}),(0,U.jsx)(R,{value:`no`,children:s()})]})]}),(0,U.jsxs)(O,{value:l,onValueChange:X,children:[(0,U.jsx)(A,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:g()})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(R,{value:G,children:S()}),ne.map(e=>(0,U.jsx)(R,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:m,onChange:Q}),(0,U.jsx)(V,{title:a(),rows:$,emptyHint:h(),columns:[{header:C(),cell:e=>j(e.at),sort:e=>e.at},{header:r(),cell:e=>e.action,sort:e=>e.action},{header:v(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:w(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:g(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Al as i,Av as a,Ay as o,BL as s,Bl as c,Bv as l,Cv as u,Cy as d,D as f,Dv as p,Dy as m,Ev as h,Fl as g,Fv as _,Gv as v,HL as ee,Hv as te,Il as y,Iv as b,Iy as x,Jv as ne,Kv as re,Ll as ie,Lv as ae,Ly as oe,Ml as se,Mv as ce,My as le,Nl as ue,Nv as de,Ny as fe,Ov as pe,Oy as me,Pl as he,Pv as ge,Py as _e,Qv as ve,Rl as ye,Rv as be,Sv as xe,Tl as Se,Tv as Ce,UL as S,Uv as we,Vl as Te,Vv as Ee,Wv as De,Xv as Oe,Yv as ke,Zv as Ae,_v as je,ar as Me,av as C,bv as Ne,cv as Pe,dv as Fe,ey as Ie,fv as Le,gv as Re,hv as ze,ir as Be,iv as w,jl as Ve,jv as He,jy as Ue,kl as We,kv as Ge,ky as Ke,lv as qe,mv as Je,or as Ye,ov as T,pv as Xe,qv as Ze,rr as Qe,sr as $e,sv as et,t as E,ty as tt,ur as nt,uv as rt,vv as D,wv as it,wy as at,xv as ot,yv as st,zl as ct,zv as lt}from"./api-CZm__5my.js";import{r as O}from"./dist-51K385p9.js";import{t as ut}from"./chevron-up-vMJbEVXv.js";import{t as dt}from"./chevrons-up-down-EIX0ppH0.js";import{i as ft,n as k,o as pt,r as mt,s as ht}from"./FieldLabel-DnOYy3n5.js";import{i as gt,n as _t,r as vt,t as yt}from"./tabs-DNVRkGA5.js";import{t as bt}from"./button-DMpgqct_.js";import{An as xt,Bt as St,Dt as Ct,Fn as wt,I as Tt,P as Et,Pn as Dt,Rt as Ot,_t as A,bn as kt,bt as j,ct as At,dt as jt,ft as Mt,gt as Nt,ht as Pt,jn as Ft,jt as M,lt as N,on as P,pt as It,rn as F,ut as I,vt as L,wt as Lt,xt as R,yt as z,zt as Rt}from"./index-C6y-Zg32.js";import{r as zt}from"./locales-CPjguROj.js";import{a as B,i as V,n as H,o as U,r as W,t as Bt}from"./table-CwZjj3ZU.js";import{t as Vt}from"./FilterBar-DlTMnvB-.js";import{a as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt}from"./compatView-DP5Md9HZ.js";import{t as G}from"./dispatchErrorInfo-BXrHatTD.js";var Jt=f(`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`}]]),Yt=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Xt(e){return e.filter(e=>e.state===`error`)}function Zt(e){return e.reachable&&Xt(e.targets).length===0}function Qt(e){return Zt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function $t(e){return e.state===`error`&&e.lastErrorCode!==null}function en(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function tn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function nn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return tn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,rn={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function an(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function on(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function sn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function cn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Wt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function ln(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=sn(t.key,e),a=sn(t.key,r);return i&&a?0:i?1:a?-1:n*cn(t.key,e,r)})}function un(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function dn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function fn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Wt(e,t)??Z(e,t))}var Q=n();function pn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(rn),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>un(o),[o]),c=(0,K.useMemo)(()=>dn(o),[o]),l=(0,K.useMemo)(()=>fn(o),[o]),u=(0,K.useMemo)(()=>ln(on(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Vt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:st(),onReset:()=>r(rn),canReset:an(n),children:[(0,Q.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(R,{placeholder:je()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(z,{value:Y,children:D()}),s.map(e=>(0,Q.jsx)(z,{value:e,children:hn(e)},e))]})]}),(0,Q.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(R,{placeholder:Re()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(z,{value:Y,children:D()}),c.map(e=>(0,Q.jsx)(z,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(A,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(R,{placeholder:ze()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(z,{value:Y,children:D()}),l.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):(0,Q.jsxs)(Bt,{className:`oc-conn__table`,children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)($,{label:Xe(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Le(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Fe(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:rt(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:qe(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(V,{children:Pe()}),(0,Q.jsx)($,{label:et(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(H,{children:u.map(e=>(0,Q.jsx)(mn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(ut,{size:13,"aria-hidden":!0}):(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(dt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function mn({r:e}){let t=$t(e)?G(e.lastErrorCode):null,n=en(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(W,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(gn,{state:e.state})}),(0,Q.jsx)(W,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(W,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:ot({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(W,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:N(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(W,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${N(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ne({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${N(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function hn(e){return e===`connected`?T():e===`error`?C():w()}function gn({state:e}){return e===`connected`?(0,Q.jsx)(I,{variant:`secondary`,children:T()}):e===`error`?(0,Q.jsx)(I,{variant:`destructive`,children:C()}):(0,Q.jsx)(I,{variant:`outline`,children:w()})}function _n(){return S(E.bridgeHealth.getBridgeHealth,{})}function vn(){let e=_n(),t=S(E.compat.getBridgeCompat,{}),n=S(E.me.getMe,{host:Lt})?.role===`admin`,r=S(E.admin.listInstances,n?{}:`skip`),i=S(E.agents.usageForInstances,n?{}:`skip`),a=Dt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=nn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=wt({from:`/settings/bridge`}),u=Dt({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Ut(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(yn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ee()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:l()}),(0,Q.jsxs)(Bt,{children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(V,{children:$e()}),(0,Q.jsx)(V,{children:Ye()}),(0,Q.jsx)(V,{children:Me()}),(0,Q.jsx)(V,{children:Be()}),(0,Q.jsx)(V,{children:Qe()})]})}),(0,Q.jsx)(H,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(W,{children:t.provider}),(0,Q.jsx)(W,{children:t.label}),(0,Q.jsx)(W,{children:(0,Q.jsxs)(I,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(W,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(yt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(vt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(gt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(_t,{value:e.key,children:(0,Q.jsx)(bn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null]})}function yn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ht(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ct(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ye({build:t.buildVersion??`?`})]}):null,` · `,ie(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ce()});let s=Xt(e.targets),c=!e.reachable,l=Qt(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=At(e.checkedAt),m=e.startedAt==null?null:At(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(xt,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(Yt,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?He():l===`gateways_unreachable`?p({count:u.length}):c?a():Ge({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Jt,{size:12,"aria-hidden":!0}),` `,pe({time:f})]}),m?(0,Q.jsx)(`span`,{children:Ce({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:h({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:it()})]})}function bn({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=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:qt(t,e,r)})}let f=l.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(P,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),p?(0,Q.jsx)(I,{variant:p===`beyond`?`destructive`:`secondary`,children:Gt(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Te()}),(0,Q.jsx)(Sn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(xn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ft,{size:13,"aria-hidden":!0}),u({count:t.length})]}),m?(0,Q.jsx)(pn,{connections:t,displayByInstance:c}):null]})}function xn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[lt(),i.length>0?(0,Q.jsx)(I,{variant:`destructive`,children:ae({count:i.length})}):(0,Q.jsx)(I,{variant:`secondary`,children:be()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[b({version:e.vendoredVersion}),r?` · `+_({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ft,{size:13,"aria-hidden":!0}),ge({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Sn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:nt({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:ue({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:We()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ht(e.version)}),(0,Q.jsx)(I,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Gt(e.state)})]},e.instanceName))})]})}function Cn({instance:e,onClose:t}){return(0,Q.jsx)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Nt,{children:oe({instance:e.displayName??e.name})}),(0,Q.jsx)(It,{children:x()})]}),(0,Q.jsx)(Tn,{instance:e,onClose:t})]})})}function wn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(xt,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?v():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,De()]}):null}function Tn({instance:e,onClose:t}){let n=ee(E.admin.upsertInstanceConfig),i=s(E.bridge.validateMediaPaths),a=Ct(),c=zt(e.config?.contentLocale,void 0),[l,u]=(0,K.useState)(()=>ft(e.config??{},c)),[f,p]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function ie(){g(!0),v(null);try{v(await i({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){a.error(ke(),e)}finally{g(!1)}}async function ae(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:mt(l,r,c)}),t()}catch(e){a.error(Ke(),e)}finally{p(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:_e(),help:me()}),(0,Q.jsxs)(A,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(R,{})}),(0,Q.jsx)(L,{children:ht.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:fe(),help:m()}),(0,Q.jsxs)(A,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(R,{})}),(0,Q.jsx)(L,{children:pt.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:le(),help:at()}),(0,Q.jsx)(M,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:tt(),help:Ie()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:r(),help:ve()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Et,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Q.jsx)(k,{label:Ue(),help:d()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),te({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{label:Ze(),result:_.inbound}),(0,Q.jsx)(wn,{label:re(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),we()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(bt,{variant:`outline`,size:`sm`,onClick:()=>void ie(),disabled:h,children:[h?(0,Q.jsx)(kt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?Oe():Ae()]}),(0,Q.jsx)(bt,{size:`sm`,onClick:()=>void ae(),disabled:f,children:o()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(St,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?se():Ve({count:e.length}),(0,Q.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:i()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(I,{variant:`secondary`,children:e},e))})]})]})}export{vn as BridgeTab,Cn as InstanceConfigDialog};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Al as i,Av as a,Ay as o,BL as s,Bl as c,Bv as l,Cv as u,Cy as d,D as f,Dv as p,Dy as m,Ev as h,Fl as g,Fv as _,Gv as v,HL as ee,Hv as te,Il as y,Iv as b,Iy as x,Jv as ne,Kv as re,Ll as ie,Lv as ae,Ly as oe,Ml as se,Mv as ce,My as le,Nl as ue,Nv as de,Ny as fe,Ov as pe,Oy as me,Pl as he,Pv as ge,Py as _e,Qv as ve,Rl as ye,Rv as be,Sv as xe,Tl as Se,Tv as Ce,UL as S,Uv as we,Vl as Te,Vv as Ee,Wv as De,Xv as Oe,Yv as ke,Zv as Ae,_v as je,ar as Me,av as C,bv as Ne,cv as Pe,dv as Fe,ey as Ie,fv as Le,gv as Re,hv as ze,ir as Be,iv as w,jl as Ve,jv as He,jy as Ue,kl as We,kv as Ge,ky as Ke,lv as qe,mv as Je,or as Ye,ov as T,pv as Xe,qv as Ze,rr as Qe,sr as $e,sv as et,t as E,ty as tt,ur as nt,uv as rt,vv as D,wv as it,wy as at,xv as ot,yv as st,zl as ct,zv as lt}from"./api-CZm__5my.js";import{r as O}from"./dist-51K385p9.js";import{t as ut}from"./chevron-up-vMJbEVXv.js";import{t as dt}from"./chevrons-up-down-EIX0ppH0.js";import{i as ft,n as k,o as pt,r as mt,s as ht}from"./FieldLabel-TkK78Rxe.js";import{i as gt,n as _t,r as vt,t as yt}from"./tabs-CNjvgr2F.js";import{t as bt}from"./button-DMpgqct_.js";import{An as xt,Bt as St,Dt as Ct,Fn as wt,I as Tt,P as Et,Pn as Dt,Rt as Ot,_t as A,bn as kt,bt as j,ct as At,dt as jt,ft as Mt,gt as Nt,ht as Pt,jn as Ft,jt as M,lt as N,on as P,pt as It,rn as F,ut as I,vt as L,wt as Lt,xt as R,yt as z,zt as Rt}from"./index-DI3wVm5g.js";import{r as zt}from"./locales-CPjguROj.js";import{a as B,i as V,n as H,o as U,r as W,t as Bt}from"./table-CwZjj3ZU.js";import{t as Vt}from"./FilterBar-BBUyj-UI.js";import{a as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt}from"./compatView-DP5Md9HZ.js";import{t as G}from"./dispatchErrorInfo-BXrHatTD.js";var Jt=f(`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`}]]),Yt=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Xt(e){return e.filter(e=>e.state===`error`)}function Zt(e){return e.reachable&&Xt(e.targets).length===0}function Qt(e){return Zt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function $t(e){return e.state===`error`&&e.lastErrorCode!==null}function en(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function tn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function nn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return tn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,rn={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function an(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function on(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function sn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function cn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Wt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function ln(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=sn(t.key,e),a=sn(t.key,r);return i&&a?0:i?1:a?-1:n*cn(t.key,e,r)})}function un(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function dn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function fn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Wt(e,t)??Z(e,t))}var Q=n();function pn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(rn),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>un(o),[o]),c=(0,K.useMemo)(()=>dn(o),[o]),l=(0,K.useMemo)(()=>fn(o),[o]),u=(0,K.useMemo)(()=>ln(on(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Vt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:st(),onReset:()=>r(rn),canReset:an(n),children:[(0,Q.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(R,{placeholder:je()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(z,{value:Y,children:D()}),s.map(e=>(0,Q.jsx)(z,{value:e,children:hn(e)},e))]})]}),(0,Q.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(R,{placeholder:Re()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(z,{value:Y,children:D()}),c.map(e=>(0,Q.jsx)(z,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(A,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(R,{placeholder:ze()})}),(0,Q.jsxs)(L,{children:[(0,Q.jsx)(z,{value:Y,children:D()}),l.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):(0,Q.jsxs)(Bt,{className:`oc-conn__table`,children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)($,{label:Xe(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Le(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Fe(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:rt(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:qe(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(V,{children:Pe()}),(0,Q.jsx)($,{label:et(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(H,{children:u.map(e=>(0,Q.jsx)(mn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(ut,{size:13,"aria-hidden":!0}):(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(dt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function mn({r:e}){let t=$t(e)?G(e.lastErrorCode):null,n=en(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(W,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(gn,{state:e.state})}),(0,Q.jsx)(W,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(W,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:ot({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(W,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:N(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(W,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${N(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ne({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${N(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function hn(e){return e===`connected`?T():e===`error`?C():w()}function gn({state:e}){return e===`connected`?(0,Q.jsx)(I,{variant:`secondary`,children:T()}):e===`error`?(0,Q.jsx)(I,{variant:`destructive`,children:C()}):(0,Q.jsx)(I,{variant:`outline`,children:w()})}function _n(){return S(E.bridgeHealth.getBridgeHealth,{})}function vn(){let e=_n(),t=S(E.compat.getBridgeCompat,{}),n=S(E.me.getMe,{host:Lt})?.role===`admin`,r=S(E.admin.listInstances,n?{}:`skip`),i=S(E.agents.usageForInstances,n?{}:`skip`),a=Dt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=nn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=wt({from:`/settings/bridge`}),u=Dt({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Ut(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(yn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ee()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:l()}),(0,Q.jsxs)(Bt,{children:[(0,Q.jsx)(B,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(V,{children:$e()}),(0,Q.jsx)(V,{children:Ye()}),(0,Q.jsx)(V,{children:Me()}),(0,Q.jsx)(V,{children:Be()}),(0,Q.jsx)(V,{children:Qe()})]})}),(0,Q.jsx)(H,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(W,{children:t.provider}),(0,Q.jsx)(W,{children:t.label}),(0,Q.jsx)(W,{children:(0,Q.jsxs)(I,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(W,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(yt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(vt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(gt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(_t,{value:e.key,children:(0,Q.jsx)(bn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null]})}function yn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ht(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ct(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ye({build:t.buildVersion??`?`})]}):null,` · `,ie(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ce()});let s=Xt(e.targets),c=!e.reachable,l=Qt(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=At(e.checkedAt),m=e.startedAt==null?null:At(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(xt,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(Yt,{size:22}):(0,Q.jsx)(F,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?He():l===`gateways_unreachable`?p({count:u.length}):c?a():Ge({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Jt,{size:12,"aria-hidden":!0}),` `,pe({time:f})]}),m?(0,Q.jsx)(`span`,{children:Ce({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:h({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:it()})]})}function bn({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=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:qt(t,e,r)})}let f=l.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(P,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),p?(0,Q.jsx)(I,{variant:p===`beyond`?`destructive`:`secondary`,children:Gt(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Te()}),(0,Q.jsx)(Sn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(xn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ft,{size:13,"aria-hidden":!0}),u({count:t.length})]}),m?(0,Q.jsx)(pn,{connections:t,displayByInstance:c}):null]})}function xn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[lt(),i.length>0?(0,Q.jsx)(I,{variant:`destructive`,children:ae({count:i.length})}):(0,Q.jsx)(I,{variant:`secondary`,children:be()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[b({version:e.vendoredVersion}),r?` · `+_({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ft,{size:13,"aria-hidden":!0}),ge({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Sn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:nt({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:ue({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:We()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ht(e.version)}),(0,Q.jsx)(I,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Gt(e.state)})]},e.instanceName))})]})}function Cn({instance:e,onClose:t}){return(0,Q.jsx)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Mt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(Nt,{children:oe({instance:e.displayName??e.name})}),(0,Q.jsx)(It,{children:x()})]}),(0,Q.jsx)(Tn,{instance:e,onClose:t})]})})}function wn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(xt,{"aria-hidden":!0}):(0,Q.jsx)(F,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?v():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,De()]}):null}function Tn({instance:e,onClose:t}){let n=ee(E.admin.upsertInstanceConfig),i=s(E.bridge.validateMediaPaths),a=Ct(),c=zt(e.config?.contentLocale,void 0),[l,u]=(0,K.useState)(()=>ft(e.config??{},c)),[f,p]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function ie(){g(!0),v(null);try{v(await i({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){a.error(ke(),e)}finally{g(!1)}}async function ae(){p(!0);try{let r=e.config??{};await n({instanceId:e._id,config:mt(l,r,c)}),t()}catch(e){a.error(Ke(),e)}finally{p(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:_e(),help:me()}),(0,Q.jsxs)(A,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(R,{})}),(0,Q.jsx)(L,{children:ht.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:fe(),help:m()}),(0,Q.jsxs)(A,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(R,{})}),(0,Q.jsx)(L,{children:pt.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:le(),help:at()}),(0,Q.jsx)(M,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:tt(),help:Ie()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:r(),help:ve()}),(0,Q.jsx)(M,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Et,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Q.jsx)(k,{label:Ue(),help:d()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),te({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{label:Ze(),result:_.inbound}),(0,Q.jsx)(wn,{label:re(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(F,{"aria-hidden":!0}),we()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(bt,{variant:`outline`,size:`sm`,onClick:()=>void ie(),disabled:h,children:[h?(0,Q.jsx)(kt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?Oe():Ae()]}),(0,Q.jsx)(bt,{size:`sm`,onClick:()=>void ae(),disabled:f,children:o()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(St,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?se():Ve({count:e.length}),(0,Q.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:i()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(I,{variant:`secondary`,children:e},e))})]})]})}export{vn as BridgeTab,Cn as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BL as r,Eu as i,Fy as a,Gl as o,HL as s,Hl as c,Jl as l,Kl as u,PL as d,UL as f,Ul as p,Wl as m,Xl as h,Yl as g,_o as _,ad as v,bo as y,dd as b,do as x,fo as S,go as C,ho as w,id as T,ld as E,lr as D,mo as O,po as k,ql as A,t as j,vo as M,yo as N}from"./api-CZm__5my.js";import{t as P}from"./button-DMpgqct_.js";import{M as F,N as I,P as L,V as R,_t as z,bt as B,jt as V,rn as H,vt as U,xt as W,yt as G}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BL as r,Eu as i,Fy as a,Gl as o,HL as s,Hl as c,Jl as l,Kl as u,PL as d,UL as f,Ul as p,Wl as m,Xl as h,Yl as g,_o as _,ad as v,bo as y,dd as b,do as x,fo as S,go as C,ho as w,id as T,ld as E,lr as D,mo as O,po as k,ql as A,t as j,vo as M,yo as N}from"./api-CZm__5my.js";import{t as P}from"./button-DMpgqct_.js";import{M as F,N as I,P as L,V as R,_t as z,bt as B,jt as V,rn as H,vt as U,xt as W,yt as G}from"./index-DI3wVm5g.js";import{i as K}from"./compatView-DP5Md9HZ.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(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 X=n();function Z({instance:e}){let t=s(j.admin.upsertInstanceConfig),n=f(j.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[o,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),l(`idle`)},[e._id,r]);let u=`__none__`,d=i!==r;async function h(){l(`saving`);try{let n={...e.config??{}};i===``||i===u?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let g=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(z,{value:i===``?u:i,onValueChange:e=>a(e===u?``:e),children:[(0,X.jsx)(B,{className:`oc-cdefaults__select`,"aria-label":_(),children:(0,X.jsx)(W,{placeholder:w()})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(G,{value:u,children:w()}),g.map(e=>(0,X.jsx)(G,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!d||o===`saving`,onClick:()=>void h(),children:o===`saving`?b():m()})]}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:c()}):null]})}function Q({instance:e}){let t=s(j.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,q.useState)(n),[o,l]=(0,q.useState)(r===null?``:String(r)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n),l(r===null?``:String(r)),d(`idle`)},[e._id,n,r]);let f=o.trim(),h=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,g=!i||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=i!==n||(h??null)!==r;async function v(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(L,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":M()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":O(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?b():m()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:c()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]})}function $({instance:e}){let t=s(j.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,o]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function h(){o(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,X.jsx)(P,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void h(),children:a===`saving`?b():m()})]}),d?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:c()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function ee(){let e=r(j.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),s=f(j.admin.listInstances,{}),[c,p]=(0,q.useState)(null);(0,q.useEffect)(()=>{!s||s.length===0||(!c||!s.some(e=>e.name===c))&&p(s[0].name)},[s,c]);let m=(s?.length??0)>1,_=s!==void 0&&s.length===0,y=f(j.compat.forInstance,c?{instanceName:c}:`skip`),b=c?R(y,`configDefaults`):`loading`,x=b===`loading`?null:b.blocked,S=(0,q.useMemo)(()=>m&&c?{instanceName:c}:{},[m,c]),C=(0,q.useRef)(0),w=(0,q.useCallback)(async()=>{let t=++C.current;n({status:`loading`});try{let r=Y(await e(S));if(C.current!==t)return;n({status:`done`,current:r})}catch{if(C.current!==t)return;n({status:`error`})}},[e,S]);(0,q.useEffect)(()=>{x===!1&&(m&&!c||w())},[w,x,m,c]);let O=t.status===`done`?t.current:null,k=(0,q.useMemo)(()=>J.map(e=>({id:e,label:I(e)})),[]),M=(0,q.useMemo)(()=>[{id:`fast`,label:v()},{id:`standard`,label:T()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),m&&c?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,X.jsxs)(z,{value:c,onValueChange:e=>p(e),children:[(0,X.jsx)(B,{size:`sm`,"aria-label":i(),children:(0,X.jsx)(W,{})}),(0,X.jsx)(U,{children:(s??[]).map(e=>(0,X.jsx)(G,{value:e.name,children:e.name},e.name))})]})]}):null,_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):b===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):b.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(H,{size:14,"aria-hidden":!0}),` `,K(b.gatewayVersion,b.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[o(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:E()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,X.jsx)(F,{options:k,value:O?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:l()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,X.jsx)(F,{options:M,value:O===null||O.fastModeDefault===null?null:O.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:D()})]}),(()=>{let e=s?.find(e=>e.name===(c??s[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_m as r,fm as i,gm as a,hm as o,mm as s,pm as c,vm as l}from"./api-CZm__5my.js";import{r as u}from"./dist-51K385p9.js";import{t as d}from"./chevron-up-vMJbEVXv.js";import{t as f}from"./chevrons-up-down-EIX0ppH0.js";import{t as p}from"./button-DMpgqct_.js";import{En as m,It as h,Lt as g,Mt as _,Nt as v,P as y,Pt as b,in as x,ln as S}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_m as r,fm as i,gm as a,hm as o,mm as s,pm as c,vm as l}from"./api-CZm__5my.js";import{r as u}from"./dist-51K385p9.js";import{t as d}from"./chevron-up-vMJbEVXv.js";import{t as f}from"./chevrons-up-down-EIX0ppH0.js";import{t as p}from"./button-DMpgqct_.js";import{En as m,It as h,Lt as g,Mt as _,Nt as v,P as y,Pt as b,in as x,ln as S}from"./index-DI3wVm5g.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CwZjj3ZU.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=l(),bulkActions:F,emptyHint:I=r(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(S,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(y,{"aria-label":o(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(y,{"aria-label":s(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(g,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(b,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ut as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ut as t}from"./index-DI3wVm5g.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{$E as r,$T as i,AE as a,Aa as o,BE as s,CE as c,DE as l,EE as u,FE as d,GE as f,HE as ee,HL as p,IE as te,JE as m,KE as h,LE as ne,ME as g,Ma as _,NE as v,OE as re,PE as ie,QE as y,QT as b,RE as ae,SE as x,TE as S,UE as C,UL as w,VE as T,WE as E,XE as D,YE as O,ZE as k,ZT as A,_E as j,aE as M,bE as N,cE as P,dE as F,eE as I,fE as L,gE as R,hE as z,iE as B,jE as V,kE as H,lE as U,mE as W,nE as oe,oE as G,pE as K,qE as q,rE as se,sE as ce,t as J,tE as le,uE as ue,vE as de,wE as fe,xE as pe,yE as me,zE as he}from"./api-CZm__5my.js";import{t as ge}from"./button-DMpgqct_.js";import{Z as _e,ct as Y}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AE as a,Aa as o,BE as s,CE as c,DE as l,EE as u,FE as d,GE as f,HE as ee,HL as p,IE as te,JE as m,KE as h,LE as ne,ME as g,Ma as _,NE as v,OE as re,PE as ie,QE as y,QT as b,RE as ae,SE as x,TE as S,UE as C,UL as w,VE as T,WE as E,XE as D,YE as O,ZE as k,ZT as A,_E as j,aE as M,bE as N,cE as P,dE as F,eE as I,fE as L,gE as R,hE as z,iE as B,jE as V,kE as H,lE as U,mE as W,nE as oe,oE as G,pE as K,qE as q,rE as se,sE as ce,t as J,tE as le,uE as ue,vE as de,wE as fe,xE as pe,yE as me,zE as he}from"./api-CZm__5my.js";import{t as ge}from"./button-DMpgqct_.js";import{Z as _e,ct as Y}from"./index-DI3wVm5g.js";import{t as ve}from"./DataTableShell-BDPxsytR.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>r(),incorrect:()=>y(),incoherence:()=>k(),formatting:()=>D(),latency:()=>O(),api_error:()=>m(),other:()=>q()},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:f()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:E()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:h()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=p(J.feedback.respondToFeedback),[o,f]=(0,X.useState)(e.thread),[m,h]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1);async function x(){let t=m.trim();if(!(!t||y)){b(!0);try{await i({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),h(``)}finally{b(!1)}}}let w=[];try{w=r.contextJson?JSON.parse(r.contextJson):[]}catch{w=[]}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?` · ${C()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:j(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(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:se()}),(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:T()}),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`?s():e.authorRole===`agent`?e.authorLabel??_():he()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ae()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ne(),value:m,maxLength:2e3,rows:3,onChange:e=>h(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 x(),disabled:!m.trim()||y,children:y?te():d()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||v()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||v()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,w.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a({count:r.contextCount??w.length,truncated:r.contextTruncated?H():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.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:re()}),(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:l()}),(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:u()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?S({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:[fe(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,c()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=w(J.feedback.listForAdmin,{}),t=p(J.feedback.readSnapshot),n=p(J.feedback.deleteFeedback),r=_e(),[a,s]=(0,X.useState)(null),[c,l]=(0,X.useState)({});async function u(e){if(a===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 d(e){await r({title:i(),description:b(),confirmLabel:A(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,Z.jsx)(`strong`,{children:pe()}),` `,N()]}),(0,Z.jsx)(ve,{title:me(),rows:e,emptyHint:de(),isExpanded:e=>a===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:R(),cell:e=>Y(e.at),sort:e=>e.at},{header:z(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:W(),cell:e=>e.messageRole===`user`?K():L(),sort:e=>e.messageRole},{header:F(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ue({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:U(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:P(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ce(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:G()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:M()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:o()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:B()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?oe():le(),onSelect:()=>void u(e)},{label:I(),onSelect:()=>void d(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,XL as n}from"./api-CZm__5my.js";import{B as r,L as i,R as a,z as o}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,XL as n}from"./api-CZm__5my.js";import{B as r,L as i,R as a,z as o}from"./index-DI3wVm5g.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as ee,$k as r,AI as i,BI as a,CI as te,DI as ne,EI as re,FI as ie,Fa as ae,GI as oe,HI as o,HL as s,II as c,IL as l,Ia as u,JI as se,KI as ce,LI as le,MI as ue,NI as de,OI as d,PI as fe,PL as pe,QI as f,RI as p,SI as me,TI as he,UI as m,UL as ge,VI as h,WI as g,XI as _e,YI as ve,ZI as _,bI as ye,eL as be,jI as xe,kI as v,qI as y,t as b,tL as x,wI as S,xI as C,zI as w}from"./api-CZm__5my.js";import{t as T}from"./button-DMpgqct_.js";import{$ as E,Dn as D,Dt as O,En as k,Lt as A,Mt as j,Nt as M,P as Se,Pt as N,_t as P,at as Ce,bt as F,cn as we,et as Te,in as Ee,it as De,nt as Oe,ot as ke,rt as Ae,tt as je,ut as I,vt as L,xt as R,yt as z}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as ee,$k as r,AI as i,BI as a,CI as te,DI as ne,EI as re,FI as ie,Fa as ae,GI as oe,HI as o,HL as s,II as c,IL as l,Ia as u,JI as se,KI as ce,LI as le,MI as ue,NI as de,OI as d,PI as fe,PL as pe,QI as f,RI as p,SI as me,TI as he,UI as m,UL as ge,VI as h,WI as g,XI as _e,YI as ve,ZI as _,bI as ye,eL as be,jI as xe,kI as v,qI as y,t as b,tL as x,wI as S,xI as C,zI as w}from"./api-CZm__5my.js";import{t as T}from"./button-DMpgqct_.js";import{$ as E,Dn as D,Dt as O,En as k,Lt as A,Mt as j,Nt as M,P as Se,Pt as N,_t as P,at as Ce,bt as F,cn as we,et as Te,in as Ee,it as De,nt as Oe,ot as ke,rt as Ae,tt as je,ut as I,vt as L,xt as R,yt as z}from"./index-DI3wVm5g.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CwZjj3ZU.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return g();case`audio`:return m();case`video`:return o();case`pdf`:return h();case`document`:return a();case`archive`:return w();default:return p()}}function q(){let[e,t]=(0,U.useState)(G),[n,a]=(0,U.useState)(G),[o,p]=(0,U.useState)(G),[m,h]=(0,U.useState)(G),[g,w]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=s(b.files.softDelete),Y=O();function Ie(){t(G),a(G),p(G),h(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(ne())}catch(e){Y.error(re(),e)}}let X=ge(b.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:o===G?void 0:o,category:m===G?void 0:m,includeAutoGenerated:g||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(l(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:pe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||o!==G||m!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(P,{value:e,onValueChange:t,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":be(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:ee()}),(0,W.jsx)(z,{value:`inbound`,children:f()}),(0,W.jsx)(z,{value:`outbound`,children:_()})]})]}),(0,W.jsxs)(P,{value:n,onValueChange:a,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":_e(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:ve()}),Q.chats.map(e=>(0,W.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(P,{value:o,onValueChange:p,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":se(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:y()}),Q.instances.map(e=>(0,W.jsx)(z,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(P,{value:m,onValueChange:h,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":ce(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(z,{value:G,children:oe()}),Q.categories.map(e=>(0,W.jsx)(z,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Se,{checked:g,onCheckedChange:e=>w(e===!0),"aria-label":u()}),(0,W.jsx)(`span`,{children:u()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(we,{size:14,"aria-hidden":!0}),i()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?C():me()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:c()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:fe()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{className:`text-right`,children:ue()})]})}),(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)(I,{variant:`outline`,style:{marginLeft:6},children:ae()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?f():_()})}),(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)(j,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":v(),children:(0,W.jsx)(k,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(N,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(D,{size:14}),xe()]})}):(0,W.jsxs)(N,{disabled:!0,children:[(0,W.jsx)(D,{size:14}),te()]}),(0,W.jsxs)(N,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),d()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ye({cap:Be})}):null]}),(0,W.jsx)(E,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Oe,{children:[(0,W.jsxs)(Ce,{children:[(0,W.jsx)(ke,{children:he()}),(0,W.jsx)(Ae,{children:S()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(je,{children:r()}),(0,W.jsx)(Te,{onClick:()=>void Le(),children:d()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{bm as r,ym as i}from"./api-CZm__5my.js";import{t as a}from"./button-DMpgqct_.js";import{cn as o,jt as s,sn as c}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{bm as r,ym as i}from"./api-CZm__5my.js";import{t as a}from"./button-DMpgqct_.js";import{cn as o,jt as s,sn as c}from"./index-DI3wVm5g.js";import{t as l}from"./TimeRangePicker-Cgf77qy5.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{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)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Af as a,Bd as o,Cd as s,Cf as c,D as l,Dd as u,Df as d,Ed as f,Ef as p,Fd as m,Gd as h,HL as g,Hd as _,Id as v,Jd as y,Kd as b,Ld as x,Md as S,Mf as C,Nd as w,Od as ee,Of as T,Pd as E,Qd as D,Rd as O,Sf as te,Td as ne,Tf as k,UL as A,Ud as j,Vd as re,Wd as M,Xd as ie,Yd as N,Zd as P,_f as F,af as ae,bf as I,cf as oe,df as se,ef as ce,ff as le,gf as ue,hf as de,if as fe,jd as L,jf as pe,kd as me,kf as he,lf as ge,mf as _e,nf as ve,of as ye,pf as be,qd as xe,rf as R,sf as Se,t as z,tf as Ce,uf as we,vf as Te,wd as Ee,wf as De,xf as Oe,yf as ke,zd as Ae}from"./api-CZm__5my.js";import{t as je}from"./x-B8ncs2fH.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-DNVRkGA5.js";import{t as H}from"./button-DMpgqct_.js";import{Dt as U,Mn as Pe,P as W,Z as Fe,_ as Ie,_t as Le,an as G,bt as Re,dt as ze,ft as Be,gt as Ve,ht as He,jn as Ue,jt as K,on as q,pt as We,ut as J,vt as Ge,wt as Ke,xt as qe,yt as Je}from"./index-C6y-Zg32.js";import{t as Ye}from"./FilterBar-DlTMnvB-.js";import{t as Xe}from"./DataTableShell-BmkE6ZKo.js";import{t as Y}from"./DetailChips-Di7RSv7f.js";var Ze=l(`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`}]]),X=l(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=l(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return r();case`user`:return D();case`pending`:return P();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=A(z.groups.listGroups,{}),t=A(z.me.getMe,{host:Ke})?.role===`admin`,n=g(z.groups.createGroup),r=g(z.groups.updateGroup),i=g(z.groups.deleteGroup),o=Fe(),s=U(),[l,u]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[y,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 ee(){h(null),v($),u(!0)}function E(e){h(e),v({name:e.name,description:e.description??``}),u(!0)}async function D(){try{m?await r({groupId:m._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),h(null),u(!1)}catch(e){s.error(f(),e)}}async function O(e){if(await o({title:be({name:e.name}),description:le(),confirmWord:e.name,confirmLabel:se(),cancelLabel:ke(),destructive:!0}))try{await i({groupId:e._id})}catch(e){s.error(ne(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,Q.jsx)(Ye,{q:x,onQChange:S,onReset:()=>S(``),canReset:x!==``,searchPlaceholder:De()}),(0,Q.jsx)(Xe,{title:C(),rows:w,addLabel:a(),onAdd:t?ee:void 0,emptyHint:he(),columns:[{header:T(),cell:e=>e.name,sort:e=>e.name},{header:d(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:p(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:k(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:c(),onSelect:()=>b({groupId:e._id,name:e.name})},...t?[{label:te(),onSelect:()=>E(e)},{label:Oe(),variant:`destructive`,onSelect:()=>void O(e)}]:[]]}),(0,Q.jsx)(Ie,{open:l,onOpenChange:u,title:m?F():Te(),description:ue(),canSubmit:!!_.name.trim(),onSubmit:D,submitLabel:I(),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:de()}),(0,Q.jsx)(K,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:_e()}),(0,Q.jsx)(K,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:y?.groupId??null,groupName:y?.name??``,open:y!==null,onOpenChange:e=>{e||b(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Pe,{size:14,"aria-hidden":!0}),ve()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ce({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Ce(),(0,Q.jsx)(Ue,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=A(z.groups.getGroup,n&&e?{groupId:e}:`skip`),o=A(z.groups.listAssignableInstances,n?{}:`skip`),s=A(z.groups.listAssignableUsers,n?{}:`skip`),c=g(z.groups.addMember),l=g(z.groups.removeMember),u=g(z.groups.bulkSetMembers),d=g(z.groups.setGroupManager),f=U(),[p,m]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[C,w]=(0,Z.useState)(1),[T,E]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{m(``),v(``),S(`members`),w(1),D.current=null},[n,e]),(0,Z.useEffect)(()=>{w(1)},[p]),(0,Z.useEffect)(()=>{n&&a&&e&&D.current!==e&&(D.current=e,E(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let j=(0,Z.useMemo)(()=>s?$e(s,p,T):[],[s,p,T]);async function re(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){f.error(Ee(),e)}}async function M(t,n){if(e)try{await d({groupId:e,userId:t,manager:!n})}catch(e){f.error(ee(),e)}}let N=rt(j,e=>O.has(e.userId)),P=j.filter(e=>O.has(e.userId)).length,F=it(j,C,ot);async function I(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await u({groupId:e,userIds:t,member:N!==`all`})}catch(e){f.error(Ee(),e)}}return(0,Q.jsx)(ze,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Be,{className:`oc-access`,children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ve,{children:we({name:t})}),(0,Q.jsx)(We,{children:ge()})]}),(0,Q.jsxs)(Ne,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),oe(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),ye(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),Ae(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:p,onChange:e=>m(e.target.value),placeholder:Se(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(W,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void I(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[P,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=O.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(W,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":ie({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]}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?me():i(),title:r?me():i(),onClick:()=>void M(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":L(),title:L(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:F.page,pageCount:F.pageCount,onPage:w})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:_,onChange:e=>v(e.target.value),placeholder:ae(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:_},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=A(z.groups.listAssignableAgents,{instanceName:t}),c=g(z.groups.assignAgentToGroup),l=g(z.groups.removeAgentFromGroup),u=g(z.groups.bulkSetGroupAgents),d=U(),[f,p]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{p(1)},[i]),!e)return null;let m=et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let v=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),y=rt(v,e=>r.has(`${t}/${e.agentId}`)),b=it(m,f,ot);async function x(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(s(),e)}}async function S(){if(v.length===0)return;let n=v.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:y!==`all`})}catch(e){d.error(s(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:_()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):m.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?j():M()}):(0,Q.jsxs)(Q.Fragment,{children:[v.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(W,{checked:y===`all`?!0:y===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,b.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,s=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(W,{checked:i,disabled:(a||s)&&!i,onCheckedChange:()=>void x(e.agentId,i),"aria-label":N({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,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":o(),title:o(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:re()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=A(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=g(z.charts.assignChartToGroup),r=g(z.charts.removeChartFromGroup),i=g(z.charts.setGroupDefaultChart),a=g(z.charts.addChartToGroupPool),o=g(z.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:O()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(u(),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)(W,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":E({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":w(),title:w(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:S()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":m({name:e.name}),title:m({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,Q.jsxs)(Le,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(qe,{placeholder:v()})}),(0,Q.jsx)(Ge,{children:l.map(e=>(0,Q.jsx)(Je,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x()}):null:null]})}export{at as GroupsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Af as a,Bd as o,Cd as s,Cf as c,D as l,Dd as u,Df as d,Ed as f,Ef as p,Fd as m,Gd as h,HL as g,Hd as _,Id as v,Jd as y,Kd as b,Ld as x,Md as S,Mf as C,Nd as w,Od as ee,Of as T,Pd as E,Qd as D,Rd as O,Sf as te,Td as ne,Tf as k,UL as A,Ud as j,Vd as re,Wd as M,Xd as ie,Yd as N,Zd as P,_f as F,af as ae,bf as I,cf as oe,df as se,ef as ce,ff as le,gf as ue,hf as de,if as fe,jd as L,jf as pe,kd as me,kf as he,lf as ge,mf as _e,nf as ve,of as ye,pf as be,qd as xe,rf as R,sf as Se,t as z,tf as Ce,uf as we,vf as Te,wd as Ee,wf as De,xf as Oe,yf as ke,zd as Ae}from"./api-CZm__5my.js";import{t as je}from"./x-B8ncs2fH.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-CNjvgr2F.js";import{t as H}from"./button-DMpgqct_.js";import{Dt as U,Mn as Pe,P as W,Z as Fe,_ as Ie,_t as Le,an as G,bt as Re,dt as ze,ft as Be,gt as Ve,ht as He,jn as Ue,jt as K,on as q,pt as We,ut as J,vt as Ge,wt as Ke,xt as qe,yt as Je}from"./index-DI3wVm5g.js";import{t as Ye}from"./FilterBar-BBUyj-UI.js";import{t as Xe}from"./DataTableShell-BDPxsytR.js";import{t as Y}from"./DetailChips-Dz1CvCUA.js";var Ze=l(`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`}]]),X=l(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=l(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return r();case`user`:return D();case`pending`:return P();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=A(z.groups.listGroups,{}),t=A(z.me.getMe,{host:Ke})?.role===`admin`,n=g(z.groups.createGroup),r=g(z.groups.updateGroup),i=g(z.groups.deleteGroup),o=Fe(),s=U(),[l,u]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[y,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 ee(){h(null),v($),u(!0)}function E(e){h(e),v({name:e.name,description:e.description??``}),u(!0)}async function D(){try{m?await r({groupId:m._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),h(null),u(!1)}catch(e){s.error(f(),e)}}async function O(e){if(await o({title:be({name:e.name}),description:le(),confirmWord:e.name,confirmLabel:se(),cancelLabel:ke(),destructive:!0}))try{await i({groupId:e._id})}catch(e){s.error(ne(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,Q.jsx)(Ye,{q:x,onQChange:S,onReset:()=>S(``),canReset:x!==``,searchPlaceholder:De()}),(0,Q.jsx)(Xe,{title:C(),rows:w,addLabel:a(),onAdd:t?ee:void 0,emptyHint:he(),columns:[{header:T(),cell:e=>e.name,sort:e=>e.name},{header:d(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:p(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:k(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:c(),onSelect:()=>b({groupId:e._id,name:e.name})},...t?[{label:te(),onSelect:()=>E(e)},{label:Oe(),variant:`destructive`,onSelect:()=>void O(e)}]:[]]}),(0,Q.jsx)(Ie,{open:l,onOpenChange:u,title:m?F():Te(),description:ue(),canSubmit:!!_.name.trim(),onSubmit:D,submitLabel:I(),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:de()}),(0,Q.jsx)(K,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:_e()}),(0,Q.jsx)(K,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:y?.groupId??null,groupName:y?.name??``,open:y!==null,onOpenChange:e=>{e||b(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Pe,{size:14,"aria-hidden":!0}),ve()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ce({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Ce(),(0,Q.jsx)(Ue,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=A(z.groups.getGroup,n&&e?{groupId:e}:`skip`),o=A(z.groups.listAssignableInstances,n?{}:`skip`),s=A(z.groups.listAssignableUsers,n?{}:`skip`),c=g(z.groups.addMember),l=g(z.groups.removeMember),u=g(z.groups.bulkSetMembers),d=g(z.groups.setGroupManager),f=U(),[p,m]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`members`),[C,w]=(0,Z.useState)(1),[T,E]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ne=a?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{m(``),v(``),S(`members`),w(1),D.current=null},[n,e]),(0,Z.useEffect)(()=>{w(1)},[p]),(0,Z.useEffect)(()=>{n&&a&&e&&D.current!==e&&(D.current=e,E(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let j=(0,Z.useMemo)(()=>s?$e(s,p,T):[],[s,p,T]);async function re(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){f.error(Ee(),e)}}async function M(t,n){if(e)try{await d({groupId:e,userId:t,manager:!n})}catch(e){f.error(ee(),e)}}let N=rt(j,e=>O.has(e.userId)),P=j.filter(e=>O.has(e.userId)).length,F=it(j,C,ot);async function I(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await u({groupId:e,userIds:t,member:N!==`all`})}catch(e){f.error(Ee(),e)}}return(0,Q.jsx)(ze,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Be,{className:`oc-access`,children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ve,{children:we({name:t})}),(0,Q.jsx)(We,{children:ge()})]}),(0,Q.jsxs)(Ne,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),oe(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),ye(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),Ae(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:p,onChange:e=>m(e.target.value),placeholder:Se(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(W,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void I(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[P,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=O.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(W,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":ie({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]}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ne?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?me():i(),title:r?me():i(),onClick:()=>void M(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":L(),title:L(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:F.page,pageCount:F.pageCount,onPage:w})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:_,onChange:e=>v(e.target.value),placeholder:ae(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:_},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=A(z.groups.listAssignableAgents,{instanceName:t}),c=g(z.groups.assignAgentToGroup),l=g(z.groups.removeAgentFromGroup),u=g(z.groups.bulkSetGroupAgents),d=U(),[f,p]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{p(1)},[i]),!e)return null;let m=et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let v=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),y=rt(v,e=>r.has(`${t}/${e.agentId}`)),b=it(m,f,ot);async function x(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(s(),e)}}async function S(){if(v.length===0)return;let n=v.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:y!==`all`})}catch(e){d.error(s(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:_()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):m.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?j():M()}):(0,Q.jsxs)(Q.Fragment,{children:[v.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(W,{checked:y===`all`?!0:y===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,b.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,s=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(W,{checked:i,disabled:(a||s)&&!i,onCheckedChange:()=>void x(e.agentId,i),"aria-label":N({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,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":o(),title:o(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:re()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:b.page,pageCount:b.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=A(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=g(z.charts.assignChartToGroup),r=g(z.charts.removeChartFromGroup),i=g(z.charts.setGroupDefaultChart),a=g(z.charts.addChartToGroupPool),o=g(z.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:O()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(u(),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)(W,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":E({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":w(),title:w(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:S()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":m({name:e.name}),title:m({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,Q.jsxs)(Le,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(qe,{placeholder:v()})}),(0,Q.jsx)(Ge,{children:l.map(e=>(0,Q.jsx)(Je,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$w as i,Aw as a,BC as o,BL as s,Bw as c,CT as l,Cw as u,Dw as d,Ew as f,Ey as p,FC as m,Fo as h,Fw as g,GA as _,GC as v,Gw as y,HC as b,HL as x,Hw as ee,IC as S,Io as C,Iw as te,JC as ne,Jw as w,KA as T,KC as E,Kw as re,LC as D,Lo as O,Lw as ie,Mw as ae,Nw as k,Ow as oe,PC as se,Pw as ce,QC as le,Qw as ue,RC as de,Ro as fe,Rw as pe,ST as me,Sw as he,Tw as ge,Ty as _e,UC as ve,UL as A,Uw as ye,VC as be,Vw as xe,WC as Se,Ww as Ce,XC as we,Xw as Te,YC as Ee,Yw as De,ZC as Oe,Zw as ke,_T as Ae,_w as je,aT as Me,aw as Ne,bT as Pe,bw as Fe,cT as Ie,cw as Le,dT as Re,dw as ze,eT as Be,ew as Ve,fT as He,fr as Ue,fw as We,gT as Ge,gw as Ke,hT as qe,hw as Je,iT as Ye,iw as j,jw as Xe,kw as Ze,lT as Qe,lw as $e,mT as et,mr as tt,mw as nt,nT as rt,nw as it,oT as at,ow as ot,pT as st,pr as ct,pw as lt,qC as ut,qw as dt,rT as ft,sT as pt,sw as M,t as N,tT as mt,tw as ht,uT as gt,uw as _t,vT as vt,vw as yt,ww as bt,xT as xt,xw as St,yT as Ct,yw as wt,zC as Tt,zw as P}from"./api-CZm__5my.js";import{a as Et,c as Dt}from"./FieldLabel-DnOYy3n5.js";import{t as F}from"./button-DMpgqct_.js";import{Bt as Ot,Dt as I,P as L,Rt as kt,Z as At,_ as jt,_t as R,bt as z,dt as B,ft as V,gt as H,ht as U,jt as W,pt as Mt,ut as G,vt as K,xt as q,yt as J,zt as Nt}from"./index-C6y-Zg32.js";import{t as Pt}from"./DataTableShell-BmkE6ZKo.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-LvVXzAlN.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Et},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(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??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=A(N.admin.listInstances,{}),t=A(N.agents.listAllInstanceAgents,{}),n=x(N.admin.upsertInstance),r=x(N.admin.deleteInstance),a=I(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(Q),[d,f]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null);async function ee(){try{await n({instanceId:y??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,transport:c.kind===`hermes`?c.transport:void 0,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),u(Q),b(null),s(!1)}catch(e){a.error(xt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Pe(),(0,Z.jsx)(`strong`,{children:Ct()}),vt()]}),(0,Z.jsx)(Pt,{title:Ae(),rows:e,addLabel:Ge(),onAdd:()=>{b(null),u(Q),s(!0)},emptyHint:qe(),columns:[{header:et(),cell:e=>e.name,sort:e=>e.name},{header:st(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:He(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Re(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:l(),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)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?m():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:pt(),onSelect:()=>{b(e._id),u(Bt(e)),s(!0)}},{label:me(),onSelect:()=>f(e.name)},{label:re(),onSelect:()=>v(e)},{label:gt(),onSelect:()=>g(e)},{label:Qe(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:Qe(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:s,title:y?at():Ie(),description:Ye(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:ee,submitLabel:ft(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:rt(),children:[(0,Z.jsx)(W,{value:c.name,disabled:y!==null,onChange:e=>u({...c,name:e.target.value})}),y?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Me()}):null]}),(0,Z.jsx)($,{label:mt(),children:(0,Z.jsxs)(R,{value:c.kind,onValueChange:e=>u({...c,kind:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),c.kind===`hermes`?(0,Z.jsx)($,{label:tt(),children:(0,Z.jsxs)(R,{value:c.transport,onValueChange:e=>u({...c,transport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`ws`,children:ct()}),(0,Z.jsx)(J,{value:`rest`,children:Ue()})]})]})}):null,(0,Z.jsx)($,{label:Be(),children:(0,Z.jsx)(W,{value:c.gatewayUrl,onChange:e=>u({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsx)(W,{value:c.bridgeUrl,placeholder:ue(),onChange:e=>u({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ke(),children:(0,Z.jsx)(W,{value:c.displayName,onChange:e=>u({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:p(),children:[(0,Z.jsxs)(R,{value:c.streamTransport,onValueChange:e=>u({...c,streamTransport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(K,{children:Dt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_e()})]}),(0,Z.jsx)($,{label:Te(),children:(0,Z.jsx)(W,{value:c.gatewayVersion,placeholder:De(),onChange:e=>u({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:w(),children:(0,Z.jsx)(W,{value:c.gatewayHttpUrl,placeholder:dt(),onChange:e=>u({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:d,open:d!==null,onOpenChange:e=>{e||f(null)}}),h?(0,Z.jsx)(Ft,{instance:h,onClose:()=>g(null)},h._id):null,_?(0,Z.jsx)(Ht,{instance:_,onClose:()=>v(null)},_._id):null]})}function Ht({instance:e,onClose:t}){let n=A(N.instanceSecrets.listInstanceSecretStatus,{}),r=zt[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)(B,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(V,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(H,{children:y({instance:e.displayName??e.name})}),(0,Z.jsx)(Mt,{children:Ce()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=s(N.instanceSync.forceInstanceSync),n=I(),[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(bt());break;case`no_agents`:n.success(he());break;case`no_bridge_url`:n.error(St());break;case`deploy_misconfigured`:n.error(Fe());break;case`unauthorized`:n.error(yt());break;case`not_served`:n.error(je());break;default:n.error(wt());break}}catch(e){n.error(u(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?ge():f()})})]})}function Wt({instance:e}){let t=A(N.bridgeAuth.listBridgeAuthStatus,{}),n=s(N.bridgeAuth.mintBridgeSecret),r=x(N.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){o(!0);try{u((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error($e(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),u(null),i.success(_t())}catch(e){i.error($e(),e)}finally{o(!1)}}}async function v(){if(l)try{await navigator.clipboard.writeText(l),f(!0)}catch{}}return(0,Z.jsxs)($,{label:Je(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:m?`outline`:`secondary`,children:m?`${c()} · ${p.prefix}…${p.lastFour}`:P()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?We():lt()}),m?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:ze()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Le()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:d?T():_()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),f(!1)},children:M()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=s(N.instanceSecrets.setInstanceSecret),i=x(N.instanceSecrets.clearInstanceSecret),o=s(N.deviceIdentity.generateDeviceIdentity),l=I(),[u,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(!1),[h,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),S=n!==null,C=t===`deviceIdentity`,ne=t===`token`?ye():t===`deviceIdentity`?ee():xe();async function w(){if(!(!u.trim()||p)){m(!0);try{await r({instanceId:e,field:t,plaintext:u}),f(``),v(null),b(!1),l.success(ce())}catch(e){l.error(k(),e)}finally{m(!1)}}}async function E(){if(!p){m(!0);try{await i({instanceId:e,field:t}),v(null),b(!1),l.success(ae())}catch(e){l.error(k(),e)}finally{m(!1)}}}async function re(){if(!p){m(!0);try{v(await o({instanceId:e})),b(!1),l.success(Ze())}catch(e){l.error(d(),e)}finally{m(!1)}}}let D=h?`openclaw devices approve ${h.id}`:``;async function O(){if(D)try{await navigator.clipboard.writeText(D),b(!0)}catch{}}return(0,Z.jsxs)($,{label:ne,children:[C?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:S?`outline`:`secondary`,children:S?c():P()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:u,placeholder:S?ie():pe(),onChange:e=>f(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void w(),disabled:p||u.trim().length===0,children:te()}),C?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void re(),disabled:p,children:Xe()}):null,S?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void E(),disabled:p,children:g()}):null]})]}),h?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Ze()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:y?T():_()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{v(null),b(!1)},children:M()})]}):null]})}var Kt={conversational:we,documentary:ne,summarizer:fe,curator:C},qt={conversational:Ee,documentary:ut,summarizer:O,curator:h},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({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:Ve()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:r()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:le()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Oe()}),(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)(L,{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:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=A(N.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=x(N.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=x(N.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=x(N.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=x(N.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=x(N.agents.removeInstanceAgent),u=At(),d=I();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(j(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(j(),e)}}async function h(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){d.error(j(),e)}}async function g(t,n){if(e&&await u({title:Se({name:n}),description:ve(),confirmLabel:b(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(be())}catch(e){d.error(j(),e)}}return(0,Z.jsx)(B,{open:t,onOpenChange:n,children:(0,Z.jsxs)(V,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(H,{children:ot({name:e??``})}),(0,Z.jsx)(Mt,{children:Ne()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:o()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Tt():r.discovery.lastPollOk?de():D({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:S()}):(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)(L,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(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,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:se()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:v()})]}):i?(0,Z.jsx)(G,{variant:`default`,children:m()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:E()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(j(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({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)(W,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:it(),"aria-label":ht(),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{Vt as InstancesTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$w as i,Aw as a,BC as o,BL as s,Bw as c,CT as l,Cw as u,Dw as d,Ew as f,Ey as p,FC as m,Fo as h,Fw as g,GA as _,GC as v,Gw as y,HC as b,HL as x,Hw as ee,IC as S,Io as C,Iw as te,JC as ne,Jw as w,KA as T,KC as E,Kw as re,LC as D,Lo as O,Lw as ie,Mw as ae,Nw as k,Ow as oe,PC as se,Pw as ce,QC as le,Qw as ue,RC as de,Ro as fe,Rw as pe,ST as me,Sw as he,Tw as ge,Ty as _e,UC as ve,UL as A,Uw as ye,VC as be,Vw as xe,WC as Se,Ww as Ce,XC as we,Xw as Te,YC as Ee,Yw as De,ZC as Oe,Zw as ke,_T as Ae,_w as je,aT as Me,aw as Ne,bT as Pe,bw as Fe,cT as Ie,cw as Le,dT as Re,dw as ze,eT as Be,ew as Ve,fT as He,fr as Ue,fw as We,gT as Ge,gw as Ke,hT as qe,hw as Je,iT as Ye,iw as j,jw as Xe,kw as Ze,lT as Qe,lw as $e,mT as et,mr as tt,mw as nt,nT as rt,nw as it,oT as at,ow as ot,pT as st,pr as ct,pw as lt,qC as ut,qw as dt,rT as ft,sT as pt,sw as M,t as N,tT as mt,tw as ht,uT as gt,uw as _t,vT as vt,vw as yt,ww as bt,xT as xt,xw as St,yT as Ct,yw as wt,zC as Tt,zw as P}from"./api-CZm__5my.js";import{a as Et,c as Dt}from"./FieldLabel-TkK78Rxe.js";import{t as F}from"./button-DMpgqct_.js";import{Bt as Ot,Dt as I,P as L,Rt as kt,Z as At,_ as jt,_t as R,bt as z,dt as B,ft as V,gt as H,ht as U,jt as W,pt as Mt,ut as G,vt as K,xt as q,yt as J,zt as Nt}from"./index-DI3wVm5g.js";import{t as Pt}from"./DataTableShell-BDPxsytR.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-BDw6d-rB.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Et},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(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??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=A(N.admin.listInstances,{}),t=A(N.agents.listAllInstanceAgents,{}),n=x(N.admin.upsertInstance),r=x(N.admin.deleteInstance),a=I(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(Q),[d,f]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null);async function ee(){try{await n({instanceId:y??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,transport:c.kind===`hermes`?c.transport:void 0,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),u(Q),b(null),s(!1)}catch(e){a.error(xt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Pe(),(0,Z.jsx)(`strong`,{children:Ct()}),vt()]}),(0,Z.jsx)(Pt,{title:Ae(),rows:e,addLabel:Ge(),onAdd:()=>{b(null),u(Q),s(!0)},emptyHint:qe(),columns:[{header:et(),cell:e=>e.name,sort:e=>e.name},{header:st(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:He(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Re(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:l(),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)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?m():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:pt(),onSelect:()=>{b(e._id),u(Bt(e)),s(!0)}},{label:me(),onSelect:()=>f(e.name)},{label:re(),onSelect:()=>v(e)},{label:gt(),onSelect:()=>g(e)},{label:Qe(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:Qe(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:s,title:y?at():Ie(),description:Ye(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:ee,submitLabel:ft(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:rt(),children:[(0,Z.jsx)(W,{value:c.name,disabled:y!==null,onChange:e=>u({...c,name:e.target.value})}),y?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Me()}):null]}),(0,Z.jsx)($,{label:mt(),children:(0,Z.jsxs)(R,{value:c.kind,onValueChange:e=>u({...c,kind:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),c.kind===`hermes`?(0,Z.jsx)($,{label:tt(),children:(0,Z.jsxs)(R,{value:c.transport,onValueChange:e=>u({...c,transport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`ws`,children:ct()}),(0,Z.jsx)(J,{value:`rest`,children:Ue()})]})]})}):null,(0,Z.jsx)($,{label:Be(),children:(0,Z.jsx)(W,{value:c.gatewayUrl,onChange:e=>u({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsx)(W,{value:c.bridgeUrl,placeholder:ue(),onChange:e=>u({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ke(),children:(0,Z.jsx)(W,{value:c.displayName,onChange:e=>u({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:p(),children:[(0,Z.jsxs)(R,{value:c.streamTransport,onValueChange:e=>u({...c,streamTransport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(K,{children:Dt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_e()})]}),(0,Z.jsx)($,{label:Te(),children:(0,Z.jsx)(W,{value:c.gatewayVersion,placeholder:De(),onChange:e=>u({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:w(),children:(0,Z.jsx)(W,{value:c.gatewayHttpUrl,placeholder:dt(),onChange:e=>u({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:d,open:d!==null,onOpenChange:e=>{e||f(null)}}),h?(0,Z.jsx)(Ft,{instance:h,onClose:()=>g(null)},h._id):null,_?(0,Z.jsx)(Ht,{instance:_,onClose:()=>v(null)},_._id):null]})}function Ht({instance:e,onClose:t}){let n=A(N.instanceSecrets.listInstanceSecretStatus,{}),r=zt[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)(B,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(V,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(H,{children:y({instance:e.displayName??e.name})}),(0,Z.jsx)(Mt,{children:Ce()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=s(N.instanceSync.forceInstanceSync),n=I(),[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(bt());break;case`no_agents`:n.success(he());break;case`no_bridge_url`:n.error(St());break;case`deploy_misconfigured`:n.error(Fe());break;case`unauthorized`:n.error(yt());break;case`not_served`:n.error(je());break;default:n.error(wt());break}}catch(e){n.error(u(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?ge():f()})})]})}function Wt({instance:e}){let t=A(N.bridgeAuth.listBridgeAuthStatus,{}),n=s(N.bridgeAuth.mintBridgeSecret),r=x(N.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){o(!0);try{u((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error($e(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),u(null),i.success(_t())}catch(e){i.error($e(),e)}finally{o(!1)}}}async function v(){if(l)try{await navigator.clipboard.writeText(l),f(!0)}catch{}}return(0,Z.jsxs)($,{label:Je(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:m?`outline`:`secondary`,children:m?`${c()} · ${p.prefix}…${p.lastFour}`:P()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?We():lt()}),m?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:ze()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Le()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:d?T():_()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),f(!1)},children:M()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=s(N.instanceSecrets.setInstanceSecret),i=x(N.instanceSecrets.clearInstanceSecret),o=s(N.deviceIdentity.generateDeviceIdentity),l=I(),[u,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(!1),[h,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),S=n!==null,C=t===`deviceIdentity`,ne=t===`token`?ye():t===`deviceIdentity`?ee():xe();async function w(){if(!(!u.trim()||p)){m(!0);try{await r({instanceId:e,field:t,plaintext:u}),f(``),v(null),b(!1),l.success(ce())}catch(e){l.error(k(),e)}finally{m(!1)}}}async function E(){if(!p){m(!0);try{await i({instanceId:e,field:t}),v(null),b(!1),l.success(ae())}catch(e){l.error(k(),e)}finally{m(!1)}}}async function re(){if(!p){m(!0);try{v(await o({instanceId:e})),b(!1),l.success(Ze())}catch(e){l.error(d(),e)}finally{m(!1)}}}let D=h?`openclaw devices approve ${h.id}`:``;async function O(){if(D)try{await navigator.clipboard.writeText(D),b(!0)}catch{}}return(0,Z.jsxs)($,{label:ne,children:[C?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:S?`outline`:`secondary`,children:S?c():P()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:u,placeholder:S?ie():pe(),onChange:e=>f(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void w(),disabled:p||u.trim().length===0,children:te()}),C?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void re(),disabled:p,children:Xe()}):null,S?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void E(),disabled:p,children:g()}):null]})]}),h?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Ze()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:y?T():_()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{v(null),b(!1)},children:M()})]}):null]})}var Kt={conversational:we,documentary:ne,summarizer:fe,curator:C},qt={conversational:Ee,documentary:ut,summarizer:O,curator:h},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({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:Ve()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:r()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:le()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Oe()}),(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)(L,{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:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=A(N.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=x(N.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=x(N.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=x(N.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=x(N.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=x(N.agents.removeInstanceAgent),u=At(),d=I();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(j(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(j(),e)}}async function h(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){d.error(j(),e)}}async function g(t,n){if(e&&await u({title:Se({name:n}),description:ve(),confirmLabel:b(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(be())}catch(e){d.error(j(),e)}}return(0,Z.jsx)(B,{open:t,onOpenChange:n,children:(0,Z.jsxs)(V,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(H,{children:ot({name:e??``})}),(0,Z.jsx)(Mt,{children:Ne()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:o()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Tt():r.discovery.lastPollOk?de():D({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:S()}):(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)(L,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(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,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:se()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:v()})]}):i?(0,Z.jsx)(G,{variant:`default`,children:m()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:E()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(j(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({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)(W,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:it(),"aria-label":ht(),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{Vt as InstancesTab};
|