@lacneu/atrium 0.101.4 → 0.102.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AnomaliesTab-BQ2Bu98W.js → AnomaliesTab-CpiY8ZTC.js} +1 -1
- package/dist/assets/{AuditTab-BV-XydO_.js → AuditTab-D5YrLbTy.js} +1 -1
- package/dist/assets/{BridgeTab-rIDUCrXq.js → BridgeTab-D4RFq-Rb.js} +1 -1
- package/dist/assets/{FieldLabel-DkgrHevY.js → FieldLabel-Tea3wyVe.js} +1 -1
- package/dist/assets/{InstancesTab-BlSeuPrH.js → InstancesTab-BevtM68H.js} +1 -1
- package/dist/assets/{KpiTab-KPPcgUxA.js → KpiTab-DCfAwBfJ.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-CvFC141N.js → PromptInjectionsTab-Vdb1lF36.js} +1 -1
- package/dist/assets/{TracesTab-DiAkOmei.js → TracesTab-DMdT_psj.js} +1 -1
- package/dist/assets/chunk-7TTQLYRW-ByhoRIPY.js +156 -0
- package/dist/assets/highlighted-body-JLMTFACH-3FraDdGA.js +1 -0
- package/dist/assets/{index-QmAXy0ZO.js → index-CQk5TM8W.js} +3 -3
- package/dist/assets/index-D6RuTaB7.css +1 -0
- package/dist/assets/mermaid-WFAXDIZX-DpR3_BmG.js +1 -0
- package/dist/assets/searchSchemas-Dm-Qg010.js +55 -0
- package/dist/index.html +4 -4
- package/package.json +2 -2
- package/dist/assets/chunk-BO2N2NFS-UUurW2hP.js +0 -131
- package/dist/assets/highlighted-body-OFNGDK62-DlR3zOuW.js +0 -1
- package/dist/assets/index-C9C2o76d.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-NX_-ekHq.js +0 -1
- package/dist/assets/searchSchemas-CS2ZgsHC.js +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,BM as i,CN as a,DN as o,EN as s,FM as c,GM as ee,HM as te,IM as l,JM as u,KM as ne,LM as d,NM as f,ON as p,PM as m,QM as h,RM as g,SN as re,TN as ie,UM as ae,VM as oe,WM as se,XM as ce,XX as _,YM as le,YX as ue,ZM as de,_N as fe,aN as v,bN as pe,cN as me,dN as he,eN as y,fN as ge,gN as _e,hN as ve,iN as ye,lN as be,mN as xe,nN as Se,oN as Ce,pN as we,qM as b,rN as x,sN as S,t as C,tN as w,uN as T,vN as E,wN as D,xN as O,yN as k,zM as A}from"./api-DSJJn0d7.js";import{n as Te,t as j}from"./useNavigate-D3GIoxyW.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-qM3ZfTHx.js";import"./convexApi-CyScjgcq.js";import{r as Ee}from"./toast-xNFwDnUy.js";import{t as L}from"./badge-C4po8DQ1.js";import{n as R}from"./format-DGKgJf2p.js";import{a as z,n as B,o as V,t as H}from"./dialog-BfrsWZiD.js";import{c as De,o as Oe}from"./searchSchemas-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,BM as i,CN as a,DN as o,EN as s,FM as c,GM as ee,HM as te,IM as l,JM as u,KM as ne,LM as d,NM as f,ON as p,PM as m,QM as h,RM as g,SN as re,TN as ie,UM as ae,VM as oe,WM as se,XM as ce,XX as _,YM as le,YX as ue,ZM as de,_N as fe,aN as v,bN as pe,cN as me,dN as he,eN as y,fN as ge,gN as _e,hN as ve,iN as ye,lN as be,mN as xe,nN as Se,oN as Ce,pN as we,qM as b,rN as x,sN as S,t as C,tN as w,uN as T,vN as E,wN as D,xN as O,yN as k,zM as A}from"./api-DSJJn0d7.js";import{n as Te,t as j}from"./useNavigate-D3GIoxyW.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-qM3ZfTHx.js";import"./convexApi-CyScjgcq.js";import{r as Ee}from"./toast-xNFwDnUy.js";import{t as L}from"./badge-C4po8DQ1.js";import{n as R}from"./format-DGKgJf2p.js";import{a as z,n as B,o as V,t as H}from"./dialog-BfrsWZiD.js";import{c as De,o as Oe}from"./searchSchemas-Dm-Qg010.js";import{t as ke}from"./appHost-CH3EGcJw.js";import{n as Ae}from"./ConfirmDialog-BXcki0Ee.js";import{n as je}from"./TimeRangePicker-D3PJq1H8.js";import{t as Me}from"./FilterBar-DTVwlDpF.js";import{t as Ne}from"./DataTableShell-DRFFBx_j.js";import{t as U}from"./dispatchErrorInfo-Bb7JyJFO.js";var W=t(e(),1),G=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),K=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function q(e){let t=K.has(e.kind);if(!G.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var J=n(),Y=`__all__`,Pe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Fe(e){return e===`open`?p():e===`acknowledged`?o():s()}var Ie=[`info`,`warn`,`critical`],Le=[`detector`,`agent`,`user`],Re={kind:`relative`,from:`now-30d`,to:`now`},ze=200,X=`all`;function Z(){let e=Te({from:`/settings/anomalies`}),t=j({from:`/settings/anomalies`}),n=e.q??``,i=e.status===X?Y:e.status,o=e.severity??Y,s=e.kind??Y,[c,l]=(0,W.useState)(Y),d=Oe(e.from,e.to),{from:f,to:p}=je(d),m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),g=e=>void t({search:t=>({...t,status:e===Y?X:e})}),A=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),B=e=>void t({search:t=>({...t,...De(e)})}),V=Ae(),H=Ee(),U=ue(C.anomalies.resolveAnomaly),G=(_(C.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),K=_(C.anomalies.listAnomalies,{limit:ze,filter:{q:n||void 0,from:f,to:p,anomalyStatus:i===Y?void 0:i,severity:o===Y?void 0:o,source:c===Y?void 0:c,kind:s===Y?void 0:s}}),q=(0,W.useMemo)(()=>{let e=new Set;for(let t of K??[])e.add(t.kind);return[...e].sort()},[K]),Z=n!==``||i!==`open`||o!==Y||c!==Y||s!==Y||d.kind!==`relative`||d.from!==Re.from;function Q(){l(Y),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:ie(),description:(0,J.jsxs)(J.Fragment,{children:[D(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,a(),` `,(0,J.jsx)(`strong`,{children:re()}),`.`,` `,O()]}),confirmLabel:pe()}))try{await U({anomalyId:e._id,status:`resolved`}),H.success(k(),e.kind)}catch(e){H.error(E(),e)}}async function Ge(e){try{await U({anomalyId:e._id,status:`acknowledged`}),H.success(fe(),e.kind)}catch(e){H.error(_e(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ve(),` `,(0,J.jsx)(`strong`,{children:xe()}),` `,we(),` `,(0,J.jsx)(`strong`,{children:ge()}),` `,he(),` `,(0,J.jsx)(`strong`,{children:T()}),` `,be(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:me()})]}),(0,J.jsxs)(Me,{q:n,onQChange:m,searchPlaceholder:S(),timeRange:d,onTimeRangeChange:B,onReset:Q,canReset:Z,children:[(0,J.jsxs)(I,{value:i,onValueChange:g,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:Ce()}),Pe.map(e=>(0,J.jsx)(F,{value:e.value,children:Fe(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:o,onValueChange:A,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:v()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:w()}),Ie.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:c,onValueChange:l,children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(M,{placeholder:y()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:r()}),Le.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:s,onValueChange:z,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(M,{placeholder:h()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{value:Y,children:de()}),q.map(e=>(0,J.jsx)(F,{value:e,children:e},e))]})]})]}),(0,J.jsx)(Ne,{title:ce(),rows:K,emptyHint:i===`open`?le():u(),rowActions:e=>G&&e.status===`open`?[{label:b(),onSelect:()=>void We(e)},{label:ne(),onSelect:()=>void Ge(e)}]:[],columns:[{header:ee(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)}),sort:e=>e.at},{header:h(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ye(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,J.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:Se({when:R(e.firstAt)}),children:x({count:String(e.occurrenceCount)})}):(0,J.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:v(),cell:e=>(0,J.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:se(),cell:e=>(0,J.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:y(),cell:e=>(0,J.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ae(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:te(),cell:e=>(0,J.jsx)($,{row:e}),sort:e=>e.evidence??null},{header:oe(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function $({row:e}){let t=j();if(e.kind===`subagent.failure`){let n=Q(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,i()]}):null]})}let n=q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,J.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,i()]})}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=U(n.dominantCode,n.context),a=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),a?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:a,limit:100}}),children:[`↗ `,i()]}):null]})}function Be({row:e}){let[t,n]=(0,W.useState)(!1),r=_(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[A(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(H,{open:t,onOpenChange:n,children:(0,J.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(z,{children:(0,J.jsx)(V,{children:g()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:l()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,J.jsx)(L,{variant:`destructive`,children:c()}):e===`acknowledged`?(0,J.jsx)(L,{variant:`secondary`,children:m()}):(0,J.jsx)(L,{variant:`outline`,children:f()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,AP as i,CP as a,DP as o,EP as s,Ju as c,MP as l,NP as u,OP as d,PP as f,Qu as p,SP as m,TP as h,XX as g,Xu as _,Yu as v,Zu as y,bP as b,jP as x,kP as S,t as C,wP as w,xP as T}from"./api-DSJJn0d7.js";import{n as E,t as D}from"./useNavigate-D3GIoxyW.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-qM3ZfTHx.js";import"./convexApi-CyScjgcq.js";import{n as N}from"./format-DGKgJf2p.js";import{c as P,o as F,s as I,t as L,u as R}from"./searchSchemas-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,AP as i,CP as a,DP as o,EP as s,Ju as c,MP as l,NP as u,OP as d,PP as f,Qu as p,SP as m,TP as h,XX as g,Xu as _,Yu as v,Zu as y,bP as b,jP as x,kP as S,t as C,wP as w,xP as T}from"./api-DSJJn0d7.js";import{n as E,t as D}from"./useNavigate-D3GIoxyW.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-qM3ZfTHx.js";import"./convexApi-CyScjgcq.js";import{n as N}from"./format-DGKgJf2p.js";import{c as P,o as F,s as I,t as L,u as R}from"./searchSchemas-Dm-Qg010.js";import{n as ee}from"./TimeRangePicker-D3PJq1H8.js";import{t as z}from"./FilterBar-DTVwlDpF.js";import{t as B}from"./AdvancedFilter-Bb66m5kb.js";import{t as V}from"./DataTableShell-DRFFBx_j.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:r()},{value:`realLabel`,label:p()},{value:`targetLabel`,label:y()},{value:`impersonated`,label:_()},{value:`resource`,label:v()},{value:`resourceId`,label:c()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,r=e.action??G,c=e.impersonated??G,p=e.resource??G,_=F(e.from,e.to),v=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:y,to:L}=ee(_),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:I(e)}),replace:!0}),$=g(C.admin.listAudit,{filter:{q:n||void 0,from:y,to:L,action:r===G?void 0:r,resource:p===G?void 0:p,impersonated:c===G?void 0:c===`yes`,advanced:v.length>0?v:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||c!==G||p!==G||v.length>0||_.kind!==`relative`||_.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:l(),timeRange:_,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:r,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:x()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:i()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:c,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:S()}),(0,U.jsx)(j,{value:`yes`,children:d()}),(0,U.jsx)(j,{value:`no`,children:o()})]})]}),(0,U.jsxs)(M,{value:p,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:s()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:h()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:v,onChange:Q}),(0,U.jsx)(V,{title:w(),rows:$,emptyHint:a(),columns:[{header:m(),cell:e=>N(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:T(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:b(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AA as i,A_ as a,Ak as o,As as s,Bk as c,CA as l,C_ as u,Ck as d,DA as f,D_ as p,Dk as m,E as h,EA as ee,E_ as g,Ek as _,Fk as te,Gk as ne,Hk as re,Ik as ie,Jk as ae,Kk as oe,Lk as v,Mk as y,Nk as se,O_ as ce,Ok as le,Pk as ue,QO as de,Rk as fe,SA as pe,S_ as me,Sk as he,Su as ge,TA as _e,T_ as ve,Tk as b,Uk as ye,Vk as be,Wk as xe,XO as Se,XX as x,YX as Ce,ZO as S,_A as we,_k as Te,_u as Ee,ak as De,bA as Oe,b_ as ke,bk as Ae,ck as je,dk as Me,ek as Ne,fk as Pe,gA as Fe,gk as Ie,gu as Le,hk as Re,hu as ze,ik as Be,j_ as Ve,jk as He,kA as Ue,k_ as We,kk as Ge,lk as Ke,mk as qe,nk as Je,ok as Ye,oo as Xe,p_ as Ze,pk as Qe,qX as $e,qk as et,rk as tt,sk as nt,t as C,tk as rt,uk as w,vk as it,vu as at,wA as ot,w_ as st,wk as ct,xA as lt,x_ as ut,xk as dt,y_ as ft,yk as pt,yu as mt,zk as ht}from"./api-DSJJn0d7.js";import{i as gt,n as T,o as _t,r as vt,s as yt}from"./FieldLabel-DkgrHevY.js";import{n as bt,t as E}from"./useNavigate-D3GIoxyW.js";import{r as D}from"./dist-ClkJChBn.js";import{t as O}from"./chevron-right-C_b_y922.js";import{t as xt}from"./chevron-up-Dsqj2Oaj.js";import{t as St}from"./chevrons-up-down-Pva00Np5.js";import{n as Ct,t as wt}from"./usageView-C9Y6E0Zu.js";import{t as Tt}from"./loader-circle-BNhIFGdg.js";import{t as Et}from"./checkbox-CsI4ggnp.js";import{t as Dt}from"./server-DLnWqkX-.js";import{t as k}from"./triangle-alert-BkDa-x8g.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-qM3ZfTHx.js";import{i as Ot,n as kt,r as At,t as jt}from"./tabs-mZfLmn2f.js";import{n as Mt,r as Nt,t as Pt}from"./popover-DBaIbsBr.js";import{t as Ft}from"./button-Dio0PVrp.js";import{t as F}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as It}from"./toast-xNFwDnUy.js";import{t as I}from"./badge-C4po8DQ1.js";import{a as L,n as R}from"./format-DGKgJf2p.js";import{a as Lt,n as Rt,o as zt,r as Bt,t as Vt}from"./dialog-BfrsWZiD.js";import{t as Ht}from"./appHost-CH3EGcJw.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as z,i as B,n as V,o as H,r as U,t as Wt}from"./table-D2SJC960.js";import{t as Gt}from"./FilterBar-DTVwlDpF.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView--1YlftIc.js";import{t as W}from"./dispatchErrorInfo-Bb7JyJFO.js";var $t=h(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=h(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:Me(),onReset:()=>i(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:Ke()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(A,{placeholder:je()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:nt()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:De(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Be(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:tt(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Je(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:rt(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(B,{children:Ne()}),(0,Z.jsx)(Q,{label:r(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(V,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(St,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Qe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:L(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${L(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${L(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Pe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${L(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?de():e===`error`?S():Se()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(I,{variant:`secondary`,children:de()}):e===`error`?(0,Z.jsx)(I,{variant:`destructive`,children:S()}):(0,Z.jsx)(I,{variant:`outline`,children:Se()})}function wn(){return x(C.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=x(C.compat.getBridgeCompat,{}),n=x(C.me.getMe,{host:Ht})?.role===`admin`,r=x(C.admin.listInstances,n?{}:`skip`),i=x(C.agents.usageForInstances,n?{}:`skip`),a=E(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=bt({from:`/settings/bridge`}),l=E({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ue()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:se()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{children:mt()}),(0,Z.jsx)(B,{children:at()}),(0,Z.jsx)(B,{children:Ee()}),(0,Z.jsx)(B,{children:Le()}),(0,Z.jsx)(B,{children:ze()})]})}),(0,Z.jsx)(V,{children:i.flatMap(e=>{let t=wt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(I,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(jt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(At,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(Ot,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Dt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(kt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:We(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ce({build:t.buildVersion??`?`})]}):null,` · `,p(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?g():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ct()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,f=R(e.checkedAt),m=e.startedAt==null?null:R(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(Ct,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(k,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?d():c===`gateways_unreachable`?pt({count:l.length}):s?he():dt({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,Ae({time:f})]}),m?(0,Z.jsx)(`span`,{children:Te({time:m})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:it({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ie()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Dt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(I,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ve()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),Re({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[y(),i.length>0?(0,Z.jsx)(I,{variant:`destructive`,children:o({count:i.length})}):a>0?(0,Z.jsx)(I,{variant:`destructive`,children:Ge()}):(0,Z.jsx)(I,{variant:`secondary`,children:He()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[le({version:e.vendoredVersion}),r?` · `+m({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),_({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ge({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:u({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:g()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(I,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Vt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Lt,{children:[(0,Z.jsx)(zt,{children:i({instance:e.displayName??e.name})}),(0,Z.jsx)(Bt,{children:Ue()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ct,{"aria-hidden":!0}):(0,Z.jsx)(k,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?fe():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,v()]}):null}function jn({instance:e,onClose:t}){let n=Ce(C.admin.upsertInstanceConfig),r=$e(C.bridge.validateMediaPaths),i=It(),a=Ut(e.config?.contentLocale,void 0),[o,s]=(0,G.useState)(()=>gt(e.config??{},a)),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,y=_||v;async function se(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(re(),e)}finally{m(!1)}}async function ce(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(o,r,a)}),t()}catch(e){i.error(pe(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:f(),help:lt()}),(0,Z.jsxs)(P,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:yt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ee(),help:Oe()}),(0,Z.jsxs)(P,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:_t.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:_e(),help:we()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ae(),help:et()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:oe(),help:ne()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(T,{label:ot(),help:Fe()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),te({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:c(),result:h.inbound}),(0,Z.jsx)($,{label:ht(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),ie()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(Ft,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:p,children:[p?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ye():xe()]}),(0,Z.jsx)(Ft,{size:`sm`,onClick:()=>void ce(),disabled:u,children:l()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?me():ut({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Mt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ke()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(I,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AA as i,A_ as a,Ak as o,As as s,Bk as c,CA as l,C_ as u,Ck as d,DA as f,D_ as p,Dk as m,E as h,EA as ee,E_ as g,Ek as _,Fk as te,Gk as ne,Hk as re,Ik as ie,Jk as ae,Kk as oe,Lk as v,Mk as y,Nk as se,O_ as ce,Ok as le,Pk as ue,QO as de,Rk as fe,SA as pe,S_ as me,Sk as he,Su as ge,TA as _e,T_ as ve,Tk as b,Uk as ye,Vk as be,Wk as xe,XO as Se,XX as x,YX as Ce,ZO as S,_A as we,_k as Te,_u as Ee,ak as De,bA as Oe,b_ as ke,bk as Ae,ck as je,dk as Me,ek as Ne,fk as Pe,gA as Fe,gk as Ie,gu as Le,hk as Re,hu as ze,ik as Be,j_ as Ve,jk as He,kA as Ue,k_ as We,kk as Ge,lk as Ke,mk as qe,nk as Je,ok as Ye,oo as Xe,p_ as Ze,pk as Qe,qX as $e,qk as et,rk as tt,sk as nt,t as C,tk as rt,uk as w,vk as it,vu as at,wA as ot,w_ as st,wk as ct,xA as lt,x_ as ut,xk as dt,y_ as ft,yk as pt,yu as mt,zk as ht}from"./api-DSJJn0d7.js";import{i as gt,n as T,o as _t,r as vt,s as yt}from"./FieldLabel-Tea3wyVe.js";import{n as bt,t as E}from"./useNavigate-D3GIoxyW.js";import{r as D}from"./dist-ClkJChBn.js";import{t as O}from"./chevron-right-C_b_y922.js";import{t as xt}from"./chevron-up-Dsqj2Oaj.js";import{t as St}from"./chevrons-up-down-Pva00Np5.js";import{n as Ct,t as wt}from"./usageView-C9Y6E0Zu.js";import{t as Tt}from"./loader-circle-BNhIFGdg.js";import{t as Et}from"./checkbox-CsI4ggnp.js";import{t as Dt}from"./server-DLnWqkX-.js";import{t as k}from"./triangle-alert-BkDa-x8g.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-qM3ZfTHx.js";import{i as Ot,n as kt,r as At,t as jt}from"./tabs-mZfLmn2f.js";import{n as Mt,r as Nt,t as Pt}from"./popover-DBaIbsBr.js";import{t as Ft}from"./button-Dio0PVrp.js";import{t as F}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as It}from"./toast-xNFwDnUy.js";import{t as I}from"./badge-C4po8DQ1.js";import{a as L,n as R}from"./format-DGKgJf2p.js";import{a as Lt,n as Rt,o as zt,r as Bt,t as Vt}from"./dialog-BfrsWZiD.js";import{t as Ht}from"./appHost-CH3EGcJw.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as z,i as B,n as V,o as H,r as U,t as Wt}from"./table-D2SJC960.js";import{t as Gt}from"./FilterBar-DTVwlDpF.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView--1YlftIc.js";import{t as W}from"./dispatchErrorInfo-Bb7JyJFO.js";var $t=h(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=h(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:Me(),onReset:()=>i(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:Ke()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(A,{placeholder:je()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:nt()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:De(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Be(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:tt(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Je(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:rt(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(B,{children:Ne()}),(0,Z.jsx)(Q,{label:r(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(V,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(St,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Qe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:L(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${L(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${L(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Pe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${L(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?de():e===`error`?S():Se()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(I,{variant:`secondary`,children:de()}):e===`error`?(0,Z.jsx)(I,{variant:`destructive`,children:S()}):(0,Z.jsx)(I,{variant:`outline`,children:Se()})}function wn(){return x(C.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=x(C.compat.getBridgeCompat,{}),n=x(C.me.getMe,{host:Ht})?.role===`admin`,r=x(C.admin.listInstances,n?{}:`skip`),i=x(C.agents.usageForInstances,n?{}:`skip`),a=E(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=bt({from:`/settings/bridge`}),l=E({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ue()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:se()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{children:mt()}),(0,Z.jsx)(B,{children:at()}),(0,Z.jsx)(B,{children:Ee()}),(0,Z.jsx)(B,{children:Le()}),(0,Z.jsx)(B,{children:ze()})]})}),(0,Z.jsx)(V,{children:i.flatMap(e=>{let t=wt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(I,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(jt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(At,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(Ot,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Dt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(kt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:We(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ce({build:t.buildVersion??`?`})]}):null,` · `,p(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?g():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ct()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,f=R(e.checkedAt),m=e.startedAt==null?null:R(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(Ct,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(k,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?d():c===`gateways_unreachable`?pt({count:l.length}):s?he():dt({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,Ae({time:f})]}),m?(0,Z.jsx)(`span`,{children:Te({time:m})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:it({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ie()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Dt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(I,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ve()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),Re({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[y(),i.length>0?(0,Z.jsx)(I,{variant:`destructive`,children:o({count:i.length})}):a>0?(0,Z.jsx)(I,{variant:`destructive`,children:Ge()}):(0,Z.jsx)(I,{variant:`secondary`,children:He()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[le({version:e.vendoredVersion}),r?` · `+m({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),_({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ge({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:u({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:g()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(I,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Vt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Lt,{children:[(0,Z.jsx)(zt,{children:i({instance:e.displayName??e.name})}),(0,Z.jsx)(Bt,{children:Ue()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ct,{"aria-hidden":!0}):(0,Z.jsx)(k,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?fe():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,v()]}):null}function jn({instance:e,onClose:t}){let n=Ce(C.admin.upsertInstanceConfig),r=$e(C.bridge.validateMediaPaths),i=It(),a=Ut(e.config?.contentLocale,void 0),[o,s]=(0,G.useState)(()=>gt(e.config??{},a)),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,y=_||v;async function se(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(re(),e)}finally{m(!1)}}async function ce(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(o,r,a)}),t()}catch(e){i.error(pe(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:f(),help:lt()}),(0,Z.jsxs)(P,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:yt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ee(),help:Oe()}),(0,Z.jsxs)(P,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:_t.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:_e(),help:we()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ae(),help:et()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:oe(),help:ne()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(T,{label:ot(),help:Fe()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),te({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:c(),result:h.inbound}),(0,Z.jsx)($,{label:ht(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),ie()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(Ft,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:p,children:[p?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ye():xe()]}),(0,Z.jsx)(Ft,{size:`sm`,onClick:()=>void ce(),disabled:u,children:l()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?me():ut({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Mt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ke()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(I,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,rZ as n}from"./api-DSJJn0d7.js";import{a as r,i,n as a,o,r as s,t as c}from"./tooltip-v_AyOWn6.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=Object.defineProperty,u=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>u(e,typeof t==`symbol`?t:t+``,n),f=`https://docs.convex.dev/error#undefined-validator`;function p(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${f} for details.`)}var m=class{constructor({isOptional:e}){d(this,`type`),d(this,`fieldPaths`),d(this,`isOptional`),d(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},h=class e extends m{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),d(this,`tableName`),d(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},g=class e extends m{constructor(){super(...arguments),d(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},_=class e extends m{constructor(){super(...arguments),d(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},v=class e extends m{constructor(){super(...arguments),d(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},y=class e extends m{constructor(){super(...arguments),d(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},b=class e extends m{constructor(){super(...arguments),d(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends m{constructor(){super(...arguments),d(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends m{constructor(){super(...arguments),d(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends m{constructor({isOptional:e,fields:t}){super({isOptional:e}),d(this,`fields`),d(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&p(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},w=class e extends m{constructor({isOptional:e,value:t}){if(super({isOptional:e}),d(this,`value`),d(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:n(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},T=class e extends m{constructor({isOptional:e,element:t}){super({isOptional:e}),d(this,`element`),d(this,`kind`,`array`),t===void 0&&p(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},E=class e extends m{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),d(this,`key`),d(this,`value`),d(this,`kind`,`record`),t===void 0&&p(`v.record()`,`key`),n===void 0&&p(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},D=class e extends m{constructor({isOptional:e,members:t}){super({isOptional:e}),d(this,`members`),d(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&p(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},O={id:e=>new h({isOptional:`required`,tableName:e}),null:()=>new x({isOptional:`required`}),number:()=>new g({isOptional:`required`}),float64:()=>new g({isOptional:`required`}),bigint:()=>new _({isOptional:`required`}),int64:()=>new _({isOptional:`required`}),boolean:()=>new v({isOptional:`required`}),string:()=>new b({isOptional:`required`}),bytes:()=>new y({isOptional:`required`}),literal:e=>new w({isOptional:`required`,value:e}),array:e=>new T({isOptional:`required`,element:e}),object:e=>new C({isOptional:`required`,fields:e}),record:(e,t)=>new E({isOptional:`required`,key:e,value:t}),union:(...e)=>new D({isOptional:`required`,members:e}),any:()=>new S({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>O.union(e,O.null())},k=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),A=[`gateway-http`,`shared-fs`,`off`],j=[`inline`,`shared-fs`],M=[`reactive`,`sse`],N=`reactive`;O.object({mediaMode:O.optional(O.union(O.literal(`gateway-http`),O.literal(`shared-fs`),O.literal(`off`))),inboundMediaMode:O.optional(O.union(O.literal(`inline`),O.literal(`shared-fs`))),rehydration:O.optional(O.boolean()),mediaMaxMb:O.optional(O.number()),attachmentFixAttested:O.optional(O.boolean()),summarizeThresholdChars:O.optional(O.number()),curationEnabled:O.optional(O.boolean()),curationBudgetChars:O.optional(O.number()),converterAgentId:O.optional(O.string()),voiceEnabled:O.optional(O.boolean()),talkEnabled:O.optional(O.boolean()),widgetsEnabled:O.optional(O.boolean()),widgetPromptConfirm:O.optional(O.boolean()),voiceEngine:O.optional(O.union(O.literal(`browser`),O.literal(`gateway`))),voiceLang:O.optional(O.string()),voiceRate:O.optional(O.number()),voiceAutoRead:O.optional(O.boolean()),contentLocale:O.optional(O.string()),inboundAgentMount:O.optional(O.string()),outboundAgentMount:O.optional(O.string()),transcriptProjection:O.optional(O.union(O.literal(`off`),O.literal(`shadow`),O.literal(`on`))),promptInjections:O.optional(O.record(O.string(),O.object({enabled:O.optional(O.boolean()),template:O.optional(O.string())})))});var P={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function F(e,t){let n={};for(let i of o){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function I(e,t){let n={};for(let i of o){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function L(e,t){return{mediaMode:e.mediaMode??P.mediaMode,inboundMediaMode:e.inboundMediaMode??P.inboundMediaMode,rehydration:e.rehydration??P.rehydration,mediaMaxMb:e.mediaMaxMb??P.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??P.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??P.outboundAgentMount,promptInjections:F(e.promptInjections,t)}}var R=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,rZ as n}from"./api-DSJJn0d7.js";import{a as r,i,n as a,o,r as s,t as c}from"./tooltip-v_AyOWn6.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=Object.defineProperty,u=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>u(e,typeof t==`symbol`?t:t+``,n),f=`https://docs.convex.dev/error#undefined-validator`;function p(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${f} for details.`)}var m=class{constructor({isOptional:e}){d(this,`type`),d(this,`fieldPaths`),d(this,`isOptional`),d(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},h=class e extends m{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),d(this,`tableName`),d(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},g=class e extends m{constructor(){super(...arguments),d(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},_=class e extends m{constructor(){super(...arguments),d(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},v=class e extends m{constructor(){super(...arguments),d(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},y=class e extends m{constructor(){super(...arguments),d(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},b=class e extends m{constructor(){super(...arguments),d(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends m{constructor(){super(...arguments),d(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends m{constructor(){super(...arguments),d(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends m{constructor({isOptional:e,fields:t}){super({isOptional:e}),d(this,`fields`),d(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&p(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},w=class e extends m{constructor({isOptional:e,value:t}){if(super({isOptional:e}),d(this,`value`),d(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:n(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},T=class e extends m{constructor({isOptional:e,element:t}){super({isOptional:e}),d(this,`element`),d(this,`kind`,`array`),t===void 0&&p(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},E=class e extends m{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),d(this,`key`),d(this,`value`),d(this,`kind`,`record`),t===void 0&&p(`v.record()`,`key`),n===void 0&&p(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},D=class e extends m{constructor({isOptional:e,members:t}){super({isOptional:e}),d(this,`members`),d(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&p(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},O={id:e=>new h({isOptional:`required`,tableName:e}),null:()=>new x({isOptional:`required`}),number:()=>new g({isOptional:`required`}),float64:()=>new g({isOptional:`required`}),bigint:()=>new _({isOptional:`required`}),int64:()=>new _({isOptional:`required`}),boolean:()=>new v({isOptional:`required`}),string:()=>new b({isOptional:`required`}),bytes:()=>new y({isOptional:`required`}),literal:e=>new w({isOptional:`required`,value:e}),array:e=>new T({isOptional:`required`,element:e}),object:e=>new C({isOptional:`required`,fields:e}),record:(e,t)=>new E({isOptional:`required`,key:e,value:t}),union:(...e)=>new D({isOptional:`required`,members:e}),any:()=>new S({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>O.union(e,O.null())},k=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),A=[`gateway-http`,`shared-fs`,`off`],j=[`inline`,`shared-fs`],M=[`reactive`,`sse`],N=`reactive`;O.object({mediaMode:O.optional(O.union(O.literal(`gateway-http`),O.literal(`shared-fs`),O.literal(`off`))),inboundMediaMode:O.optional(O.union(O.literal(`inline`),O.literal(`shared-fs`))),rehydration:O.optional(O.boolean()),mediaMaxMb:O.optional(O.number()),attachmentFixAttested:O.optional(O.boolean()),summarizeThresholdChars:O.optional(O.number()),curationEnabled:O.optional(O.boolean()),curationBudgetChars:O.optional(O.number()),converterAgentId:O.optional(O.string()),voiceEnabled:O.optional(O.boolean()),talkEnabled:O.optional(O.boolean()),widgetsEnabled:O.optional(O.boolean()),widgetPromptConfirm:O.optional(O.boolean()),voiceEngine:O.optional(O.union(O.literal(`browser`),O.literal(`gateway`))),voiceLang:O.optional(O.string()),voiceRate:O.optional(O.number()),voiceAutoRead:O.optional(O.boolean()),contentLocale:O.optional(O.string()),inboundAgentMount:O.optional(O.string()),outboundAgentMount:O.optional(O.string()),transcriptProjection:O.optional(O.union(O.literal(`off`),O.literal(`shadow`),O.literal(`on`))),promptInjections:O.optional(O.record(O.string(),O.object({enabled:O.optional(O.boolean()),template:O.optional(O.string())})))});var P={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function F(e,t){let n={};for(let i of o){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function I(e,t){let n={};for(let i of o){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function L(e,t){return{mediaMode:e.mediaMode??P.mediaMode,inboundMediaMode:e.inboundMediaMode??P.inboundMediaMode,rehydration:e.rehydration??P.rehydration,mediaMaxMb:e.mediaMaxMb??P.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??P.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??P.outboundAgentMount,promptInjections:F(e.promptInjections,t)}}var R=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function z(e,t,n){let r={},i=n=>{(e[n]!==P[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=I(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of R){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var B=e();function V({text:e}){return(0,B.jsx)(s,{delayDuration:150,children:(0,B.jsxs)(c,{children:[(0,B.jsx)(i,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,B.jsx)(k,{"aria-hidden":!0})})}),(0,B.jsx)(a,{className:`max-w-xs text-pretty`,children:e})]})})}function H({label:e,help:t}){return(0,B.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,B.jsx)(V,{text:t})]})}export{N as a,M as c,L as i,H as n,j as o,z as r,A as s,V as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$F as i,$P as a,AF as o,AI as s,An as c,Ao as l,BF as u,BP as d,CF as f,CI as p,Co as m,DF as h,DI as g,Dn as _,Do as v,EF as y,EI as b,En as ee,Eo as x,Eu as te,FF as S,FP as C,Fn as ne,Fo as re,GF as w,GP as T,GU as E,HF as D,HP as ie,IF as O,IP as k,J as ae,JF as oe,JP as se,K as ce,KF as le,KP as ue,KU as de,LF as fe,LP as pe,MF as me,Mn as he,Mo as ge,NF as _e,Nn as ve,No as ye,OF as be,OI as xe,On as Se,Oo as Ce,PF as we,Pn as Te,Po as Ee,Q as De,QF as Oe,QP as ke,RF as Ae,RP as je,SF as Me,SI as Ne,So as Pe,TF as Fe,TI as Ie,To as Le,Tu as Re,UF as ze,UP as Be,VF as Ve,VP as He,WF as Ue,WP as We,X as Ge,XF as Ke,XP as qe,XX as A,Y as Je,YF as Ye,YP as Xe,YX as j,Z as Ze,ZF as Qe,ZP as $e,_F as et,_I as tt,_y as nt,aF as rt,aI as it,bF as at,bI as ot,bo as st,cF as ct,cI as lt,cm as ut,dF as M,dI as dt,dm as ft,eF as pt,eI as mt,et as ht,fF as gt,fI as _t,gF as N,gI as P,gy as vt,hF as yt,hI as bt,hy as xt,iF as St,iI as Ct,jF as wt,jn as Tt,jo as Et,kF as Dt,kI as Ot,kn as kt,ko as At,lF as jt,lI as Mt,lm as Nt,mF as F,mI as Pt,nF as Ft,nI as It,oF as Lt,oI as Rt,pF as zt,pI as Bt,q as Vt,qF as I,qP as Ht,qX as L,rF as Ut,rI as Wt,sF as Gt,sI as Kt,t as R,tF as qt,tI as Jt,uI as Yt,um as Xt,vA as Zt,vF as Qt,vI as $t,wF as en,wI as tn,wo as nn,wu as rn,xF as an,xI as on,xo as sn,yA as cn,yF as ln,yI as un,yo as dn,zF as fn,zP as pn}from"./api-DSJJn0d7.js";import{a as mn,c as hn}from"./FieldLabel-DkgrHevY.js";import{t as gn}from"./checkbox-CsI4ggnp.js";import{a as z,i as B,n as V,r as H,t as U}from"./select-qM3ZfTHx.js";import{n as _n,r as vn,t as yn}from"./popover-DBaIbsBr.js";import{t as W}from"./button-Dio0PVrp.js";import{t as G}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as K}from"./toast-xNFwDnUy.js";import{t as q}from"./badge-C4po8DQ1.js";import{a as bn,n as xn,o as Sn,r as Cn,t as wn}from"./dialog-BfrsWZiD.js";import{n as Tn}from"./ConfirmDialog-BXcki0Ee.js";import{t as En}from"./EntitySheet-B2B48bss.js";import{a as J}from"./groupManageView-BMBqgRhV.js";import{t as Dn}from"./DataTableShell-DRFFBx_j.js";import{InstanceConfigDialog as On}from"./BridgeTab-rIDUCrXq.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:mn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=A(R.admin.listInstances,{}),t=A(R.agents.listAllInstanceAgents,{}),n=j(R.admin.upsertInstance),a=j(R.widgets.setInstanceWidgets),o=j(R.admin.deleteInstance),u=K(),[d,f]=(0,Y.useState)(!1),[h,y]=(0,Y.useState)(Q),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(null);async function oe(){try{let t=await n({instanceId:O??void 0,name:h.name,gatewayUrl:h.gatewayUrl,bridgeUrl:h.bridgeUrl||void 0,displayName:h.displayName||void 0,kind:h.kind,transport:h.kind===`hermes`?h.transport:void 0,gatewayVersion:h.gatewayVersion||void 0,gatewayHttpUrl:h.gatewayHttpUrl||void 0,...h.kind===`openclaw`?{authMode:h.authMode,personScopes:h.personScopes,identitySource:h.identitySource,participantIdentity:h.participantIdentity,managePermissionModes:h.managePermissionModes,systemIdentity:h.systemIdentity||void 0}:{},streamTransport:h.streamTransport}),r=O===null?null:e?.find(e=>e._id===O),i=r?.config?.widgetsEnabled!==!1,o=r?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==i||h.widgetPromptConfirm!==o)&&await a({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),y(Q),k(null),f(!1)}catch(e){u.error(xe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),(0,Z.jsx)(`strong`,{children:b()}),Ie()]}),(0,Z.jsx)(Dn,{title:tn(),rows:e,addLabel:p(),onAdd:()=>{k(null),y(Q),f(!0)},emptyHint:Ne(),columns:[{header:on(),cell:e=>e.name,sort:e=>e.name},{header:ot(),cell:e=>(0,Z.jsx)(q,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:un(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:$t(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:s(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(q,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ie():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Pt(),onSelect:()=>{k(e._id),y(Nn(e)),f(!0)}},{label:Ot(),onSelect:()=>C(e.name)},{label:i(),onSelect:()=>D(e)},{label:tt(),onSelect:()=>T(e)},{label:P(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:P(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(En,{open:d,onOpenChange:f,title:O?Bt():bt(),description:dt(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:oe,submitLabel:Yt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Mt(),children:[(0,Z.jsx)(G,{value:h.name,disabled:O!==null,onChange:e=>y({...h,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_t()}):null]}),(0,Z.jsx)($,{label:lt(),children:(0,Z.jsxs)(U,{value:h.kind,onValueChange:e=>y({...h,kind:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(H,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,Z.jsx)($,{label:te(),children:(0,Z.jsxs)(U,{value:h.transport,onValueChange:e=>y({...h,transport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`ws`,children:Re()}),(0,Z.jsx)(H,{value:`rest`,children:rn()})]})]})}):null,(0,Z.jsx)($,{label:Kt(),children:(0,Z.jsx)(G,{value:h.gatewayUrl,onChange:e=>y({...h,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Rt(),children:(0,Z.jsx)(G,{value:h.bridgeUrl,placeholder:it(),onChange:e=>y({...h,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ct(),children:(0,Z.jsx)(G,{value:h.displayName,onChange:e=>y({...h,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:cn(),children:[(0,Z.jsxs)(U,{value:h.streamTransport,onValueChange:e=>y({...h,streamTransport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsx)(V,{children:hn.map(e=>(0,Z.jsx)(H,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Zt()})]}),(0,Z.jsx)($,{label:Wt(),children:(0,Z.jsx)(G,{value:h.gatewayVersion,placeholder:It(),onChange:e=>y({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Le(),children:[(0,Z.jsxs)(U,{value:h.authMode,onValueChange:e=>y({...h,authMode:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`token`,children:nn()}),(0,Z.jsx)(H,{value:`trusted-proxy`,children:m()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?sn():Pe()})]}),h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsxs)(U,{value:h.personScopes,onValueChange:e=>y({...h,personScopes:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`capped`,children:Ee()}),(0,Z.jsx)(H,{value:`full`,children:ye()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?Et():ge()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsxs)(U,{value:h.identitySource,onValueChange:e=>y({...h,identitySource:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`canonical`,children:At()}),(0,Z.jsx)(H,{value:`email`,children:Ce()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?x():v()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsxs)(U,{value:h.participantIdentity,onValueChange:e=>y({...h,participantIdentity:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`owner`,children:Te()}),(0,Z.jsx)(H,{value:`self`,children:ve()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?ee():he()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:Tt(),children:[(0,Z.jsxs)(U,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>y({...h,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:c()}),(0,Z.jsx)(H,{value:`on`,children:kt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?_():Se()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:ht(),children:[(0,Z.jsxs)(U,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>y({...h,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`on`,children:r()}),(0,Z.jsx)(H,{value:`off`,children:De()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?Ze():Ge()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,Z.jsxs)($,{label:Je(),children:[(0,Z.jsxs)(U,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>y({...h,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:ae()}),(0,Z.jsx)(H,{value:`on`,children:Vt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:ce()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(G,{value:h.systemIdentity,placeholder:dn(),onChange:e=>y({...h,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Jt(),children:(0,Z.jsx)(G,{value:h.gatewayHttpUrl,placeholder:mt(),onChange:e=>y({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:S,open:S!==null,onOpenChange:e=>{e||C(null)}}),w?(0,Z.jsx)(On,{instance:w,onClose:()=>T(null)},w._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=A(R.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(xn,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:Oe({instance:e.displayName??e.name})}),(0,Z.jsx)(Cn,{children:Qe()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ln,{instance:e})}),(0,Z.jsx)(In,{instance:e})]})})}function In({instance:e}){let t=L(R.instanceSync.forceInstanceSync),n=K(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(wt());break;case`no_agents`:n.success(Dt());break;case`no_bridge_url`:n.error(be());break;case`deploy_misconfigured`:n.error(h());break;case`unauthorized`:n.error(Fe());break;case`not_served`:n.error(en());break;default:n.error(y());break}}catch(e){n.error(o(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?me():_e()})})]})}function Ln({instance:e}){let t=A(R.bridgeAuth.listBridgeAuthStatus,{}),n=L(R.bridgeAuth.mintBridgeSecret),r=j(R.bridgeAuth.revokeBridgeSecret),i=K(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{let t=await n({instanceId:e._id});c(t.plaintext),u(!1)}catch(e){i.error(N(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(et())}catch(e){i.error(N(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:an()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:f?`outline`:`secondary`,children:f?`${I()} · ${d.prefix}…${d.lastFour}`:le()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?ln():at()}),f?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Qt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:yt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?de():E()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:F()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=L(R.instanceSecrets.setInstanceSecret),i=j(R.instanceSecrets.clearInstanceSecret),a=L(R.deviceIdentity.generateDeviceIdentity),o=K(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Ke():t===`deviceIdentity`?Ye():oe();async function y(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Ve())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function b(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(fn())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function ee(){if(!l){d(!0);try{let t=await a({instanceId:e});p(t),h(!1),o.success(O())}catch(e){o.error(we(),e)}finally{d(!1)}}}let x=f?`openclaw devices approve ${f.id}`:``;async function te(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:g?`outline`:`secondary`,children:g?I():le()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ue():w(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void y(),disabled:l||s.trim().length===0,children:ze()}),_?(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:l,children:Ae()}):null,g?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:l,children:D()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:m?de():E()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:F()})]}):null]})}var zn={conversational:Ut,documentary:qt,summarizer:ft,curator:Nt},Bn={conversational:Ft,documentary:pt,summarizer:Xt,curator:ut},Vn=e=>(zn[e]??(()=>e))(),Hn=e=>(Bn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Gt()}),t.map(e=>(0,Z.jsx)(q,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(vn,{asChild:!0,children:(0,Z.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Lt()})}),(0,Z.jsxs)(_n,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:rt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:St()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(gn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=A(R.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=j(R.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=j(R.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=j(R.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=j(R.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=j(R.agents.removeInstanceAgent),u=j(R.agents.setAgentReservation),f=A(R.groups.listGroupLabels,t?{}:`skip`),p=Tn(),m=K();async function h(t,n){if(e&&await p({title:je({name:n}),description:pe(),confirmLabel:pn()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(M(),J(e))}}async function g(t,n,r){if(!e)return;let i=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:nt({name:n,group:i}),description:vt({group:i}),confirmLabel:xt()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(M(),J(e))}}async function _(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(M(),e)}}async function v(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(M(),e)}}async function y(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){m.error(M(),e)}}async function b(t,n){if(e&&await p({title:$e({name:n}),description:qe(),confirmLabel:Xe(),destructive:!0}))try{await l({instanceName:e,agentId:t}),m.success(se())}catch(e){m.error(M(),e)}}return(0,Z.jsx)(wn,{open:t,onOpenChange:n,children:(0,Z.jsxs)(xn,{className:`oc-access`,children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:zt({name:e??``})}),(0,Z.jsx)(Cn,{children:gt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ht()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ue():r.discovery.lastPollOk?T():We({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Be()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(gn,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,Z.jsx)(q,{variant:`outline`,children:t.reserved.groupName===null?d():He({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:C()}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,o),children:ke()})]}):i?(0,Z.jsx)(q,{variant:`default`,children:ie()}):(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:a()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,o),children:pn()}),(0,Z.jsxs)(U,{value:``,onValueChange:e=>void g(t.agentId,o,e),children:[(0,Z.jsx)(B,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(z,{placeholder:k()})}),(0,Z.jsx)(V,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(H,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:s,onToggle:e=>void y(t.agentId,e,s)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){m.error(M(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:jt(),"aria-label":ct(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pn as InstancesTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$F as i,$P as a,AF as o,AI as s,An as c,Ao as l,BF as u,BP as d,CF as f,CI as p,Co as m,DF as h,DI as g,Dn as _,Do as v,EF as y,EI as b,En as ee,Eo as x,Eu as te,FF as S,FP as C,Fn as ne,Fo as re,GF as w,GP as T,GU as E,HF as D,HP as ie,IF as O,IP as k,J as ae,JF as oe,JP as se,K as ce,KF as le,KP as ue,KU as de,LF as fe,LP as pe,MF as me,Mn as he,Mo as ge,NF as _e,Nn as ve,No as ye,OF as be,OI as xe,On as Se,Oo as Ce,PF as we,Pn as Te,Po as Ee,Q as De,QF as Oe,QP as ke,RF as Ae,RP as je,SF as Me,SI as Ne,So as Pe,TF as Fe,TI as Ie,To as Le,Tu as Re,UF as ze,UP as Be,VF as Ve,VP as He,WF as Ue,WP as We,X as Ge,XF as Ke,XP as qe,XX as A,Y as Je,YF as Ye,YP as Xe,YX as j,Z as Ze,ZF as Qe,ZP as $e,_F as et,_I as tt,_y as nt,aF as rt,aI as it,bF as at,bI as ot,bo as st,cF as ct,cI as lt,cm as ut,dF as M,dI as dt,dm as ft,eF as pt,eI as mt,et as ht,fF as gt,fI as _t,gF as N,gI as P,gy as vt,hF as yt,hI as bt,hy as xt,iF as St,iI as Ct,jF as wt,jn as Tt,jo as Et,kF as Dt,kI as Ot,kn as kt,ko as At,lF as jt,lI as Mt,lm as Nt,mF as F,mI as Pt,nF as Ft,nI as It,oF as Lt,oI as Rt,pF as zt,pI as Bt,q as Vt,qF as I,qP as Ht,qX as L,rF as Ut,rI as Wt,sF as Gt,sI as Kt,t as R,tF as qt,tI as Jt,uI as Yt,um as Xt,vA as Zt,vF as Qt,vI as $t,wF as en,wI as tn,wo as nn,wu as rn,xF as an,xI as on,xo as sn,yA as cn,yF as ln,yI as un,yo as dn,zF as fn,zP as pn}from"./api-DSJJn0d7.js";import{a as mn,c as hn}from"./FieldLabel-Tea3wyVe.js";import{t as gn}from"./checkbox-CsI4ggnp.js";import{a as z,i as B,n as V,r as H,t as U}from"./select-qM3ZfTHx.js";import{n as _n,r as vn,t as yn}from"./popover-DBaIbsBr.js";import{t as W}from"./button-Dio0PVrp.js";import{t as G}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as K}from"./toast-xNFwDnUy.js";import{t as q}from"./badge-C4po8DQ1.js";import{a as bn,n as xn,o as Sn,r as Cn,t as wn}from"./dialog-BfrsWZiD.js";import{n as Tn}from"./ConfirmDialog-BXcki0Ee.js";import{t as En}from"./EntitySheet-B2B48bss.js";import{a as J}from"./groupManageView-BMBqgRhV.js";import{t as Dn}from"./DataTableShell-DRFFBx_j.js";import{InstanceConfigDialog as On}from"./BridgeTab-D4RFq-Rb.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:mn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=A(R.admin.listInstances,{}),t=A(R.agents.listAllInstanceAgents,{}),n=j(R.admin.upsertInstance),a=j(R.widgets.setInstanceWidgets),o=j(R.admin.deleteInstance),u=K(),[d,f]=(0,Y.useState)(!1),[h,y]=(0,Y.useState)(Q),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(null);async function oe(){try{let t=await n({instanceId:O??void 0,name:h.name,gatewayUrl:h.gatewayUrl,bridgeUrl:h.bridgeUrl||void 0,displayName:h.displayName||void 0,kind:h.kind,transport:h.kind===`hermes`?h.transport:void 0,gatewayVersion:h.gatewayVersion||void 0,gatewayHttpUrl:h.gatewayHttpUrl||void 0,...h.kind===`openclaw`?{authMode:h.authMode,personScopes:h.personScopes,identitySource:h.identitySource,participantIdentity:h.participantIdentity,managePermissionModes:h.managePermissionModes,systemIdentity:h.systemIdentity||void 0}:{},streamTransport:h.streamTransport}),r=O===null?null:e?.find(e=>e._id===O),i=r?.config?.widgetsEnabled!==!1,o=r?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==i||h.widgetPromptConfirm!==o)&&await a({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),y(Q),k(null),f(!1)}catch(e){u.error(xe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),(0,Z.jsx)(`strong`,{children:b()}),Ie()]}),(0,Z.jsx)(Dn,{title:tn(),rows:e,addLabel:p(),onAdd:()=>{k(null),y(Q),f(!0)},emptyHint:Ne(),columns:[{header:on(),cell:e=>e.name,sort:e=>e.name},{header:ot(),cell:e=>(0,Z.jsx)(q,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:un(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:$t(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:s(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(q,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ie():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Pt(),onSelect:()=>{k(e._id),y(Nn(e)),f(!0)}},{label:Ot(),onSelect:()=>C(e.name)},{label:i(),onSelect:()=>D(e)},{label:tt(),onSelect:()=>T(e)},{label:P(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:P(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(En,{open:d,onOpenChange:f,title:O?Bt():bt(),description:dt(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:oe,submitLabel:Yt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Mt(),children:[(0,Z.jsx)(G,{value:h.name,disabled:O!==null,onChange:e=>y({...h,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_t()}):null]}),(0,Z.jsx)($,{label:lt(),children:(0,Z.jsxs)(U,{value:h.kind,onValueChange:e=>y({...h,kind:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(H,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,Z.jsx)($,{label:te(),children:(0,Z.jsxs)(U,{value:h.transport,onValueChange:e=>y({...h,transport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`ws`,children:Re()}),(0,Z.jsx)(H,{value:`rest`,children:rn()})]})]})}):null,(0,Z.jsx)($,{label:Kt(),children:(0,Z.jsx)(G,{value:h.gatewayUrl,onChange:e=>y({...h,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Rt(),children:(0,Z.jsx)(G,{value:h.bridgeUrl,placeholder:it(),onChange:e=>y({...h,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ct(),children:(0,Z.jsx)(G,{value:h.displayName,onChange:e=>y({...h,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:cn(),children:[(0,Z.jsxs)(U,{value:h.streamTransport,onValueChange:e=>y({...h,streamTransport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsx)(V,{children:hn.map(e=>(0,Z.jsx)(H,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Zt()})]}),(0,Z.jsx)($,{label:Wt(),children:(0,Z.jsx)(G,{value:h.gatewayVersion,placeholder:It(),onChange:e=>y({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Le(),children:[(0,Z.jsxs)(U,{value:h.authMode,onValueChange:e=>y({...h,authMode:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`token`,children:nn()}),(0,Z.jsx)(H,{value:`trusted-proxy`,children:m()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?sn():Pe()})]}),h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsxs)(U,{value:h.personScopes,onValueChange:e=>y({...h,personScopes:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`capped`,children:Ee()}),(0,Z.jsx)(H,{value:`full`,children:ye()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?Et():ge()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsxs)(U,{value:h.identitySource,onValueChange:e=>y({...h,identitySource:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`canonical`,children:At()}),(0,Z.jsx)(H,{value:`email`,children:Ce()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?x():v()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsxs)(U,{value:h.participantIdentity,onValueChange:e=>y({...h,participantIdentity:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`owner`,children:Te()}),(0,Z.jsx)(H,{value:`self`,children:ve()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?ee():he()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:Tt(),children:[(0,Z.jsxs)(U,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>y({...h,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:c()}),(0,Z.jsx)(H,{value:`on`,children:kt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?_():Se()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:ht(),children:[(0,Z.jsxs)(U,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>y({...h,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`on`,children:r()}),(0,Z.jsx)(H,{value:`off`,children:De()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?Ze():Ge()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,Z.jsxs)($,{label:Je(),children:[(0,Z.jsxs)(U,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>y({...h,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:ae()}),(0,Z.jsx)(H,{value:`on`,children:Vt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:ce()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(G,{value:h.systemIdentity,placeholder:dn(),onChange:e=>y({...h,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Jt(),children:(0,Z.jsx)(G,{value:h.gatewayHttpUrl,placeholder:mt(),onChange:e=>y({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:S,open:S!==null,onOpenChange:e=>{e||C(null)}}),w?(0,Z.jsx)(On,{instance:w,onClose:()=>T(null)},w._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=A(R.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(xn,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:Oe({instance:e.displayName??e.name})}),(0,Z.jsx)(Cn,{children:Qe()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ln,{instance:e})}),(0,Z.jsx)(In,{instance:e})]})})}function In({instance:e}){let t=L(R.instanceSync.forceInstanceSync),n=K(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(wt());break;case`no_agents`:n.success(Dt());break;case`no_bridge_url`:n.error(be());break;case`deploy_misconfigured`:n.error(h());break;case`unauthorized`:n.error(Fe());break;case`not_served`:n.error(en());break;default:n.error(y());break}}catch(e){n.error(o(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?me():_e()})})]})}function Ln({instance:e}){let t=A(R.bridgeAuth.listBridgeAuthStatus,{}),n=L(R.bridgeAuth.mintBridgeSecret),r=j(R.bridgeAuth.revokeBridgeSecret),i=K(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{let t=await n({instanceId:e._id});c(t.plaintext),u(!1)}catch(e){i.error(N(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(et())}catch(e){i.error(N(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:an()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:f?`outline`:`secondary`,children:f?`${I()} · ${d.prefix}…${d.lastFour}`:le()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?ln():at()}),f?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Qt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:yt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?de():E()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:F()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=L(R.instanceSecrets.setInstanceSecret),i=j(R.instanceSecrets.clearInstanceSecret),a=L(R.deviceIdentity.generateDeviceIdentity),o=K(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Ke():t===`deviceIdentity`?Ye():oe();async function y(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Ve())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function b(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(fn())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function ee(){if(!l){d(!0);try{let t=await a({instanceId:e});p(t),h(!1),o.success(O())}catch(e){o.error(we(),e)}finally{d(!1)}}}let x=f?`openclaw devices approve ${f.id}`:``;async function te(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:g?`outline`:`secondary`,children:g?I():le()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ue():w(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void y(),disabled:l||s.trim().length===0,children:ze()}),_?(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:l,children:Ae()}):null,g?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:l,children:D()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:m?de():E()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:F()})]}):null]})}var zn={conversational:Ut,documentary:qt,summarizer:ft,curator:Nt},Bn={conversational:Ft,documentary:pt,summarizer:Xt,curator:ut},Vn=e=>(zn[e]??(()=>e))(),Hn=e=>(Bn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Gt()}),t.map(e=>(0,Z.jsx)(q,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(vn,{asChild:!0,children:(0,Z.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Lt()})}),(0,Z.jsxs)(_n,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:rt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:St()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(gn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=A(R.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=j(R.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=j(R.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=j(R.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=j(R.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=j(R.agents.removeInstanceAgent),u=j(R.agents.setAgentReservation),f=A(R.groups.listGroupLabels,t?{}:`skip`),p=Tn(),m=K();async function h(t,n){if(e&&await p({title:je({name:n}),description:pe(),confirmLabel:pn()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(M(),J(e))}}async function g(t,n,r){if(!e)return;let i=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:nt({name:n,group:i}),description:vt({group:i}),confirmLabel:xt()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(M(),J(e))}}async function _(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(M(),e)}}async function v(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(M(),e)}}async function y(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){m.error(M(),e)}}async function b(t,n){if(e&&await p({title:$e({name:n}),description:qe(),confirmLabel:Xe(),destructive:!0}))try{await l({instanceName:e,agentId:t}),m.success(se())}catch(e){m.error(M(),e)}}return(0,Z.jsx)(wn,{open:t,onOpenChange:n,children:(0,Z.jsxs)(xn,{className:`oc-access`,children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:zt({name:e??``})}),(0,Z.jsx)(Cn,{children:gt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ht()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ue():r.discovery.lastPollOk?T():We({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Be()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(gn,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,Z.jsx)(q,{variant:`outline`,children:t.reserved.groupName===null?d():He({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:C()}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,o),children:ke()})]}):i?(0,Z.jsx)(q,{variant:`default`,children:ie()}):(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:a()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,o),children:pn()}),(0,Z.jsxs)(U,{value:``,onValueChange:e=>void g(t.agentId,o,e),children:[(0,Z.jsx)(B,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(z,{placeholder:k()})}),(0,Z.jsx)(V,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(H,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:s,onToggle:e=>void y(t.agentId,e,s)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){m.error(M(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:jt(),"aria-label":ct(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pn as InstancesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,Cz as a,DO as o,EO as s,FO as c,IO as l,MO as u,NO as d,OO as f,PO as p,SO as m,Sz as h,TO as g,XX as _,Yz as v,jO as ee,kO as te,mz as y,pz as b,t as x,wO as S,wz as C,xz as w}from"./api-DSJJn0d7.js";import{n as T,t as E}from"./useNavigate-D3GIoxyW.js";import"./convexApi-CyScjgcq.js";import{c as D,n as O,o as ne}from"./searchSchemas-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,Cz as a,DO as o,EO as s,FO as c,IO as l,MO as u,NO as d,OO as f,PO as p,SO as m,Sz as h,TO as g,XX as _,Yz as v,jO as ee,kO as te,mz as y,pz as b,t as x,wO as S,wz as C,xz as w}from"./api-DSJJn0d7.js";import{n as T,t as E}from"./useNavigate-D3GIoxyW.js";import"./convexApi-CyScjgcq.js";import{c as D,n as O,o as ne}from"./searchSchemas-Dm-Qg010.js";import{t as re}from"./appHost-CH3EGcJw.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-CerX9wDn.js";import{n as P,t as F}from"./TimeRangePicker-D3PJq1H8.js";var I=t(e(),1),L={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},R=Object.keys(L).length,z=n(),B=15,V=e=>String(Math.round(e));function H(){let e=_(x.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=_(x.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:v()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:C()}),(0,z.jsx)(M,{children:h()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),o=e=>74-e*68/r,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[b(),` p50 `,V(c.cP50),` `,a()]}),(0,z.jsxs)(`span`,{children:[y(),` p50 `,V(c.aP50),` `,a()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":C(),children:[(0,z.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:l(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:c(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:p(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:d(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:u(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:ee(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:r(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=T({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=ne(e.from,e.to,O,`now`),r=e=>void t({search:t=>({...t,...D(e)})}),{from:i,to:a}=P(n),{rowLimit:c,buckets:l}=Y(i,a),u=_(x.kpi.listKpis,{limit:c,filter:{from:i,to:a}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),p=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:g({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:S()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:i({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":m({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,CA as i,Cf as a,Du as o,Ou as s,Qk as c,SA as l,Sf as u,Uo as d,XX as f,Xk as p,YX as m,Zk as h,aA as g,cA as _,dA as v,df as y,eA as b,fA as x,ff as ee,fm as te,gm as S,hA as C,hm as w,iA as T,ku as E,lA as D,mA as ne,mf as re,mm as ie,nA as ae,oA as oe,pA as se,pf as ce,pm as O,rA as k,sA as A,t as j,tA as M,uA as N,uf as P,wf as F,xf as I}from"./api-DSJJn0d7.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,CA as i,Cf as a,Du as o,Ou as s,Qk as c,SA as l,Sf as u,Uo as d,XX as f,Xk as p,YX as m,Zk as h,aA as g,cA as _,dA as v,df as y,eA as b,fA as x,ff as ee,fm as te,gm as S,hA as C,hm as w,iA as T,ku as E,lA as D,mA as ne,mf as re,mm as ie,nA as ae,oA as oe,pA as se,pf as ce,pm as O,rA as k,sA as A,t as j,tA as M,uA as N,uf as P,wf as F,xf as I}from"./api-DSJJn0d7.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-Tea3wyVe.js";import{t as V}from"./checkbox-CsI4ggnp.js";import{a as H,c as le,o as U,s as W}from"./tooltip-v_AyOWn6.js";import{a as G,i as K,n as q,r as J,t as Y}from"./select-qM3ZfTHx.js";import{t as X}from"./button-Dio0PVrp.js";import{r as ue}from"./toast-xNFwDnUy.js";import{t as de}from"./appHost-CH3EGcJw.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:N,help:D},documentary_fetch:{label:_,help:A},inbound_files:{label:oe,help:g},history_summary:{label:S,help:w},file_curation:{label:F,help:re},quote_reply:{label:a,help:u}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
2
|
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
3
|
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
4
|
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:c,references:h,files:p,previous_summary:ie,new_messages:O,max_chars:te,file_name:ce,budget_chars:ee,feedback:y,content:P,excerpt:I};function _e(){let e=f(j.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:k()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(R,{label:C(),help:ne()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:T()}),(0,$.jsxs)(Y,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsx)(q,{children:e.map(e=>(0,$.jsx)(J,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=m(j.admin.upsertInstanceConfig),n=ue(),r=f(j.me.getMe,{host:de}),a=e.config??{},c=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[u,d]=(0,Q.useState)(()=>L(a,c));(0,Q.useEffect)(()=>{d(L(a,c))},[c,e._id]);let[p,h]=(0,Q.useState)(!1),g=u.promptInjections,_=(e,t)=>d({...u,promptInjections:{...g,[e]:{...g[e],...t}}});async function v(){h(!0);try{await t({instanceId:e._id,config:z(u,a,c)})}catch(e){n.error(l(),e)}finally{h(!1)}}async function y(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(l(),e)}}let b=e.config?.contentLocale??`default`,x=fe[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:E()}),(0,$.jsxs)(Y,{value:b,onValueChange:e=>void y(e),children:[(0,$.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsxs)(q,{children:[(0,$.jsx)(J,{value:`default`,children:o({locale:x})}),pe().map(e=>(0,$.jsx)(J,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}),U.map(e=>(0,$.jsx)(ye,{injKey:e,def:H[e],i18n:me[e],row:g[e]??{enabled:!0,template:H[e].defaultTemplate[c]},contentLocale:c,onChange:t=>_(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(X,{size:`sm`,onClick:()=>void v(),disabled:p,children:i()})})]})}function ye({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=i.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!i.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=W(e,i,a),m=p?le(p,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(V,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:x()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:v()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(B,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?M():ae()}),l&&(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:se()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:b()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:d()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:r()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,Aj as i,Az as a,Bj as o,Bz as s,Cj as c,Dj as l,Dz as u,E as d,Ej as f,Ez as p,Fj as m,Fz as h,Gj as g,Gu as _,Gz as v,Hj as y,Hz as b,Ij as x,Iz as S,Jj as ee,Jz as C,Kj as te,Ku as w,Kz as T,Lj as ne,Lz as E,Mj as re,Mz as ie,Nj as ae,Nz as oe,Oj as se,Oz as D,Pj as ce,Pz as O,Qj as le,Rj as ue,Rz as de,Sj as fe,Tj as pe,Tz as k,Uj as me,Uz as A,Vj as he,Vz as j,Wj as ge,Wz as M,XX as N,Xj as _e,YX as P,Yj as ve,Yz as ye,Zj as be,_z as xe,aM as Se,bz as Ce,cz as we,dz as Te,eM as Ee,fz as De,gz as Oe,hz as F,iM as ke,jj as Ae,jz as je,kj as Me,kz as Ne,lz as Pe,mz as Fe,nM as Ie,oz as Le,pz as Re,qj as ze,qu as Be,qz as Ve,rM as He,sz as Ue,t as I,tM as We,uz as Ge,vz as Ke,wj as qe,yz as Je,zj as Ye,zz as Xe}from"./api-DSJJn0d7.js";import{n as Ze,t as Qe}from"./useNavigate-D3GIoxyW.js";import{t as $e}from"./check-DmQzfrws.js";import{t as et}from"./copy-BaUCUMp2.js";import{n as tt,t as nt}from"./eye-B-ipuYEd.js";import{o as rt,r as it}from"./deliveryRecorder-C7NQZrrH.js";import{t as at}from"./x-CK8d5DC1.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-qM3ZfTHx.js";import{i as H,n as U,r as ot,t as st}from"./tabs-mZfLmn2f.js";import{t as W}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{t as G}from"./badge-C4po8DQ1.js";import{a as ct,n as K}from"./format-DGKgJf2p.js";import{a as lt,n as ut,o as dt,r as ft,t as pt}from"./dialog-BfrsWZiD.js";import{c as mt,o as ht,s as gt,u as _t}from"./searchSchemas-CS2ZgsHC.js";import{t as vt}from"./appHost-CH3EGcJw.js";import{n as yt}from"./TimeRangePicker-D3PJq1H8.js";import{t as bt}from"./FilterBar-DTVwlDpF.js";import{t as xt}from"./AdvancedFilter-Bb66m5kb.js";import{t as St}from"./DataTableShell-DRFFBx_j.js";var Ct=d(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?a():n===`agent`?`${Ne()} - ${r}`:e}function Tt(){let e=N(I.me.getMe,{host:vt})?.role===`admin`,t=N(I.deliveryTiming.getDeliveryStatus,{}),n=P(I.deliveryTiming.startDeliveryRecord),r=P(I.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:ye()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}),e?(0,J.jsx)(W,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?T():Ve()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(G,{variant:`secondary`,children:v()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:M({time:ct(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?j():b()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=N(I.deliveryTiming.listDeliverySessions,{}),n=P(I.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[d,f]=(0,q.useState)(null),{from:m,to:g}=yt(c),_=c.to===`now`?1/0:g,v=r.trim()!==``||a!==`all`||c!==Y,y=()=>{i(``),o(`all`),l(Y)},b=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=m&&t.startedAt<=_).map(e=>({...e,_id:e.sessionId}))},[t,r,a,m,_]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:Xe(),timeRange:c,onTimeRangeChange:l,onReset:y,canReset:v,children:(0,J.jsxs)(V,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:`all`,children:de()}),(0,J.jsx)(B,{value:`active`,children:E()}),(0,J.jsx)(B,{value:`stopped`,children:S()})]})]})}),(0,J.jsx)(St,{title:s(),rows:b,emptyHint:Ue(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(W,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?u():D(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,J.jsx)(tt,{size:15,"aria-hidden":!0}):(0,J.jsx)(nt,{size:15,"aria-hidden":!0})})},{header:h(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:K(e.startedAt)})},{header:O(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:K(e.stoppedAt)})},{header:oe(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:ie(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:je(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(G,{variant:`secondary`,children:E()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:S()})}],rowActions:e?e=>[{label:p(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:p(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=N(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(it(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:k()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:A()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,Le()]}),(0,J.jsxs)(W,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)($e,{size:13,"aria-hidden":!0}):(0,J.jsx)(et,{size:13,"aria-hidden":!0}),t?we():Pe()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:Ke()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:xe()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Oe()})]})}),(0,J.jsxs)(`tbody`,{children:[i(F(),r.bridge),i(Fe(),r.A),i(Re(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Te()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Be()},{value:`principalType`,label:w()},{value:`direction`,label:`direction`},{value:`roleKey`,label:_()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=Ze({from:`/settings/traces`}),t=Qe({from:`/settings/traces`}),n=e.limit,a=e.kind,s=e.statusClass??Q,c=e.principalType??Q,u=e.direction??Q,d=e.roleKey??Q,p=e.q??``,h=e.correlationId,_=ht(e.from,e.to),v=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:b,to:S}=yt(_),[C,w]=(0,q.useState)(null),[T,E]=(0,q.useState)(null),ie=e=>void t({search:t=>({...t,limit:e})}),oe=e=>void t({search:t=>({...t,kind:e})}),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),fe=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,...mt(e)})}),j=e=>void t({search:t=>({...t,adv:gt(e)}),replace:!0}),M=N(I.observability.listEvents,{limit:n}),P=N(I.observability.listEvents,{limit:n,kind:a===Z?void 0:a,...h?{correlationId:h}:{},filter:{q:p||void 0,from:b,to:S,statusClass:s===Q?void 0:s,principalType:c===Q?void 0:c,direction:u===Q?void 0:u,roleKey:d===Q?void 0:d,advanced:v.length>0?v:void 0}}),ye=(0,q.useMemo)(()=>{let e=new Set;for(let t of M??[])e.add(t.kind);return[...e].sort()},[M]),xe=(0,q.useMemo)(()=>{let e=new Set;for(let t of M??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[M]),we=p!==``||s!==Q||c!==Q||u!==Q||d!==Q||v.length>0||_.kind!==`relative`||_.from!==Nt.from;function Te(){t({search:{limit:100,kind:`all`},replace:!0})}let De=C?M?.filter(e=>e.correlationId===C):P,Oe=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(st,{value:Oe,onValueChange:e=>F(e),children:[(0,J.jsxs)(ot,{className:`w-full`,children:[(0,J.jsxs)(H,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(rt,{size:13,"aria-hidden":!0}),Ce()]}),(0,J.jsxs)(H,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),Je()]})]}),(0,J.jsx)(U,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(U,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Se(),(0,J.jsx)(`strong`,{children:ke()}),He(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ie()})]}),(0,J.jsxs)(bt,{q:p,onQChange:D,searchPlaceholder:We(),timeRange:_,onTimeRangeChange:A,onReset:Te,canReset:we,children:[(0,J.jsxs)(V,{value:s,onValueChange:O,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:Ee()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:r()}),At.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:c,onValueChange:de,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:le()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:be()}),jt.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:u,onValueChange:fe,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:_e()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:ve()}),Mt.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:d,onValueChange:k,children:[(0,J.jsx)(R,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{placeholder:ee()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:ze()}),xe.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:a===Z?``:a,placeholder:te(),"aria-label":te(),onChange:e=>{let t=e.target.value.trim();oe(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:ye.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(V,{value:String(n),onValueChange:e=>ie(Number(e)),children:[(0,J.jsx)(R,{size:`sm`,className:`w-28`,children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:kt.map(e=>(0,J.jsx)(B,{value:String(e),children:g({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:v,onChange:j}),C?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>w(null),title:ge(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[me(),(0,J.jsx)(`code`,{children:$(C)})]}),(0,J.jsx)(at,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:y()})]})}):null,(0,J.jsx)(St,{title:he(),rows:De,emptyHint:C?o():Ye(),columns:[{header:ue(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:K(e.at)})},{header:ne(),sort:e=>e.kind,cell:e=>(0,J.jsx)(G,{variant:`secondary`,children:e.kind})},{header:x(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":m(),children:`✓`})}},{header:ce(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(G,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ae(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(G,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:re(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(G,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Ae(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:i(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:Me(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:se(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:l(),onClick:()=>w(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:f(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:pe()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:T,onClose:()=>E(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(pt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ut,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(dt,{className:`oc-traces__meta-title`,children:[qe(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(G,{variant:`outline`,children:c()})]}),(0,J.jsx)(ft,{children:fe()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,Aj as i,Az as a,Bj as o,Bz as s,Cj as c,Dj as l,Dz as u,E as d,Ej as f,Ez as p,Fj as m,Fz as h,Gj as g,Gu as _,Gz as v,Hj as y,Hz as b,Ij as x,Iz as S,Jj as ee,Jz as C,Kj as te,Ku as w,Kz as T,Lj as ne,Lz as E,Mj as re,Mz as ie,Nj as ae,Nz as oe,Oj as se,Oz as D,Pj as ce,Pz as O,Qj as le,Rj as ue,Rz as de,Sj as fe,Tj as pe,Tz as k,Uj as me,Uz as A,Vj as he,Vz as j,Wj as ge,Wz as M,XX as N,Xj as _e,YX as P,Yj as ve,Yz as ye,Zj as be,_z as xe,aM as Se,bz as Ce,cz as we,dz as Te,eM as Ee,fz as De,gz as Oe,hz as F,iM as ke,jj as Ae,jz as je,kj as Me,kz as Ne,lz as Pe,mz as Fe,nM as Ie,oz as Le,pz as Re,qj as ze,qu as Be,qz as Ve,rM as He,sz as Ue,t as I,tM as We,uz as Ge,vz as Ke,wj as qe,yz as Je,zj as Ye,zz as Xe}from"./api-DSJJn0d7.js";import{n as Ze,t as Qe}from"./useNavigate-D3GIoxyW.js";import{t as $e}from"./check-DmQzfrws.js";import{t as et}from"./copy-BaUCUMp2.js";import{n as tt,t as nt}from"./eye-B-ipuYEd.js";import{o as rt,r as it}from"./deliveryRecorder-C7NQZrrH.js";import{t as at}from"./x-CK8d5DC1.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-qM3ZfTHx.js";import{i as H,n as U,r as ot,t as st}from"./tabs-mZfLmn2f.js";import{t as W}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{t as G}from"./badge-C4po8DQ1.js";import{a as ct,n as K}from"./format-DGKgJf2p.js";import{a as lt,n as ut,o as dt,r as ft,t as pt}from"./dialog-BfrsWZiD.js";import{c as mt,o as ht,s as gt,u as _t}from"./searchSchemas-Dm-Qg010.js";import{t as vt}from"./appHost-CH3EGcJw.js";import{n as yt}from"./TimeRangePicker-D3PJq1H8.js";import{t as bt}from"./FilterBar-DTVwlDpF.js";import{t as xt}from"./AdvancedFilter-Bb66m5kb.js";import{t as St}from"./DataTableShell-DRFFBx_j.js";var Ct=d(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?a():n===`agent`?`${Ne()} - ${r}`:e}function Tt(){let e=N(I.me.getMe,{host:vt})?.role===`admin`,t=N(I.deliveryTiming.getDeliveryStatus,{}),n=P(I.deliveryTiming.startDeliveryRecord),r=P(I.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:ye()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}),e?(0,J.jsx)(W,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?T():Ve()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(G,{variant:`secondary`,children:v()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:M({time:ct(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?j():b()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=N(I.deliveryTiming.listDeliverySessions,{}),n=P(I.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[d,f]=(0,q.useState)(null),{from:m,to:g}=yt(c),_=c.to===`now`?1/0:g,v=r.trim()!==``||a!==`all`||c!==Y,y=()=>{i(``),o(`all`),l(Y)},b=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=m&&t.startedAt<=_).map(e=>({...e,_id:e.sessionId}))},[t,r,a,m,_]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:Xe(),timeRange:c,onTimeRangeChange:l,onReset:y,canReset:v,children:(0,J.jsxs)(V,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:`all`,children:de()}),(0,J.jsx)(B,{value:`active`,children:E()}),(0,J.jsx)(B,{value:`stopped`,children:S()})]})]})}),(0,J.jsx)(St,{title:s(),rows:b,emptyHint:Ue(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(W,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?u():D(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,J.jsx)(tt,{size:15,"aria-hidden":!0}):(0,J.jsx)(nt,{size:15,"aria-hidden":!0})})},{header:h(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:K(e.startedAt)})},{header:O(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:K(e.stoppedAt)})},{header:oe(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:ie(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:je(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(G,{variant:`secondary`,children:E()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:S()})}],rowActions:e?e=>[{label:p(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:p(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=N(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(it(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:k()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:A()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,Le()]}),(0,J.jsxs)(W,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)($e,{size:13,"aria-hidden":!0}):(0,J.jsx)(et,{size:13,"aria-hidden":!0}),t?we():Pe()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:Ke()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:xe()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Oe()})]})}),(0,J.jsxs)(`tbody`,{children:[i(F(),r.bridge),i(Fe(),r.A),i(Re(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Te()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Be()},{value:`principalType`,label:w()},{value:`direction`,label:`direction`},{value:`roleKey`,label:_()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=Ze({from:`/settings/traces`}),t=Qe({from:`/settings/traces`}),n=e.limit,a=e.kind,s=e.statusClass??Q,c=e.principalType??Q,u=e.direction??Q,d=e.roleKey??Q,p=e.q??``,h=e.correlationId,_=ht(e.from,e.to),v=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:b,to:S}=yt(_),[C,w]=(0,q.useState)(null),[T,E]=(0,q.useState)(null),ie=e=>void t({search:t=>({...t,limit:e})}),oe=e=>void t({search:t=>({...t,kind:e})}),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),fe=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,...mt(e)})}),j=e=>void t({search:t=>({...t,adv:gt(e)}),replace:!0}),M=N(I.observability.listEvents,{limit:n}),P=N(I.observability.listEvents,{limit:n,kind:a===Z?void 0:a,...h?{correlationId:h}:{},filter:{q:p||void 0,from:b,to:S,statusClass:s===Q?void 0:s,principalType:c===Q?void 0:c,direction:u===Q?void 0:u,roleKey:d===Q?void 0:d,advanced:v.length>0?v:void 0}}),ye=(0,q.useMemo)(()=>{let e=new Set;for(let t of M??[])e.add(t.kind);return[...e].sort()},[M]),xe=(0,q.useMemo)(()=>{let e=new Set;for(let t of M??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[M]),we=p!==``||s!==Q||c!==Q||u!==Q||d!==Q||v.length>0||_.kind!==`relative`||_.from!==Nt.from;function Te(){t({search:{limit:100,kind:`all`},replace:!0})}let De=C?M?.filter(e=>e.correlationId===C):P,Oe=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(st,{value:Oe,onValueChange:e=>F(e),children:[(0,J.jsxs)(ot,{className:`w-full`,children:[(0,J.jsxs)(H,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(rt,{size:13,"aria-hidden":!0}),Ce()]}),(0,J.jsxs)(H,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),Je()]})]}),(0,J.jsx)(U,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(U,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Se(),(0,J.jsx)(`strong`,{children:ke()}),He(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ie()})]}),(0,J.jsxs)(bt,{q:p,onQChange:D,searchPlaceholder:We(),timeRange:_,onTimeRangeChange:A,onReset:Te,canReset:we,children:[(0,J.jsxs)(V,{value:s,onValueChange:O,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:Ee()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:r()}),At.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:c,onValueChange:de,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:le()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:be()}),jt.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:u,onValueChange:fe,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:_e()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:ve()}),Mt.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:d,onValueChange:k,children:[(0,J.jsx)(R,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{placeholder:ee()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:ze()}),xe.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:a===Z?``:a,placeholder:te(),"aria-label":te(),onChange:e=>{let t=e.target.value.trim();oe(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:ye.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(V,{value:String(n),onValueChange:e=>ie(Number(e)),children:[(0,J.jsx)(R,{size:`sm`,className:`w-28`,children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:kt.map(e=>(0,J.jsx)(B,{value:String(e),children:g({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:v,onChange:j}),C?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>w(null),title:ge(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[me(),(0,J.jsx)(`code`,{children:$(C)})]}),(0,J.jsx)(at,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:y()})]})}):null,(0,J.jsx)(St,{title:he(),rows:De,emptyHint:C?o():Ye(),columns:[{header:ue(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:K(e.at)})},{header:ne(),sort:e=>e.kind,cell:e=>(0,J.jsx)(G,{variant:`secondary`,children:e.kind})},{header:x(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":m(),children:`✓`})}},{header:ce(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(G,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ae(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(G,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:re(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(G,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Ae(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:i(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:Me(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:se(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:l(),onClick:()=>w(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:f(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:pe()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:T,onClose:()=>E(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(pt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ut,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(dt,{className:`oc-traces__meta-title`,children:[qe(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(G,{variant:`outline`,children:c()})]}),(0,J.jsx)(ft,{children:fe()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|