@lacneu/atrium 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-CSh3tcHp.js +1 -0
- package/dist/assets/{AdvancedFilter-DEhAlKxd.js → AdvancedFilter-CcMolhzz.js} +1 -1
- package/dist/assets/AgentFilesTab-DD7nQPIs.js +3 -0
- package/dist/assets/AnomaliesTab-CGUn5M38.js +1 -0
- package/dist/assets/AuditTab-BAmXWdpn.js +1 -0
- package/dist/assets/BridgeTab-B6u6wsyS.js +1 -0
- package/dist/assets/ChatDefaultsTab-T-SjwUiO.js +1 -0
- package/dist/assets/{DataTableShell-BZvBoZ1G.js → DataTableShell-DKcU9E8v.js} +1 -1
- package/dist/assets/{DetailChips-BFtzcoXp.js → DetailChips-BHFRTi5X.js} +1 -1
- package/dist/assets/FeedbacksTab-BTNSHMXX.js +1 -0
- package/dist/assets/{FieldLabel-CPekO9oe.js → FieldLabel-BhXlfWG6.js} +1 -1
- package/dist/assets/FilesTab-CQ9OQmvl.js +1 -0
- package/dist/assets/{FilterBar-BoX1wF11.js → FilterBar-BVzupjQK.js} +1 -1
- package/dist/assets/GroupsTab-DQ1ql751.js +1 -0
- package/dist/assets/InstancesTab-DnDS69jL.js +1 -0
- package/dist/assets/IntegrationsTab-x8aaAzQY.js +1 -0
- package/dist/assets/KpiTab-CSduQ5s8.js +1 -0
- package/dist/assets/PreferencesTab-DylL7Q2H.js +1 -0
- package/dist/assets/PromptInjectionsTab-DbjWSlzY.js +4 -0
- package/dist/assets/RolesTab-Bx3akDip.js +1 -0
- package/dist/assets/ScheduledTab-nsdy0Bh_.js +1 -0
- package/dist/assets/ServiceAccountsTab-D8rsyxJF.js +1 -0
- package/dist/assets/SubAgentReportsTab-CSj0Hba1.js +1 -0
- package/dist/assets/ThemeShowroom-BwmvZBXd.js +1 -0
- package/dist/assets/{TimeRangePicker-DCJdh6EO.js → TimeRangePicker-0VkTfHt_.js} +1 -1
- package/dist/assets/TracesTab-QD7eyy39.js +1 -0
- package/dist/assets/UsersTab-C0eniehN.js +1 -0
- package/dist/assets/VoiceTab-BRfeYXDu.js +1 -0
- package/dist/assets/{button-tNZOr3G0.js → button-B49JSqzm.js} +1 -1
- package/dist/assets/{card-DMGoFSD5.js → card-eKiPt2Wc.js} +1 -1
- package/dist/assets/chevrons-up-down-CWDbG1Cy.js +1 -0
- package/dist/assets/{compatView-qw-7WcB1.js → compatView-C1X2zgFr.js} +1 -1
- package/dist/assets/dispatchErrorInfo-DdP7JU_7.js +1 -0
- package/dist/assets/{dist-M-eo0yR9.js → dist-BINM1nJo.js} +1 -1
- package/dist/assets/{dist-4E5oRhRr.js → dist-C0sZxuDo.js} +1 -1
- package/dist/assets/{dist-C9XukVQS.js → dist-CjH9Ohdx.js} +5 -5
- package/dist/assets/{dist-DtE7xrqx.js → dist-DCbB4klt.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-B3Wf8Ifi.js → highlighted-body-OFNGDK62-CwsFUg2x.js} +1 -1
- package/dist/assets/index-DnuEILeM.js +238 -0
- package/dist/assets/mermaid-GHXKKRXX-d9fLQ_Fe.js +1 -0
- package/dist/assets/{pdf-CYI0xfzX.js → pdf-BZLyWd4d.js} +1 -1
- package/dist/assets/roleDescriptions-C6Gqx97s.js +1 -0
- package/dist/assets/{table-CoppdJed.js → table-COx9FvKU.js} +1 -1
- package/dist/assets/{tabs-Bu9zEbbu.js → tabs-BFg7qw3e.js} +1 -1
- package/dist/assets/x-DYJkW-kP.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AccessTab-iPKgNnAc.js +0 -1
- package/dist/assets/AgentFilesTab-uzSbUBf1.js +0 -3
- package/dist/assets/AnomaliesTab-DXI-ZW4r.js +0 -1
- package/dist/assets/AuditTab-CFw0FMDV.js +0 -1
- package/dist/assets/BridgeTab-CI73YoPy.js +0 -1
- package/dist/assets/ChatDefaultsTab-BOHRRXy-.js +0 -1
- package/dist/assets/FeedbacksTab-DcCX2e3C.js +0 -1
- package/dist/assets/FilesTab-DksBjXvy.js +0 -1
- package/dist/assets/GroupsTab-mRKoUhuj.js +0 -1
- package/dist/assets/InstancesTab-DisaAOdw.js +0 -1
- package/dist/assets/IntegrationsTab-CXyj-0nk.js +0 -1
- package/dist/assets/KpiTab-CTlnp1vC.js +0 -1
- package/dist/assets/PreferencesTab-DLD3Q_a_.js +0 -1
- package/dist/assets/PromptInjectionsTab-DClwAV2n.js +0 -4
- package/dist/assets/RolesTab-z5qmxUA4.js +0 -1
- package/dist/assets/ScheduledTab-DY0yxiVf.js +0 -1
- package/dist/assets/ServiceAccountsTab-BUgaEoQf.js +0 -1
- package/dist/assets/SubAgentReportsTab-D4bI4Q4l.js +0 -1
- package/dist/assets/ThemeShowroom-BqvAKdho.js +0 -1
- package/dist/assets/TracesTab-CbJ8-Kh8.js +0 -1
- package/dist/assets/UsersTab-Ds3Axm6j.js +0 -1
- package/dist/assets/VoiceTab-DCknX6Kl.js +0 -1
- package/dist/assets/chevrons-up-down-Bm0f55JZ.js +0 -1
- package/dist/assets/dispatchErrorInfo-5YMmGbec.js +0 -1
- package/dist/assets/index-BAIDhn1P.js +0 -238
- package/dist/assets/mermaid-GHXKKRXX-BDm9gAqz.js +0 -1
- package/dist/assets/roleDescriptions-Cfnf-wzM.js +0 -1
- package/dist/assets/x-CAfZeMdG.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,Cd as i,Dd as a,E as o,EP as s,Ed as c,FP as l,Md as u,Nd as d,Od as f,Pd as p,Sd as m,Td as h,bd as g,jd as _,kd as v,wd as y,xd as b}from"./dist-CjH9Ohdx.js";import{C as x,S,T as C,dt as w,w as T,x as E}from"./index-DnuEILeM.js";var D=t(e(),1);function O(e){return e===`user`?y():e===`all`?i():m({group:e.group})}function k(e){return e===`common`?b():e===`owner`?g():m({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=l(o.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=l(o.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":d(),children:(0,A.jsx)(C,{placeholder:d()})}),(0,A.jsx)(S,{children:(e??[]).map(e=>(0,A.jsx)(x,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:h()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:a()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gp as r,Hp as i,Kp as a,Up as o,Vp as s,Wp as c,qp as l}from"./dist-CjH9Ohdx.js";import{i as u}from"./dist-DCbB4klt.js";import{t as d}from"./x-DYJkW-kP.js";import{t as f}from"./button-B49JSqzm.js";import{Bt as p,C as m,S as h,T as g,ft as _,w as v,x as y}from"./index-DnuEILeM.js";import{r as b}from"./TimeRangePicker-0VkTfHt_.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),a(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(v,{size:`sm`,className:`w-40`,children:(0,S.jsx)(g,{placeholder:c()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(v,{size:`sm`,className:`w-28`,children:(0,S.jsx)(g,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:o()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(p,{}),s()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,$r as i,Bc as a,Br as o,DD as s,E as c,EP as l,FP as u,Gc as d,Hc as f,Hr as p,Jc as m,Kc as h,Lr as g,MP as _,OP as v,PP as y,Qc as b,Ql as x,Qr as S,Rr as C,Uc as w,Ur as T,Vc as E,Vr as D,Wc as O,Xc as k,Xl as ee,Xr as A,Yc as j,Zc as M,Zr as N,ai as P,al as te,ci as F,cl as I,di as L,dl as R,ei as ne,el as re,fi as ie,fl as z,gi as B,hi as V,hl as H,ii as U,il as W,li as G,ll as ae,mi as oe,ml as se,ni as ce,nl as le,oi as ue,ol as de,pi as fe,pl as pe,qc as me,ri as he,rl as ge,si as _e,sl as ve,ti as ye,tl as be,ui as xe,ul as Se,zr as Ce}from"./dist-CjH9Ohdx.js";import{t as K}from"./button-B49JSqzm.js";import{C as we,G as Te,H as q,J as Ee,K as De,Pt as J,Q as Oe,S as ke,T as Ae,X as je,Y as Me,Z as Ne,_t as Pe,b as Fe,dt as Ie,ht as Le,mt as Re,pt as ze,q as Be,vt as Ve,w as He,wt as Ue,x as We}from"./index-DnuEILeM.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-C1X2zgFr.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
+
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=u(c.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=u(c.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=u(c.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=u(c.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),d=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[f,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!d||d.length===0||(!f||!d.some(e=>$(e)===f))&&p($(d[0]))},[d,f]);let m=d?.find(e=>$(e)===f)??null,h=_(c.agentFiles.listAgentFiles),[g,y]=(0,Y.useState)({status:`idle`}),b=m?.instanceName??null,x=m?.agentId??null,S=u(c.compat.forInstance,n&&b!==null?{instanceName:b}:`skip`),C=n&&b!==null?Fe(S,`agentFiles`):null,w=C===null?!1:C===`loading`?null:C.blocked,T=(0,Y.useCallback)(async()=>{if(!(b===null||x===null)){y({status:`loading`});try{y({status:`done`,files:(await h({instanceName:b,agentId:x})).files})}catch{y({status:`error`})}}},[h,b,x]);(0,Y.useEffect)(()=>{w===!1&&T()},[T,w]);let[E,D]=(0,Y.useState)(null),O=u(c.agentFileCuration.listCurations,t&&b!==null&&x!==null?{instanceName:b,agentId:x}:`skip`),k=u(c.agentFileCuration.curationSettings,t&&b!==null?{instanceName:b}:`skip`),A=_(c.agentFileCuration.requestCuration),[j,M]=(0,Y.useState)(null),[N,P]=(0,Y.useState)(null),{toast:F}=q(),ne=(0,Y.useMemo)(()=>{let e=new Map;for(let t of O??[])e.has(t.name)||e.set(t.name,t);return e},[O]),re=(0,Y.useCallback)(async e=>{if(!(b===null||x===null)){M(e);try{let t=await A({instanceName:b,agentId:x,name:e,trigger:`manual`});t.ok?F({title:fe(),variant:`success`}):F({title:ie({reason:t.reason??`unknown`}),variant:`error`})}catch{F({title:L(),variant:`error`})}finally{M(null)}}},[A,b,x,F]),B=v(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||d===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(We,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(He,{size:`sm`,"aria-label":se(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(ke,{children:(r??[]).map(e=>(0,Q.jsx)(we,{value:e.name,children:e.name},e.name))})]}):null,d.length>0?(0,Q.jsxs)(We,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(He,{size:`sm`,"aria-label":pe(),children:(0,Q.jsx)(Ae,{})}),(0,Q.jsx)(ke,{children:d.map(e=>(0,Q.jsx)(we,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()})]}),m===null?null:C===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):C!==null&&C.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(C.gatewayVersion,C.provider)]}):g.status===`loading`||g.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):g.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[Se(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:ee()})]}):g.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:g.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Ie,{variant:`outline`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:I({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ve({pct:V.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":de()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>D(e),children:t?W():ge()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:k?.budgetChars??null,enabled:k?.enabled??!1,curation:ne.get(e.name)??null,inFlight:j===e.name,onCurate:()=>void re(e.name),onReview:e=>P(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:te({used:Z(Ze(g.files),B),total:Z(Je,B),pct:V.format(Xe(Ze(g.files)))})})]}),E&&m?(0,Q.jsx)(rt,{instanceName:m.instanceName,agentId:m.agentId,name:E.name,isAdmin:t,onClose:()=>D(null),onSaved:()=>void T()}):null,N?(0,Q.jsx)(it,{curationId:N,onClose:()=>P(null),onApplied:()=>{P(null),T()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:V()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ie,{variant:`outline`,className:`oc-afiles__curate-status`,children:oe()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:B()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:o,onSaved:u}){let p=_(c.agentFiles.getAgentFile),g=_(c.agentFiles.setAgentFile),y=q(),[S,C]=(0,Y.useState)(null),[T,D]=(0,Y.useState)(!1),[A,N]=(0,Y.useState)(``),[P,te]=(0,Y.useState)(!1),[F,I]=(0,Y.useState)(!1),[L,R]=(0,Y.useState)(!1),[ne,ie]=(0,Y.useState)(!1),z=(0,Y.useCallback)(async r=>{D(!1);try{let i=await p({instanceName:e,agentId:t,name:n});C({content:i.content,updatedAtMs:i.updatedAtMs}),r||N(i.content),R(!1)}catch{D(!0)}},[p,e,t,n]);(0,Y.useEffect)(()=>{z(!1)},[z]);async function B(){if(S!==null){I(!0),ie(!1);try{await g({instanceName:e,agentId:t,name:n,content:A,baseUpdatedAtMs:S.updatedAtMs??void 0}),y.success(k({name:n})),u(),await z(!1)}catch(e){et(e)?R(!0):ie(!0)}finally{I(!1)}}}let V=S!==null&&A!==S.content,H=(0,Y.useMemo)(()=>S===null?null:$e(S.content,A),[S,A]),U=A.length>X,W=v(),G=(0,Y.useMemo)(()=>new Intl.NumberFormat(W),[W]);return(0,Q.jsx)(ze,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Ve,{children:le({name:n})}),(0,Q.jsxs)(Le,{children:[be({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,re()]})]})]}),T?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[m(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void z(!1),children:ee()})]}):S===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:A,readOnly:!i,spellCheck:!1,onChange:e=>N(e.target.value),"aria-label":le({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:r()}),L?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[me(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void z(!0),children:h()})]}):null,ne?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:j()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${U?` is-over`:``}`,children:b({count:G.format(A.length),max:G.format(X)})}),i?(0,Q.jsx)(K,{size:`sm`,disabled:!V||F||L,onClick:()=>te(!0),children:F?x():M()}):null]})]}),(0,Q.jsx)(Te,{open:P,onOpenChange:te,children:(0,Q.jsxs)(Ee,{children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Oe,{children:d({name:n})}),(0,Q.jsx)(Me,{children:O({agent:t})})]}),H?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:w({added:H.added,removed:H.removed})}),H.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:f()}),H.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,H.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),H.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Be,{children:s()}),(0,Q.jsx)(De,{onClick:()=>void B(),children:a()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=u(c.agentFileCuration.getProposal,{curationId:e}),a=_(c.agentFileCuration.approveCuration),s=y(c.agentFileCuration.rejectCuration),{toast:d}=q(),[f,m]=(0,Y.useState)(null),[h,b]=(0,Y.useState)(!1),[w,E]=(0,Y.useState)(``),O=v(),k=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function ee(){m(`approve`);try{let t=await a({curationId:e});t.ok?(d({title:xe(),variant:`success`}),n()):d({title:t.reason===`conflict`?F():_e({reason:t.reason??`unknown`}),variant:`error`})}catch{d({title:L(),variant:`error`})}finally{m(null)}}async function j(n){m(`reject`);try{let r=w.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?d({title:n?C():G(),variant:`success`}):d({title:U(),variant:`error`}),t()}catch{d({title:L(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(ze,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Ve,{children:r?ue({name:r.name}):l()}),(0,Q.jsx)(Le,{children:P()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[he({before:Z(r.beforeSize,O),after:Z(r.proposedSize,O)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,ce()]}):null]}),k?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ye({added:k.added,removed:k.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:g({feedback:r.feedback})}):null,k&&k.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:A()}),(0,Q.jsx)(`ul`,{children:k.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:N()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ne()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:T()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:p(),value:w,onChange:e=>E(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>b(!1),disabled:f!==null,children:D()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void j(!1),disabled:f!==null,children:f===`reject`?x():o()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void j(!0),disabled:f!==null,children:f===`reject`?x():Ce()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>b(!0),disabled:f!==null||r==null,children:i()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void ee(),disabled:f!==null||r==null,children:f===`approve`?x():S()})]})]})})}export{tt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as i,By as ee,Cy as te,Dy as ne,E as a,Ey as re,FP as o,Fy as s,Gy as c,Hy as ie,Iy as ae,Jy as oe,Ky as se,Ly as ce,My as l,Ny as le,Oy as ue,PP as de,Py as u,Qy as fe,Ry as pe,Sy as d,Ty as f,Uy as p,Vy as m,Wy as h,Xy as me,Yy as he,Zy as ge,_y as g,by as _e,dy as _,eb as ve,fy as v,gy as y,hy as b,jy as ye,ky as x,my as S,nb as C,py as w,qy as T,rb as E,tb as D,vy as O,wy as k,xy as A,yy as j,zy as M}from"./dist-CjH9Ohdx.js";import{C as N,H as P,S as F,T as I,U as be,_t as L,dt as R,i as xe,mt as z,nn as B,o as Se,pt as V,rn as Ce,rt as we,vt as H,w as U,wt as Te,x as W}from"./index-DnuEILeM.js";import{n as Ee}from"./TimeRangePicker-0VkTfHt_.js";import{t as De}from"./FilterBar-BVzupjQK.js";import{t as Oe}from"./DataTableShell-DKcU9E8v.js";import{t as G}from"./dispatchErrorInfo-DdP7JU_7.js";var K=t(e(),1),q=n(),J=`__all__`,ke=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ae(e){return e===`open`?E():e===`acknowledged`?C():D()}var je=[`info`,`warn`,`critical`],Me=[`detector`,`agent`,`user`],Ne={kind:`relative`,from:`now-30d`,to:`now`},Pe=200,Y=`all`;function X(){let e=Ce({from:`/settings/anomalies`}),t=B({from:`/settings/anomalies`}),n=e.q??``,g=e.status===Y?J:e.status,_=e.severity??J,v=e.kind??J,[y,b]=(0,K.useState)(J),S=xe(e.from,e.to),{from:C,to:w}=Ee(S),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,status:e===J?Y:e})}),O=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),L=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),z=e=>void t({search:t=>({...t,...Se(e)})}),V=be(),H=P(),G=de(a.anomalies.resolveAnomaly),X=(o(a.me.getMe,{host:Te})?.permissions??[]).includes(`admin.manage`),Z=o(a.anomalies.listAnomalies,{limit:Pe,filter:{q:n||void 0,from:C,to:w,anomalyStatus:g===J?void 0:g,severity:_===J?void 0:_,source:y===J?void 0:y,kind:v===J?void 0:v}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),ze=n!==``||g!==`open`||_!==J||y!==J||v!==J||S.kind!==`relative`||S.from!==Ne.from;function Be(){b(J),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await V({title:ve(),description:(0,q.jsxs)(q.Fragment,{children:[r(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,fe(),` `,(0,q.jsx)(`strong`,{children:ge()}),`.`,` `,me()]}),confirmLabel:he()}))try{await G({anomalyId:e._id,status:`resolved`}),H.success(oe(),e.kind)}catch(e){H.error(T(),e)}}async function He(e){try{await G({anomalyId:e._id,status:`acknowledged`}),H.success(se(),e.kind)}catch(e){H.error(c(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,q.jsx)(`strong`,{children:p()}),` `,ie(),` `,(0,q.jsx)(`strong`,{children:m()}),` `,ee(),` `,(0,q.jsx)(`strong`,{children:M()}),` `,pe(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:ce()})]}),(0,q.jsxs)(De,{q:n,onQChange:E,searchPlaceholder:ae(),timeRange:S,onTimeRangeChange:z,onReset:Be,canReset:ze,children:[(0,q.jsxs)(W,{value:g,onValueChange:D,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:s()}),ke.map(e=>(0,q.jsx)(N,{value:e.value,children:Ae(e.value)},e.value))]})]}),(0,q.jsxs)(W,{value:_,onValueChange:O,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:u()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:le()}),je.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]}),(0,q.jsxs)(W,{value:y,onValueChange:b,children:[(0,q.jsx)(U,{size:`sm`,className:`w-32`,children:(0,q.jsx)(I,{placeholder:l()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:ye()}),Me.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]}),(0,q.jsxs)(W,{value:v,onValueChange:L,children:[(0,q.jsx)(U,{size:`sm`,className:`w-36`,children:(0,q.jsx)(I,{placeholder:i()})}),(0,q.jsxs)(F,{children:[(0,q.jsx)(N,{value:J,children:x()}),Q.map(e=>(0,q.jsx)(N,{value:e,children:e},e))]})]})]}),(0,q.jsx)(Oe,{title:ue(),rows:Z,emptyHint:g===`open`?ne():re(),rowActions:e=>X&&e.status===`open`?[{label:f(),onSelect:()=>void Ve(e)},{label:k(),onSelect:()=>void He(e)}]:[],columns:[{header:te(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:we(e.at)}),sort:e=>e.at},{header:i(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:u(),cell:e=>(0,q.jsx)(Le,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:d(),cell:e=>(0,q.jsx)(Re,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:l(),cell:e=>(0,q.jsx)(R,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:A(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(Ie,{row:e})]}),sort:e=>e.message},{header:_e(),cell:e=>(0,q.jsx)(Fe,{row:e}),sort:e=>e.evidence??null},{header:j(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Z(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function 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 Fe({row:e}){let t=B();if(e.kind===`subagent.failure`){let n=Q(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,O()]}):null]})}let n=Z(e);if(!n.dominantCode)return(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,O()]}):null]})}function Ie({row:e}){let[t,n]=(0,K.useState)(!1),r=o(a.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[g(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(V,{open:t,onOpenChange:n,children:(0,q.jsxs)(z,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(L,{children:(0,q.jsx)(H,{children:y()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:b()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:S()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Le({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Re({status:e}){return e===`open`?(0,q.jsx)(R,{variant:`destructive`,children:w()}):e===`acknowledged`?(0,q.jsx)(R,{variant:`secondary`,children:v()}):(0,q.jsx)(R,{variant:`outline`,children:_()})}function $(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,E as i,FP as a,Fn as o,In as s,Jb as c,Ln as l,Pn as u,Qb as d,Rn as f,Xb as p,Yb as m,Zb as h,ax as g,cx as _,ex as v,ix as y,nx as b,ox as x,rx as S,sx as C,tx as w,zn as T}from"./dist-CjH9Ohdx.js";import{C as E,S as D,T as O,a as k,i as A,n as j,nn as M,o as N,rn as P,rt as F,s as I,w as L,x as R}from"./index-DnuEILeM.js";import{n as ee}from"./TimeRangePicker-0VkTfHt_.js";import{t as z}from"./FilterBar-BVzupjQK.js";import{t as B}from"./AdvancedFilter-CcMolhzz.js";import{t as V}from"./DataTableShell-DKcU9E8v.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:j,to:`now`},G=`__all__`,K=[{value:`action`,label:T()},{value:`realLabel`,label:f()},{value:`targetLabel`,label:l()},{value:`impersonated`,label:s()},{value:`resource`,label:o()},{value:`resourceId`,label:u()}];function q(){let e=P({from:`/settings/audit`}),t=M({from:`/settings/audit`}),n=e.q??``,o=e.action??G,s=e.impersonated??G,l=e.resource??G,u=A(e.from,e.to),f=(0,H.useMemo)(()=>I(e.adv),[e.adv]),{from:T,to:j}=ee(u),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...N(e)})}),Q=e=>void t({search:t=>({...t,adv:k(e)}),replace:!0}),$=a(i.admin.listAudit,{filter:{q:n||void 0,from:T,to:j,action:o===G?void 0:o,resource:l===G?void 0:l,impersonated:s===G?void 0:s===`yes`,advanced:f.length>0?f:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||o!==G||s!==G||l!==G||f.length>0||u.kind!==`relative`||u.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:C()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:x(),timeRange:u,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(R,{value:o,onValueChange:J,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:g()})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:y()}),te.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]}),(0,U.jsxs)(R,{value:s,onValueChange:Y,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:S()}),(0,U.jsx)(E,{value:`yes`,children:b()}),(0,U.jsx)(E,{value:`no`,children:w()})]})]}),(0,U.jsxs)(R,{value:l,onValueChange:X,children:[(0,U.jsx)(L,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:v()})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(E,{value:G,children:r()}),ne.map(e=>(0,U.jsx)(E,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:f,onChange:Q}),(0,U.jsx)(V,{title:d(),rows:$,emptyHint:h(),columns:[{header:p(),cell:e=>F(e.at),sort:e=>e.at},{header:g(),cell:e=>e.action,sort:e=>e.action},{header:m(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:c(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:v(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$h as i,Ag as a,Bh as o,Cc as s,Cg as c,D as l,Dc as u,Dg as d,E as f,Ec as p,Eg as m,FP as h,Fh as g,Gh as _,Hh as v,Ih as y,Jh as b,Kh as x,Lh as S,MP as ee,Nh as C,Oc as w,Og as te,PP as ne,Ph as T,Qg as re,Qh as ie,Rh as ae,Sc as oe,Sg as se,Tc as ce,Tg as le,Uh as ue,Vh as de,Wh as fe,Xh as pe,Yh as me,Zh as he,_c as ge,_g as _e,a_ as ve,ag as ye,an as be,bc as xe,bg as Se,c_ as Ce,cg as E,d_ as we,dg as Te,eg as Ee,f_ as De,fg as Oe,gg as ke,hg as Ae,i_ as je,ig as Me,in as Ne,kc as Pe,kg as Fe,l_ as Ie,lg as Le,ln as Re,mg as ze,n_ as Be,ng as Ve,nn as He,o_ as Ue,og as We,on as Ge,pc as Ke,pg as qe,qh as D,r_ as Je,rg as Ye,rn as Xe,s_ as Ze,sg as Qe,tg as $e,ug as et,vc as tt,vg as nt,wc as O,wg as rt,xc as it,xg as at,yc as ot,yg as st,zh as ct}from"./dist-CjH9Ohdx.js";import{i as k,r as lt}from"./dist-DCbB4klt.js";import{t as ut}from"./chevrons-up-down-CWDbG1Cy.js";import{i as dt,n as A,o as ft,r as pt,s as mt}from"./FieldLabel-BhXlfWG6.js";import{i as ht,n as gt,r as _t,t as vt}from"./tabs-BFg7qw3e.js";import{t as j}from"./button-B49JSqzm.js";import{$ as yt,$t as M,C as N,H as bt,Kt as xt,Lt as St,Pt as P,S as F,T as I,_t as Ct,dt as L,en as wt,et as Tt,ft as R,h as Et,ht as Dt,it as z,m as Ot,mt as kt,nn as At,pt as jt,rn as Mt,rt as Nt,tt as Pt,vt as Ft,w as B,wt as It,x as V}from"./index-DnuEILeM.js";import{r as Lt}from"./locales-CPjguROj.js";import{a as Rt,i as H,n as zt,o as U,r as W,t as Bt}from"./table-COx9FvKU.js";import{t as Vt}from"./FilterBar-BVzupjQK.js";import{a as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt}from"./compatView-C1X2zgFr.js";import{t as G}from"./dispatchErrorInfo-DdP7JU_7.js";var Jt=l(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Yt=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Xt(e){return e.filter(e=>e.state===`error`)}function Zt(e){return e.reachable&&Xt(e.targets).length===0}function Qt(e){return Zt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function $t(e){return e.state===`error`&&e.lastErrorCode!==null}function en(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function tn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function nn(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return tn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,rn={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function an(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function on(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function sn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function cn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Wt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function ln(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=sn(t.key,e),a=sn(t.key,r);return i&&a?0:i?1:a?-1:n*cn(t.key,e,r)})}function un(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function dn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function fn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Wt(e,t)??Z(e,t))}var Q=n();function pn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(rn),[i,a]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>un(s),[s]),l=(0,K.useMemo)(()=>dn(s),[s]),u=(0,K.useMemo)(()=>fn(s),[s]),d=(0,K.useMemo)(()=>ln(on(s,n),i),[s,n,i]);function f(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Vt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:b(),onReset:()=>r(rn),canReset:an(n),children:[(0,Q.jsxs)(V,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(B,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(I,{placeholder:x()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(N,{value:Y,children:D()}),c.map(e=>(0,Q.jsx)(N,{value:e,children:hn(e)},e))]})]}),(0,Q.jsxs)(V,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(B,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(I,{placeholder:_()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(N,{value:Y,children:D()}),l.map(e=>(0,Q.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(V,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(B,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(I,{placeholder:fe()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(N,{value:Y,children:D()}),u.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):(0,Q.jsxs)(Bt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Rt,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)($,{label:v(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:de(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:o(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ct(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ae(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(H,{children:S()}),(0,Q.jsx)($,{label:y(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(zt,{children:d.map(e=>(0,Q.jsx)(mn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(H,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(lt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(k,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function mn({r:e}){let t=$t(e)?G(e.lastErrorCode):null,n=en(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(W,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(gn,{state:e.state})}),(0,Q.jsx)(W,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(W,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:pe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(W,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:z(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(W,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${z(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[me({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${z(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function hn(e){return e===`connected`?g():e===`error`?T():C()}function gn({state:e}){return e===`connected`?(0,Q.jsx)(L,{variant:`secondary`,children:g()}):e===`error`?(0,Q.jsx)(L,{variant:`destructive`,children:T()}):(0,Q.jsx)(L,{variant:`outline`,children:C()})}function _n(){return h(f.bridgeHealth.getBridgeHealth,{})}function vn(){let e=_n(),t=h(f.compat.getBridgeCompat,{}),n=h(f.me.getMe,{host:It})?.role===`admin`,r=h(f.admin.listInstances,n?{}:`skip`),i=h(f.agents.usageForInstances,n?{}:`skip`),a=At(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=nn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Mt({from:`/settings/bridge`}),l=At({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,p=u!==null&&Ut(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(yn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ke()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ae()}),(0,Q.jsxs)(Bt,{children:[(0,Q.jsx)(Rt,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(H,{children:Ge()}),(0,Q.jsx)(H,{children:be()}),(0,Q.jsx)(H,{children:Ne()}),(0,Q.jsx)(H,{children:Xe()}),(0,Q.jsx)(H,{children:He()})]})}),(0,Q.jsx)(zt,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(W,{children:t.provider}),(0,Q.jsx)(W,{children:t.label}),(0,Q.jsx)(W,{children:(0,Q.jsxs)(L,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(W,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(vt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(_t,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(ht,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(St,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(gt,{value:e.key,children:(0,Q.jsx)(bn,{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,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}):null]})}function yn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ht(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:u(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,p({build:t.buildVersion??`?`})]}):null,` · `,ce(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?O():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Qe()});let s=Xt(e.targets),c=!e.reachable,l=Qt(e),d=e.unreachableInstances??[],f=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,m=Nt(e.checkedAt),h=e.startedAt==null?null:Nt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(M,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(Yt,{size:22}):(0,Q.jsx)(P,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?We():l===`gateways_unreachable`?Ve({count:d.length}):c?ye():Me({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Jt,{size:12,"aria-hidden":!0}),` `,Ye({time:m})]}),h?(0,Q.jsx)(`span`,{children:Ee({time:h})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:$e({names:d.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:i()})]})}function bn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],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:qt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(St,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(L,{variant:f===`beyond`?`destructive`:`secondary`,children:Gt(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Pe()}),(0,Q.jsx)(Sn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(xn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(k,{size:13,"aria-hidden":!0}):(0,Q.jsx)(wt,{size:13,"aria-hidden":!0}),ie({count:t.length})]}),p?(0,Q.jsx)(pn,{connections:t,displayByInstance:c}):null]})}function xn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[ze(),i.length>0?(0,Q.jsx)(L,{variant:`destructive`,children:Oe({count:i.length})}):(0,Q.jsx)(L,{variant:`secondary`,children:qe()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Te({version:e.vendoredVersion}),r?` · `+et({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(k,{size:13,"aria-hidden":!0}):(0,Q.jsx)(wt,{size:13,"aria-hidden":!0}),Le({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Sn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Re({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:it({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:O()}),e?(0,Q.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Ht(e.version)}),(0,Q.jsx)(L,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Gt(e.state)})]},e.instanceName))})]})}function Cn({instance:e,onClose:t}){return(0,Q.jsx)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(kt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(Ft,{children:De({instance:e.displayName??e.name})}),(0,Q.jsx)(Dt,{children:we()})]}),(0,Q.jsx)(Tn,{instance:e,onClose:t})]})})}function wn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(M,{"aria-hidden":!0}):(0,Q.jsx)(P,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Se():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,st()]}):null}function Tn({instance:e,onClose:t}){let n=ne(f.admin.upsertInstanceConfig),i=ee(f.bridge.validateMediaPaths),o=bt(),s=Lt(e.config?.contentLocale,void 0),[l,u]=(0,K.useState)(()=>dt(e.config??{},s)),[p,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(null),b=l.inboundMediaMode===`shared-fs`,x=l.mediaMode===`shared-fs`,S=b||x;async function C(){_(!0),y(null);try{y(await i({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){o.error(rt(),e)}finally{_(!1)}}async function w(){h(!0);try{let r=e.config??{};await n({instanceId:e._id,config:pt(l,r,s)}),t()}catch(e){o.error(je(),e)}finally{h(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:Ie(),help:Je()}),(0,Q.jsxs)(V,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Q.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(F,{children:mt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:Ce(),help:Be()}),(0,Q.jsxs)(V,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Q.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(F,{children:ft.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:Ze(),help:r()}),(0,Q.jsx)(R,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),S&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:a(),help:Fe()}),(0,Q.jsx)(R,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),x&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:te(),help:d()}),(0,Q.jsx)(R,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Ot,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Q.jsx)(A,{label:Ue(),help:re()})]}),S&&v!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:v.reachable?!v.inbound&&!v.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(P,{"aria-hidden":!0}),_e({reason:v.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{label:se(),result:v.inbound}),(0,Q.jsx)(wn,{label:at(),result:v.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(P,{"aria-hidden":!0}),nt()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[S&&(0,Q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void C(),disabled:g,children:[g?(0,Q.jsx)(xt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?le():m()]}),(0,Q.jsx)(j,{size:`sm`,onClick:()=>void w(),disabled:p,children:ve()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?xe():ot({count:e.length}),(0,Q.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Tt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:tt()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(L,{variant:`secondary`,children:e},e))})]})]})}export{vn as BridgeTab,Cn as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,E as i,EP as a,FP as o,Fc as s,Gl as c,Ic as l,Kl as u,Lc as d,MP as f,Mc as p,Nc as m,PP as h,Pc as g,Ql as _,Rc as v,Xl as y,aa as b,ca as x,cn as S,ia as C,jc as w,la as T,ml as E,na as D,oa as O,ra as k,sa as A,ta as j,u_ as M,ua as N}from"./dist-CjH9Ohdx.js";import{t as P}from"./button-B49JSqzm.js";import{C as F,Pt as I,S as L,T as R,b as z,f as B,ft as V,m as H,p as U,w as W,x as G}from"./index-DnuEILeM.js";import{i as K}from"./compatView-C1X2zgFr.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=h(i.admin.upsertInstanceConfig),n=o(i.agents.listAgentsForInstance,{instanceName:e.name}),a=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[s,c]=(0,q.useState)(a),[l,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{c(a),u(`idle`)},[e._id,a]);let d=`__none__`,f=s!==a;async function m(){u(`saving`);try{let n={...e.config??{}};s===``||s===d?delete n.converterAgentId:n.converterAgentId=s,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}let g=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:O()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(G,{value:s===``?d:s,onValueChange:e=>c(e===d?``:e),children:[(0,X.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":A(),children:(0,X.jsx)(R,{placeholder:b()})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{value:d,children:b()}),g.map(e=>(0,X.jsx)(F,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!f||l===`saving`,onClick:()=>void m(),children:l===`saving`?_():p()})]}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:w()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:r()}):null]})}function Q({instance:e}){let t=h(i.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,a=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[o,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(a===null?``:String(a)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(a===null?``:String(a)),d(`idle`)},[e._id,n,a]);let f=c.trim(),m=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,g=!o||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,v=o!==n||(m??null)!==a;async function y(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=o,!o||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:o,onCheckedChange:e=>s(e===!0),"aria-label":x()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":C(),disabled:!o}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!g||u===`saving`,onClick:()=>void y(),children:u===`saving`?_():p()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:w()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:r()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:D()})]})}function $({instance:e}){let t=h(i.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[a,o]=(0,q.useState)(n===null?``:String(n)),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n===null?``:String(n)),c(`idle`)},[e._id,n]);let l=a.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,f=(u??null)!==n;async function m(){c(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:a,onChange:e=>o(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,X.jsx)(P,{size:`sm`,disabled:!f||!d||s===`saving`,onClick:()=>void m(),children:s===`saving`?_():p()})]}),d?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:w()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:r()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:T()})]})}function ee(){let e=f(i.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=o(i.admin.listInstances,{}),[p,h]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!p||!r.some(e=>e.name===p))&&h(r[0].name)},[r,p]);let _=(r?.length??0)>1,b=r!==void 0&&r.length===0,x=o(i.compat.forInstance,p?{instanceName:p}:`skip`),C=p?z(x,`configDefaults`):`loading`,w=C===`loading`?null:C.blocked,T=(0,q.useMemo)(()=>_&&p?{instanceName:p}:{},[_,p]),D=(0,q.useRef)(0),O=(0,q.useCallback)(async()=>{let t=++D.current;n({status:`loading`});try{let r=Y(await e(T));if(D.current!==t)return;n({status:`done`,current:r})}catch{if(D.current!==t)return;n({status:`error`})}},[e,T]);(0,q.useEffect)(()=>{w===!1&&(_&&!p||O())},[O,w,_,p]);let k=t.status===`done`?t.current:null,A=(0,q.useMemo)(()=>J.map(e=>({id:e,label:U(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:u()},{id:`standard`,label:c()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),_&&p?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,X.jsxs)(G,{value:p,onValueChange:e=>h(e),children:[(0,X.jsx)(W,{size:`sm`,"aria-label":E(),children:(0,X.jsx)(R,{})}),(0,X.jsx)(L,{children:(r??[]).map(e=>(0,X.jsx)(F,{value:e.name,children:e.name},e.name))})]})]}):null,b?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:M()}):C===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):C.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(I,{size:14,"aria-hidden":!0}),` `,K(C.gatewayVersion,C.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[m(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:y()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsx)(B,{options:A,value:k?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:l()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,X.jsx)(B,{options:j,value:k===null||k.fastModeDefault===null?null:k.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:g()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:S()})]}),(()=>{let e=r?.find(e=>e.name===(p??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,ap as i,ep as a,ip as o,np as s,rp as c,tp as l}from"./dist-CjH9Ohdx.js";import{i as u,r as d}from"./dist-DCbB4klt.js";import{t as f}from"./chevrons-up-down-CWDbG1Cy.js";import{t as p}from"./button-B49JSqzm.js";import{Bt as m,Ft as h,Yt as g,at as _,lt as v,m as y,ot as b,st as x,ut as S}from"./index-DnuEILeM.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-COx9FvKU.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=i(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(h,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(m,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(y,{"aria-label":s(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(y,{"aria-label":l(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(S,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(g,{})})}),(0,M.jsx)(b,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(v,{}):null,(0,M.jsx)(x,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{dt as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{dt as t}from"./index-DnuEILeM.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as a,Cw as o,DC as s,Dw as c,E as l,EC as u,Ew as d,FC as f,FP as p,GC as m,HC as h,IC as ee,JC as te,KC as g,LC as _,MC as v,NC as ne,OC as re,Ow as y,PC as ie,PP as b,QC as x,RC as S,Si as C,Sw as w,Tw as T,UC as E,VC as D,WC as O,XC as k,YC as A,ZC as j,_w as M,aw as N,bi as P,bw as F,cw as I,dw as L,ew as R,fw as z,gw as B,hw as V,iw as H,jC as U,kC as ae,lw as W,mw as G,nw as K,ow as q,pw as J,qC as oe,rw as se,sw as ce,tw as le,uw as ue,vw as de,ww as fe,xw as pe,yw as me,zC as he}from"./dist-CjH9Ohdx.js";import{t as ge}from"./button-B49JSqzm.js";import{U as _e,rt as Y}from"./index-DnuEILeM.js";import{t as ve}from"./DataTableShell-DKcU9E8v.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>y(),incorrect:()=>c(),incoherence:()=>d(),formatting:()=>T(),latency:()=>fe(),api_error:()=>o(),other:()=>w()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:F()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:me()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:pe()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=b(l.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||d)){f(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${de()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:g(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?V():e.authorRole===`agent`?e.authorLabel??C():G()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:J()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:z(),value:c,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void p(),disabled:!c.trim()||d,children:d?L():ue()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||I()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||I()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:q()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N({count:i.contextCount??m.length,truncated:i.contextTruncated?H():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?R({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[r(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,x()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=p(l.feedback.listForAdmin,{}),t=b(l.feedback.readSnapshot),n=b(l.feedback.deleteFeedback),r=_e(),[o,c]=(0,X.useState)(null),[d,g]=(0,X.useState)({});async function v(e){if(o===e._id){c(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});g(t=>({...t,[e._id]:n}))}c(e._id)}async function y(e){await r({title:re(),description:s(),confirmLabel:u(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[j(),` `,(0,Z.jsx)(`strong`,{children:k()}),` `,A()]}),(0,Z.jsx)(ve,{title:te(),rows:e,emptyHint:oe(),isExpanded:e=>o===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,Z.jsx)(be,{data:d[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:m(),cell:e=>Y(e.at),sort:e=>e.at},{header:O(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:E(),cell:e=>e.messageRole===`user`?h():D(),sort:e=>e.messageRole},{header:a(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${he({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:S(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:_(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ee(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:f()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:P()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ne()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?U():i(),onSelect:()=>void v(e)},{label:ae(),onSelect:()=>void y(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,HP as n}from"./dist-CjH9Ohdx.js";import{_ as r,g as i,v as a,y as o}from"./index-DnuEILeM.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as ee,AN as te,BN as r,CN as ne,DD as i,DN as a,E as o,EN as s,EP as re,Ei as c,FN as ie,FP as l,GN as u,HN as d,IN as f,JN as ae,KN as oe,LN as p,MN as se,NN as ce,ON as le,OP as ue,PN as de,PP as fe,QN as pe,RN as m,SN as me,TN as he,Ti as ge,UN as _e,VN as h,WN as ve,XN as g,YN as _,ZN as ye,bN as be,jN as xe,kN as v,qN as y,vN as b,wN as x,xN as S,yN as C,zN as w}from"./dist-CjH9Ohdx.js";import{t as T}from"./button-B49JSqzm.js";import{C as E,Ft as D,G as O,H as k,J as A,K as j,Q as M,S as N,T as P,X as Se,Xt as F,Y as Ce,Yt as we,Z as Te,at as Ee,dt as I,m as De,ot as Oe,q as ke,st as L,ut as Ae,w as R,x as z,zt as je}from"./index-DnuEILeM.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-COx9FvKU.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return d();case`audio`:return h();case`video`:return r();case`pdf`:return w();case`document`:return m();case`archive`:return p();default:return f()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[d,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[h,w]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=fe(o.files.softDelete),Y=k();function Ie(){t(G),r(G),f(G),m(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(he())}catch(e){Y.error(x(),e)}}let X=l(o.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:d===G?void 0:d,category:p===G?void 0:p,includeAutoGenerated:h||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ue(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:re()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||d!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(E,{value:G,children:ye()}),(0,W.jsx)(E,{value:`inbound`,children:g()}),(0,W.jsx)(E,{value:`outbound`,children:_()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:r,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ae(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(E,{value:G,children:y()}),Q.chats.map(e=>(0,W.jsx)(E,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:d,onValueChange:f,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":oe(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(E,{value:G,children:u()}),Q.instances.map(e=>(0,W.jsx)(E,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:p,onValueChange:m,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":ve(),children:(0,W.jsx)(P,{})}),(0,W.jsxs)(N,{children:[(0,W.jsx)(E,{value:G,children:_e()}),Q.categories.map(e=>(0,W.jsx)(E,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:h,onCheckedChange:e=>w(e===!0),"aria-label":c()}),(0,W.jsx)(`span`,{children:c()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(je,{size:14,"aria-hidden":!0}),le()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?C():be()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{children:ce()}),(0,W.jsx)(B,{children:se()}),(0,W.jsx)(B,{children:xe()}),(0,W.jsx)(B,{className:`text-right`,children:te()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(I,{variant:`outline`,style:{marginLeft:6},children:ge()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?g():_()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ee,{children:[(0,W.jsx)(Ae,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":a(),children:(0,W.jsx)(we,{size:16})})}),(0,W.jsxs)(Oe,{align:`end`,children:[e.url?(0,W.jsx)(L,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(F,{size:14}),v()]})}):(0,W.jsxs)(L,{disabled:!0,children:[(0,W.jsx)(F,{size:14}),S()]}),(0,W.jsxs)(L,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(D,{size:14}),s()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:b({cap:Be})}):null]}),(0,W.jsx)(O,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(A,{children:[(0,W.jsxs)(Te,{children:[(0,W.jsx)(M,{children:ne()}),(0,W.jsx)(Ce,{children:me()})]}),(0,W.jsxs)(Se,{children:[(0,W.jsx)(ke,{children:i()}),(0,W.jsx)(j,{onClick:()=>void Le(),children:s()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{op as r,sp as i}from"./dist-CjH9Ohdx.js";import{t as a}from"./button-B49JSqzm.js";import{Rt as o,ft as s,zt as c}from"./index-DnuEILeM.js";import{t as l}from"./TimeRangePicker-0VkTfHt_.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(o,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Au as i,Bu as a,Cu as o,D as s,Du as c,E as l,Eu as u,FP as d,Fu as f,Gu as p,Hu as m,Iu as h,Ju as g,Ku as _,Lu as v,Mu as y,Nu as b,Ou as x,PP as S,Pu as C,Qu as w,Ru as T,Su as E,Tu as ee,Uu as D,Vu as te,Wu as O,Xu as ne,Yu as re,Zu as ie,_d as k,_u as ae,ad as A,bu as j,cd as M,dd as N,du as oe,ed as se,fd as ce,fu as P,gd as F,gu as le,hd as ue,hu as de,id as fe,ju as I,ku as pe,ld as L,md as me,mu as R,nd as he,od as ge,pd as _e,pu as ve,qu as ye,rd as be,sd as xe,td as Se,ud as Ce,uu as we,vd as Te,vu as Ee,wu as De,xu as Oe,yd as ke,yu as Ae,zu as je}from"./dist-CjH9Ohdx.js";import{t as Me}from"./x-DYJkW-kP.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-BFg7qw3e.js";import{t as V}from"./button-B49JSqzm.js";import{C as Fe,H,It as U,Lt as W,S as Ie,T as Le,U as Re,_t as ze,d as Be,dt as G,en as Ve,ft as K,ht as He,m as q,mt as Ue,pt as We,tn as Ge,vt as Ke,w as qe,wt as Je,x as Ye}from"./index-DnuEILeM.js";import{t as Xe}from"./FilterBar-BVzupjQK.js";import{t as Ze}from"./DataTableShell-DKcU9E8v.js";import{t as J}from"./DetailChips-BHFRTi5X.js";var Qe=s(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Y=s(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),$e=s(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),X=t(e(),1);function et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function tt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function nt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function rt(e){switch(e){case`admin`:return a();case`user`:return je();case`pending`:return T();default:return e}}function it(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function Z(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=d(l.groups.listGroups,{}),t=d(l.me.getMe,{host:Je})?.role===`admin`,n=S(l.groups.createGroup),i=S(l.groups.updateGroup),a=S(l.groups.deleteGroup),o=Re(),s=H(),[c,u]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)($),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(``),b=(0,X.useMemo)(()=>{if(!e)return e;let t=v.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,v]);function x(){p(null),h($),u(!0)}function C(e){p(e),h({name:e.name,description:e.description??``}),u(!0)}async function T(){try{f?await i({groupId:f._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),h($),p(null),u(!1)}catch(e){s.error(ve(),e)}}async function E(e){if(await o({title:se({name:e.name}),description:r(),confirmWord:e.name,confirmLabel:w(),cancelLabel:ge(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(P(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,Q.jsx)(Xe,{q:v,onQChange:y,onReset:()=>y(``),canReset:v!==``,searchPlaceholder:N()}),(0,Q.jsx)(Ze,{title:ke(),rows:b,addLabel:k(),onAdd:t?x:void 0,emptyHint:F(),columns:[{header:ue(),cell:e=>e.name,sort:e=>e.name},{header:me(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:_e(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ce(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(U,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Ce(),onSelect:()=>_({groupId:e._id,name:e.name})},...t?[{label:L(),onSelect:()=>C(e)},{label:M(),variant:`destructive`,onSelect:()=>void E(e)}]:[]]}),(0,Q.jsx)(Be,{open:c,onOpenChange:u,title:f?fe():A(),description:be(),canSubmit:!!m.name.trim(),onSubmit:T,submitLabel:xe(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:he()}),(0,Q.jsx)(K,{value:m.name,onChange:e=>h({...m,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:Se()}),(0,Q.jsx)(K,{value:m.description,onChange:e=>h({...m,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:g?.groupId??null,groupName:g?.name??``,open:g!==null,onOpenChange:e=>{e||_(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ge,{size:14,"aria-hidden":!0}),D()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":te({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[m(),(0,Q.jsx)(Ve,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=d(l.groups.getGroup,n&&e?{groupId:e}:`skip`),a=d(l.groups.listAssignableInstances,n?{}:`skip`),o=d(l.groups.listAssignableUsers,n?{}:`skip`),s=S(l.groups.addMember),c=S(l.groups.removeMember),m=S(l.groups.bulkSetMembers),h=S(l.groups.setGroupManager),x=H(),[C,w]=(0,X.useState)(``),[T,E]=(0,X.useState)(``),[ee,D]=(0,X.useState)(`members`),[te,k]=(0,X.useState)(1),[A,j]=(0,X.useState)(new Set),M=(0,X.useRef)(null),N=(0,X.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),se=(0,X.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ce=i?.viewerIsAdmin===!0,P=(0,X.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,X.useEffect)(()=>{w(``),E(``),D(`members`),k(1),M.current=null},[n,e]),(0,X.useEffect)(()=>{k(1)},[C]),(0,X.useEffect)(()=>{n&&i&&e&&M.current!==e&&(M.current=e,j(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let F=(0,X.useMemo)(()=>o?et(o,C,A):[],[o,C,A]);async function ue(t,n){if(e)try{n?await c({groupId:e,userId:t}):await s({groupId:e,userId:t})}catch(e){x.error(oe(),e)}}async function fe(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){x.error(de(),e)}}let I=it(F,e=>N.has(e.userId)),pe=F.filter(e=>N.has(e.userId)).length,L=Z(F,te,ot);async function me(){if(!e||F.length===0)return;let t=F.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:I!==`all`})}catch(e){x.error(oe(),e)}}return(0,Q.jsx)(We,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Ue,{className:`oc-access`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Ke,{children:ie({name:t})}),(0,Q.jsx)(He,{children:ne()})]}),(0,Q.jsxs)(Pe,{value:ee,onValueChange:D,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),re(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(W,{size:13,"aria-hidden":!0}),ye(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:P.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),u(),i?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:o===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:f()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:C,onChange:e=>w(e.target.value),placeholder:g(),className:`oc-access__search`}),F.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):(0,Q.jsxs)(Q.Fragment,{children:[F.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void me(),"aria-label":O()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:O()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[pe,` / `,F.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=N.has(e.userId),n=nt(e),r=se.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ue(e.userId,t),"aria-label":v({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ce?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?le():ae(),title:r?le():ae(),onClick:()=>void fe(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Ee(),title:Ee(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:k})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:f()}):a.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:T,onChange:e=>E(e.target.value),placeholder:_(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:P,query:T},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:a}){let o=d(l.groups.listAssignableAgents,{instanceName:t}),s=S(l.groups.assignAgentToGroup),u=S(l.groups.removeAgentFromGroup),f=S(l.groups.bulkSetGroupAgents),p=H(),[m,g]=(0,X.useState)(1);if((0,X.useEffect)(()=>{g(1)},[a]),!e)return null;let _=tt(o?.agents??[],a),v=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&_.length===0)return null;let y=_.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),b=it(y,e=>r.has(`${t}/${e.agentId}`)),w=Z(_,m,ot);async function T(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(we(),e)}}async function E(){if(y.length===0)return;let n=y.map(e=>e.agentId);try{await f({groupId:e,instanceName:t,agentIds:n,assigned:b!==`all`})}catch(e){p.error(we(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(W,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),v?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:pe()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):_.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v?i():I()}):(0,Q.jsxs)(Q.Fragment,{children:[y.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:b===`all`?!0:b===`some`?`indeterminate`:!1,onCheckedChange:()=>void E(),"aria-label":O()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:O()})]}):null,w.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void T(e.agentId,i),"aria-label":h({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":c(),title:c(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:x()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:w.page,pageCount:w.pageCount,onPage:g})]})]})}function ut({groupId:e}){let t=d(l.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=S(l.charts.assignChartToGroup),r=S(l.charts.removeChartFromGroup),i=S(l.charts.setGroupDefaultChart),a=S(l.charts.addChartToGroupPool),s=S(l.charts.removeChartFromGroupPool),c=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:f()});let{pool:u,addable:p,canManagePool:m}=t;if(u.length===0&&!m)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ee()});async function h(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function g(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":Oe({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":j(),title:j(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:Ae()}):null,m?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":E({name:e.name}),title:E({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),m?p.length>0?(0,Q.jsxs)(Ye,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(qe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Le,{placeholder:o()})}),(0,Q.jsx)(Ie,{children:p.map(e=>(0,Q.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:De()}):null:null]})}export{at as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AS as i,Ax as a,BS as o,Bx as s,CS as c,Cx as l,DS as u,Da as d,Dx as f,E as p,ES as m,Ea as h,Ex as g,FP as _,FS as v,Fx as y,GS as b,Gx as x,HS as S,Hx as C,IS as ee,Ix as w,JS as te,Jx as T,KS as ne,Kx as E,LS as re,Lx as D,MP as O,MS as ie,NS as ae,Nx as k,OS as oe,Oa as se,Ox as ce,PP as A,PS as le,Px as ue,QS as de,Qx as fe,RS as j,Rx as M,SS as pe,Sx as me,TS as he,Ta as ge,Tx as _e,US as ve,Ux as ye,VS as be,Vx as xe,WS as Se,Wx as Ce,XS as we,Xx as Te,YS as Ee,Yx as De,ZS as Oe,Zx as ke,_S as Ae,_x as je,aS as Me,bO as N,bS as Ne,bx as Pe,cS as Fe,dS as Ie,dn as Le,dx as Re,eS as ze,e_ as Be,fS as Ve,fn as He,fx as Ue,gS as We,gx as Ge,hS as Ke,hx as qe,iS as Je,jS as Ye,jx as Xe,kS as Ze,kx as Qe,lS as $e,lx as et,mS as tt,mx as nt,nS as rt,oS as it,pS as at,pn as ot,px as st,qS as ct,qx as lt,rS as ut,sS as dt,tS as ft,t_ as pt,uS as mt,ux as P,vS as ht,vx as gt,wS as _t,wx as vt,xS as yt,xx as bt,yO as F,yS as xt,yx as St,zS as Ct,zx as wt}from"./dist-CjH9Ohdx.js";import{a as Tt,c as Et}from"./FieldLabel-BhXlfWG6.js";import{t as I}from"./button-B49JSqzm.js";import{$ as Dt,C as L,H as R,S as z,T as B,U as Ot,_t as V,d as kt,dt as H,et as At,ft as U,ht as W,m as G,mt as K,pt as jt,tt as Mt,vt as Nt,w as q,x as J}from"./index-DnuEILeM.js";import{t as Pt}from"./DataTableShell-DKcU9E8v.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-B6u6wsyS.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=_(p.admin.listInstances,{}),t=_(p.agents.listAllInstanceAgents,{}),n=A(p.admin.upsertInstance),r=A(p.admin.deleteInstance),a=R(),[s,l]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(Q),[h,g]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null);async function D(){try{await n({instanceId:T??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,transport:d.kind===`hermes`?d.transport:void 0,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,streamTransport:d.streamTransport}),f(Q),E(null),l(!1)}catch(e){a.error(we(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ee(),(0,Z.jsx)(`strong`,{children:te()}),ct()]}),(0,Z.jsx)(Pt,{title:ne(),rows:e,addLabel:b(),onAdd:()=>{E(null),f(Q),l(!0)},emptyHint:Se(),columns:[{header:ve(),cell:e=>e.name,sort:e=>e.name},{header:S(),cell:e=>(0,Z.jsx)(H,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:be(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:o(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:de(),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)(H,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?P():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ee(),onSelect:()=>{E(e._id),f(Bt(e)),l(!0)}},{label:Oe(),onSelect:()=>g(e.name)},{label:yt(),onSelect:()=>w(e)},{label:Ct(),onSelect:()=>x(e)},{label:j(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:j(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(kt,{open:s,onOpenChange:l,title:T?v():re(),description:ae(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:D,submitLabel:ie(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Ye(),children:[(0,Z.jsx)(U,{value:d.name,disabled:T!==null,onChange:e=>f({...d,name:e.target.value})}),T?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:le()}):null]}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsxs)(J,{value:d.kind,onValueChange:e=>f({...d,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(L,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(L,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,Z.jsx)($,{label:ot(),children:(0,Z.jsxs)(J,{value:d.transport,onValueChange:e=>f({...d,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(L,{value:`ws`,children:He()}),(0,Z.jsx)(L,{value:`rest`,children:Le()})]})]})}):null,(0,Z.jsx)($,{label:Ze(),children:(0,Z.jsx)(U,{value:d.gatewayUrl,onChange:e=>f({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:oe(),children:(0,Z.jsx)(U,{value:d.bridgeUrl,placeholder:u(),onChange:e=>f({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:m(),children:(0,Z.jsx)(U,{value:d.displayName,onChange:e=>f({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:pt(),children:[(0,Z.jsxs)(J,{value:d.streamTransport,onValueChange:e=>f({...d,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(z,{children:Et.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Be()})]}),(0,Z.jsx)($,{label:he(),children:(0,Z.jsx)(U,{value:d.gatewayVersion,placeholder:_t(),onChange:e=>f({...d,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:c(),children:(0,Z.jsx)(U,{value:d.gatewayHttpUrl,placeholder:pe(),onChange:e=>f({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:h,open:h!==null,onOpenChange:e=>{e||g(null)}}),y?(0,Z.jsx)(Ft,{instance:y,onClose:()=>x(null)},y._id):null,C?(0,Z.jsx)(Ht,{instance:C,onClose:()=>w(null)},C._id):null]})}function Ht({instance:e,onClose:t}){let n=_(p.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Nt,{children:Ne({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:xt()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=O(p.instanceSync.forceInstanceSync),n=R(),[i,a]=(0,Y.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(r());break;case`no_agents`:n.success(ke());break;case`no_bridge_url`:n.error(Te());break;case`deploy_misconfigured`:n.error(De());break;case`unauthorized`:n.error(lt());break;case`not_served`:n.error(E());break;default:n.error(T());break}}catch(e){n.error(fe(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?ze():ft()})})]})}function Wt({instance:e}){let t=_(p.bridgeAuth.listBridgeAuthStatus,{}),n=O(p.bridgeAuth.mintBridgeSecret),r=A(p.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),m=f!==void 0;async function h(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(M(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(wt())}catch(e){i.error(M(),e)}finally{o(!1)}}}async function v(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Ce(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:m?`outline`:`secondary`,children:m?`${Ke()} · ${f.prefix}…${f.lastFour}`:tt()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?xe():C()}),m?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:s()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:D()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:u?N():F()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:w()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=O(p.instanceSecrets.setInstanceSecret),i=A(p.instanceSecrets.clearInstanceSecret),a=O(p.deviceIdentity.generateDeviceIdentity),o=R(),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?ht():t===`deviceIdentity`?Ae():We();async function y(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),f(null),h(!1),o.success($e())}catch(e){o.error(Fe(),e)}finally{u(!1)}}}async function b(){if(!l){u(!0);try{await i({instanceId:e,field:t}),f(null),h(!1),o.success(dt())}catch(e){o.error(Fe(),e)}finally{u(!1)}}}async function x(){if(!l){u(!0);try{f(await a({instanceId:e})),h(!1),o.success(Je())}catch(e){o.error(rt(),e)}finally{u(!1)}}}let S=d?`openclaw devices approve ${d.id}`:``;async function C(){if(S)try{await navigator.clipboard.writeText(S),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:g?`outline`:`secondary`,children:g?Ke():tt()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ve():at(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void y(),disabled:l||s.trim().length===0,children:Ie()}),_?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void x(),disabled:l,children:it()}):null,g?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:l,children:mt()}):null]})]}),d?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Je()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:S}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:m?N():F()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{f(null),h(!1)},children:w()})]}):null]})}var Kt={conversational:_e,documentary:l,summarizer:se,curator:h},qt={conversational:vt,documentary:me,summarizer:d,curator:ge},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Qe()}),t.map(e=>(0,Z.jsx)(H,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Mt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ce()})}),(0,Z.jsxs)(At,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:f()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:g()}),(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)(G,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=_(p.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=A(p.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=A(p.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=A(p.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=A(p.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=A(p.agents.removeInstanceAgent),l=Ot(),u=R();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(k(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(k(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(k(),e)}}async function h(t,n){if(e&&await l({title:St({name:n}),description:gt(),confirmLabel:je(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Ge())}catch(e){u.error(k(),e)}}return(0,Z.jsx)(jt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Nt,{children:y({name:e??``})}),(0,Z.jsx)(W,{children:ue()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:qe()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?nt():r.discovery.lastPollOk?st():Ue({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Re()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(G,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void d(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:et()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:Pe()})]}):i?(0,Z.jsx)(H,{variant:`default`,children:P()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void f(t.agentId),children:bt()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){u.error(k(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Xe(),"aria-label":a(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aw as r,Bw as i,E as a,FP as o,Fw as s,Go as c,Ho as l,Hw as u,Iw as d,Jo as f,Ko as p,Lw as m,MP as h,Mw as g,Nw as _,PP as v,Pw as y,Rw as b,Uo as x,Vo as S,Vw as C,Wo as w,Yo as T,jw as E,kw as D,qo as O,zw as k}from"./dist-CjH9Ohdx.js";import{t as A}from"./button-B49JSqzm.js";import{dt as j,ft as M,m as N}from"./index-DnuEILeM.js";var P=t(e(),1),F=n();function I(){let e=o(a.integrations.status.status,{}),t=v(a.admin.setIntegrationConfig),[n,c]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&c(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:u()});let l=n,p=(e,t,n)=>c({...l,[e]:{...l[e],[t]:n}}),h=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[C(),` `,(0,F.jsx)(`strong`,{children:i()}),` `,k()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:m()}):(0,F.jsx)(j,{variant:`outline`,children:d()}),note:s(),children:[(0,F.jsx)(R,{label:_(),children:(0,F.jsx)(M,{value:l.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>p(`langfuse`,`host`,e.target.value),onBlur:()=>h(`langfuse`,{host:l.langfuse.host??``})})}),(0,F.jsx)(z,{label:D(),checked:l.langfuse.enabled??!0,onChange:e=>{p(`langfuse`,`enabled`,e),h(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:m()}):(0,F.jsx)(j,{variant:`outline`,children:d()}),note:y(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(M,{value:l.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>p(`opik`,`baseUrl`,e.target.value),onBlur:()=>h(`opik`,{baseUrl:l.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:E(),children:(0,F.jsx)(M,{value:l.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||r(),onChange:e=>p(`opik`,`workspace`,e.target.value),onBlur:()=>h(`opik`,{workspace:l.opik.workspace??``})})}),(0,F.jsx)(z,{label:D(),checked:l.opik.enabled??!0,onChange:e=>{p(`opik`,`enabled`,e),h(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:b()}):(0,F.jsx)(j,{variant:`outline`,children:m()}):(0,F.jsx)(j,{variant:`outline`,children:T()}),note:f(),children:[(0,F.jsx)(R,{label:O(),children:(0,F.jsx)(M,{value:l.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>p(`otlp`,`endpoint`,e.target.value),onBlur:()=>h(`otlp`,{endpoint:l.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:D(),checked:l.otlp.enabled??!0,onChange:e=>{p(`otlp`,`enabled`,e),h(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=h(a.integrations.otlpSecret.setOtlpHeaders),n=v(a.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),f=async()=>{d(!0),s(null);try{await t({headersJson:r}),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:p(),children:[(0,F.jsx)(M,{value:r,placeholder:e?c():w(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:u||r.trim().length===0,onClick:()=>void f(),children:x()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:u,onClick:()=>void n({}),children:l()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:S()})]})}export{I as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CT as r,E as i,FP as a,ST as o,TT as s,XT as c,_h as l,ch as u,dh as d,fh as f,gh as p,hT as m,hh as h,lh as g,mT as _,mh as v,oh as y,ph as b,sh as x,uh as S,vh as C,wT as w,yh as T}from"./dist-CjH9Ohdx.js";import{i as ee,nn as te,o as ne,r as re,rn as E,wt as D}from"./index-DnuEILeM.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-eKiPt2Wc.js";import{n as N,t as P}from"./TimeRangePicker-0VkTfHt_.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=a(i.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=a(i.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:c()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:s()}),(0,I.jsx)(j,{children:r()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[_(),` p50 `,R(c.cP50),` `,w()]}),(0,I.jsxs)(`span`,{children:[m(),` p50 `,R(c.aP50),` `,w()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":s(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:T(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:C(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:l(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:p(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:h(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:v(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=te({from:`/settings/kpi`}),n=ee(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:o,to:s}=N(n),{rowLimit:c,buckets:l}=K(o,s),u=a(i.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),p=(0,F.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]),m=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(p.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:p.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:g({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:u()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:x({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.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-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":y({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,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.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{q as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$k as i,Bk as a,E as o,EP as s,FP as c,Fk as l,Gk as u,Hk as d,Ik as f,J as p,Jk as m,Kk as ee,Lk as te,MS as ne,Mk as re,Nk as ie,PP as h,Pk as ae,Q as oe,Qk as se,Rk as ce,Uk as le,Vk as g,Wk as ue,X as de,Xk as fe,Y as pe,Yk as me,Z as he,Zk as _,_A as v,_P as y,aA as b,aP as x,cA as S,cP as C,ct as w,dA as T,dP as E,eA as D,et as O,fA as k,fP as A,gA as j,gP as M,hA as N,hP as P,iA as F,iP as I,lA as L,lP as R,mA as ge,mP as _e,mt as ve,n as z,nA as ye,nP as be,oA as xe,oP as Se,pA as Ce,pP as we,pt as Te,q as Ee,qk as De,rA as Oe,rP as ke,sA as Ae,sP as je,tA as Me,tP as Ne,uA as Pe,uP as Fe,vP as Ie,xP as Le,zk as B}from"./dist-CjH9Ohdx.js";import{t as V}from"./button-B49JSqzm.js";import{C as H,Ct as Re,H as ze,S as Be,St as Ve,T as He,dt as U,ft as W,j as Ue,m as G,t as We,w as Ge,wt as K,x as Ke,xt as qe}from"./index-DnuEILeM.js";import{t as Je}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=n();function Ye({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>v()},{id:`composer`,label:()=>j()},{id:`sidebar`,label:()=>N()},{id:`notifications`,label:()=>se()},{id:`other`,label:()=>ge()}],X={showSource:{category:`messages`,label:()=>Ce(),help:()=>k()},showReport:{category:`messages`,label:()=>T(),help:()=>Pe()},copyAssistant:{category:`messages`,label:()=>L()},copyUser:{category:`messages`,label:()=>S()},showDelete:{category:`messages`,label:()=>Ae()},showTools:{category:`messages`,label:()=>xe(),help:()=>b()},voiceInput:{category:`composer`,label:()=>F(),help:()=>Oe()},showUsage:{category:`composer`,label:()=>ye(),help:()=>Me()},autoReadAloud:{category:`composer`,label:()=>ve(),help:()=>Te()},showChatAge:{category:`sidebar`,label:()=>D(),help:()=>i()},notifSound:{category:`notifications`,label:()=>_(),help:()=>fe()},notifSystem:{category:`notifications`,label:()=>me(),help:()=>m()},replySound:{category:`notifications`,label:()=>De(),help:()=>ee()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ze={voiceInput:`voiceInput`};function Qe(e){return Xe.includes(e)}function $(e){return e===`admin`}function $e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function et(e){return e===`on`?!0:e===`off`?!1:null}function tt(e){return Qe(e)?Ze[e]:void 0}var nt={voiceInput:()=>f()};function rt({prefKey:e,ui:t}){let n=h(o.admin.setUiPrefDefault),r=h(o.admin.setFeatureEnabled),i=tt(e),s=i?nt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:a()}),(0,J.jsxs)(Ke,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,J.jsx)(Ge,{size:`sm`,className:`w-36`,children:(0,J.jsx)(He,{})}),(0,J.jsxs)(Be,{children:[(0,J.jsx)(H,{value:`on`,children:ae()}),(0,J.jsx)(H,{value:`off`,children:ie()}),(0,J.jsx)(H,{value:`inherit`,children:re()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(G,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":B()}),B()]}):null]}),s?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:s}):null]})}function it({current:e,enabled:t}){let n=h(o.me.setDictationShortcut),[i,a]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!i)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ve(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(c(!0),window.setTimeout(()=>c(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[O(),e?(0,J.jsx)(U,{variant:`secondary`,children:Re(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:s?he():i?oe():r()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!i?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:Ee()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?p():e?pe():de()})]})]})}function at(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=c(o.me.getMe,{host:K}),a=i?.ui,f=$(i?.role)&&n,p=h(o.me.setUiPref).withOptimisticUpdate(Ue),m=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(G,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":g()}),g()]}):null,f?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:ce()}),(0,J.jsx)(`p`,{children:te()}),(0,J.jsx)(`p`,{children:l()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:u(),"aria-label":u(),className:`mb-2`}),m.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ue()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:m.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],s=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(U,{variant:`outline`,children:le()}):s?(0,J.jsx)(U,{variant:`secondary`,children:w()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void p({key:e,value:null}),children:d()}):null,(0,J.jsx)(Ye,{checked:o,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),p({key:e,value:t})},"aria-label":n})]}),f?(0,J.jsx)(rt,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(it,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:s()})}var ot={sm:()=>Se(),md:()=>x(),lg:()=>I(),xl:()=>ke()};function st(){let e=c(o.me.getMe,{host:K}),t=h(o.me.setLocale),n=h(o.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(o.me.getMe,{host:K});n&&e.setQuery(o.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),r=h(o.me.setMyName),i=ze(),a=e?.locale??`default`,s=e?.name??``,[l,u]=(0,q.useState)(null),d=l??s,f=d.trim()!==s.trim();async function p(){try{await r({name:d}),u(null),i.success(_e())}catch(e){i.error(we(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ie()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:d,maxLength:120,placeholder:M(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,J.jsx)(V,{size:`sm`,disabled:!f,onClick:()=>void p(),children:ne()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:P()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[Je().map(e=>(0,J.jsx)(V,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Le()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:R()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:We.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:be()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,J.jsx)(at,{})]})]})}export{st as PreferencesTab};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aa as r,Bg as i,E as a,FP as o,Fg as s,Gg as c,Gr as l,Hg as u,Ig as d,Jg as f,Jr as p,Kg as m,Kr as h,Lg as g,Ma as _,Mg as v,Na as ee,Ng as te,PP as ne,Pg as re,Rg as y,Ug as b,Vg as x,Wg as S,Wr as C,Xg as w,Yg as T,Yr as E,Zg as ie,a_ as ae,gn as D,hn as O,i_ as k,ja as A,ka as j,mn as M,qg as N,qr as P,zg as F}from"./dist-CjH9Ohdx.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as oe,u as H}from"./FieldLabel-BhXlfWG6.js";import{t as U}from"./button-B49JSqzm.js";import{C as W,H as G,S as K,T as q,m as se,w as J,wt as ce,x as Y}from"./index-DnuEILeM.js";import{r as X,t as le}from"./locales-CPjguROj.js";import{t as ue}from"./localePickerView-C2RmOS86.js";/* empty css */var Z=t(e(),1),Q=n(),$={media_delivery:{label:m,help:c},documentary_fetch:{label:S,help:b},inbound_files:{label:u,help:x},history_summary:{label:ee,help:_},file_curation:{label:E,help:p}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
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
|
+
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
|
+
- [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:re,references:te,files:v,previous_summary:A,new_messages:r,max_chars:j,file_name:P,budget_chars:h,feedback:l,content:C};function pe(){let e=o(a.admin.listInstances,{}),[t,n]=(0,Z.useState)(null);if(e===void 0)return(0,Q.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Q.jsx)(`div`,{className:`oc-injtab`,children:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:F()})});let r=e.find(e=>e._id===t)??e[0];return(0,Q.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Q.jsx)(B,{label:ie(),help:w()}),(0,Q.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Q.jsx)(`span`,{children:i()}),(0,Q.jsxs)(Y,{value:r._id,onValueChange:e=>n(e),children:[(0,Q.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:e.map(e=>(0,Q.jsx)(W,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Q.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=ne(a.admin.upsertInstanceConfig),n=G(),r=o(a.me.getMe,{host:ce}),i=e.config??{},s=X(e.config?.contentLocale,r?.defaultLocale??void 0),[c,l]=(0,Z.useState)(()=>R(i,s));(0,Z.useEffect)(()=>{l(R(i,s))},[s,e._id]);let[u,d]=(0,Z.useState)(!1),f=c.promptInjections,p=(e,t)=>l({...c,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){d(!0);try{await t({instanceId:e._id,config:V(c,i,s)})}catch(e){n.error(k(),e)}finally{d(!1)}}async function h(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(k(),e)}}let g=e.config?.contentLocale??`default`,_=le[X(void 0,r?.defaultLocale??void 0)];return(0,Q.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,Q.jsx)(`span`,{children:D()}),(0,Q.jsxs)(Y,{value:g,onValueChange:e=>void h(e),children:[(0,Q.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(q,{})}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(W,{value:`default`,children:M({locale:_})}),ue().map(e=>(0,Q.jsx)(W,{value:e.value,children:e.label},e.value))]})]}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:O()})]}),H.map(e=>(0,Q.jsx)(he,{injKey:e,def:z[e],i18n:$[e],row:f[e]??{enabled:!0,template:z[e].defaultTemplate[s]},contentLocale:s,onChange:t=>p(e,t)},e)),(0,Q.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Q.jsx)(U,{size:`sm`,onClick:()=>void m(),disabled:u,children:ae()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,c]=(0,Z.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=I(e,r,i),h=m?L(m,p):``;return(0,Q.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(se,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,Q.jsx)(B,{label:n.label(),help:n.help()})]}):(0,Q.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,Q.jsx)(`span`,{className:`oc-injection__badge`,children:f()})]}),(0,Q.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,Q.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:N()}),t.placeholders.map(e=>(0,Q.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Q.jsx)(`code`,{children:`{${e}}`}),(0,Q.jsx)(oe,{text:(fe[e]??(()=>e))()})]},e))]}),(0,Q.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:o?g():y()}),l&&(0,Q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:T()})]})]}),o&&(0,Q.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:d()})]}):(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:s()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ab as r,Bb as i,Cb as ee,Db as te,E as a,Eb as ne,FP as o,Fb as s,Gb as c,Hb as l,Ib as u,Kb as d,Lb as f,Mb as re,Nb as p,Ob as m,PP as h,Pb as g,Rb as _,Sb as v,Tb as y,Ub as b,Vb as x,Wb as S,ab as ie,bb as ae,cb as C,db as w,fb as T,ib as E,jb as D,kb as O,lb as k,ob as A,qb as j,sb as M,ub as N,vb as P,wb as F,xb as I,yb as L,yi as R,zb as z}from"./dist-CjH9Ohdx.js";import{t as B}from"./button-B49JSqzm.js";import{Gt as V,H,U,d as W,dt as G,ft as K,m as q}from"./index-DnuEILeM.js";import{t as J}from"./roleDescriptions-C6Gqx97s.js";var Y=t(e(),1),X=n(),Z=[{group:()=>j(),keys:[{key:`traces.read`,label:()=>l()},{key:`traces.read.content`,label:()=>x(),phi:!0},{key:`traces.write`,label:()=>i()}]},{group:()=>d(),keys:[{key:`kpi.read`,label:()=>l()},{key:`kpi.write`,label:()=>i()}]},{group:()=>c(),keys:[{key:`openclaw.query`,label:()=>z()},{key:`anomalies.read`,label:()=>_()},{key:`anomalies.report`,label:()=>f()}]},{group:()=>S(),keys:[{key:`chats.read`,label:()=>l()},{key:`selfheal`,label:()=>s()},{key:`feedback.respond`,label:()=>R()}]},{group:()=>b(),keys:[{key:`admin.manage`,label:()=>u()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=o(a.apiKeys.listRoles,{}),t=h(a.apiKeys.createRole),n=h(a.apiKeys.ensureRolesSeeded),i=h(a.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(a.apiKeys.listRoles,{});r&&e.setQuery(a.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=U(),c=H(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[_,b]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(p(),e)})},[n,c]);let x=e??[];async function S(e,t){if(Q(e.permissions))return;if(e.builtin){await s({title:re({name:e.name}),description:D(),confirmLabel:r()});return}if(_.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];b(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){c.error(O(),e)}finally{b(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function j(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),u(!1)}catch(e){c.error(m(),e)}}let R=e===void 0,z=!R&&x.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,y()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:F()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{f($),u(!0)},children:ee()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:I()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ae()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?g({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:x.map(e=>{let t=Q(e.permissions),n=_.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(G,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(V,{}),` `,L()]}):(0,X.jsx)(G,{variant:`secondary`,children:P()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?T():n?w():r,onCheckedChange:()=>void S(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:l,onOpenChange:u,title:N(),description:k(),canSubmit:!!(d.key&&d.name),onSubmit:j,submitLabel:C(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:M()}),(0,X.jsx)(K,{value:d.key,placeholder:A(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,X.jsx)(K,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:E()}),(0,X.jsx)(K,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$j as r,AM as i,CM as a,D as o,DM as s,E as c,EM as l,EP as u,FM as ee,IM as d,LM as f,MM as te,MP as p,NM as m,OM as ne,OP as re,Qj as ie,RM as ae,SM as oe,TM as se,Wj as ce,Xj as le,Yj as ue,Zj as de,aM as fe,aN as pe,cM as me,cN as he,dM as h,dN as ge,eM as _e,fM as ve,fN as ye,gN as be,hN as xe,iM as Se,iN as Ce,jM as we,kM as Te,lM as Ee,lN as g,mN as De,nM as Oe,nN as ke,oM as Ae,oN as je,pN as Me,rM as Ne,rN as Pe,sM as Fe,sN as Ie,tM as Le,uM as _,uN as Re,zM as ze}from"./dist-CjH9Ohdx.js";import{t as v}from"./button-B49JSqzm.js";import{B as Be,C as y,Ft as Ve,G as He,H as Ue,Ht as We,J as Ge,K as Ke,Kt as qe,Mt as Je,Q as Ye,S as Xe,T as Ze,Ut as Qe,V as $e,Vt as et,X as tt,Y as nt,Z as rt,_t as it,dt as b,ft as x,gt as at,ht as ot,mt as S,pt as C,q as st,vt as w,w as T,x as E,zt as ct}from"./index-DnuEILeM.js";import{a as lt,i as D,n as ut,o as O,r as k,t as dt}from"./table-COx9FvKU.js";var ft=o(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),A=t(e(),1),j=n(),M={minutes:6e4,hours:36e5,days:864e5};function N(e){return e?.data?.code??`unknown`}function P(){let e=p(c.scheduled.listMyCrons),t=p(c.scheduled.getCronDetail),n=p(c.scheduled.listCronRuns),o=p(c.scheduled.updateCron),P=p(c.scheduled.removeCron),pt=p(c.scheduled.runCronNow),F=Ue(),[I,mt]=(0,A.useState)(null),[L,R]=(0,A.useState)(!1),[z,B]=(0,A.useState)(!1),[V,ht]=(0,A.useState)(null),[H,U]=(0,A.useState)(null),[W,G]=(0,A.useState)(null),[K,q]=(0,A.useState)(null),[gt,J]=(0,A.useState)(!1),Y=(0,A.useCallback)(async()=>{R(!0),B(!1);try{mt(await e({}))}catch{B(!0)}finally{R(!1)}},[e]);(0,A.useEffect)(()=>{Y()},[Y]);let _t=(0,A.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),X=(0,A.useRef)(null);(0,A.useEffect)(()=>{I!==null&&X.current!==null&&X.current.scrollIntoView({block:`center`})},[I]);let vt=(0,A.useMemo)(()=>new Intl.DateTimeFormat(re(),{dateStyle:`medium`,timeStyle:`short`}),[]),Z=async(e,t,n)=>{ht(e);try{await t(),F.success(n),await Y()}catch(e){F.toast({variant:`error`,title:m({code:N(e)})})}finally{ht(null)}},Q=(0,A.useRef)(0),$=(0,A.useRef)(0),yt=async(e,t)=>{if(t.id===null)return;let r=++Q.current;G({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Q.current)return;G({name:t.name??t.id,entries:i})}catch(e){if(r!==Q.current)return;G(null),F.toast({variant:`error`,title:m({code:N(e)})})}},bt=async(e,n)=>{if(n.id===null)return;let r=++$.current;q({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%M.days===0?(s=String(e/M.days),c=`days`):e%M.hours===0?(s=String(e/M.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/M.minutes))),c=`minutes`))}if(r!==$.current)return;q(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==$.current)return;q(null),F.toast({variant:`error`,title:m({code:N(e)})})}},xt=async()=>{if(K===null)return;let e={};if(K.nameDirty&&K.name.trim()===``||K.messageDirty&&K.hasMessage&&K.message.trim()===``){F.toast({variant:`error`,title:ue()});return}if(K.nameDirty&&K.name.trim()!==``&&(e.name=K.name.trim()),K.scheduleDirty){if(K.scheduleKind===`cron`&&K.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:K.cronExpr.trim(),...K.tz.trim()===``?{}:{tz:K.tz.trim()}};else if(K.scheduleKind===`every`){let t=Number(K.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*M[K.everyUnit])})}else if(K.scheduleKind===`at`&&K.at!==``){let t=Date.parse(K.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(K.scheduleDirty&&e.schedule===void 0){F.toast({variant:`error`,title:le()});return}if(K.messageDirty&&K.hasMessage&&K.message.trim()!==``&&(e.message=K.message.trim()),Object.keys(e).length===0){q(null);return}let t=$.current;J(!0);try{await o({instanceName:K.instanceName,jobId:K.jobId,patch:e}),F.success(Ee()),t===$.current&&q(null),await Y()}catch(e){F.toast({variant:`error`,title:m({code:N(e)})})}finally{J(!1)}},St=I?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,j.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:be()}),(0,j.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:L,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,j.jsx)(ct,{size:14,"aria-hidden":!0}),xe()]})]}),I===null?(0,j.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":L,children:z?De():u()}):(0,j.jsxs)(j.Fragment,{children:[z?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):null,I.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}):null,I.map(e=>(0,j.jsxs)(`section`,{style:{marginBottom:20},children:[I.length>1||e.error||!e.supported?(0,j.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,j.jsx)(b,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:ge({code:e.error})}):e.jobs.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):(0,j.jsxs)(dt,{children:[(0,j.jsx)(lt,{children:(0,j.jsxs)(O,{children:[(0,j.jsx)(D,{children:g()}),(0,j.jsx)(D,{children:he()}),(0,j.jsx)(D,{children:Ie()}),(0,j.jsx)(D,{children:je()}),(0,j.jsx)(D,{children:pe()}),(0,j.jsx)(D,{children:ve()})]})}),(0,j.jsx)(ut,{children:e.jobs.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,a=V===r,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,j.jsxs)(O,{ref:t.id!==null&&t.id===_t?X:void 0,"data-state":t.id!==null&&t.id===_t?`selected`:void 0,children:[(0,j.jsx)(k,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Ce()}),(0,j.jsx)(k,{children:(0,j.jsx)(b,{variant:`secondary`,children:t.agentId})}),(0,j.jsxs)(k,{className:`whitespace-nowrap`,children:[(0,j.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Be(t.schedule),n=e===null?null:$e(e);return n===null?null:(0,j.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,j.jsx)(k,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:vt.format(t.nextRunAtMs)}),(0,j.jsxs)(k,{children:[t.enabled===!0?(0,j.jsx)(b,{variant:`secondary`,children:ke()}):t.enabled===!1?(0,j.jsx)(b,{variant:`outline`,children:Pe()}):(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,j.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]}),(0,j.jsx)(k,{className:`whitespace-nowrap`,children:t.id===null?(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,j.jsx)(qe,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,j.jsxs)(`span`,{style:{display:`inline-flex`,gap:2},children:[c?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:ae(),"aria-label":ae(),disabled:V!==null,onClick:()=>void Z(r,async()=>{let n=await pt({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},te()),children:(0,j.jsx)(Je,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:t.enabled?f():d(),"aria-label":t.enabled?f():d(),disabled:V!==null,onClick:()=>void Z(r,()=>o({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?we():i()),children:t.enabled?(0,j.jsx)(Qe,{size:14,"aria-hidden":!0}):(0,j.jsx)(et,{size:14,"aria-hidden":!0})}):null,c?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:h(),"aria-label":h(),disabled:V!==null,onClick:()=>void bt(e.instanceName,t),children:(0,j.jsx)(We,{size:14,"aria-hidden":!0})}):null,c?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:_(),"aria-label":_(),disabled:V!==null,onClick:()=>void yt(e.instanceName,t),children:(0,j.jsx)(ft,{size:14,"aria-hidden":!0})}):null,s?(0,j.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:ee(),"aria-label":ee(),disabled:V!==null,onClick:()=>U({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,j.jsx)(Ve,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:ye()})]},e.instanceName)),St>0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:ce()}):null]}),(0,j.jsx)(He,{open:H!==null,onOpenChange:e=>{e||U(null)},children:(0,j.jsxs)(Ge,{children:[(0,j.jsxs)(rt,{children:[(0,j.jsx)(Ye,{children:ne()}),(0,j.jsx)(nt,{children:s({name:H?.name??``})})]}),(0,j.jsxs)(tt,{children:[(0,j.jsx)(st,{children:l()}),(0,j.jsx)(Ke,{onClick:()=>{let e=H;U(null),e!==null&&Z(`${e.instanceName}:${e.jobId}`,()=>P({instanceName:e.instanceName,jobId:e.jobId}),Te())},children:se()})]})]})}),(0,j.jsx)(C,{open:W!==null,onOpenChange:e=>{e||(Q.current++,G(null))},children:(0,j.jsxs)(S,{style:{maxWidth:640},children:[(0,j.jsx)(it,{children:(0,j.jsx)(w,{children:me({name:W?.name??``})})}),W?.entries===null?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):W!==null&&W.entries.length===0?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):W===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:W.entries.map((e,t)=>(0,j.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,j.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[e.status===`ok`?(0,j.jsx)(b,{variant:`secondary`,children:a()}):e.status===`error`?(0,j.jsx)(b,{variant:`destructive`,children:oe()}):(0,j.jsx)(b,{variant:`outline`,children:e.status??`—`}),(0,j.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?vt.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,j.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,j.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error})]},t))})]})}),(0,j.jsx)(C,{open:K!==null,onOpenChange:e=>{e||($.current++,q(null))},children:(0,j.jsxs)(S,{children:[(0,j.jsxs)(it,{children:[(0,j.jsx)(w,{children:Ae()}),(0,j.jsx)(ot,{children:fe()})]}),K===null?null:K.loading?(0,j.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,j.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:g()}),(0,j.jsx)(x,{value:K.name,maxLength:200,onChange:e=>q({...K,name:e.target.value,nameDirty:!0})})]}),(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Se()}),(0,j.jsxs)(E,{value:K.scheduleKind,onValueChange:e=>q({...K,scheduleKind:e,scheduleDirty:!0}),children:[(0,j.jsx)(T,{children:(0,j.jsx)(Ze,{})}),(0,j.jsxs)(Xe,{children:[(0,j.jsx)(y,{value:`cron`,children:Ne()}),(0,j.jsx)(y,{value:`every`,children:Oe()}),(0,j.jsx)(y,{value:`at`,children:Le()})]})]}),K.scheduleKind===`cron`?(0,j.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,j.jsx)(x,{value:K.cronExpr,onChange:e=>q({...K,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,j.jsx)(x,{value:K.tz,onChange:e=>q({...K,tz:e.target.value,scheduleDirty:!0}),placeholder:`America/Toronto`,style:{maxWidth:180}})]}):K.scheduleKind===`every`?(0,j.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,j.jsx)(x,{type:`number`,min:1,value:K.everyValue,onChange:e=>q({...K,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,j.jsxs)(E,{value:K.everyUnit,onValueChange:e=>q({...K,everyUnit:e,scheduleDirty:!0}),children:[(0,j.jsx)(T,{style:{maxWidth:160},children:(0,j.jsx)(Ze,{})}),(0,j.jsxs)(Xe,{children:[(0,j.jsx)(y,{value:`minutes`,children:_e()}),(0,j.jsx)(y,{value:`hours`,children:r()}),(0,j.jsx)(y,{value:`days`,children:ie()})]})]})]}):(0,j.jsx)(x,{type:`datetime-local`,value:K.at,onChange:e=>q({...K,at:e.target.value,scheduleDirty:!0})})]}),K.hasMessage?(0,j.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,j.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ze()}),(0,j.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:K.message,onChange:e=>q({...K,message:e.target.value,messageDirty:!0})})]}):null]}),(0,j.jsxs)(at,{children:[(0,j.jsx)(v,{variant:`ghost`,onClick:()=>q(null),children:l()}),(0,j.jsxs)(v,{onClick:()=>void xt(),disabled:K===null||K.loading||gt,children:[gt?(0,j.jsx)(qe,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,de()]})]})]})})]})}export{P as ScheduledTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AO as i,Ak as ee,BO as te,CO as a,Ck as ne,DO as o,Dk as re,E as s,EO as c,Ek as l,FO as ie,FP as u,GO as ae,HO as oe,IO as se,JO as ce,KO as le,LO as ue,MO as d,MP as de,NO as f,OO as p,Ok as fe,PO as m,PP as h,QO as pe,RO as me,SO as he,Sk as ge,TO as _e,Tk as ve,UO as ye,VO as be,WO as xe,XO as Se,YO as Ce,ZO as we,_O as g,_k as Te,ak as Ee,bO as _,bk as De,ck as Oe,dO as v,dk as ke,ek as Ae,fO as y,fk as je,gO as b,gk as Me,hO as x,hk as Ne,ik as Pe,jO as S,jk as Fe,kO as C,kk as Ie,lk as Le,mO as w,mk as Re,nk as ze,ok as Be,pO as T,pk as Ve,qO as He,rk as Ue,sk as We,tk as Ge,uk as Ke,vO as E,vk as qe,wO as D,wk as Je,xO as O,xk as Ye,yO as k,yk as Xe,zO as Ze}from"./dist-CjH9Ohdx.js";import{n as A}from"./dist-C0sZxuDo.js";import{i as Qe}from"./dist-DCbB4klt.js";import{t as j}from"./button-B49JSqzm.js";import{C as M,H as $e,S as N,T as P,U as et,Zt as F,_t as I,d as tt,dt as L,en as nt,ft as rt,gt as R,ht as z,mt as B,nn as it,nt as V,pt as at,rn as ot,rt as H,vt as U,w as W,x as G}from"./index-DnuEILeM.js";import{t as st}from"./FilterBar-BVzupjQK.js";import{t as ct}from"./DataTableShell-DKcU9E8v.js";import{t as lt}from"./roleDescriptions-C6Gqx97s.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>g(),days:null},{value:`30`,label:()=>b(),days:30},{value:`90`,label:()=>x(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=ot({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[a,o]=(0,K.useState)(X),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),f=u(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:i===X?void 0:i===`disabled`}}),p=u(s.apiKeys.listKeys,{}),m=u(s.apiKeys.listRoles,{}),he=h(s.apiKeys.createServiceAccount),_e=h(s.apiKeys.updateServiceAccount),g=h(s.apiKeys.deleteServiceAccount),_=de(s.apiKeys.mintApiKey),v=h(s.apiKeys.revokeApiKey),y=et(),b=$e(),x=n!==``||a!==X||i!==X;function S(){o(X),t({search:{},replace:!0})}let[C,w]=(0,K.useState)(!1),[T,E]=(0,K.useState)(Z),[D,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(new Set),[F,I]=(0,K.useState)(null),R=(0,K.useRef)(!1),[z,B]=(0,K.useState)(new Set),[V,at]=(0,K.useState)({}),[H,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[p]);function Q(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await _e({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),b.success(Ce())):await he({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Z),O(null),w(!1)}catch(e){b.error(D?Se():we(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function mt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await _({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){b.error(ce(),e)}finally{R.current=!1,I(null)}}async function $(e){if(await y({title:He(),description:(0,q.jsxs)(q.Fragment,{children:[le(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ae(),` `,(0,q.jsx)(`strong`,{children:xe()}),` `,ye()]}),confirmWord:e.name,confirmLabel:oe(),destructive:!0}))try{await g({serviceAccountId:e._id}),b.success(be(),e.name)}catch(e){b.error(te(),e)}}async function ht(e){if(await y({title:Ze(),description:(0,q.jsxs)(q.Fragment,{children:[me(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ue()]}),confirmLabel:se(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await v({keyId:e._id})}catch(e){b.error(ie(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,q.jsxs)(st,{q:n,onQChange:c,searchPlaceholder:ee(),onReset:S,canReset:x,children:[(0,q.jsxs)(G,{value:a,onValueChange:o,children:[(0,q.jsx)(W,{size:`sm`,className:`w-40`,children:(0,q.jsx)(P,{placeholder:Ie()})}),(0,q.jsxs)(N,{children:[(0,q.jsx)(M,{value:X,children:fe()}),(m??[]).map(e=>(0,q.jsx)(M,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:i,onValueChange:d,children:[(0,q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,q.jsx)(P,{})}),(0,q.jsxs)(N,{children:[(0,q.jsx)(M,{value:X,children:re()}),(0,q.jsx)(M,{value:`active`,children:l()}),(0,q.jsx)(M,{value:`disabled`,children:ve()})]})]})]}),(0,q.jsx)(ct,{title:Je(),rows:f,addLabel:ne(),onAdd:()=>{E(Z),O(null),w(!0)},emptyHint:ge(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:qe(),onSelect:()=>pt(e)},{label:Ye(),onSelect:()=>void mt(e)},{label:k.has(e._id)?De():Xe(),onSelect:()=>Q(e._id)},{label:Te(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Me():Ne(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,q.jsx)(Qe,{}):(0,q.jsx)(nt,{})})},{header:Re(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ve(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:je(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(L,{variant:`destructive`,children:ve()}):(0,q.jsx)(L,{variant:`outline`,children:l()})},{header:ke(),cell:e=>(0,q.jsxs)(G,{value:V[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(W,{size:`sm`,className:`w-32`,children:(0,q.jsx)(P,{})}),(0,q.jsx)(N,{children:J.map(e=>(0,q.jsx)(M,{value:e.value,children:e.label()},e.value))})]})},{header:Ke(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:F===e._id?Le():Oe({count:t})})}}]}),(0,q.jsx)(tt,{open:C,onOpenChange:e=>{w(e),e||O(null)},title:D?We():Pe(),description:D?Be():Ue(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?Ee():ze(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ge()}),(0,q.jsx)(rt,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ae()}),(0,q.jsxs)(G,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,q.jsx)(W,{className:`w-full`,children:(0,q.jsx)(P,{placeholder:r()})}),(0,q.jsx)(N,{children:(m??[]).map(e=>(0,q.jsxs)(M,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===T.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,q.jsx)(rt,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:H,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[m(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:d()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:i()}),(0,q.jsx)(`th`,{children:C()}),(0,q.jsx)(`th`,{children:p()}),(0,q.jsx)(`th`,{children:o()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:H(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?c():_e()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(at,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(B,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(I,{children:[(0,q.jsx)(U,{children:D()}),(0,q.jsx)(z,{children:a({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:he()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":O(),children:[n?(0,q.jsx)(A,{}):(0,q.jsx)(F,{}),n?_():k()]})]}),(0,q.jsx)(R,{children:(0,q.jsx)(j,{onClick:()=>{r(!1),t()},children:E()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?w():H(e)}function mt(e){return e===null?`—`:V(e)}function $(e){return e.disabled?(0,q.jsx)(L,{variant:`destructive`,children:T()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(L,{variant:`outline`,children:y()}):(0,q.jsx)(L,{variant:`outline`,children:v()})}export{Q as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Ba as i,E as a,FP as o,Ga as s,Ha as c,Ja as l,Ka as u,PP as d,Qa as f,Ra as p,So as m,Ua as h,Va as g,Wa as _,Xa as v,Ya as y,Za as b,_o as x,ao as S,bo as C,co as w,do as T,eo as E,fo as D,go as O,ho as k,io as A,lo as j,mo as M,no as N,oo as P,po as F,qa as I,ro as L,so as R,to as ee,uo as z,vo as B,xo as V,yo as H,za as U}from"./dist-CjH9Ohdx.js";import{t as W}from"./button-B49JSqzm.js";import{U as G,rt as K}from"./index-DnuEILeM.js";import{t as q}from"./DataTableShell-DKcU9E8v.js";var J=t(e(),1),Y=n(),X={hung:()=>S(),wrong_result:()=>A(),error:()=>L(),other:()=>N()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=d(a.subAgentReports.respondToReport),[i,o]=(0,J.useState)(e.thread),[p,m]=(0,J.useState)(``),[x,S]=(0,J.useState)(!1);async function C(){let t=p.trim();if(!(!t||x)){S(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{S(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,ee({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:E()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?f():b()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:v()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:y(),value:p,maxLength:2e3,rows:3,onChange:e=>m(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void C(),disabled:!p.trim()||x,children:x?I():l()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[u({count:t.children.length}),t.childrenTruncated?` ${s()}`:``,t.textTruncated?` ${_()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${h()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=o(a.subAgentReports.listForAdmin,{}),t=d(a.subAgentReports.readReport),n=d(a.subAgentReports.deleteReport),r=G(),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)({});async function f(e){if(s===e._id){c(null);return}if(!l[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}c(e._id)}async function h(e){await r({title:i(),description:U(),confirmLabel:p(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[C(),` `,(0,Y.jsx)(`strong`,{children:H()}),` `,B()]}),(0,Y.jsx)(q,{title:m(),rows:e,emptyHint:V(),isExpanded:e=>s===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Y.jsx)($,{data:l[e._id]}):null,columns:[{header:x(),cell:e=>K(e.at),sort:e=>e.at},{header:O(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:k(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:M(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${T({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:F(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:D(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:z()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:j()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?R():w(),onSelect:()=>void f(e)},{label:P(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|