@lacneu/atrium 0.28.0 → 0.28.2
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-CUrhYOD-.js +1 -0
- package/dist/assets/{AdvancedFilter-BFrnFKT8.js → AdvancedFilter-BM-NsfWQ.js} +1 -1
- package/dist/assets/AgentFilesTab-Dq4y_9nj.js +3 -0
- package/dist/assets/AnomaliesTab-C40acUCU.js +1 -0
- package/dist/assets/{AuditTab-BrQtjSHt.js → AuditTab-7UfsE_38.js} +1 -1
- package/dist/assets/BridgeTab-CjidRXGN.js +1 -0
- package/dist/assets/ChatDefaultsTab-Bl4jU1yW.js +1 -0
- package/dist/assets/{DataTableShell-D3UoYiLm.js → DataTableShell-DBDIF654.js} +1 -1
- package/dist/assets/{DetailChips-CEPLO74z.js → DetailChips-eDCHm7fV.js} +1 -1
- package/dist/assets/FeedbacksTab-B40TFMxk.js +1 -0
- package/dist/assets/{FieldLabel-D-Hzx5_p.js → FieldLabel-BxCSPKLD.js} +2 -2
- package/dist/assets/FilesTab-go4v_nAG.js +1 -0
- package/dist/assets/{FilterBar-BwVt4XJ7.js → FilterBar-egrudkw6.js} +1 -1
- package/dist/assets/GroupsTab-DPMLiMCc.js +1 -0
- package/dist/assets/InstancesTab-KzujA3gD.js +1 -0
- package/dist/assets/IntegrationsTab-y61Q2VDy.js +1 -0
- package/dist/assets/KpiTab-BW9nVj-Y.js +1 -0
- package/dist/assets/PreferencesTab-CNpy4JQu.js +1 -0
- package/dist/assets/{PromptInjectionsTab-twM5Wu4M.js → PromptInjectionsTab-CWC7LSmE.js} +2 -2
- package/dist/assets/RolesTab-DyDQiA_c.js +1 -0
- package/dist/assets/ServiceAccountsTab-B6F-47Gm.js +1 -0
- package/dist/assets/SubAgentReportsTab-NTWhdI69.js +1 -0
- package/dist/assets/ThemeShowroom-B7Z2ffNQ.js +1 -0
- package/dist/assets/{TimeRangePicker-pz6n37si.js → TimeRangePicker-CjeAiSdk.js} +1 -1
- package/dist/assets/TracesTab-CFkotfAj.js +1 -0
- package/dist/assets/UsersTab-BUX8VYmD.js +1 -0
- package/dist/assets/{button-BKx-78Cz.js → button-CcNQBW08.js} +1 -1
- package/dist/assets/{card-r-aJwNEo.js → card-B9JuMxhP.js} +1 -1
- package/dist/assets/chevrons-up-down-ar6Ygzeq.js +1 -0
- package/dist/assets/{compatView-Cvvm-eZM.js → compatView-aBtPNegs.js} +1 -1
- package/dist/assets/dispatchErrorInfo-MZJyPS1B.js +1 -0
- package/dist/assets/{dist-CLSp0oLP.js → dist-BOukL7gG.js} +1 -1
- package/dist/assets/{dist-CdJRWSN2.js → dist-BhnVOFIn.js} +1 -1
- package/dist/assets/dist-CNxV6qRL.js +5 -0
- package/dist/assets/dist-GFH_mzhb.js +1 -0
- package/dist/assets/{highlighted-body-OFNGDK62-BB_6m41R.js → highlighted-body-OFNGDK62-CcH-KtiT.js} +1 -1
- package/dist/assets/index-HZd91gw7.js +229 -0
- package/dist/assets/mermaid-GHXKKRXX-D7Hy3m87.js +1 -0
- package/dist/assets/roleDescriptions-CxEPrkAY.js +1 -0
- package/dist/assets/{table-v_cIgz3K.js → table-DAtXjw2C.js} +1 -1
- package/dist/assets/{tabs-ClKgxi4q.js → tabs-BHYINAjr.js} +1 -1
- package/dist/assets/x-C81gK-RB.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AccessTab-DvvDXBXb.js +0 -1
- package/dist/assets/AgentFilesTab-jMVGc-7o.js +0 -3
- package/dist/assets/AnomaliesTab-JRqIpCQ3.js +0 -1
- package/dist/assets/BridgeTab-CVMr5-7B.js +0 -1
- package/dist/assets/ChatDefaultsTab-CRnsKi17.js +0 -1
- package/dist/assets/FeedbacksTab-DtcTHukp.js +0 -1
- package/dist/assets/FilesTab-9huo9v-_.js +0 -1
- package/dist/assets/GroupsTab-CtYeHOBA.js +0 -1
- package/dist/assets/InstancesTab-BNzkCJvr.js +0 -1
- package/dist/assets/IntegrationsTab-BRGKBdRH.js +0 -1
- package/dist/assets/KpiTab-J9KHRyfK.js +0 -1
- package/dist/assets/PreferencesTab-C_MSfGKP.js +0 -1
- package/dist/assets/RolesTab-C9h6psGw.js +0 -1
- package/dist/assets/ServiceAccountsTab-CxPmhPYx.js +0 -1
- package/dist/assets/SubAgentReportsTab-BlTwmb10.js +0 -1
- package/dist/assets/ThemeShowroom-DZ0Zkebx.js +0 -1
- package/dist/assets/TracesTab-Bn3nIxEe.js +0 -1
- package/dist/assets/UsersTab-C4Vr4jwt.js +0 -1
- package/dist/assets/chevrons-up-down-59d1_9hJ.js +0 -1
- package/dist/assets/dispatchErrorInfo-BY-uJbtG.js +0 -1
- package/dist/assets/dist-CEZ2NhYx.js +0 -5
- package/dist/assets/dist-DcNll3Cm.js +0 -1
- package/dist/assets/index-BDVPDgRe.js +0 -229
- package/dist/assets/mermaid-GHXKKRXX-Bt2lAXSp.js +0 -1
- package/dist/assets/roleDescriptions-BVyzh7hN.js +0 -1
- package/dist/assets/x-DmVX0ZZY.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,BO as i,Jo as a,NO as o,Qo as s,Xo as c,Yo as l,Zo as u,as as d,cs as f,es as p,is as m,ns as h,oO as g,os as _,rs as v,ss as y,ts as b}from"./dist-BOukL7gG.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-HZd91gw7.js";var D=t(e(),1);function O(e){return e===`user`?s():e===`all`?u():c({group:e.group})}function k(e){return e===`common`?l():e===`owner`?a():c({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=i(o.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=i(o.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":y(),children:(0,A.jsx)(x,{placeholder:y()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:r()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_l as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_l as r,gl as i,hl as a,ml as o,pl as s,vl as c,yl as l}from"./dist-BOukL7gG.js";import{i as u}from"./dist-GFH_mzhb.js";import{t as d}from"./x-C81gK-RB.js";import{t as f}from"./button-CcNQBW08.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-HZd91gw7.js";import{r as b}from"./TimeRangePicker-CjeAiSdk.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}),c(),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)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:i()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{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)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),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)(_,{}),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{Ai as r,BO as i,Bi as a,Ci as o,Di as s,Ea as c,Ei as l,Fi as ee,Hi as u,Ii as te,LO as d,Li as ne,Mi as f,NO as p,Ni as re,Oi as m,Pi as ie,Ri as h,Si as g,Ti as _,Ui as v,Vi as y,ZS as b,_i as x,bi as S,cO as ae,gi as C,hi as w,ji as oe,ki as T,mi as se,oO as E,vi as D,wa as ce,wi as O,xi as k,yi as A,zi as j}from"./dist-BOukL7gG.js";import{t as M}from"./button-CcNQBW08.js";import{$ as N,A as P,B as F,C as I,F as le,I as ue,L as de,N as fe,P as pe,Q as me,R as he,S as L,X as R,b as z,et as ge,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-HZd91gw7.js";import{i as G}from"./compatView-aBtPNegs.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*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 be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(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<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=i(p.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=i(p.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!r||r.length===0||(!o||!r.some(e=>e.name===o))&&s(r[0].name)},[t,r,o]);let c=i(p.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),l=i(p.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return o===null||c===void 0?r!==void 0&&r.length===0?[]:void 0:c.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,c,r,l]),[g,_]=(0,K.useState)(null);(0,K.useEffect)(()=>{!m||m.length===0||(!g||!m.some(e=>$(e)===g))&&_($(m[0]))},[m,g]);let b=m?.find(e=>$(e)===g)??null,x=d(p.agentFiles.listAgentFiles),[S,C]=(0,K.useState)({status:`idle`}),w=b?.instanceName??null,T=b?.agentId??null,se=i(p.compat.forInstance,n&&w!==null?{instanceName:w}:`skip`),D=n&&w!==null?H(se,`agentFiles`):null,O=D===null?!1:D===`loading`?null:D.blocked,k=(0,K.useCallback)(async()=>{if(!(w===null||T===null)){C({status:`loading`});try{C({status:`done`,files:(await x({instanceName:w,agentId:T})).files})}catch{C({status:`error`})}}},[x,w,T]);(0,K.useEffect)(()=>{O===!1&&k()},[k,O]);let[A,N]=(0,K.useState)(null),P=ae(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(W,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":u(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(r??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(W,{value:g??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":y(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:m.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}),b===null?null:D===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):D!==null&&D.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(D.gatewayVersion)]}):S.status===`loading`||S.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):S.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:ce()})]}):S.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:S.files.map(e=>{let n=Y(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)(R,{variant:`outline`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:te({size:Z(e.size,P)})}),(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:ee({pct:F.format(n)})}),r?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":ie()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?f():oe()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:re({used:Z(be(S.files),P),total:Z(J,P),pct:F.format(X(be(S.files)))})})]}),A&&b?(0,Q.jsx)(Te,{instanceName:b.instanceName,agentId:b.agentId,name:A.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void k()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:ee}){let u=d(p.agentFiles.getAgentFile),te=d(p.agentFiles.setAgentFile),ne=P(),[f,re]=(0,K.useState)(null),[ie,h]=(0,K.useState)(!1),[v,y]=(0,K.useState)(``),[oe,j]=(0,K.useState)(!1),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{h(!1);try{let i=await u({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||y(i.content),z(!1)}catch{h(!0)}},[u,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(f!==null){L(!0),V(!1);try{await te({instanceName:e,agentId:t,name:n,content:v,baseUpdatedAtMs:f.updatedAtMs??void 0}),ne.success(O({name:n})),ee(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=f!==null&&v!==f.content,G=(0,K.useMemo)(()=>f===null?null:Se(f.content,v),[f,v]),J=v.length>q,Y=ae(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:r({name:n})}),(0,Q.jsxs)(ge,{children:[T({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,m()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[g(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:ce()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:v,readOnly:!i,spellCheck:!1,onChange:e=>y(e.target.value),"aria-label":r({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:s()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[k(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:S()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:o()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:l({count:X.format(v.length),max:X.format(q)})}),i?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>j(!0),children:I?c():_()}):null]})]}),(0,Q.jsx)(fe,{open:oe,onOpenChange:j,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:A({name:n})}),(0,Q.jsx)(de,{children:D({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:x({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:C()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:w()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(he,{children:[(0,Q.jsx)(le,{children:b()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:se()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Am as i,BO as a,Bm as ee,Cm as o,Dm as s,Em as c,Fm as l,Gm as te,Hm as ne,Im as u,Jm as d,Km as f,Lm as p,Mm as m,NO as h,Nm as g,Om as re,Pm as ie,Qm as ae,Rm as oe,Sm as _,Tm as se,Um as ce,Vm as le,Wm as ue,Xm as de,Ym as fe,Zm as pe,ah as me,bm as v,ch as y,eh as he,ih as ge,jm as b,km as x,nh as S,oh as C,qm as w,rh as T,sh as E,th as D,wm as O,xm as k,zO as A,zm as j}from"./dist-BOukL7gG.js";import{A as M,C as N,Mt as P,S as F,X as I,a as L,b as R,j as _e,jt as z,ot as ve,r as ye,x as B,y as V}from"./index-HZd91gw7.js";import{n as be}from"./TimeRangePicker-CjeAiSdk.js";import{t as xe}from"./FilterBar-egrudkw6.js";import{t as Se}from"./DataTableShell-DBDIF654.js";import{t as H}from"./dispatchErrorInfo-MZJyPS1B.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?y():e===`acknowledged`?E():C()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,o=e.status===K?G:e.status,_=e.severity??G,v=e.kind??G,[y,C]=(0,U.useState)(G),E=ye(e.from,e.to),{from:k,to:H}=be(E),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=M(),Q=A(h.anomalies.resolveAnomaly),Fe=(a(h.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=a(h.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:k,to:H,anomalyStatus:o===G?void 0:o,severity:_===G?void 0:_,source:y===G?void 0:y,kind:v===G?void 0:v}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||o!==`open`||_!==G||y!==G||v!==G||E.kind!==`relative`||E.from!==De.from;function Re(){C(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:me(),description:(0,W.jsxs)(W.Fragment,{children:[ge(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,T(),` `,(0,W.jsx)(`strong`,{children:S()}),`.`,` `,D()]}),confirmLabel:he()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(r(),e.kind)}catch(e){Z.error(ae(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(pe(),e.kind)}catch(e){Z.error(de(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[fe(),` `,(0,W.jsx)(`strong`,{children:d()}),` `,w(),` `,(0,W.jsx)(`strong`,{children:f()}),` `,te(),` `,(0,W.jsx)(`strong`,{children:ue()}),` `,ce(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:ne()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:le(),timeRange:E,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:o,onValueChange:J,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ee()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:_,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:j()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:oe()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:y,onValueChange:C,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:p()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:u()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:v,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:l()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ie()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:g(),rows:$,emptyHint:o===`open`?m():b(),rowActions:e=>Fe&&e.status===`open`?[{label:i(),onSelect:()=>void ze(e)},{label:x(),onSelect:()=>void Be(e)}]:[],columns:[{header:re(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:l(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:j(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:s(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:p(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:c(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:se(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:O(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Me(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(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 Y(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 ke({row:e}){let t=z();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.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=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,o()]}):null]})}function Ae({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,W.jsx)(I,{variant:`destructive`,children:_()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:k()}):(0,W.jsx)(I,{variant:`outline`,children:v()})}function Me(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,BO as i,NO as a,ag as o,cg as s,dg as c,eg as l,fg as u,ig as ee,lg as d,ng as f,og as p,pg as m,rg as h,sg as g,tg as _,ug as v}from"./dist-BOukL7gG.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-HZd91gw7.js";import{n as j}from"./TimeRangePicker-CjeAiSdk.js";import{t as M}from"./FilterBar-egrudkw6.js";import{t as N}from"./AdvancedFilter-BM-NsfWQ.js";import{t as P}from"./DataTableShell-DBDIF654.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=i(a.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:c(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:v()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:d()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:s()}),(0,I.jsx)(k,{value:`yes`,children:g()}),(0,I.jsx)(k,{value:`no`,children:p()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:o()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:ee()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:h(),rows:Q,emptyHint:f(),columns:[{header:_(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:v(),cell:e=>e.action,sort:e=>e.action},{header:l(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:r(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:o(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,$u as i,Ad as a,BO as o,Br as s,Cd as c,Dd as l,Ed as u,Fd as d,Gr as f,Gu as p,Hr as m,Id as h,Ir as g,Jr as _,Ju as v,Kr as y,Ku as b,LO as ee,Ld as te,Md as ne,NO as x,Nd as re,Od as S,PO as C,Pd as ie,Qr as ae,Qu as oe,Rd as se,Sd as ce,Td as le,Ur as ue,Vr as de,Wr as fe,Xr as pe,Xu as me,Yr as he,Yu as ge,Zr as _e,Zu as ve,_d as ye,_f as be,ad as w,bd as xe,bf as Se,cd as Ce,cf as we,dd as Te,df as Ee,ed as De,fd as Oe,ff as ke,gd as Ae,gf as je,hd as Me,hf as Ne,id as Pe,jd as Fe,kd as Ie,ld as Le,md as Re,mf as ze,nd as Be,od as Ve,pd as He,pf as Ue,qr as We,qu as T,rd as Ge,sd as Ke,sf as qe,td as Je,ud as Ye,vd as E,vf as Xe,wd as Ze,xd as Qe,xf as $e,yd as et,zO as tt,zd as nt}from"./dist-BOukL7gG.js";import{i as D,r as rt}from"./dist-GFH_mzhb.js";import{t as it}from"./chevrons-up-down-ar6Ygzeq.js";import{i as at,n as O,o as ot,r as st,s as ct}from"./FieldLabel-BxCSPKLD.js";import{t as k}from"./button-CcNQBW08.js";import{$ as lt,A as ut,At as A,C as j,H as dt,Q as ft,S as M,St as pt,U as mt,V as ht,X as N,Z as P,_ as gt,_t,b as F,et as vt,jt as yt,kt as I,mt as L,nt as bt,ot as xt,rt as St,x as R,y as z}from"./index-HZd91gw7.js";import{a as Ct,i as B,n as wt,o as V,r as H,t as Tt}from"./table-DAtXjw2C.js";import{t as Et}from"./FilterBar-egrudkw6.js";import{a as U,n as Dt,o as W,r as Ot,s as kt,t as At}from"./compatView-aBtPNegs.js";import{t as G}from"./dispatchErrorInfo-MZJyPS1B.js";var jt=C(`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`}]]),Mt=C(`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 Nt(e){return e.filter(e=>e.state===`error`)}function Pt(e){return e.reachable&&Nt(e.targets).length===0}function Ft(e){return e.state===`error`&&e.lastErrorCode!==null}function It(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Lt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Rt(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 Lt(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 zt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Bt={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Vt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ht(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Ut(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Wt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return W(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Gt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Ut(t.key,e),a=Ut(t.key,r);return i&&a?0:i?1:a?-1:n*Wt(t.key,e,r)})}function Kt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function qt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function Jt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>W(e,t)??X(e,t))}var Z=n();function Yt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Bt),[a,o]=(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,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)(()=>Kt(s),[s]),l=(0,K.useMemo)(()=>qt(s),[s]),u=(0,K.useMemo)(()=>Jt(s),[s]),d=(0,K.useMemo)(()=>Gt(Ht(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Et,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ve(),onReset:()=>r(Bt),canReset:Vt(n),children:[(0,Z.jsxs)(z,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Pe()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:w()}),c.map(e=>(0,Z.jsx)(R,{value:e,children:Zt(e)},e))]})]}),(0,Z.jsxs)(z,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:Ge()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:w()}),l.map(e=>(0,Z.jsx)(R,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(z,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Be()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:w()}),u.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):(0,Z.jsxs)(Tt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ct,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:De(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:i(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:oe(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:ve(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:me(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(B,{children:ge()}),(0,Z.jsx)(Q,{label:v(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(wt,{children:d.map(e=>(0,Z.jsx)(Xt,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(rt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(it,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Xt({r:e}){let t=Ft(e)?G(e.lastErrorCode):null,n=It(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(Qt,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Ce({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ke({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Zt(e){return e===`connected`?T():e===`error`?b():p()}function Qt({state:e}){return e===`connected`?(0,Z.jsx)(N,{variant:`secondary`,children:T()}):e===`error`?(0,Z.jsx)(N,{variant:`destructive`,children:b()}):(0,Z.jsx)(N,{variant:`outline`,children:p()})}function $t(){return o(x.bridgeHealth.getBridgeHealth,{})}function en(){let e=$t(),t=o(x.compat.getBridgeCompat,{}),n=o(x.me.getMe,{host:xt})?.role===`admin`,r=o(x.admin.listInstances,n?{}:`skip`),i=yt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),s=Rt(e?e.targets:[],t?t.targets:[],r??[]),c=t?.compat??null,l=t===void 0?`loading`:t===null?`nodata`:`ready`,u=c!==null&&Dt(c,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(tn,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:le()}),s.map(e=>(0,Z.jsx)(nn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:c,compatStatus:l,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),u?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):null]})}function tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:U(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:_e(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,pe({build:t.buildVersion??`?`})]}):null,` · `,he(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?_():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ye()});let o=Nt(e.targets),s=!e.reachable,c=Pt(e),l=c?`ok`:`error`,u=new Date(e.checkedAt).toLocaleString(`fr-FR`),d=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${l}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c?(0,Z.jsx)(I,{size:22}):s?(0,Z.jsx)(Mt,{size:22}):(0,Z.jsx)(L,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c?Ae():s?Me():Re({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(jt,{size:12,"aria-hidden":!0}),` `,He({time:u})]}),d?(0,Z.jsx)(`span`,{children:Oe({time:d})}):null,a]}),s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Te()})]})}function nn({providerKey:e,connections:t,instances:n,manifest:i,compatStatus:a,compatReachable:o,protocol:s}){let c=i?kt(i,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:At(t,e,i)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(0,K.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(_t,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:zt(e)}),p?(0,Z.jsx)(N,{variant:p===`beyond`?`destructive`:`secondary`,children:Ot(p)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:r()}),(0,Z.jsx)(an,{support:c,compatStatus:a,compatReachable:o,manifest:i,instanceRows:u}),s?(0,Z.jsx)(rn,{protocol:s}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),Ye({count:t.length})]}),m?(0,Z.jsx)(Yt,{connections:t,displayByInstance:l}):null]})}function rn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ze(),i.length>0?(0,Z.jsx)(N,{variant:`destructive`,children:ce({count:i.length})}):(0,Z.jsx)(N,{variant:`secondary`,children:c()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Qe({version:e.vendoredVersion}),r?` · `+xe({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),et({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function an({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:We()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:f()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:fe({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:_()}),e?(0,Z.jsx)(cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:U(e.version)}),(0,Z.jsx)(N,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Ot(e.state)})]},e.instanceName))})]})}function on({instance:e,onClose:t}){return(0,Z.jsx)(ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(lt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(bt,{children:[(0,Z.jsx)(St,{children:$e({instance:e.displayName??e.name})}),(0,Z.jsx)(vt,{children:Se()})]}),(0,Z.jsx)(sn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(I,{"aria-hidden":!0}):(0,Z.jsx)(L,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ie():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,S()]}):null}function sn({instance:e,onClose:t}){let n=tt(x.admin.upsertInstanceConfig),r=ee(x.bridge.validateMediaPaths),i=ut(),[o,s]=(0,K.useState)(()=>at(e.config??{})),[c,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),v=o.inboundMediaMode===`shared-fs`,y=o.mediaMode===`shared-fs`,b=v||y;async function S(){m(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(re(),e)}finally{m(!1)}}async function C(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:st(o,r)}),t()}catch(e){i.error(Ue(),e)}finally{f(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Xe(),help:ke()}),(0,Z.jsxs)(z,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(F,{children:ct.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:be(),help:Ee()}),(0,Z.jsxs)(z,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(F,{children:ot.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:je(),help:we()}),(0,Z.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:nt(),help:se()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:te(),help:h()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(gt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(O,{label:Ne(),help:qe()})]}),b&&g!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(L,{"aria-hidden":!0}),u({reason:g.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Fe(),result:g.inbound}),(0,Z.jsx)($,{label:a(),result:g.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(L,{"aria-hidden":!0}),l()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:p,children:[p?(0,Z.jsx)(pt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ie():d()]}),(0,Z.jsx)(k,{size:`sm`,onClick:()=>void C(),disabled:c,children:ze()})]})]})})}function cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(mt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ue():m({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(dt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:de()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(N,{variant:`secondary`,children:e},e))})]})]})}export{en as BridgeTab,on as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BO as r,Ea as i,F as a,Hi as o,I as s,LO as c,NO as l,P as u,ZS as d,ai as f,ba as p,ci as m,di as h,ei as g,fi as _,ii as v,li as y,ni as ee,oO as b,oi as x,ri as te,si as ne,ti as re,ui as ie,wa as ae,ya as oe,yf as se,zO as S}from"./dist-BOukL7gG.js";import{t as C}from"./button-CcNQBW08.js";import{A as ce,B as w,C as T,F as le,I as ue,L as de,N as fe,P as pe,R as me,S as he,Z as E,b as ge,g as D,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-HZd91gw7.js";import{i as P}from"./compatView-aBtPNegs.js";/* empty css */var F=t(e(),1),I=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function L(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 R=n();function _e({instance:e}){let t=S(l.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,o]=(0,F.useState)(n===null?``:String(n)),[c,d]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{o(n===null?``:String(n)),d(`idle`)},[e._id,n]);let p=r.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,h=m===null||Number.isInteger(m)&&m>=1e3&&m<=2e5,g=(m??null)!==n;async function _(){d(`saving`);try{let n={...e.config??{}};m===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=m,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(E,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>o(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h}),(0,R.jsx)(C,{size:`sm`,disabled:!g||!h||c===`saving`,onClick:()=>void _(),children:c===`saving`?i():x()})]}),h?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:u()}),c===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:f()}):null,c===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()})]})}function z(){let e=c(l.agentFiles.getChatDefaults),t=c(l.agentFiles.setChatDefaults),n=ce(),[a,s]=(0,F.useState)({status:`loading`}),[u,S]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[E,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=r(l.admin.listInstances,{}),[U,W]=(0,F.useState)(null);(0,F.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,ve=H!==void 0&&H.length===0,ye=r(l.compat.forInstance,U?{instanceName:U}:`skip`),K=U?A(ye,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,F.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,F.useRef)(0),X=(0,F.useCallback)(async()=>{let t=++Y.current;s({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;s({status:`done`,current:n}),S(n)}catch{if(Y.current!==t)return;s({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=a.status===`done`?a.current:null,Q=Z!==null&&u.thinkingDefault!==null&&u.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&u.fastModeDefault!==null&&u.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:u.thinkingDefault}:{},...$?{fastModeDefault:u.fastModeDefault}:{}}),n.success(f()),await X()}catch(e){n.error(v(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:D(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:p()},{id:`standard`,label:oe()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(he,{size:`sm`,"aria-label":o(),children:(0,R.jsx)(T,{})}),(0,R.jsx)(ge,{children:(H??[]).map(e=>(0,R.jsx)(j,{value:e.name,children:e.name},e.name))})]})]}):null,ve?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:se()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):K.blocked?(0,R.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,R.jsx)(k,{size:14,"aria-hidden":!0}),` `,P(K.gatewayVersion)]}):a.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):a.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,R.jsx)(C,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:ae()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,R.jsx)(O,{options:Se,value:u.thinkingDefault,onChange:e=>S({...u,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:ie()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,R.jsx)(O,{options:Ce,value:u.fastModeDefault===null?null:u.fastModeDefault?`fast`:`standard`,onChange:e=>S({...u,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(C,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?i():x()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:te()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(fe,{open:E,onOpenChange:z,children:(0,R.jsxs)(ue,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(w,{children:ee()}),(0,R.jsx)(de,{children:re()})]}),(0,R.jsxs)(me,{children:[(0,R.jsx)(le,{children:d()}),(0,R.jsx)(pe,{onClick:()=>void xe(),children:g()})]})]})})]})}export{z as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Dc as i,Ec as a,Oc as o,Tc as s,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Dc as i,Ec as a,Oc as o,Tc as s,jc as c,kc as l}from"./dist-BOukL7gG.js";import{i as u,r as d}from"./dist-GFH_mzhb.js";import{t as f}from"./chevrons-up-down-ar6Ygzeq.js";import{t as p}from"./button-CcNQBW08.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-HZd91gw7.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-DAtXjw2C.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=c(),bulkActions:F,emptyHint:I=r(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):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)(b,{"aria-label":o(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":s({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)(b,{"aria-label":i(),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)(v,{children:[(0,M.jsx)(y,{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)(_,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{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{X as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-HZd91gw7.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{$v as r,Av as i,BO as a,Bv as o,Cy as s,Dy as c,Ey as l,Fv as u,Gv as d,Hv as f,Iv as ee,Jv as te,Kv as ne,Lv as p,Mv as m,NO as h,Nv as re,Ov as ie,Oy as g,Pv as _,Qv as ae,Rv as v,Sy as y,Ty as b,Uv as x,Vv as S,Wv as C,Xv as w,Yv as T,Zv as E,_y as D,ay as O,by as k,cy as A,dy as j,ey as M,fy as N,gy as P,hy as F,iy as I,jv as L,kv as R,ky as z,ly as B,my as V,ny as oe,oy as H,py as U,qv as W,ry as G,sy as K,ty as q,uy as se,vy as ce,wy as le,xy as ue,yy as de,zO as J,zv as fe}from"./dist-BOukL7gG.js";import{t as pe}from"./button-CcNQBW08.js";import{j as me}from"./index-HZd91gw7.js";import{t as he}from"./DataTableShell-DBDIF654.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>z(),incorrect:()=>g(),incoherence:()=>c(),formatting:()=>l(),latency:()=>b(),api_error:()=>le(),other:()=>s()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ue()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:k()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:y()})}function ge({data:e,closeReason:t}){let n=e.snapshot,i=J(h.feedback.respondToFeedback),[a,o]=(0,Y.useState)(e.thread),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1);async function d(){let t=s.trim();if(!(!t||l)){u(!0);try{await i({feedbackId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{u(!1)}}}let f=[];try{f=n.contextJson?JSON.parse(n.contextJson):[]}catch{f=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${de()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),a.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?P():F()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:V()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:U(),value:s,maxLength:2e3,rows:3,onChange:e=>c(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void d(),disabled:!s.trim()||l,children:l?N():j()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||B()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||B()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,f.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H({count:n.contextCount??f.length,truncated:n.contextTruncated?O():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:f.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:G()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?q({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[M(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,r()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=a(h.feedback.listForAdmin,{}),t=J(h.feedback.readSnapshot),n=J(h.feedback.deleteFeedback),r=me(),[s,c]=(0,Y.useState)(null),[l,g]=(0,Y.useState)({});async function _(e){if(s===e._id){c(null);return}if(!l[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:i(),description:R(),confirmLabel:ie(),destructive:!0})&&(await n({feedbackId:e._id}),s===e._id&&c(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ae(),` `,(0,X.jsx)(`strong`,{children:E()}),` `,w()]}),(0,X.jsx)(he,{title:T(),rows:e,emptyHint:te(),isExpanded:e=>s===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,X.jsx)(ge,{data:l[e._id],closeReason:e.userCloseReason}):null,columns:[{header:W(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:ne(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:d(),cell:e=>e.messageRole===`user`?C():x(),sort:e=>e.messageRole},{header:f(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${S({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:o(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:fe(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:v(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:p()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ee()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:u()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:s===e._id?re():m(),onSelect:()=>void _(e)},{label:L(),onSelect:()=>void y(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{PO as t,qO as n}from"./dist-BOukL7gG.js";import{c as r,l as i,s as a,u as o}from"./index-HZd91gw7.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:`[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.`},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:`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 :
|
|
3
3
|
{references}`,disabledTemplate:`{references}`},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:`[FICHIERS REÇUS]
|
|
4
4
|
{files}`},history_summary:{key:`history_summary`,appliedIn:`convex`,togglable:!0,placeholders:[`previous_summary`,`new_messages`,`max_chars`],defaultTemplate:`[SYNTHÈSE DE CONVERSATION]
|
|
@@ -12,4 +12,4 @@ Tu maintiens le résumé cumulatif d'une conversation entre un utilisateur et un
|
|
|
12
12
|
{previous_summary}
|
|
13
13
|
|
|
14
14
|
[NOUVEAUX MESSAGES]
|
|
15
|
-
{new_messages}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;
|
|
15
|
+
{new_messages}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),summarizeThresholdChars:n.optional(n.number()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function v(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function y(e){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections)}}var b=[`summarizeThresholdChars`];function x(e,t){let n={},r=r=>{(e[r]!==g[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=v(e.promptInjections);Object.keys(i).length>0&&(n.promptInjections=i);let a=t;for(let e of b)typeof a[e]==`number`&&(n[e]=a[e]);return n}var S=e();function C({text:e}){return(0,S.jsx)(i,{delayDuration:150,children:(0,S.jsxs)(a,{children:[(0,S.jsx)(o,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,S.jsx)(s,{"aria-hidden":!0})})}),(0,S.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function w({label:e,help:t}){return(0,S.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,S.jsx)(C,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,w as n,p as o,x as r,f as s,C as t,l as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AD as ee,BO as te,CD as r,DD as i,ED as a,FD as o,ID as s,LD as c,MD as ne,ND as l,NO as u,OD as re,PD as d,RD as ie,SD as f,TD as p,ZS as ae,_D as oe,a as m,aD as se,bD as ce,cD as le,cO as ue,dD as h,fD as g,gD as _,hD as v,i as de,iD as fe,jD as pe,kD as me,lD as he,mD as ge,oD as _e,oO as ve,pD as ye,rD as be,sD as y,uD as b,vD as x,wD as S,xD as C,yD as w,zO as T}from"./dist-BOukL7gG.js";import{t as E}from"./button-CcNQBW08.js";import{A as D,B as O,C as k,Et as A,F as j,G as M,I as N,K as P,L as xe,N as Se,P as Ce,R as we,S as F,Tt as Te,W as Ee,X as I,Y as De,_ as Oe,b as L,ht as ke,x as R,y as z,yt as Ae,z as je}from"./index-HZd91gw7.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-DAtXjw2C.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return i();case`audio`:return a();case`video`:return p();case`pdf`:return S();case`document`:return r();case`archive`:return f();default:return C()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[i,a]=(0,U.useState)(G),[f,p]=(0,U.useState)(G),[S,C]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=T(u.files.softDelete),Y=D();function Ie(){t(G),r(G),a(G),p(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(b())}catch(e){Y.error(he(),e)}}let X=te(u.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:i===G?void 0:i,category:f===G?void 0:f,includeAutoGenerated:S||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:ve()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||i!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":c(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:s()}),(0,W.jsx)(R,{value:`inbound`,children:o()}),(0,W.jsx)(R,{value:`outbound`,children:d()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:r,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":l(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:ne()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:i,onValueChange:a,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:ee()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:f,onValueChange:p,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:re()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Oe,{checked:S,onCheckedChange:e=>C(e===!0),"aria-label":m()}),(0,W.jsx)(`span`,{children:m()})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Ae,{size:14,"aria-hidden":!0}),ye()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?fe():se()}):(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:ce()}),(0,W.jsx)(B,{children:w()}),(0,W.jsx)(B,{children:x()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:_()}),(0,W.jsx)(B,{className:`text-right`,children:v()})]})}),(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:de()}):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`?o():d()})}),(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)(De,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":g(),children:(0,W.jsx)(Te,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),ge()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),_e()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(ke,{size:14}),h()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:be({cap:Be})}):null]}),(0,W.jsx)(Se,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(O,{children:le()}),(0,W.jsx)(xe,{children:y()})]}),(0,W.jsxs)(we,{children:[(0,W.jsx)(j,{children:ae()}),(0,W.jsx)(Ce,{onClick:()=>void Le(),children:h()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Mc as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Mc as r,Nc as i}from"./dist-BOukL7gG.js";import{t as a}from"./button-CcNQBW08.js";import{Z as o,vt as s,yt as c}from"./index-HZd91gw7.js";import{t as l}from"./TimeRangePicker-CjeAiSdk.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)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{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{$a as r,Ao as i,BO as a,Ba as o,Bo as s,Co as c,Do as l,Eo as u,Fo as d,Ga as f,Go as p,Ha as m,Ho as h,Io as g,Ja as _,Ka as v,Ko as y,Lo as ee,Mo as b,NO as x,No as te,Oo as S,PO as C,Po as ne,Qa as w,Ra as T,Ro as re,So as E,To as D,Ua as O,Uo as ie,Va as k,Vo as A,Wa as j,Wo as ae,Xa as M,Ya as N,Za as P,_o as F,ao as I,bo as oe,co as se,do as ce,eo as le,fo as ue,go as de,ho as fe,io as pe,jo as me,ko as he,lo as L,mo as ge,no as _e,oo as ve,po as ye,qa as be,qo as xe,ro as Se,so as Ce,to as we,uo as Te,vo as R,wo as Ee,xo as De,yo as Oe,zO as z,za as ke,zo as Ae}from"./dist-BOukL7gG.js";import{t as je}from"./x-C81gK-RB.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-BHYINAjr.js";import{t as H}from"./button-CcNQBW08.js";import{$ as Pe,A as U,At as Fe,C as Ie,Q as Le,S as Re,X as W,Z as G,_ as K,_t as q,b as ze,et as Be,gt as J,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,x as Ke,y as qe}from"./index-HZd91gw7.js";import{t as Je}from"./FilterBar-egrudkw6.js";import{t as Ye}from"./DataTableShell-DBDIF654.js";import{t as Y}from"./DetailChips-eDCHm7fV.js";var Xe=C(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=C(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=C(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=C(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return ge();case`user`:return ye();case`pending`:return ue();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=a(x.groups.listGroups,{}),t=a(x.me.getMe,{host:We})?.role===`admin`,n=z(x.groups.createGroup),r=z(x.groups.updateGroup),c=z(x.groups.deleteGroup),f=Ve(),m=U(),[_,v]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)($),[D,O]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(``),N=(0,Z.useMemo)(()=>{if(!e)return e;let t=j.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,j]);function P(){w(null),E($),v(!0)}function F(e){w(e),E({name:e.name,description:e.description??``}),v(!0)}async function I(){try{C?await r({groupId:C._id,name:T.name,description:T.description}):await n({name:T.name,description:T.description||void 0}),E($),w(null),v(!1)}catch(e){m.error(k(),e)}}async function oe(e){if(await f({title:S({name:e.name}),description:l(),confirmWord:e.name,confirmLabel:u(),cancelLabel:ne(),destructive:!0}))try{await c({groupId:e._id})}catch(e){m.error(o(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),(0,Q.jsx)(Je,{q:j,onQChange:M,onReset:()=>M(``),canReset:j!==``,searchPlaceholder:Ae()}),(0,Q.jsx)(Ye,{title:xe(),rows:N,addLabel:p(),onAdd:t?P:void 0,emptyHint:ae(),columns:[{header:ie(),cell:e=>e.name,sort:e=>e.name},{header:h(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:A(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:s(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:re(),onSelect:()=>O({groupId:e._id,name:e.name})},...t?[{label:ee(),onSelect:()=>F(e)},{label:g(),variant:`destructive`,onSelect:()=>void oe(e)}]:[]]}),(0,Q.jsx)(He,{open:_,onOpenChange:v,title:C?b():te(),description:me(),canSubmit:!!T.name.trim(),onSubmit:I,submitLabel:d(),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:i()}),(0,Q.jsx)(G,{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:he()}),(0,Q.jsx)(G,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:D?.groupId??null,groupName:D?.name??``,open:D!==null,onOpenChange:e=>{e||O(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),F()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":fe({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[de(),(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=a(x.groups.getGroup,n&&e?{groupId:e}:`skip`),o=a(x.groups.listAssignableInstances,n?{}:`skip`),s=a(x.groups.listAssignableUsers,n?{}:`skip`),l=z(x.groups.addMember),u=z(x.groups.removeMember),d=z(x.groups.bulkSetMembers),p=z(x.groups.setGroupManager),m=U(),[h,g]=(0,Z.useState)(``),[_,y]=(0,Z.useState)(``),[ee,b]=(0,Z.useState)(`members`),[te,S]=(0,Z.useState)(1),[C,ne]=(0,Z.useState)(new Set),w=(0,Z.useRef)(null),T=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ie=i?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Z.useEffect)(()=>{g(``),y(``),b(`members`),S(1),w.current=null},[n,e]),(0,Z.useEffect)(()=>{S(1)},[h]),(0,Z.useEffect)(()=>{n&&i&&e&&w.current!==e&&(w.current=e,ne(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let A=(0,Z.useMemo)(()=>s?$e(s,h,C):[],[s,h,C]);async function ae(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){m.error(ke(),e)}}async function M(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(O(),e)}}let N=rt(A,e=>T.has(e.userId)),P=A.filter(e=>T.has(e.userId)).length,F=it(A,te,ot);async function I(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:N!==`all`})}catch(e){m.error(ke(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Pe,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ge,{children:D({name:t})}),(0,Q.jsx)(Be,{children:Ee()})]}),(0,Q.jsxs)(Ne,{value:ee,onValueChange:b,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),c(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:T.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),De(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),le(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:h,onChange:e=>g(e.target.value),placeholder:E(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void I(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[P,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=T.has(e.userId),n=tt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":ce({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)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?j():f(),title:r?j():f(),onClick:()=>void M(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":v(),title:v(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:F.page,pageCount:F.pageCount,onPage:S})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:_,onChange:e=>y(e.target.value),placeholder:oe(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:_},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let o=a(x.groups.listAssignableAgents,{instanceName:t}),s=z(x.groups.assignAgentToGroup),c=z(x.groups.removeAgentFromGroup),l=z(x.groups.bulkSetGroupAgents),u=U(),[d,f]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{f(1)},[i]),!e)return null;let p=et(o?.agents??[],i),m=o?.discovery&&!o.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1),g=rt(h,e=>r.has(`${t}/${e.agentId}`)),_=it(p,d,ot);async function v(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(T(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){u.error(T(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:Se()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:se()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?pe():I()}):(0,Q.jsxs)(Q.Fragment,{children:[h.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":Te({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":we(),title:we(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:_e()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=a(x.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(x.charts.assignChartToGroup),i=z(x.charts.removeChartFromGroup),o=z(x.charts.setGroupDefaultChart),s=z(x.charts.addChartToGroupPool),c=z(x.charts.removeChartFromGroupPool),l=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:u,addable:d,canManagePool:f}=t;if(u.length===0&&!f)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:r()});async function p(t,r){try{r?await i({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(m(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){l.error(m(),e)}}async function g(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(m(),e)}}async function v(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(m(),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)(K,{checked:e.selected,onCheckedChange:()=>void p(e.chartKey,e.selected),"aria-label":N({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":_(),title:_(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:be()}):null,f?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":M({name:e.name}),title:M({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,Q.jsxs)(qe,{value:``,onValueChange:e=>void g(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ie,{placeholder:P()})}),(0,Q.jsx)(ze,{children:d.map(e=>(0,Q.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):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{$_ as r,$g as i,A_ as a,Ag as o,BC as s,BO as c,B_ as l,Bg as u,C_ as d,Cg as f,D_ as p,Dg as m,E_ as h,Eg as g,F_ as _,Fg as v,G_ as y,Gg as b,H_ as ee,Hg as x,I_ as te,Ig as S,J_ as ne,Jg as C,K_ as re,Kg as w,LO as T,L_ as ie,Lg as E,M_ as ae,Mg as oe,NO as D,N_ as se,Ng as ce,O_ as le,Og as ue,P_ as de,Pg as fe,Q as pe,Q_ as me,Qg as he,R_ as ge,Rg as O,S_ as _e,Sg as ve,T_ as ye,Tg as be,U_ as xe,Ug as Se,VC as k,V_ as Ce,Vg as we,W_ as Te,Wg as Ee,X_ as De,Xg as Oe,Y_ as ke,Yg as Ae,Z as je,Z_ as Me,Zg as Ne,__ as A,_g as Pe,a_ as Fe,b_ as Ie,bg as Le,c_ as Re,d_ as ze,e_ as Be,ev as Ve,f_ as He,g_ as j,gg as Ue,h_ as We,hg as M,i_ as Ge,j_ as Ke,jg as qe,k_ as Je,kg as Ye,l_ as Xe,lf as Ze,m_ as Qe,mg as $e,n_ as et,o_ as tt,p_ as nt,q_ as rt,qg as it,r_ as at,s_ as ot,t_ as st,u_ as ct,uf as lt,v_ as ut,vg as dt,w_ as ft,wg as pt,x_ as mt,xg as ht,y_ as gt,yg as _t,zO as N,z_ as vt,zg as yt}from"./dist-BOukL7gG.js";import{a as bt,c as xt}from"./FieldLabel-BxCSPKLD.js";import{t as P}from"./button-CcNQBW08.js";import{$ as F,A as I,C as L,H as St,Q as R,S as z,U as Ct,V as wt,X as B,Z as V,_ as H,b as U,et as W,j as Tt,m as Et,nt as G,rt as K,x as q,y as J}from"./index-HZd91gw7.js";import{t as Dt}from"./DataTableShell-DBDIF654.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-CjidRXGN.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`],kt=new Set(X),At=`conversational`;function jt(e){let t=new Set((e??[]).filter(e=>kt.has(e)));return t.size===0?[At]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:bt},Mt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Pt(){let e=c(D.admin.listInstances,{}),t=c(D.agents.listAllInstanceAgents,{}),n=N(D.admin.upsertInstance),i=N(D.admin.deleteInstance),o=I(),[s,u]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(Q),[g,v]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null);async function E(){try{await n({instanceId:w??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,streamTransport:f.streamTransport}),m(Q),T(null),u(!1)}catch(e){o.error(me(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Me(),(0,Z.jsx)(`strong`,{children:De()}),ke()]}),(0,Z.jsx)(Dt,{title:ne(),rows:e,addLabel:rt(),onAdd:()=>{T(null),m(Q),u(!0)},emptyHint:re(),columns:[{header:y(),cell:e=>e.name,sort:e=>e.name},{header:Te(),cell:e=>(0,Z.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:xe(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ee(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ve(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,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)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?M():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ge(),onSelect:()=>{T(e._id),m(Nt(e)),u(!0)}},{label:r(),onSelect:()=>v(e.name)},{label:d(),onSelect:()=>C(e)},{label:Ce(),onSelect:()=>x(e)},{label:l(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:l(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Et,{open:s,onOpenChange:u,title:w?ie():vt(),description:_(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:E,submitLabel:de(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:se(),children:[(0,Z.jsx)(V,{value:f.name,disabled:w!==null,onChange:e=>m({...f,name:e.target.value})}),w?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:te()}):null]}),(0,Z.jsx)($,{label:ae(),children:(0,Z.jsxs)(J,{value:f.kind,onValueChange:e=>m({...f,kind:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(L,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:Ke(),children:(0,Z.jsx)(V,{value:f.gatewayUrl,onChange:e=>m({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:a(),children:(0,Z.jsx)(V,{value:f.bridgeUrl,placeholder:Je(),onChange:e=>m({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:le(),children:(0,Z.jsx)(V,{value:f.displayName,onChange:e=>m({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:lt(),children:[(0,Z.jsxs)(J,{value:f.streamTransport,onValueChange:e=>m({...f,streamTransport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(L,{})}),(0,Z.jsx)(U,{children:xt.map(e=>(0,Z.jsx)(q,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ze()})]}),(0,Z.jsx)($,{label:p(),children:(0,Z.jsx)(V,{value:f.gatewayVersion,placeholder:h(),onChange:e=>m({...f,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:ye(),children:(0,Z.jsx)(V,{value:f.gatewayHttpUrl,placeholder:ft(),onChange:e=>m({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:g,open:g!==null,onOpenChange:e=>{e||v(null)}}),b?(0,Z.jsx)(Ot,{instance:b,onClose:()=>x(null)},b._id):null,S?(0,Z.jsx)(Ft,{instance:S,onClose:()=>C(null)},S._id):null]})}function Ft({instance:e,onClose:t}){let n=c(D.instanceSecrets.listInstanceSecretStatus,{}),r=Mt[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)(R,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(F,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:_e({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:mt()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Lt,{instance:e})}),(0,Z.jsx)(It,{instance:e})]})})}function It({instance:e}){let t=T(D.instanceSync.forceInstanceSync),n=I(),[r,a]=(0,Y.useState)(!1);async function o(){if(!r){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(st());break;case`no_agents`:n.success(i());break;case`no_bridge_url`:n.error(he());break;case`deploy_misconfigured`:n.error(Ne());break;case`unauthorized`:n.error(Ae());break;case`not_served`:n.error(C());break;default:n.error(Oe());break}}catch(e){n.error(Be(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?et():at()})})]})}function Lt({instance:e}){let t=c(D.bridgeAuth.listBridgeAuthStatus,{}),n=T(D.bridgeAuth.mintBridgeSecret),r=N(D.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(!1),m=(t??[]).find(t=>t.instanceId===e._id),h=m!==void 0;async function g(){if(!a){o(!0);try{d((await n({instanceId:e._id})).plaintext),p(!1)}catch(e){i.error(u(),e)}finally{o(!1)}}}async function _(){if(!a){o(!0);try{await r({instanceId:e._id}),d(null),i.success(we())}catch(e){i.error(u(),e)}finally{o(!1)}}}async function v(){if(l)try{await navigator.clipboard.writeText(l),p(!0)}catch{}}return(0,Z.jsxs)($,{label:w(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:h?`outline`:`secondary`,children:h?`${A()} · ${m.prefix}…${m.lastFour}`:j()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void g(),disabled:a,children:h?Se():Ee()}),h?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:a,children:x()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:yt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:f?k():s()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{d(null),p(!1)},children:O()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let r=T(D.instanceSecrets.setInstanceSecret),i=N(D.instanceSecrets.clearInstanceSecret),a=T(D.deviceIdentity.generateDeviceIdentity),o=I(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Ie():t===`deviceIdentity`?gt():ut();async function y(){if(!(!c.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),p(null),h(!1),o.success(ze())}catch(e){o.error(ct(),e)}finally{d(!1)}}}async function b(){if(!u){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Xe())}catch(e){o.error(ct(),e)}finally{d(!1)}}}async function ee(){if(!u){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(tt())}catch(e){o.error(Ge(),e)}finally{d(!1)}}}let x=f?`openclaw devices approve ${f.id}`:``;async function te(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:g?`outline`:`secondary`,children:g?A():j()}),(0,Z.jsx)(V,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:g?Qe():We(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void y(),disabled:u||c.trim().length===0,children:nt()}),_?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:u,children:Re()}):null,g?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:u,children:He()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:tt()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:m?k():s()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:O()})]}):null]})}var zt={conversational:o,documentary:ue,summarizer:pe},Bt={conversational:Ye,documentary:m,summarizer:je},Vt=e=>(zt[e]??(()=>e))(),Ht=e=>(Bt[e]??(()=>``))();function Ut({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:fe()}),t.map(e=>(0,Z.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ce()})}),(0,Z.jsxs)(St,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:oe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:qe()}),(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)(H,{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:Vt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Ht(r)})]})]},r)})})]})]})]})}function Wt({instanceName:e,open:t,onOpenChange:n}){let r=c(D.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=N(D.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=N(D.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=N(D.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=N(D.agents.removeInstanceAgent),l=Tt(),u=I();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(v(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(v(),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(v(),e)}}async function h(t,n){if(e&&await l({title:pt({name:n}),description:f(),confirmLabel:ve(),destructive:!0}))try{await s({instanceName:e,agentId:t}),u.success(ht())}catch(e){u.error(v(),e)}}return(0,Z.jsx)(R,{open:t,onOpenChange:n,children:(0,Z.jsxs)(F,{className:`oc-access`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:E({name:e??``})}),(0,Z.jsx)(W,{children:S()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Le()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?_t():r.discovery.lastPollOk?dt():Pe({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ue()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(H,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{variant:`outline`,className:`oc-access__gone`,children:$e()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(e.agentId,i),children:be()})]}):n?(0,Z.jsx)(B,{variant:`default`,children:M()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void p(e.agentId),children:g()})]}),e.enabled?(0,Z.jsx)(Ut,{agentId:e.agentId,types:a,onToggle:t=>void m(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}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{Pt as InstancesTab};
|
|
@@ -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,BO as a,By as o,Fy as s,Gy as c,Hy as l,Iy as ee,Jy as te,Ky as ne,LO as u,Ly as re,My as ie,NO as d,Ny as f,Py as ae,Qy as oe,Ry as se,Sb as ce,Uy as p,Vy as m,Wy as h,Xy as g,Yy as _,Zy as v,_b as y,_n as le,ab as ue,bb as de,cb as b,db as x,dn as S,eb as C,fb as w,fn as T,gb as E,gn as D,hb as O,hn as k,ib as A,jy as j,lb as M,mb as N,mn as P,nb as F,ob as I,pb as L,pn as R,qy as z,rb as B,sb as V,tb as H,ub as fe,vb as U,vn as pe,xb as me,yb as he,yn as ge,zO as W,zy as _e}from"./dist-BOukL7gG.js";import{t as G}from"./button-CcNQBW08.js";import{C as ve,S as ye,X as K,Z as q,_ as be,b as xe,x as Se,y as Ce}from"./index-HZd91gw7.js";import{t as we}from"./DataTableShell-DBDIF654.js";var J=t(e(),1),Y=n();function Te(){let e=a(d.integrations.status.status,{}),t=W(d.admin.setIntegrationConfig),[n,u]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&u(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});let S=n,T=(e,t,n)=>u({...S,[e]:{...S[e],[t]:n}}),D=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),` `,(0,Y.jsx)(`strong`,{children:de()}),` `,he()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}):(0,Y.jsx)(K,{variant:`outline`,children:E()}),note:N(),children:[(0,Y.jsx)(Z,{label:w(),children:(0,Y.jsx)(q,{value:S.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>T(`langfuse`,`host`,e.target.value),onBlur:()=>D(`langfuse`,{host:S.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:b(),checked:S.langfuse.enabled??!0,onChange:e=>{T(`langfuse`,`enabled`,e),D(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}):(0,Y.jsx)(K,{variant:`outline`,children:E()}),note:L(),children:[(0,Y.jsx)(Z,{label:x(),children:(0,Y.jsx)(q,{value:S.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>T(`opik`,`baseUrl`,e.target.value),onBlur:()=>D(`opik`,{baseUrl:S.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:fe(),children:(0,Y.jsx)(q,{value:S.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||M(),onChange:e=>T(`opik`,`workspace`,e.target.value),onBlur:()=>D(`opik`,{workspace:S.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:b(),checked:S.opik.enabled??!0,onChange:e=>{T(`opik`,`enabled`,e),D(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:y()}):(0,Y.jsx)(K,{variant:`outline`,children:ge()}),note:pe(),children:[(0,Y.jsx)(Z,{label:le(),children:(0,Y.jsx)(q,{value:S.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>T(`otlp`,`endpoint`,e.target.value),onBlur:()=>D(`otlp`,{endpoint:S.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:b(),checked:S.otlp.enabled??!0,onChange:e=>{T(`otlp`,`enabled`,e),D(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:V(),status:(0,Y.jsx)(K,{variant:`outline`,children:O()}),note:I(),children:[(0,Y.jsx)(Z,{label:ue(),children:(0,Y.jsx)($,{value:S.tts.auto??`off`,options:[[`off`,A()],[`always`,B()],[`inbound`,F()],[`tagged`,H()]],onChange:e=>{T(`tts`,`auto`,e),D(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:C(),children:(0,Y.jsx)($,{value:S.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,r()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{T(`tts`,`provider`,e),D(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:oe(),children:(0,Y.jsx)(q,{value:S.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>T(`tts`,`model`,e.target.value),onBlur:()=>D(`tts`,{model:S.tts.model??``})})}),(0,Y.jsx)(Z,{label:v(),children:(0,Y.jsx)(q,{value:S.tts.voice??``,placeholder:g(),onChange:e=>T(`tts`,`voice`,e.target.value),onBlur:()=>D(`tts`,{voice:S.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:_(),status:(0,Y.jsx)(K,{variant:`outline`,children:O()}),note:e.secrets.openai?te():z(),children:[(0,Y.jsx)(Q,{label:ne(),checked:S.talk.enabled??!1,onChange:e=>{T(`talk`,`enabled`,e),D(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:c(),children:(0,Y.jsx)($,{value:S.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{T(`talk`,`realtimeProvider`,e),D(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:h(),children:(0,Y.jsx)(q,{value:S.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>T(`talk`,`realtimeModel`,e.target.value),onBlur:()=>D(`talk`,{realtimeModel:S.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:v(),children:(0,Y.jsx)(q,{value:S.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>T(`talk`,`voice`,e.target.value),onBlur:()=>D(`talk`,{voice:S.talk.voice??``})})}),(0,Y.jsx)(Z,{label:p(),children:(0,Y.jsx)($,{value:S.talk.transport??`webrtc`,options:[[`webrtc`,l()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{T(`talk`,`transport`,e),D(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)(q,{value:S.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>T(`talk`,`speechLocale`,e.target.value),onBlur:()=>D(`talk`,{speechLocale:S.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:o(),checked:S.talk.interruptOnSpeech??!0,onChange:e=>{T(`talk`,`interruptOnSpeech`,e),D(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:_e()}),(0,Y.jsx)(K,{variant:`outline`,children:se()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[re(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:ee(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:s(),columns:[{header:ae(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:f(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:ie(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:j(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:i(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Ce,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=u(d.integrations.otlpSecret.setOtlpHeaders),n=W(d.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),l=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,Y.jsxs)(Z,{label:D(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?k():P(),onChange:e=>i(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void l(),children:R()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:T()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:S()})]})}export{Te as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,BO as i,Cu as a,Du as o,Eu as s,Mx as c,NO as l,Ou as u,Su as d,Tu as f,Xb as p,Zb as m,ax as h,bu as g,ix as _,ju as v,ku as y,ox as b,sx as x,vu as S,wu as C,xu as w,yu as T}from"./dist-BOukL7gG.js";import{Mt as E,a as D,jt as ee,n as te,ot as ne,r as re}from"./index-HZd91gw7.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-B9JuMxhP.js";import{n as N,t as P}from"./TimeRangePicker-CjeAiSdk.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=i(l.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=i(l.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:x()}),(0,I.jsx)(j,{children:h()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(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(` `),s=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:[p(),` p50 `,R(s.cP50),` `,b()]}),(0,I.jsxs)(`span`,{children:[m(),` p50 `,R(s.aP50),` `,b()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":x(),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:v(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:r(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:y(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:o(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:s(),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=ee({from:`/settings/kpi`}),n=re(e.from,e.to,te,`now`),r=e=>void t({search:t=>({...t,...D(e)})}),{from:o,to:s}=N(n),{rowLimit:c,buckets:u}=K(o,s),p=i(l.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),m=(0,F.useMemo)(()=>{let e=new Map;for(let t of p??[]){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>u&&e.set(t,n.slice(n.length-u));return e},[p,u]),h=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:C()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return p===void 0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):p.length===0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(m.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:m.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:w({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:g()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:T({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":S({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{$w as r,AT as i,BD as a,BO as o,CT as s,DT as c,ET as l,GD as u,HD as d,JD as f,KD as ee,MT as p,NO as m,OT as h,P_ as te,QD as ne,ST as g,TT as re,UD as ie,VD as ae,WD as oe,XD as se,YD as ce,ZD as le,_T as ue,aT as de,bT as fe,cT as _,dT as v,eT as y,fT as b,gT as x,hT as S,iT as C,jT as w,kT as T,lT as E,mT as D,nT as O,oO as k,oT as A,pT as j,qD as M,rT as N,sT as P,tO as F,tT as I,uT as L,vT as R,wT as z,xT as B,yT as pe,zO as V}from"./dist-BOukL7gG.js";import{t as H}from"./button-CcNQBW08.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-HZd91gw7.js";var q=t(e(),1),J=[{id:`messages`,label:()=>p()},{id:`composer`,label:()=>w()},{id:`sidebar`,label:()=>i()},{id:`other`,label:()=>T()}],Y={showSource:{category:`messages`,label:()=>h(),help:()=>c()},showReport:{category:`messages`,label:()=>l(),help:()=>re()},copyAssistant:{category:`messages`,label:()=>z()},copyUser:{category:`messages`,label:()=>s()},showDelete:{category:`messages`,label:()=>g()},showTools:{category:`messages`,label:()=>B(),help:()=>fe()},voiceInput:{category:`composer`,label:()=>pe(),help:()=>R()},showChatAge:{category:`sidebar`,label:()=>ue(),help:()=>x()},showChatProvider:{category:`sidebar`,label:()=>S(),help:()=>D()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>N()};function De({prefKey:e,ui:t}){let n=V(m.admin.setUiPrefDefault),i=V(m.admin.setFeatureEnabled),a=Te(e),o=a?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:P()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:I()}),(0,$.jsx)(K,{value:`off`,children:y()}),(0,$.jsx)(K,{value:`inherit`,children:r()})]})]}),a?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":A()}),A()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=o(m.me.getMe,{host:G}),a=i?.ui,s=Z(i?.role)&&n,c=V(m.me.setUiPref).withOptimisticUpdate(ge),l=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:de()}),(0,$.jsx)(`p`,{children:C()}),(0,$.jsx)(`p`,{children:O()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:j(),"aria-label":j(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:b()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:v()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:L()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:E()}):null,(0,$.jsx)(W,{checked:o,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:k()})}function ke(){let e=o(m.me.getMe,{host:G}),t=V(m.me.setLocale),n=V(m.me.setMyName),r=me(),i=e?.locale??`default`,s=e?.name??``,[c,l]=(0,q.useState)(null),p=c??s,h=p.trim()!==s.trim();async function g(){try{await n({name:p}),l(null),r.success(f())}catch(e){r.error(M(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ne()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:p,maxLength:120,placeholder:se(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h&&(e.preventDefault(),g())}}),(0,$.jsx)(H,{size:`sm`,disabled:!h,onClick:()=>void g(),children:te()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?ae():e===`en`?a():F()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ie()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$d as i,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$d as i,BO as a,Gd as o,Hd as s,Jd as c,Kd as l,NO as u,Qd as d,Ud as f,Vd as p,Wd as ee,Xd as m,Yd as h,Zd as g,af as _,ef as v,et as y,if as b,mf as x,nf as S,nt as C,of as w,pf as T,qd as E,rf as D,rt as O,tf as k,tt as A,zO as j}from"./dist-BOukL7gG.js";import{d as M,f as N,i as P,l as F,n as I,r as L,t as R,u as z}from"./FieldLabel-BxCSPKLD.js";import{t as B}from"./button-CcNQBW08.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-HZd91gw7.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:k,help:v},documentary_fetch:{label:i,help:d},inbound_files:{label:g,help:m},history_summary:{label:O,help:C}},Z={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
2
|
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
-
Assistant : Comparaison en cours.`,max_chars:`6000`},Q={outboundDir:
|
|
3
|
+
Assistant : Comparaison en cours.`,max_chars:`6000`},Q={outboundDir:f,references:s,files:p,previous_summary:A,new_messages:y,max_chars:r};function $(){let e=a(u.admin.listInstances,{}),[t,n]=(0,J.useState)(null);if(e===void 0)return(0,Y.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Y.jsx)(`div`,{className:`oc-injtab`,children:(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:c()})});let r=e.find(e=>e._id===t)??e[0];return(0,Y.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Y.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Y.jsx)(I,{label:w(),help:_()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:h()}),(0,Y.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:e.map(e=>(0,Y.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Y.jsx)(te,{instance:r},r._id)]})}function te({instance:e}){let t=j(u.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,J.useState)(()=>P(r)),[o,s]=(0,J.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function d(){s(!0);try{await t({instanceId:e._id,config:L(i,r)})}catch(e){n.error(T(),e)}finally{s(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:F[e],i18n:X[e],row:c[e]??{enabled:!0,template:F[e].defaultTemplate},onChange:t=>l(e,t)},e)),(0,Y.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Y.jsx)(B,{size:`sm`,onClick:()=>void d(),disabled:o,children:x()})})]})}function ne({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[a,s]=(0,J.useState)(!1),c=r.template.trim()!==t.defaultTemplate,u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),f=M(e,r),p=f?N(f,d):``;return(0,Y.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Y.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Y.jsx)(W,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,Y.jsx)(I,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(I,{label:n.label(),help:n.help()}),c&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:D()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>i({template:e.target.value})}),(0,Y.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:S()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(R,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:a?l():E()}),c&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:b()})]})]}),a&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:o()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:ee()})})]})}export{$ as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,BO as ee,Bh as i,Ch as a,Dh as te,Eh as o,Fh as ne,Gh as s,Hh as c,Ih as l,Jh as u,Kh as d,Lh as f,Mh as p,NO as m,Nh as re,Oh as ie,Ph as ae,Qh as h,Rh as g,Th as _,Uh as v,Vh as y,Wh as b,Xh as x,Yh as S,Zh as C,_h as w,dh as T,fh as E,gh as D,hh as O,jh as k,kh as A,lh as j,mh as M,ph as N,qh as P,uh as F,wh as I,zO as L,zh as R}from"./dist-BOukL7gG.js";import{t as z}from"./button-CcNQBW08.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-HZd91gw7.js";import{t as q}from"./roleDescriptions-CxEPrkAY.js";var J=t(e(),1),Y=n(),X=[{group:()=>h(),keys:[{key:`traces.read`,label:()=>P()},{key:`traces.read.content`,label:()=>d(),phi:!0},{key:`traces.write`,label:()=>s()}]},{group:()=>C(),keys:[{key:`kpi.read`,label:()=>P()},{key:`kpi.write`,label:()=>s()}]},{group:()=>x(),keys:[{key:`openclaw.query`,label:()=>b()},{key:`anomalies.read`,label:()=>v()},{key:`anomalies.report`,label:()=>c()}]},{group:()=>S(),keys:[{key:`chats.read`,label:()=>P()},{key:`selfheal`,label:()=>i()}]},{group:()=>u(),keys:[{key:`admin.manage`,label:()=>y()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=ee(m.apiKeys.listRoles,{}),t=L(m.apiKeys.createRole),n=L(m.apiKeys.ensureRolesSeeded),i=L(m.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(m.apiKeys.listRoles,{});r&&e.setQuery(m.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=W(),c=B(),[u,d]=(0,J.useState)(!1),[h,v]=(0,J.useState)(Q),[y,b]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{c.error(g(),e)})},[n,c]);let x=e??[];async function S(e,t){if(Z(e.permissions)||y.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await s({title:f({name:e.name}),description:l(),confirmLabel:ne()}))){b(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){c.error(ae(),e)}finally{b(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function C(){try{await t({key:h.key,name:h.name,description:h.description||void 0,permissions:[]}),v(Q),d(!1)}catch(e){c.error(re(),e)}}let P=e===void 0,$=!P&&x.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,k(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,r()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:A()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{v(Q),d(!0)},children:ie()})})]}),P?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:_()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?R({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:x.map(e=>{let t=Z(e.permissions),n=y.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,I()]}):(0,Y.jsx)(V,{variant:`secondary`,children:a()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?w():n?D():r,onCheckedChange:()=>void S(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:u,onOpenChange:d,title:O(),description:M(),canSubmit:!!(h.key&&h.name),onSubmit:C,submitLabel:N(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:E()}),(0,Y.jsx)(H,{value:h.key,placeholder:T(),onChange:e=>v({...h,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:F()}),(0,Y.jsx)(H,{value:h.name,onChange:e=>v({...h,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,Y.jsx)(H,{value:h.description,onChange:e=>v({...h,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,Aw as i,BC as a,BO as o,Bw as ee,Cw as te,Dw as ne,Ew as re,FC as s,Fw as ie,GC as c,Gw as ae,HC as oe,Hw as se,IC as ce,Iw as le,JC as l,Jw as ue,KC as u,Kw as d,LC as f,LO as de,Lw as fe,MC as p,Mw as pe,NC as m,NO as h,Nw as me,Ow as he,PC as g,Pw as ge,QC as _,Qw as _e,RC as v,Rw as ve,Sw as ye,Tw as be,UC as y,Uw as xe,VC as b,Vw as Se,WC as x,Ww as Ce,XC as S,Xw as we,YC as C,Yw as Te,ZC as w,Zw as Ee,_w as De,aw as Oe,bw as ke,cw as Ae,dw as je,ew as T,fw as Me,gw as Ne,hw as Pe,iw as Fe,jw as Ie,kw as Le,lw as Re,mw as ze,nw as Be,ow as Ve,pw as He,qC as E,qw as D,rw as Ue,sw as We,tw as O,uw as Ge,vw as Ke,ww as qe,xw as Je,yw as Ye,zC as k,zO as A,zw as Xe}from"./dist-BOukL7gG.js";import{n as j}from"./dist-BhnVOFIn.js";import{i as Ze}from"./dist-GFH_mzhb.js";import{t as M}from"./button-CcNQBW08.js";import{$ as N,A as Qe,At as $e,C as P,Dt as F,Mt as et,Q as I,S as L,X as R,Z as z,b as B,et as V,j as tt,jt as nt,m as rt,nt as H,rt as U,tt as it,x as W,y as G}from"./index-HZd91gw7.js";import{t as at}from"./FilterBar-egrudkw6.js";import{t as ot}from"./DataTableShell-DBDIF654.js";import{t as st}from"./roleDescriptions-CxEPrkAY.js";var K=t(e(),1),q=n(),ct=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>f(),days:30},{value:`90`,label:()=>ce(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=et({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??J,[a,s]=(0,K.useState)(J),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),oe=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),ce=o(h.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:r===J?void 0:r===`disabled`}}),l=o(h.apiKeys.listKeys,{}),u=o(h.apiKeys.listRoles,{}),f=A(h.apiKeys.createServiceAccount),p=A(h.apiKeys.updateServiceAccount),m=A(h.apiKeys.deleteServiceAccount),g=de(h.apiKeys.mintApiKey),_=A(h.apiKeys.revokeApiKey),v=tt(),y=Qe(),b=n!==``||a!==J||r!==J;function x(){s(J),t({search:{},replace:!0})}let[S,C]=(0,K.useState)(!1),[w,T]=(0,K.useState)(Y),[E,O]=(0,K.useState)(null),[k,j]=(0,K.useState)(new Set),[N,F]=(0,K.useState)(null),I=(0,K.useRef)(!1),[V,H]=(0,K.useState)(new Set),[U,it]=(0,K.useState)({}),[lt,X]=(0,K.useState)(null),Z=(0,K.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function Q(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{E?(await p({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(Ne())):await f({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Y),O(null),C(!1)}catch(e){y.error(E?De():Ke(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function $(e){if(I.current)return;I.current=!0;let t=U[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(Pe(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await v({title:ze(),description:(0,q.jsxs)(q.Fragment,{children:[He(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Me(),` `,(0,q.jsx)(`strong`,{children:je()}),` `,Ge()]}),confirmWord:e.name,confirmLabel:Re(),destructive:!0}))try{await m({serviceAccountId:e._id}),y.success(Ae(),e.name)}catch(e){y.error(We(),e)}}async function ht(e){if(await v({title:Ve(),description:(0,q.jsxs)(q.Fragment,{children:[Oe(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Fe()]}),confirmLabel:Ue(),destructive:!0})&&!V.has(e._id)){H(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(Be(),e)}finally{H(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:_e()}),(0,q.jsxs)(at,{q:n,onQChange:c,searchPlaceholder:Ee(),onReset:x,canReset:b,children:[(0,q.jsxs)(G,{value:a,onValueChange:s,children:[(0,q.jsx)(L,{size:`sm`,className:`w-40`,children:(0,q.jsx)(P,{placeholder:we()})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(W,{value:J,children:Te()}),(u??[]).map(e=>(0,q.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:r,onValueChange:oe,children:[(0,q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,q.jsx)(P,{})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(W,{value:J,children:ue()}),(0,q.jsx)(W,{value:`active`,children:D()}),(0,q.jsx)(W,{value:`disabled`,children:d()})]})]})]}),(0,q.jsx)(ot,{title:ae(),rows:ce,addLabel:Ce(),onAdd:()=>{T(Y),O(null),C(!0)},emptyHint:xe(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[{label:Xe(),onSelect:()=>pt(e)},{label:se(),onSelect:()=>void $(e)},{label:k.has(e._id)?Se():ee(),onSelect:()=>Q(e._id)},{label:ve(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?fe():le(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,q.jsx)(Ze,{}):(0,q.jsx)($e,{})})},{header:ie(),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:ge(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})},{header:me(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:d()}):(0,q.jsx)(R,{variant:`outline`,children:D()})},{header:pe(),cell:e=>(0,q.jsxs)(G,{value:U[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(L,{size:`sm`,className:`w-32`,children:(0,q.jsx)(P,{})}),(0,q.jsx)(B,{children:ct.map(e=>(0,q.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:Ie(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?i():Le({count:t})})}}]}),(0,q.jsx)(rt,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:E?he():be(),description:E?ne():qe(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:E?re():te(),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:ye()}),(0,q.jsx)(z,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Je()}),(0,q.jsxs)(G,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,q.jsx)(L,{className:`w-full`,children:(0,q.jsx)(P,{placeholder:ke()})}),(0,q.jsx)(B,{children:(u??[]).map(e=>(0,q.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===w.roleKey),t=e?st(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:Ye()}),(0,q.jsx)(z,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:i}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[O(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:r()}),(0,q.jsx)(`th`,{children:_()}),(0,q.jsx)(`th`,{children:w()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:C()}),(0,q.jsx)(`th`,{children:l()}),(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)(R,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:Z(t.createdAt)}),(0,q.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:pt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(M,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?E():u()})})]},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)(I,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(N,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(H,{children:[(0,q.jsx)(U,{children:c()}),(0,q.jsx)(V,{children:x({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:y()}),(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)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":oe(),children:[n?(0,q.jsx)(j,{}):(0,q.jsx)(F,{}),n?b():a()]})]}),(0,q.jsx)(it,{children:(0,q.jsx)(M,{onClick:()=>{r(!1),t()},children:k()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?s():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:g()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(R,{variant:`outline`,children:m()}):(0,q.jsx)(R,{variant:`outline`,children:p()})}export{X as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{At as r,BO as i,Bt as a,Ct as o,Dt as s,Et as c,Ft as l,Gt as u,Ht as d,It as f,Kt as p,Lt as m,Mt as h,NO as g,Nt as _,Ot as v,Pt as y,Rt as b,St as x,Tt as S,Ut as C,Vt as w,Wt as T,_t as E,bt as D,ct as O,dt as k,ft as A,gt as j,ht as M,jt as N,kt as P,lt as F,mt as I,pt as ee,ut as L,vt as R,wt as z,xt as B,yt as V,zO as H,zt as U}from"./dist-BOukL7gG.js";import{t as W}from"./button-CcNQBW08.js";import{j as G}from"./index-HZd91gw7.js";import{t as K}from"./DataTableShell-DBDIF654.js";var q=t(e(),1),J=n(),Y={hung:()=>P(),wrong_result:()=>v(),error:()=>s(),other:()=>c()},X=e=>(e&&Y[e]?.())??e??`—`;function Z(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function Q({data:e}){let t=e.snapshot,n=H(g.subAgentReports.respondToReport),[r,i]=(0,q.useState)(e.thread),[a,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1);async function u(){let t=a.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,J.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,J.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[X(e.category),` · `,S({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,J.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),r.length>0?(0,J.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,J.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?x():B()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,J.jsx)(`p`,{className:`oc-fbadmin__meta`,children:D()}),(0,J.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:V(),value:a,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,J.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!a.trim()||c,children:c?E():R()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[j({count:t.children.length}),t.childrenTruncated?` ${M()}`:``,t.textTruncated?` ${I()}`:``]}),(0,J.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,J.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,J.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Z(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${ee()}`:``]}),e.errorMessage?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,J.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 $(){let e=i(g.subAgentReports.listForAdmin,{}),t=H(g.subAgentReports.readReport),n=H(g.subAgentReports.deleteReport),o=G(),[s,c]=(0,q.useState)(null),[v,x]=(0,q.useState)({});async function S(e){if(s===e._id){c(null);return}if(!v[e._id]){let n=await t({reportId:e._id});x(t=>({...t,[e._id]:n}))}c(e._id)}async function E(e){await o({title:L(),description:F(),confirmLabel:O(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&c(null))}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,J.jsx)(`strong`,{children:C()}),` `,d()]}),(0,J.jsx)(K,{title:p(),rows:e,emptyHint:u(),isExpanded:e=>s===e._id&&!!v[e._id],renderExpanded:e=>v[e._id]?(0,J.jsx)(Q,{data:v[e._id]}):null,columns:[{header:w(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:a(),cell:e=>X(e.category),sort:e=>X(e.category)},{header:U(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:b(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${l({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:m(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:f(),cell:e=>e.answered?(0,J.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:y()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:_()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?N():h(),onSelect:()=>void S(e)},{label:r(),onSelect:()=>void E(e),variant:`destructive`}]})]})}export{$ as SubAgentReportsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AE as a,BD as o,BE as s,BO as c,BT as l,CE as u,DE as d,EE as f,FE as p,FT as m,GE as h,GT as g,HE as _,HT as ee,IE as v,IT as te,JE as ne,JT as re,KE as ie,KT as ae,LE as oe,LO as se,LT as y,ME as ce,NE as le,NO as b,NT as ue,OE as de,PE as fe,PO as pe,PT as me,QE as he,QT as ge,RE as _e,RT as ve,SE as ye,TE as be,UE as xe,UT as Se,VD as Ce,VE as we,VT as x,WE as Te,WT as Ee,XE as De,XT as Oe,YE as ke,YT as Ae,ZE as je,ZT as Me,_E as Ne,aE as Pe,at as Fe,bE as Ie,cE as Le,dE as Re,eD as ze,eE as Be,fE as Ve,gE as He,hE as Ue,iE as We,iO as Ge,it as Ke,jE as qe,kE as Je,lE as Ye,mE as Xe,n as Ze,nE as Qe,nO as $e,oE as et,ot as S,pE as tt,qE as nt,qT as rt,rE as it,rO as at,sE as ot,st as C,tD as st,tE as ct,uE as lt,vE as w,wE as ut,xE as dt,yE as ft,zE as pt,zO as T,zT as mt}from"./dist-BOukL7gG.js";import{n as E}from"./dist-BhnVOFIn.js";import{t as D}from"./x-C81gK-RB.js";import{t as O}from"./button-CcNQBW08.js";import{C as k,Et as ht,G as gt,J as A,K as j,S as M,Tt as N,W as _t,X as P,Y as vt,Z as F,_ as I,at as yt,b as L,it as bt,ot as R,q as xt,x as z,y as B}from"./index-HZd91gw7.js";import{a as St,i as Ct,n as wt,o as Tt,r as Et,t as Dt}from"./card-B9JuMxhP.js";import{a as Ot,i as V,n as kt,o as H,r as U,t as At}from"./table-DAtXjw2C.js";import{t as jt}from"./TimeRangePicker-CjeAiSdk.js";import{t as Mt}from"./FilterBar-egrudkw6.js";import{t as Nt}from"./AdvancedFilter-BM-NsfWQ.js";var W=pe(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),G=t(e(),1),Pt=.1,Ft=[248,248,248],It=[24,24,24];function Lt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Rt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function K(e,t,n){return Rt(e,t,n)>=Pt}function zt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Bt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Vt=12*1024*1024,Ht=480,Ut=160,Wt=.92;async function Gt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Qe());if(e.size>Vt)throw Error(ct());let{source:n,width:r,height:a,cleanup:o}=await Kt(e);try{let o=e.type===`image/svg+xml`,s=Math.min(Ht/r,Ut/a,o?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(a*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(i());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Lt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(i());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);K(e.data,f.width,f.height)?zt(e.data,t.variantFor===`dark`?Ft:It):Bt(e.data),m.putImageData(e,0,0)}let h=K(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await J(p,`image/webp`,Wt)??await J(p,`image/png`);if(!g)throw Error(ge());return{blob:g,hasAlpha:h}}finally{o()}}async function Kt(e){if(e.type===`image/svg+xml`)return q(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return q(e)}async function q(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Be())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function J(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Y=n();function qt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var X=`__all__`,Z={kind:`relative`,from:`now-24h`,to:`now`},Jt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Y.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Yt(e){return e===`light`?Ge():e===`dark`?at():$e()}var Xt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Zt({tokens:e,mode:t}){let n=e.colors[t];return(0,Y.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Xt.map(e=>{let t=n[e];return(0,Y.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Qt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Y.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:Ze(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Y.jsx)(E,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Y.jsx)(Zt,{tokens:r,mode:i}):(0,Y.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Y.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Y.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Y.jsx)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":C(),title:C(),children:(0,Y.jsx)(ht,{className:`size-4`})}):null]})}function $t({selectedKey:e,resolvedMode:t}){let n=c(b.charts.listMyCharts),r=T(b.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:nt()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Y.jsx)(Qt,{selected:e===null,title:h(),subtitle:Te(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?xe():n.via===`owner`?_():we({group:n.via.group});return(0,Y.jsx)(Qt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>qt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:s()}):null]})}function en(){let e=T(b.charts.importChart),[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[l,d]=(0,G.useState)(!1);async function p(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(w())}}}async function m(){if(o(null),c(!1),t.trim()===``){o(He());return}let a;try{a=JSON.parse(r)}catch{o(w());return}d(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:f()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:ut()}),(0,Y.jsx)(F,{value:t,onChange:e=>n(e.target.value),placeholder:u(),maxLength:60})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:ye()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:dt(),rows:8,spellCheck:!1})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(W,{className:`size-4`}),Ie(),(0,Y.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void p(e)})]})}),(0,Y.jsx)(O,{size:`sm`,disabled:l,onClick:()=>void m(),children:ft()})]}),a?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Y.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ne()}):null]})]})}function tn({chart:e}){let t=se(b.charts.setChartLogo),n=T(b.charts.removeChartLogo),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Gt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Ye():Le()}),(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Y.jsx)(`img`,{src:t,alt:``}):null}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(W,{className:`size-4`}),t?et():ot(),(0,Y.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:We()}):null,t?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Pe()}):null]})}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:lt()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Y.jsx)(f,{mode:`light`}),(0,Y.jsx)(f,{mode:`dark`})]}),r?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:it()}):null,a?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function nn({chart:e}){let t=c(b.me.getMe,{host:R}),n=T(b.charts.addChartDomain),r=T(b.charts.removeChartDomain),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Me()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:rt()}):d.map(e=>(0,Y.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ae({domain:e}),onClick:()=>void p(e),children:(0,Y.jsx)(D,{className:`size-3`})})]},e))}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(F,{value:i,onChange:e=>a(e.target.value),placeholder:Ae(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:re()})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:Oe()}),o?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=T(b.charts.updateChart),n=T(b.charts.deleteChart),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(e.name),[s,c]=(0,G.useState)(()=>$(e.tokens)),[l,u]=(0,G.useState)(e.tokens.bpm??0),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1);function h(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function _(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(w());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}m(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:h,children:Ve()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:Re()})]})})]}),r?(0,Y.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:Se()}),(0,Y.jsx)(F,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:S()}),(0,Y.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Y.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":S()}),(0,Y.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Fe():`${l} BPM`})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:Ke()})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:ee()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,disabled:p,onClick:()=>void _(),children:g()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Ee()})]})]}):null,(0,Y.jsx)(tn,{chart:e}),(0,Y.jsx)(nn,{chart:e})]})}function an(){let e=c(b.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:Ue()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),e!==void 0&&t.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:tt()}):(0,Y.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Y.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=T(b.charts.addChartToGroupPool),r=T(b.charts.removeChartFromGroupPool),i=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(P,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ce():e.kind===`custom`&&e.scope===`personal`?y():le()}),e.isGlobalDefault?(0,Y.jsx)(P,{variant:`default`,children:qe()}):null]}),(0,Y.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Je()}),(o??[]).map(e=>(0,Y.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":d({group:e.name}),onClick:()=>void u(e.groupId),children:(0,Y.jsx)(D,{className:`size-3`})})]},e.groupId)),c.length>0?(0,Y.jsxs)(B,{value:``,onValueChange:e=>void l(e),children:[(0,Y.jsx)(M,{size:`sm`,className:`w-56`,children:(0,Y.jsx)(k,{placeholder:de()})}),(0,Y.jsx)(L,{children:c.map(e=>(0,Y.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:a()}):null]})]})}function sn({chart:e}){let t=T(b.charts.promoteChartToCommon),n=T(b.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(P,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?te():y()}),e.ownerLabel?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ve({owner:e.ownerLabel})}):null]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:m()}):null,(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:me()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=T(b.admin.setDefaultThemeMode),a=T(b.admin.setDefaultLocale),s=T(b.charts.setDefaultChart),u=c(b.charts.listChartsAdmin),d=c(b.groups.listGroups,{}),f=e??`system`,m=t??`fr`;return(0,Y.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ke()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:pt()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void s({name:null}),children:h()}),yt.map(e=>(0,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key)),(u??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key))]})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:oe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(u??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Y.jsx)(on,{chart:e,groups:d??[]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:p()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(u??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Y.jsx)(nn,{chart:e})]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:l()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:mt()})]}),(()=>{let e=(u??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ue()}):(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Y.jsx)(sn,{chart:e},e.key))})})()]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:st()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Y.jsx)(O,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:Yt(e)},e))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:r()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,Y.jsx)(O,{variant:m===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?Ce():o()},e))}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:je()})]})]})}function ln(){let e=c(b.me.getMe,{host:R}),t=bt(e?.resolvedThemeMode);return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsx)($t,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Y.jsx)(en,{}),(0,Y.jsx)(an,{}),e?.role===`admin`?(0,Y.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,G.useState)(!0),[n,r]=(0,G.useState)(`per-user`),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(X),[c,l]=(0,G.useState)(X),[u,d]=(0,G.useState)(Z),f=i!==``||o!==X||c!==X;function p(){a(``),s(X),l(X),d(Z)}return(0,Y.jsxs)(`div`,{className:`oc-show`,children:[(0,Y.jsx)(ln,{}),(0,Y.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Y.jsx)(`summary`,{className:`oc-show__title`,children:De()}),(0,Y.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(O,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,Y.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,Y.jsx)(O,{variant:`link`,children:`Link`})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Small`}),(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{size:`lg`,children:`Large`}),(0,Y.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,Y.jsx)(N,{})}),(0,Y.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,Y.jsx)(Q,{title:`Badges`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(P,{children:`Default`}),(0,Y.jsx)(P,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(P,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(P,{variant:`destructive`,children:`Destructive`})]})}),(0,Y.jsx)(Q,{title:`Inputs & selection`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(F,{placeholder:`Text input…`}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsxs)(B,{value:n,onValueChange:r,children:[(0,Y.jsx)(M,{className:`w-56`,children:(0,Y.jsx)(k,{placeholder:`Select…`})}),(0,Y.jsxs)(L,{children:[(0,Y.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Y.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Y.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Y.jsx)(I,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Y.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsxs)(Mt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Y.jsxs)(B,{value:o,onValueChange:s,children:[(0,Y.jsx)(M,{size:`sm`,children:(0,Y.jsx)(k,{})}),(0,Y.jsxs)(L,{children:[(0,Y.jsx)(z,{value:X,children:`Toutes directions`}),(0,Y.jsx)(z,{value:`inbound`,children:`inbound`}),(0,Y.jsx)(z,{value:`outbound`,children:`outbound`}),(0,Y.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,Y.jsxs)(B,{value:c,onValueChange:l,children:[(0,Y.jsx)(M,{size:`sm`,children:(0,Y.jsx)(k,{})}),(0,Y.jsxs)(L,{children:[(0,Y.jsx)(z,{value:X,children:`Toutes sévérités`}),(0,Y.jsx)(z,{value:`info`,children:`info`}),(0,Y.jsx)(z,{value:`warn`,children:`warn`}),(0,Y.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,Y.jsx)(Nt,{fields:Jt,onChange:()=>{}}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Y.jsx)(jt,{value:u,onChange:d})]})]})}),(0,Y.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Y.jsxs)(_t,{children:[(0,Y.jsx)(vt,{asChild:!0,children:(0,Y.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Y.jsx)(N,{})})}),(0,Y.jsxs)(gt,{align:`start`,children:[(0,Y.jsx)(xt,{children:`Actions`}),(0,Y.jsx)(A,{}),(0,Y.jsx)(j,{children:`Edit`}),(0,Y.jsx)(j,{children:`Duplicate`}),(0,Y.jsx)(A,{}),(0,Y.jsx)(j,{variant:`destructive`,children:`Delete`})]})]})}),(0,Y.jsx)(Q,{title:`Card`,children:(0,Y.jsxs)(Dt,{className:`w-80`,children:[(0,Y.jsxs)(St,{children:[(0,Y.jsx)(Tt,{children:`Instance`}),(0,Y.jsx)(Et,{children:`Non-secret metadata only.`})]}),(0,Y.jsx)(wt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Y.jsxs)(Ct,{className:`gap-2`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Save`}),(0,Y.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Y.jsx)(Q,{title:`Table`,children:(0,Y.jsxs)(At,{children:[(0,Y.jsx)(Ot,{children:(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{className:`w-8`,children:(0,Y.jsx)(I,{"aria-label":`select all`})}),(0,Y.jsx)(V,{children:`Name`}),(0,Y.jsx)(V,{children:`Mode`}),(0,Y.jsx)(V,{className:`text-right`,children:`Status`}),(0,Y.jsx)(V,{className:`w-8`})]})}),(0,Y.jsx)(kt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(I,{"aria-label":`select ${e.n}`})}),(0,Y.jsx)(U,{className:`font-medium`,children:e.n}),(0,Y.jsx)(U,{children:(0,Y.jsx)(P,{variant:`secondary`,children:e.m})}),(0,Y.jsx)(U,{className:`text-right`,children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Y.jsx)(E,{className:`size-3.5`}),` `,e.s]})}),(0,Y.jsx)(U,{children:(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Y.jsx)(N,{})})})]},e.n))})]})}),(0,Y.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Y.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Y.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Y.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Y.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Y.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Y.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Y.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Y.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Y.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{un as ThemeShowroom};
|